[PATCH 5/8] glamor: Split the XV code into XF86-dependent parts and generic.
walter harms
wharms at bfs.de
Tue May 6 11:03:25 PDT 2014
Am 06.05.2014 18:41, schrieb Eric Anholt:
> walter harms <wharms at bfs.de> writes:
>
>> Am 05.05.2014 22:09, schrieb Eric Anholt:
>>> I want to expose this from Xephyr as well, both to be able to test XV
>>> changes rapidly, and beause the XV passthrough to the host's overlay
>>> really doesn't work out well when we glXSwapBuffers() over the
>>> colorkey.
>>>
>>> Signed-off-by: Eric Anholt <eric at anholt.net>
>>> ---
>>> glamor/Makefile.am | 1 +
>>> glamor/glamor_priv.h | 19 +-
>>> glamor/glamor_xv.c | 337 +++++++--------------------------
>>> hw/xfree86/glamor_egl/Makefile.am | 3 +-
>>> hw/xfree86/glamor_egl/glamor_xf86_xv.c | 287 ++++++++++++++++++++++++++++
>>> 5 files changed, 375 insertions(+), 272 deletions(-)
>>> create mode 100644 hw/xfree86/glamor_egl/glamor_xf86_xv.c
>>>
>>> diff --git a/glamor/Makefile.am b/glamor/Makefile.am
>>> index bde58b6..a3dcb18 100644
>>> --- a/glamor/Makefile.am
>>> +++ b/glamor/Makefile.am
>>> @@ -46,6 +46,7 @@ libglamor_la_SOURCES = \
>>> glamor_fbo.c\
>>> glamor_compositerects.c\
>>> glamor_utils.h\
>>> + glamor_xv.c \
>>> glamor.h
>>>
>>> libglamor_egl_stubs_la_SOURCES = glamor_egl_stubs.c
>>> diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
>>> index a2a21fc..dfa2cfa 100644
>>> --- a/glamor/glamor_priv.h
>>> +++ b/glamor/glamor_priv.h
>>> @@ -34,6 +34,7 @@
>>> #define NDEBUG
>>> #endif
>>> #include "glamor.h"
>>> +#include "xvdix.h"
>>>
>>> #include <epoxy/gl.h>
>>> #if GLAMOR_HAS_GBM
>>> @@ -1036,8 +1037,22 @@ typedef struct {
>>> int src_pix_w, src_pix_h;
>>> } glamor_port_private;
>>>
>>> -void glamor_init_xv_shader(ScreenPtr screen);
>>> -void glamor_fini_xv_shader(ScreenPtr screen);
>>> +extern XvAttributeRec glamor_xv_attributes[];
>>> +extern int glamor_xv_num_attributes;
>>> +extern XvImageRec glamor_xv_images[];
>>> +extern int glamor_xv_num_images;
>>> +
>>> +void glamor_xv_init_port(glamor_port_private *port_priv);
>>> +void glamor_xv_stop_video(glamor_port_private *port_priv);
>>> +int glamor_xv_set_port_attribute(glamor_port_private *port_priv,
>>> + Atom attribute, INT32 value);
>>> +int glamor_xv_get_port_attribute(glamor_port_private *port_priv,
>>> + Atom attribute, INT32 *value);
>>> +int glamor_xv_query_image_attributes(int id,
>>> + unsigned short *w, unsigned short *h,
>>> + int *pitches, int *offsets);
>>> +void glamor_xv_core_init(ScreenPtr screen);
>>> +void glamor_xv_render(glamor_port_private *port_priv);
>>>
>>> #include"glamor_utils.h"
>>>
>>> diff --git a/glamor/glamor_xv.c b/glamor/glamor_xv.c
>>> index 369b02b..4aaa866 100644
>>> --- a/glamor/glamor_xv.c
>>> +++ b/glamor/glamor_xv.c
>>> @@ -36,12 +36,10 @@
>>> #include <dix-config.h>
>>> #endif
>>>
>>> -#include "xf86xv.h"
>>> -#define GLAMOR_FOR_XORG
>>> #include "glamor_priv.h"
>>>
>>> #include <X11/extensions/Xv.h>
>>> -#include "fourcc.h"
>>> +#include "../hw/xfree86/common/fourcc.h"
>>> /* Reference color space transform data */
>>> typedef struct tagREF_TRANSFORM {
>>> float RefLuma;
>>> @@ -90,7 +88,28 @@ static const char *xv_ps = GLAMOR_DEFAULT_PRECISION
>>> "gl_FragColor = temp1;\n"
>>> "}\n";
>>>
>>> -void
>>> +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
>>> +
>>> +XvAttributeRec glamor_xv_attributes[] = {
>>> + {XvSettable | XvGettable, -1000, 1000, (char *)"XV_BRIGHTNESS"},
>>> + {XvSettable | XvGettable, -1000, 1000, (char *)"XV_CONTRAST"},
>>> + {XvSettable | XvGettable, -1000, 1000, (char *)"XV_SATURATION"},
>>> + {XvSettable | XvGettable, -1000, 1000, (char *)"XV_HUE"},
>>> + {XvSettable | XvGettable, 0, 1, (char *)"XV_COLORSPACE"},
>>> + {0, 0, 0, NULL}
>>> +};
>>> +int glamor_xv_num_attributes = ARRAY_SIZE(glamor_xv_attributes) - 1;
>>
>> you should decide for one version. Either use an upperlimit (glamor_xv_num_attributes)
>> or and terminating symbol like NULL/0. If you use the first you can remove glamor_xv_num_attributes,
>> the second can eliminate {0, 0, 0, NULL}.
>
> This patch is just moving code. If you want to change how XV attribute
> initialization works, that would be up to you in a separate patch.
no, not yet :)
i had the impression that the code is new.
re,
wh
More information about the xorg-devel
mailing list