st/xvmc: remove dst buffer texture workaround
authorChristian König <deathsimple@vodafone.de>
Fri, 24 Feb 2012 14:33:54 +0000 (15:33 +0100)
committerChristian König <deathsimple@vodafone.de>
Thu, 1 Mar 2012 14:06:39 +0000 (15:06 +0100)
Signed-off-by: Christian König <deathsimple@vodafone.de>
src/gallium/state_trackers/xvmc/context.c
src/gallium/state_trackers/xvmc/surface.c
src/gallium/state_trackers/xvmc/xvmc_private.h

index e9ba06ba9099f13ea7415f90a013967ba7aac84b..f575151567275aa473580b235df2a7000fad40c1 100644 (file)
@@ -315,7 +315,6 @@ Status XvMCDestroyContext(Display *dpy, XvMCContext *context)
       return XvMCBadContext;
 
    context_priv = context->privData;
-   pipe_surface_reference(&context_priv->drawable_surface, NULL);
    context_priv->decoder->destroy(context_priv->decoder);
    vl_compositor_cleanup(&context_priv->compositor);
    context_priv->pipe->destroy(context_priv->pipe);
index 834841cb3a0666410cbc83840d0059539f6f9eb1..8fc960723443ad192119065c619b02b077247a87 100644 (file)
@@ -357,6 +357,9 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
    struct pipe_video_rect src_rect = {srcx, srcy, srcw, srch};
    struct pipe_video_rect dst_rect = {destx, desty, destw, desth};
 
+   struct pipe_resource *tex;
+   struct pipe_surface surf_templ, *surf;
+
    XVMC_MSG(XVMC_TRACE, "[XvMC] Displaying surface %p.\n", surface);
 
    assert(dpy);
@@ -376,25 +379,13 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
    pipe = context_priv->pipe;
    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 ||
-       context_priv->dst_rect.w != dst_rect.w || context_priv->dst_rect.h != dst_rect.h) {
-
-      struct pipe_surface surf_templ;
-      struct pipe_resource *tex = vl_screen_texture_from_drawable(
-         context_priv->vscreen, drawable);
-
-      pipe_surface_reference(&context_priv->drawable_surface, NULL);
-
-      memset(&surf_templ, 0, sizeof(surf_templ));
-      surf_templ.format = tex->format;
-      surf_templ.usage = PIPE_BIND_RENDER_TARGET;
-      context_priv->drawable_surface = pipe->create_surface(pipe, tex, &surf_templ);
-      vl_compositor_reset_dirty_area(&context_priv->dirty_area);
-      context_priv->dst_rect = dst_rect;
-   }
+   tex = vl_screen_texture_from_drawable(context_priv->vscreen, drawable);
+   memset(&surf_templ, 0, sizeof(surf_templ));
+   surf_templ.format = tex->format;
+   surf_templ.usage = PIPE_BIND_RENDER_TARGET;
+   surf = pipe->create_surface(pipe, tex, &surf_templ);
 
-   if (!context_priv->drawable_surface)
+   if (!surf)
       return BadDrawable;
 
    /*
@@ -436,7 +427,7 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
    // Workaround for r600g, there seems to be a bug in the fence refcounting code
    pipe->screen->fence_reference(pipe->screen, &surface_priv->fence, NULL);
 
-   vl_compositor_render(compositor, context_priv->drawable_surface, &dst_rect, NULL, &context_priv->dirty_area);
+   vl_compositor_render(compositor, surf, &dst_rect, NULL, &context_priv->dirty_area);
 
    pipe->flush(pipe, &surface_priv->fence);
 
@@ -444,7 +435,7 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
 
    pipe->screen->flush_frontbuffer
    (
-      pipe->screen, context_priv->drawable_surface->texture, 0, 0,
+      pipe->screen, tex, 0, 0,
       vl_screen_get_private(context_priv->vscreen)
    );
 
index b9519a7e65d2f9a583afb1c5a5b0bd75426ddc27..8242be9aea82f4bbb77dab700f7e360cfacf568b 100644 (file)
@@ -62,8 +62,6 @@ typedef struct
    unsigned short subpicture_max_width;
    unsigned short subpicture_max_height;
 
-   struct pipe_video_rect dst_rect;
-   struct pipe_surface *drawable_surface;
    struct u_rect dirty_area;
 
 } XvMCContextPrivate;