[g3dvl] move compositor creation and handling directly into the state trackers
authorChristian König <deathsimple@vodafone.de>
Fri, 8 Jul 2011 12:44:19 +0000 (14:44 +0200)
committerChristian König <deathsimple@vodafone.de>
Fri, 8 Jul 2011 12:44:19 +0000 (14:44 +0200)
src/gallium/auxiliary/vl/vl_compositor.c
src/gallium/auxiliary/vl/vl_compositor.h
src/gallium/auxiliary/vl/vl_context.c
src/gallium/include/pipe/p_video_context.h
src/gallium/state_trackers/vdpau/mixer.c
src/gallium/state_trackers/vdpau/presentation.c
src/gallium/state_trackers/vdpau/vdpau_private.h
src/gallium/state_trackers/xorg/xvmc/attributes.c
src/gallium/state_trackers/xorg/xvmc/context.c
src/gallium/state_trackers/xorg/xvmc/surface.c
src/gallium/state_trackers/xorg/xvmc/xvmc_private.h

index 83c9363721976aaefde35c754090f44bbea9ea38..78b8d0627cea5ec9f89a5c74f79aeae3e3fcecdd 100644 (file)
@@ -500,36 +500,32 @@ draw_layers(struct vl_compositor *c)
    }
 }
 
-static void
-vl_compositor_reset_dirty_area(struct pipe_video_compositor *compositor)
+void
+vl_compositor_reset_dirty_area(struct vl_compositor *c)
 {
-   struct vl_compositor *c = (struct vl_compositor *)compositor;
-
-   assert(compositor);
+   assert(c);
 
    c->dirty_tl.x = c->dirty_tl.y = 0.0f;
    c->dirty_br.x = c->dirty_br.y = 1.0f;
 }
 
-static void
-vl_compositor_set_clear_color(struct pipe_video_compositor *compositor, float color[4])
+void
+vl_compositor_set_clear_color(struct vl_compositor *c, float color[4])
 {
-   struct vl_compositor *c = (struct vl_compositor *)compositor;
    unsigned i;
 
-   assert(compositor);
+   assert(c);
 
    for (i = 0; i < 4; ++i)
       c->clear_color[i] = color[i];
 }
 
-static void
-vl_compositor_clear_layers(struct pipe_video_compositor *compositor)
+void
+vl_compositor_clear_layers(struct vl_compositor *c)
 {
-   struct vl_compositor *c = (struct vl_compositor *)compositor;
    unsigned i, j;
 
-   assert(compositor);
+   assert(c);
 
    c->used_layers = 0;
    for ( i = 0; i < VL_COMPOSITOR_MAX_LAYERS; ++i) {
@@ -539,28 +535,24 @@ vl_compositor_clear_layers(struct pipe_video_compositor *compositor)
    }
 }
 
-static void
-vl_compositor_destroy(struct pipe_video_compositor *compositor)
+void
+vl_compositor_cleanup(struct vl_compositor *c)
 {
-   struct vl_compositor *c = (struct vl_compositor *)compositor;
-   assert(compositor);
+   assert(c);
 
-   vl_compositor_clear_layers(compositor);
+   vl_compositor_clear_layers(c);
 
    cleanup_buffers(c);
    cleanup_shaders(c);
    cleanup_pipe_state(c);
-
-   FREE(compositor);
 }
 
-static void
-vl_compositor_set_csc_matrix(struct pipe_video_compositor *compositor, const float matrix[16])
+void
+vl_compositor_set_csc_matrix(struct vl_compositor *c, const float matrix[16])
 {
-   struct vl_compositor *c = (struct vl_compositor *)compositor;
    struct pipe_transfer *buf_transfer;
 
-   assert(compositor);
+   assert(c);
 
    memcpy
    (
@@ -574,18 +566,17 @@ vl_compositor_set_csc_matrix(struct pipe_video_compositor *compositor, const flo
    pipe_buffer_unmap(c->pipe, buf_transfer);
 }
 
-static void
-vl_compositor_set_buffer_layer(struct pipe_video_compositor *compositor,
+void
+vl_compositor_set_buffer_layer(struct vl_compositor *c,
                                unsigned layer,
                                struct pipe_video_buffer *buffer,
                                struct pipe_video_rect *src_rect,
                                struct pipe_video_rect *dst_rect)
 {
-   struct vl_compositor *c = (struct vl_compositor *)compositor;
    struct pipe_sampler_view **sampler_views;
    unsigned i;
 
-   assert(compositor && buffer);
+   assert(c && buffer);
 
    assert(layer < VL_COMPOSITOR_MAX_LAYERS);
 
@@ -604,16 +595,15 @@ vl_compositor_set_buffer_layer(struct pipe_video_compositor *compositor,
                     dst_rect ? *dst_rect : default_rect(&c->layers[layer]));
 }
 
-static void
-vl_compositor_set_palette_layer(struct pipe_video_compositor *compositor,
+void
+vl_compositor_set_palette_layer(struct vl_compositor *c,
                                 unsigned layer,
                                 struct pipe_sampler_view *indexes,
                                 struct pipe_sampler_view *palette,
                                 struct pipe_video_rect *src_rect,
                                 struct pipe_video_rect *dst_rect)
 {
-   struct vl_compositor *c = (struct vl_compositor *)compositor;
-   assert(compositor && indexes && palette);
+   assert(c && indexes && palette);
 
    assert(layer < VL_COMPOSITOR_MAX_LAYERS);
 
@@ -632,15 +622,14 @@ vl_compositor_set_palette_layer(struct pipe_video_compositor *compositor,
 
 }
 
-static void
-vl_compositor_set_rgba_layer(struct pipe_video_compositor *compositor,
+void
+vl_compositor_set_rgba_layer(struct vl_compositor *c,
                              unsigned layer,
                              struct pipe_sampler_view *rgba,
                              struct pipe_video_rect *src_rect,
                              struct pipe_video_rect *dst_rect)
 {
-   struct vl_compositor *c = (struct vl_compositor *)compositor;
-   assert(compositor && rgba);
+   assert(c && rgba);
 
    assert(layer < VL_COMPOSITOR_MAX_LAYERS);
 
@@ -658,17 +647,16 @@ vl_compositor_set_rgba_layer(struct pipe_video_compositor *compositor,
                     dst_rect ? *dst_rect : default_rect(&c->layers[layer]));
 }
 
-static void
-vl_compositor_render(struct pipe_video_compositor *compositor,
+void
+vl_compositor_render(struct vl_compositor *c,
                      enum pipe_mpeg12_picture_type picture_type,
                      struct pipe_surface           *dst_surface,
                      struct pipe_video_rect        *dst_area,
                      struct pipe_fence_handle      **fence)
 {
-   struct vl_compositor *c = (struct vl_compositor *)compositor;
    struct pipe_scissor_state scissor;
 
-   assert(compositor);
+   assert(c);
    assert(dst_surface);
 
    c->fb_state.width = dst_surface->width;
@@ -713,48 +701,34 @@ vl_compositor_render(struct pipe_video_compositor *compositor,
    c->pipe->flush(c->pipe, fence);
 }
 
-struct pipe_video_compositor *
-vl_compositor_init(struct pipe_video_context *vpipe, struct pipe_context *pipe)
+bool
+vl_compositor_init(struct vl_compositor *c, struct pipe_context *pipe)
 {
    csc_matrix csc_matrix;
-   struct vl_compositor *compositor;
-
-   compositor = CALLOC_STRUCT(vl_compositor);
 
-   compositor->base.context = vpipe;
-   compositor->base.destroy = vl_compositor_destroy;
-   compositor->base.set_csc_matrix = vl_compositor_set_csc_matrix;
-   compositor->base.reset_dirty_area = vl_compositor_reset_dirty_area;
-   compositor->base.set_clear_color = vl_compositor_set_clear_color;
-   compositor->base.clear_layers = vl_compositor_clear_layers;
-   compositor->base.set_buffer_layer = vl_compositor_set_buffer_layer;
-   compositor->base.set_palette_layer = vl_compositor_set_palette_layer;
-   compositor->base.set_rgba_layer = vl_compositor_set_rgba_layer;
-   compositor->base.render_picture = vl_compositor_render;
+   c->pipe = pipe;
 
-   compositor->pipe = pipe;
-
-   if (!init_pipe_state(compositor))
+   if (!init_pipe_state(c))
       return false;
 
-   if (!init_shaders(compositor)) {
-      cleanup_pipe_state(compositor);
+   if (!init_shaders(c)) {
+      cleanup_pipe_state(c);
       return false;
    }
-   if (!init_buffers(compositor)) {
-      cleanup_shaders(compositor);
-      cleanup_pipe_state(compositor);
+   if (!init_buffers(c)) {
+      cleanup_shaders(c);
+      cleanup_pipe_state(c);
       return false;
    }
 
-   vl_compositor_clear_layers(&compositor->base);
+   vl_compositor_clear_layers(c);
 
    vl_csc_get_matrix(VL_CSC_COLOR_STANDARD_IDENTITY, NULL, true, csc_matrix);
-   vl_compositor_set_csc_matrix(&compositor->base, csc_matrix);
+   vl_compositor_set_csc_matrix(c, csc_matrix);
 
-   compositor->clear_color[0] = compositor->clear_color[1] = 0.0f;
-   compositor->clear_color[2] = compositor->clear_color[3] = 0.0f;
-   vl_compositor_reset_dirty_area(&compositor->base);
+   c->clear_color[0] = c->clear_color[1] = 0.0f;
+   c->clear_color[2] = c->clear_color[3] = 0.0f;
+   vl_compositor_reset_dirty_area(c);
 
-   return &compositor->base;
+   return true;
 }
index 33d2a20733dcd2e42834b6305c878d6439c3b637..97601897b662c606fd4ca597f19bd9f3e4b95402 100644 (file)
 
 struct pipe_context;
 
+/**
+ * composing and displaying of image data
+ */
+
 #define VL_COMPOSITOR_MAX_LAYERS 16
 
 struct vl_compositor_layer
@@ -53,7 +57,6 @@ struct vl_compositor_layer
 
 struct vl_compositor
 {
-   struct pipe_video_compositor base;
    struct pipe_context *pipe;
 
    struct pipe_framebuffer_state fb_state;
@@ -79,7 +82,88 @@ struct vl_compositor
    struct vl_compositor_layer layers[VL_COMPOSITOR_MAX_LAYERS];
 };
 
-struct pipe_video_compositor *vl_compositor_init(struct pipe_video_context *vpipe,
-                                                 struct pipe_context *pipe);
+/**
+ * initialize this compositor
+ */
+bool
+vl_compositor_init(struct vl_compositor *compositor, struct pipe_context *pipe);
+
+/**
+ * set yuv -> rgba conversion matrix
+ */
+void
+vl_compositor_set_csc_matrix(struct vl_compositor *compositor, const float mat[16]);
+
+/**
+ * reset dirty area, so it's cleared with the clear colour
+ */
+void
+vl_compositor_reset_dirty_area(struct vl_compositor *compositor);
+
+/**
+ * set the clear color
+ */
+void
+vl_compositor_set_clear_color(struct vl_compositor *compositor, float color[4]);
+
+/**
+ * set overlay samplers
+ */
+/*@{*/
+
+/**
+ * reset all currently set layers
+ */
+void
+vl_compositor_clear_layers(struct vl_compositor *compositor);
+
+/**
+ * set a video buffer as a layer to render
+ */
+void
+vl_compositor_set_buffer_layer(struct vl_compositor *compositor,
+                               unsigned layer,
+                               struct pipe_video_buffer *buffer,
+                               struct pipe_video_rect *src_rect,
+                               struct pipe_video_rect *dst_rect);
+
+/**
+ * set a paletted sampler as a layer to render
+ */
+void
+vl_compositor_set_palette_layer(struct vl_compositor *compositor,
+                                unsigned layer,
+                                struct pipe_sampler_view *indexes,
+                                struct pipe_sampler_view *palette,
+                                struct pipe_video_rect *src_rect,
+                                struct pipe_video_rect *dst_rect);
+
+/**
+ * set a rgba sampler as a layer to render
+ */
+void
+vl_compositor_set_rgba_layer(struct vl_compositor *compositor,
+                             unsigned layer,
+                             struct pipe_sampler_view *rgba,
+                             struct pipe_video_rect *src_rect,
+                             struct pipe_video_rect *dst_rect);
+
+/*@}*/
+
+/**
+ * render the layers to the frontbuffer
+ */
+void
+vl_compositor_render(struct vl_compositor          *compositor,
+                     enum pipe_mpeg12_picture_type picture_type,
+                     struct pipe_surface           *dst_surface,
+                     struct pipe_video_rect        *dst_area,
+                     struct pipe_fence_handle      **fence);
+
+/**
+* destroy this compositor
+*/
+void
+vl_compositor_cleanup(struct vl_compositor *compositor);
 
 #endif /* vl_compositor_h */
index 1ac0d9c30507793376510d0e37eb07705696ebe9..b685e91d23e78298b2ce5ce8c32538d76222b77f 100644 (file)
@@ -114,16 +114,6 @@ vl_context_create_buffer(struct pipe_video_context *context,
    return result;
 }
 
-static struct pipe_video_compositor *
-vl_context_create_compositor(struct pipe_video_context *context)
-{
-   struct vl_context *ctx = (struct vl_context*)context;
-
-   assert(context);
-
-   return vl_compositor_init(context, ctx->pipe);
-}
-
 struct pipe_video_context *
 vl_create_context(struct pipe_context *pipe)
 {
@@ -139,7 +129,6 @@ vl_create_context(struct pipe_context *pipe)
    ctx->base.destroy = vl_context_destroy;
    ctx->base.create_decoder = vl_context_create_decoder;
    ctx->base.create_buffer = vl_context_create_buffer;
-   ctx->base.create_compositor = vl_context_create_compositor;
 
    ctx->pipe = pipe;
 
index dfc383055a717ea4b6b7a2263150da817b6a0a3d..7ea67d3d198a141f38fb8567e476fde3d83f07f6 100644 (file)
@@ -71,11 +71,6 @@ struct pipe_video_context
                                               enum pipe_format buffer_format,
                                               enum pipe_video_chroma_format chroma_format,
                                               unsigned width, unsigned height);
-
-   /**
-    * Creates a video compositor
-    */
-   struct pipe_video_compositor *(*create_compositor)(struct pipe_video_context *context);
 };
 
 /**
@@ -201,84 +196,6 @@ struct pipe_video_buffer
    struct pipe_surface **(*get_surfaces)(struct pipe_video_buffer *buffer);
 };
 
-/**
- * composing and displaying of image data
- */
-struct pipe_video_compositor
-{
-   struct pipe_video_context *context;
-
-   /**
-    * destroy this compositor
-    */
-   void (*destroy)(struct pipe_video_compositor *compositor);
-
-   /**
-    * set yuv -> rgba conversion matrix
-    */
-   void (*set_csc_matrix)(struct pipe_video_compositor *compositor, const float mat[16]);
-
-   /**
-    * reset dirty area, so it's cleared with the clear colour
-    */
-   void (*reset_dirty_area)(struct pipe_video_compositor *compositor);
-
-   /**
-    * set the clear color
-    */
-   void (*set_clear_color)(struct pipe_video_compositor *compositor, float color[4]);
-
-   /**
-    * set overlay samplers
-    */
-   /*@{*/
-
-   /**
-    * reset all currently set layers
-    */
-   void (*clear_layers)(struct pipe_video_compositor *compositor);
-
-   /**
-    * set a video buffer as a layer to render
-    */
-   void (*set_buffer_layer)(struct pipe_video_compositor *compositor,
-                            unsigned layer,
-                            struct pipe_video_buffer *buffer,
-                            struct pipe_video_rect *src_rect,
-                            struct pipe_video_rect *dst_rect);
-
-   /**
-    * set a paletted sampler as a layer to render
-    */
-   void (*set_palette_layer)(struct pipe_video_compositor *compositor,
-                             unsigned layer,
-                             struct pipe_sampler_view *indexes,
-                             struct pipe_sampler_view *palette,
-                             struct pipe_video_rect *src_rect,
-                             struct pipe_video_rect *dst_rect);
-
-   /**
-    * set a rgba sampler as a layer to render
-    */
-   void (*set_rgba_layer)(struct pipe_video_compositor *compositor,
-                          unsigned layer,
-                          struct pipe_sampler_view *rgba,
-                          struct pipe_video_rect *src_rect,
-                          struct pipe_video_rect *dst_rect);
-
-   /*@}*/
-
-   /**
-    * render the layers to the frontbuffer
-    */
-   void (*render_picture)(struct pipe_video_compositor  *compositor,
-                          enum pipe_mpeg12_picture_type picture_type,
-                          struct pipe_surface           *dst_surface,
-                          struct pipe_video_rect        *dst_area,
-                          struct pipe_fence_handle      **fence);
-
-};
-
 #ifdef __cplusplus
 }
 #endif
index 85f4e1541ab4a92ffc1e6a5c845fb3c74c0dc21d..ea6d50d745780daffc651937e09c03278e777e2a 100644 (file)
@@ -61,7 +61,7 @@ vlVdpVideoMixerCreate(VdpDevice device,
       return VDP_STATUS_RESOURCES;
 
    vmixer->device = dev;
-   vmixer->compositor = context->create_compositor(context);
+   vl_compositor_init(&vmixer->compositor, dev->context->pipe);
 
    vl_csc_get_matrix
    (
@@ -69,7 +69,7 @@ vlVdpVideoMixerCreate(VdpDevice device,
       VL_CSC_COLOR_STANDARD_IDENTITY : VL_CSC_COLOR_STANDARD_BT_601,
       NULL, true, csc
    );
-   vmixer->compositor->set_csc_matrix(vmixer->compositor, csc);
+   vl_compositor_set_csc_matrix(&vmixer->compositor, csc);
 
    /*
     * TODO: Handle features and parameters
@@ -97,7 +97,7 @@ vlVdpVideoMixerDestroy(VdpVideoMixer mixer)
    if (!vmixer)
       return VDP_STATUS_INVALID_HANDLE;
 
-   vmixer->compositor->destroy(vmixer->compositor);
+   vl_compositor_cleanup(&vmixer->compositor);
 
    FREE(vmixer);
 
@@ -158,10 +158,10 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
    if (!dst)
       return VDP_STATUS_INVALID_HANDLE;
 
-   vmixer->compositor->clear_layers(vmixer->compositor);
-   vmixer->compositor->set_buffer_layer(vmixer->compositor, 0, surf->video_buffer, NULL, NULL);
-   vmixer->compositor->render_picture(vmixer->compositor, PIPE_MPEG12_PICTURE_TYPE_FRAME,
-                                      dst->surface, NULL, NULL);
+   vl_compositor_clear_layers(&vmixer->compositor);
+   vl_compositor_set_buffer_layer(&vmixer->compositor, 0, surf->video_buffer, NULL, NULL);
+   vl_compositor_render(&vmixer->compositor, PIPE_MPEG12_PICTURE_TYPE_FRAME,
+                        dst->surface, NULL, NULL);
 
    return VDP_STATUS_OK;
 }
index 02fcfbd0746d9dbe2a37720bab73f9a8dfa78970..0f87ca78972c2ef1f8e878547cb81dc38476f6d9 100644 (file)
@@ -67,8 +67,8 @@ vlVdpPresentationQueueCreate(VdpDevice device,
 
    pq->device = dev;
    pq->drawable = pqt->drawable;
-   pq->compositor = context->create_compositor(context);
-   if (!pq->compositor) {
+   
+   if (!vl_compositor_init(&pq->compositor, dev->context->pipe)) {
       ret = VDP_STATUS_ERROR;
       goto no_compositor;
    }
@@ -97,7 +97,7 @@ vlVdpPresentationQueueDestroy(VdpPresentationQueue presentation_queue)
    if (!pq)
       return VDP_STATUS_INVALID_HANDLE;
 
-   pq->compositor->destroy(pq->compositor);
+   vl_compositor_cleanup(&pq->compositor);
 
    vlRemoveDataHTAB(presentation_queue);
    FREE(pq);
@@ -120,7 +120,7 @@ vlVdpPresentationQueueSetBackgroundColor(VdpPresentationQueue presentation_queue
    if (!pq)
       return VDP_STATUS_INVALID_HANDLE;
 
-   pq->compositor->set_clear_color(pq->compositor, (float*)background_color);
+   vl_compositor_set_clear_color(&pq->compositor, (float*)background_color);
 
    return VDP_STATUS_OK;
 }
@@ -170,10 +170,10 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue,
    if (!surf)
       return VDP_STATUS_INVALID_HANDLE;
 
-   pq->compositor->clear_layers(pq->compositor);
-   pq->compositor->set_rgba_layer(pq->compositor, 0, surf->sampler_view, NULL, NULL);
-   pq->compositor->render_picture(pq->compositor, PIPE_MPEG12_PICTURE_TYPE_FRAME,
-                                  drawable_surface, NULL, NULL);
+   vl_compositor_clear_layers(&pq->compositor);
+   vl_compositor_set_rgba_layer(&pq->compositor, 0, surf->sampler_view, NULL, NULL);
+   vl_compositor_render(&pq->compositor, PIPE_MPEG12_PICTURE_TYPE_FRAME,
+                        drawable_surface, NULL, NULL);
 
    pq->device->context->vpipe->screen->flush_frontbuffer
    (
index 1d6ca39fe393be65e45a2a455aca25b327ac0eeb..ada17dfadc98a25e39d4d3ce77961a9091f26b09 100644 (file)
@@ -37,6 +37,7 @@
 #include <pipe/p_video_context.h>
 
 #include <util/u_debug.h>
+#include <vl/vl_compositor.h>
 
 #include <vl_winsys.h>
 
@@ -188,13 +189,13 @@ typedef struct
 {
    vlVdpDevice *device;
    Drawable drawable;
-   struct pipe_video_compositor *compositor;
+   struct vl_compositor compositor;
 } vlVdpPresentationQueue;
 
 typedef struct
 {
    vlVdpDevice *device;
-   struct pipe_video_compositor *compositor;
+   struct vl_compositor compositor;
 } vlVdpVideoMixer;
 
 typedef struct
index 06d5dc919b4dd9abfd752eaad2b44ac512db4459..817af531a328d5ea9a34551b5fba76c98828f24b 100644 (file)
@@ -113,7 +113,7 @@ Status XvMCSetAttribute(Display *dpy, XvMCContext *context, Atom attribute, int
       context_priv->color_standard,
       &context_priv->procamp, true, csc
    );
-   context_priv->compositor->set_csc_matrix(context_priv->compositor, csc);
+   vl_compositor_set_csc_matrix(&context_priv->compositor, csc);
 
    XVMC_MSG(XVMC_TRACE, "[XvMC] Set attribute %s to value %d.\n", attr, value);
 
index fbfa1afe44cf3d9a17703137d5bbbb2e01d998a8..7b74825b37ef48cf737d65045ab6400cf3727b92 100644 (file)
@@ -260,8 +260,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
       return BadAlloc;
    }
 
-   context_priv->compositor = vctx->vpipe->create_compositor(vctx->vpipe);
-   if (!context_priv->compositor) {
+   if (!vl_compositor_init(&context_priv->compositor, vctx->pipe)) {
       XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL compositor.\n");
       context_priv->decoder->destroy(context_priv->decoder);
       vl_video_destroy(vctx);
@@ -280,7 +279,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
       context_priv->color_standard,
       &context_priv->procamp, true, csc
    );
-   context_priv->compositor->set_csc_matrix(context_priv->compositor, csc);
+   vl_compositor_set_csc_matrix(&context_priv->compositor, csc);
 
    context_priv->vctx = vctx;
    context_priv->subpicture_max_width = subpic_max_w;
@@ -320,7 +319,7 @@ Status XvMCDestroyContext(Display *dpy, XvMCContext *context)
    vscreen = vctx->vscreen;
    pipe_surface_reference(&context_priv->drawable_surface, NULL);
    context_priv->decoder->destroy(context_priv->decoder);
-   context_priv->compositor->destroy(context_priv->compositor);
+   vl_compositor_cleanup(&context_priv->compositor);
    vl_video_destroy(vctx);
    vl_screen_destroy(vscreen);
    FREE(context_priv);
index 3db17d1ac5156c89fb87951071c0208adfc49f60..292610be6311632645647e12edfdc35bff863978 100644 (file)
@@ -493,7 +493,7 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
    static int dump_window = -1;
 
    struct pipe_video_context *vpipe;
-   struct pipe_video_compositor *compositor;
+   struct vl_compositor *compositor;
 
    XvMCSurfacePrivate *surface_priv;
    XvMCContextPrivate *context_priv;
@@ -519,7 +519,7 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
 
    subpicture_priv = surface_priv->subpicture ? surface_priv->subpicture->privData : NULL;
    vpipe = context_priv->vctx->vpipe;
-   compositor = context_priv->compositor;
+   compositor = &context_priv->compositor;
 
    if (!context_priv->drawable_surface ||
        context_priv->dst_rect.x != dst_rect.x || context_priv->dst_rect.y != dst_rect.y ||
@@ -527,7 +527,7 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
 
       context_priv->drawable_surface = vl_drawable_surface_get(context_priv->vctx, drawable);
       context_priv->dst_rect = dst_rect;
-      compositor->reset_dirty_area(compositor);
+      vl_compositor_reset_dirty_area(compositor);
    }
 
    if (!context_priv->drawable_surface)
@@ -547,8 +547,8 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
 
    unmap_and_flush_surface(surface_priv);
 
-   compositor->clear_layers(compositor);
-   compositor->set_buffer_layer(compositor, 0, surface_priv->video_buffer, &src_rect, NULL);
+   vl_compositor_clear_layers(compositor);
+   vl_compositor_set_buffer_layer(compositor, 0, surface_priv->video_buffer, &src_rect, NULL);
 
    if (subpicture_priv) {
       XVMC_MSG(XVMC_TRACE, "[XvMC] Surface %p has subpicture %p.\n", surface, surface_priv->subpicture);
@@ -556,11 +556,11 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
       assert(subpicture_priv->surface == surface);
 
       if (subpicture_priv->palette)
-         compositor->set_palette_layer(compositor, 1, subpicture_priv->sampler, subpicture_priv->palette,
-                                       &subpicture_priv->src_rect, &subpicture_priv->dst_rect);
+         vl_compositor_set_palette_layer(compositor, 1, subpicture_priv->sampler, subpicture_priv->palette,
+                                         &subpicture_priv->src_rect, &subpicture_priv->dst_rect);
       else
-         compositor->set_rgba_layer(compositor, 1, subpicture_priv->sampler,
-                                    &subpicture_priv->src_rect, &subpicture_priv->dst_rect);
+         vl_compositor_set_rgba_layer(compositor, 1, subpicture_priv->sampler,
+                                      &subpicture_priv->src_rect, &subpicture_priv->dst_rect);
 
       surface_priv->subpicture = NULL;
       subpicture_priv->surface = NULL;
@@ -569,7 +569,7 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
    // Workaround for r600g, there seems to be a bug in the fence refcounting code
    vpipe->screen->fence_reference(vpipe->screen, &surface_priv->fence, NULL);
 
-   compositor->render_picture(compositor, PictureToPipe(flags), context_priv->drawable_surface, &dst_rect, &surface_priv->fence);
+   vl_compositor_render(compositor, PictureToPipe(flags), context_priv->drawable_surface, &dst_rect, &surface_priv->fence);
 
    XVMC_MSG(XVMC_TRACE, "[XvMC] Submitted surface %p for display. Pushing to front buffer.\n", surface);
 
index 8d26b196fdc2ed5cdb86153e06e0acfc505d3aa3..5f8d9d13cb341a3a6af5ae43e13bf94fd938baad 100644 (file)
@@ -37,6 +37,7 @@
 #include <util/u_math.h>
 
 #include <vl/vl_csc.h>
+#include <vl/vl_compositor.h>
 
 #define BLOCK_SIZE_SAMPLES 64
 #define BLOCK_SIZE_BYTES (BLOCK_SIZE_SAMPLES * 2)
@@ -44,7 +45,6 @@
 struct vl_context;
 
 struct pipe_video_decoder;
-struct pipe_video_compositor;
 struct pipe_video_decode_buffer;
 struct pipe_video_buffer;
 
@@ -55,10 +55,10 @@ typedef struct
 {
    struct vl_context *vctx;
    struct pipe_video_decoder *decoder;
-   struct pipe_video_compositor *compositor;
 
    enum VL_CSC_COLOR_STANDARD color_standard;
    struct vl_procamp procamp;
+   struct vl_compositor compositor;
 
    unsigned short subpicture_max_width;
    unsigned short subpicture_max_height;