vl/compositor: cleanup background clearing
authorChristian König <christian.koenig@amd.com>
Mon, 29 Apr 2013 15:43:04 +0000 (17:43 +0200)
committerChristian König <christian.koenig@amd.com>
Wed, 1 May 2013 11:33:46 +0000 (13:33 +0200)
Add an extra parameter to specify if we should clear the render target.

Signed-off-by: Christian König <christian.koenig@amd.com>
src/gallium/auxiliary/vl/vl_compositor.c
src/gallium/auxiliary/vl/vl_compositor.h
src/gallium/state_trackers/vdpau/device.c
src/gallium/state_trackers/vdpau/mixer.c
src/gallium/state_trackers/vdpau/output.c
src/gallium/state_trackers/vdpau/presentation.c
src/gallium/state_trackers/xvmc/surface.c

index 0df2b570d00132bc0f258b4d79eceeb12f17732b..1c393a99de6ce37ad07dd1a2d64f94f59b44dda5 100644 (file)
@@ -986,7 +986,8 @@ void
 vl_compositor_render(struct vl_compositor_state *s,
                      struct vl_compositor       *c,
                      struct pipe_surface        *dst_surface,
-                     struct u_rect              *dirty_area)
+                     struct u_rect              *dirty_area,
+                     bool                        clear_dirty)
 {
    assert(c);
    assert(dst_surface);
@@ -1004,8 +1005,8 @@ vl_compositor_render(struct vl_compositor_state *s,
 
    gen_vertex_data(c, s, dirty_area);
 
-   if (dirty_area && (dirty_area->x0 < dirty_area->x1 ||
-                      dirty_area->y0 < dirty_area->y1)) {
+   if (clear_dirty && dirty_area &&
+       (dirty_area->x0 < dirty_area->x1 || dirty_area->y0 < dirty_area->y1)) {
 
       c->pipe->clear_render_target(c->pipe, dst_surface, &s->clear_color,
                                    0, 0, dst_surface->width, dst_surface->height);
index 6de6ca06521111bc3990e5555def7de09d6033d9..2a1f66cfb163fd91752227ee9222263fd6a05b8c 100644 (file)
@@ -224,7 +224,8 @@ void
 vl_compositor_render(struct vl_compositor_state *state,
                      struct vl_compositor       *compositor,
                      struct pipe_surface        *dst_surface,
-                     struct u_rect              *dirty_area);
+                     struct u_rect              *dirty_area,
+                     bool                        clear_dirty);
 
 /**
  * destroy this compositor
index dd586f52856174bbedbf8e96a5fbe6fcbfc74eff..c530f431644ee693194186d40219a9c299a44171 100644 (file)
@@ -279,7 +279,7 @@ vlVdpResolveDelayedRendering(vlVdpDevice *dev, struct pipe_surface *surface, str
       dirty_area = &vlsurface->dirty_area;
    }
 
-   vl_compositor_render(cstate, &dev->compositor, surface, dirty_area);
+   vl_compositor_render(cstate, &dev->compositor, surface, dirty_area, true);
 
    dev->delayed_rendering.surface = VDP_INVALID_HANDLE;
    dev->delayed_rendering.cstate = NULL;
index 81a5c2936853309aa4f1bbaf7c45ade5f9459c59..1d2ae497b0704ce0a22ccfeb53dcd2b235559832 100644 (file)
@@ -312,7 +312,7 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
    if (!vmixer->noise_reduction.filter && !vmixer->sharpness.filter)
       vlVdpSave4DelayedRendering(vmixer->device, destination_surface, &vmixer->cstate);
    else {
-      vl_compositor_render(&vmixer->cstate, compositor, dst->surface, &dst->dirty_area);
+      vl_compositor_render(&vmixer->cstate, compositor, dst->surface, &dst->dirty_area, true);
 
       /* applying the noise reduction after scaling is actually not very
          clever, but currently we should avoid to copy around the image
index df0f45856f9e4303a029250b4f9c4a78b75ea769..7266cdb8afadcc7c9312a2fd3450bafc51eb1866 100644 (file)
@@ -382,8 +382,7 @@ vlVdpOutputSurfacePutBitsIndexed(VdpOutputSurface surface,
    vl_compositor_clear_layers(cstate);
    vl_compositor_set_palette_layer(cstate, compositor, 0, sv_idx, sv_tbl, NULL, NULL, false);
    vl_compositor_set_layer_dst_area(cstate, 0, RectToPipe(destination_rect, &dst_rect));
-   vl_compositor_render(cstate, compositor, vlsurface->surface, NULL);
-   vl_compositor_reset_dirty_area(&vlsurface->dirty_area);
+   vl_compositor_render(cstate, compositor, vlsurface->surface, &vlsurface->dirty_area, false);
 
    pipe_sampler_view_reference(&sv_idx, NULL);
    pipe_sampler_view_reference(&sv_tbl, NULL);
@@ -489,8 +488,7 @@ vlVdpOutputSurfacePutBitsYCbCr(VdpOutputSurface surface,
    vl_compositor_clear_layers(cstate);
    vl_compositor_set_buffer_layer(cstate, compositor, 0, vbuffer, NULL, NULL, VL_COMPOSITOR_WEAVE);
    vl_compositor_set_layer_dst_area(cstate, 0, RectToPipe(destination_rect, &dst_rect));
-   vl_compositor_render(cstate, compositor, vlsurface->surface, NULL);
-   vl_compositor_reset_dirty_area(&vlsurface->dirty_area);
+   vl_compositor_render(cstate, compositor, vlsurface->surface, &vlsurface->dirty_area, false);
 
    vbuffer->destroy(vbuffer);
    pipe_mutex_unlock(vlsurface->device->mutex);
@@ -660,8 +658,7 @@ vlVdpOutputSurfaceRenderOutputSurface(VdpOutputSurface destination_surface,
                                 RectToPipe(source_rect, &src_rect), NULL,
                                 ColorsToPipe(colors, flags, vlcolors));
    vl_compositor_set_layer_dst_area(cstate, 0, RectToPipe(destination_rect, &dst_rect));
-   vl_compositor_render(cstate, compositor, dst_vlsurface->surface, NULL);
-   vl_compositor_reset_dirty_area(&dst_vlsurface->dirty_area);
+   vl_compositor_render(cstate, compositor, dst_vlsurface->surface, &dst_vlsurface->dirty_area, false);
 
    context->delete_blend_state(context, blend);
    pipe_mutex_unlock(dst_vlsurface->device->mutex);
@@ -720,8 +717,7 @@ vlVdpOutputSurfaceRenderBitmapSurface(VdpOutputSurface destination_surface,
                                 RectToPipe(source_rect, &src_rect), NULL,
                                 ColorsToPipe(colors, flags, vlcolors));
    vl_compositor_set_layer_dst_area(cstate, 0, RectToPipe(destination_rect, &dst_rect));
-   vl_compositor_render(cstate, compositor, dst_vlsurface->surface, NULL);
-   vl_compositor_reset_dirty_area(&dst_vlsurface->dirty_area);
+   vl_compositor_render(cstate, compositor, dst_vlsurface->surface, &dst_vlsurface->dirty_area, false);
 
    context->delete_blend_state(context, blend);
    pipe_mutex_unlock(dst_vlsurface->device->mutex);
index 3dd7f05375e7368b6d85166890c4fe29a636b00e..a5466cd378a85836f57fb249104d98affa7b3d4a 100644 (file)
@@ -264,7 +264,7 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue,
       vl_compositor_clear_layers(cstate);
       vl_compositor_set_rgba_layer(cstate, compositor, 0, surf->sampler_view, &src_rect, NULL, NULL);
       vl_compositor_set_dst_clip(cstate, &dst_clip);
-      vl_compositor_render(cstate, compositor, surf_draw, dirty_area);
+      vl_compositor_render(cstate, compositor, surf_draw, dirty_area, true);
    }
 
    vl_screen_set_next_timestamp(pq->device->vscreen, earliest_presentation_time);
index 99d2d7072a150fe08906d6e38dafbf10f744cd9b..6a895aaed6bb41864fe080ab10636d303153c0a3 100644 (file)
@@ -432,7 +432,7 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
 
    vl_compositor_set_layer_dst_area(cstate, 0, &dst_rect);
    vl_compositor_set_layer_dst_area(cstate, 1, &dst_rect);
-   vl_compositor_render(cstate, compositor, surf, dirty_area);
+   vl_compositor_render(cstate, compositor, surf, dirty_area, true);
 
    pipe->flush(pipe, &surface_priv->fence, 0);