st/vdpau: remove the delayed rendering hack(v1.1)
authorNayan Deshmukh <nayan26deshmukh@gmail.com>
Wed, 11 Jan 2017 16:57:15 +0000 (22:27 +0530)
committerChristian König <christian.koenig@amd.com>
Tue, 17 Jan 2017 10:52:03 +0000 (11:52 +0100)
the hack was introduced to avoid an extra copying
but now with dri3 we don't need it anymore

v1.1: rebasing

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Acked-by: Christian König <christian.koenig@amd.com>
src/gallium/state_trackers/vdpau/bitmap.c
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/vdpau/vdpau_private.h

index fd67a986c61cb87059d5630e0730f62d19e5ef15..d9ec60d20ad79eab14abbb074d945290f8efc7a4 100644 (file)
@@ -198,8 +198,6 @@ vlVdpBitmapSurfacePutBitsNative(VdpBitmapSurface surface,
 
    pipe_mutex_lock(vlsurface->device->mutex);
 
-   vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
-
    dst_box = RectToPipeBox(destination_rect, vlsurface->sampler_view->texture);
    pipe->texture_subdata(pipe, vlsurface->sampler_view->texture, 0,
                          PIPE_TRANSFER_WRITE, &dst_box, *source_data,
index 8bae06477208dbde17bdaf1e1a69ce4746dc221c..4f4ffdffe7d19c400c97a6340ec895906f6afdb6 100644 (file)
@@ -327,53 +327,3 @@ vlVdpDefaultSamplerViewTemplate(struct pipe_sampler_view *templ, struct pipe_res
    if (desc->swizzle[3] == PIPE_SWIZZLE_0)
       templ->swizzle_a = PIPE_SWIZZLE_1;
 }
-
-void
-vlVdpResolveDelayedRendering(vlVdpDevice *dev, struct pipe_surface *surface, struct u_rect *dirty_area)
-{
-   struct vl_compositor_state *cstate;
-   vlVdpOutputSurface *vlsurface;
-
-   assert(dev);
-
-   cstate = dev->delayed_rendering.cstate;
-   if (!cstate)
-      return;
-
-   vlsurface = vlGetDataHTAB(dev->delayed_rendering.surface);
-   if (!vlsurface)
-      return;
-
-   if (!surface) {
-      surface = vlsurface->surface;
-      dirty_area = &vlsurface->dirty_area;
-   }
-
-   vl_compositor_render(cstate, &dev->compositor, surface, dirty_area, true);
-
-   dev->delayed_rendering.surface = VDP_INVALID_HANDLE;
-   dev->delayed_rendering.cstate = NULL;
-
-   /* test if we need to create a new sampler for the just filled texture */
-   if (surface->texture != vlsurface->sampler_view->texture) {
-      struct pipe_resource *res = surface->texture;
-      struct pipe_sampler_view sv_templ;
-
-      vlVdpDefaultSamplerViewTemplate(&sv_templ, res);
-      pipe_sampler_view_reference(&vlsurface->sampler_view, NULL);
-      vlsurface->sampler_view = dev->context->create_sampler_view(dev->context, res, &sv_templ);
-   }
-
-   return;
-}
-
-void
-vlVdpSave4DelayedRendering(vlVdpDevice *dev, VdpOutputSurface surface, struct vl_compositor_state *cstate)
-{
-   assert(dev);
-
-   vlVdpResolveDelayedRendering(dev, NULL, NULL);
-
-   dev->delayed_rendering.surface = surface;
-   dev->delayed_rendering.cstate = cstate;
-}
index 101417489689c1379f81749d5055b948ab201011..37a6fcd91ce5b13702329b4a27fb9d762c7dace5 100644 (file)
@@ -193,8 +193,6 @@ vlVdpVideoMixerDestroy(VdpVideoMixer mixer)
 
    pipe_mutex_lock(vmixer->device->mutex);
 
-   vlVdpResolveDelayedRendering(vmixer->device, NULL, NULL);
-
    vlRemoveDataHTAB(mixer);
 
    vl_compositor_cleanup_state(&vmixer->cstate);
@@ -293,7 +291,6 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
    }
 
    pipe_mutex_lock(vmixer->device->mutex);
-   vlVdpResolveDelayedRendering(vmixer->device, NULL, NULL);
 
    vl_compositor_clear_layers(&vmixer->cstate);
 
@@ -403,64 +400,60 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
       ++layers;
    }
 
-   if (!vmixer->noise_reduction.filter && !vmixer->sharpness.filter && !vmixer->bicubic.filter)
-      vlVdpSave4DelayedRendering(vmixer->device, destination_surface, &vmixer->cstate);
-   else {
-      vl_compositor_render(&vmixer->cstate, compositor, surface, &dirty_area, true);
-
-      if (vmixer->noise_reduction.filter) {
-         if (!vmixer->sharpness.filter && !vmixer->bicubic.filter) {
-            vl_median_filter_render(vmixer->noise_reduction.filter,
-                                    sampler_view, dst->surface);
-         } else {
-            res = pipe->screen->resource_create(pipe->screen, &res_tmpl);
-            struct pipe_sampler_view *sampler_view_temp = pipe->create_sampler_view(pipe, res, &sv_templ);
-            struct pipe_surface *surface_temp = pipe->create_surface(pipe, res, &surf_templ);
-            pipe_resource_reference(&res, NULL);
-
-            vl_median_filter_render(vmixer->noise_reduction.filter,
-                                    sampler_view, surface_temp);
-
-            pipe_sampler_view_reference(&sampler_view, NULL);
-            pipe_surface_reference(&surface, NULL);
-
-            sampler_view = sampler_view_temp;
-            surface = surface_temp;
-         }
-      }
+   vl_compositor_render(&vmixer->cstate, compositor, surface, &dirty_area, true);
 
-      if (vmixer->sharpness.filter) {
-         if (!vmixer->bicubic.filter) {
-            vl_matrix_filter_render(vmixer->sharpness.filter,
-                                    sampler_view, dst->surface);
-         } else {
-            res = pipe->screen->resource_create(pipe->screen, &res_tmpl);
-            struct pipe_sampler_view *sampler_view_temp = pipe->create_sampler_view(pipe, res, &sv_templ);
-            struct pipe_surface *surface_temp = pipe->create_surface(pipe, res, &surf_templ);
-            pipe_resource_reference(&res, NULL);
+   if (vmixer->noise_reduction.filter) {
+      if (!vmixer->sharpness.filter && !vmixer->bicubic.filter) {
+         vl_median_filter_render(vmixer->noise_reduction.filter,
+                                 sampler_view, dst->surface);
+      } else {
+         res = pipe->screen->resource_create(pipe->screen, &res_tmpl);
+         struct pipe_sampler_view *sampler_view_temp = pipe->create_sampler_view(pipe, res, &sv_templ);
+         struct pipe_surface *surface_temp = pipe->create_surface(pipe, res, &surf_templ);
+         pipe_resource_reference(&res, NULL);
 
-            vl_matrix_filter_render(vmixer->sharpness.filter,
-                                    sampler_view, surface_temp);
+         vl_median_filter_render(vmixer->noise_reduction.filter,
+                                 sampler_view, surface_temp);
 
-            pipe_sampler_view_reference(&sampler_view, NULL);
-            pipe_surface_reference(&surface, NULL);
+         pipe_sampler_view_reference(&sampler_view, NULL);
+         pipe_surface_reference(&surface, NULL);
 
-            sampler_view = sampler_view_temp;
-            surface = surface_temp;
-         }
+         sampler_view = sampler_view_temp;
+         surface = surface_temp;
       }
+   }
 
-      if (vmixer->bicubic.filter)
-         vl_bicubic_filter_render(vmixer->bicubic.filter,
-                                 sampler_view, dst->surface,
-                                 RectToPipe(destination_video_rect, &rect),
-                                 RectToPipe(destination_rect, &clip));
+   if (vmixer->sharpness.filter) {
+      if (!vmixer->bicubic.filter) {
+         vl_matrix_filter_render(vmixer->sharpness.filter,
+                                 sampler_view, dst->surface);
+      } else {
+         res = pipe->screen->resource_create(pipe->screen, &res_tmpl);
+         struct pipe_sampler_view *sampler_view_temp = pipe->create_sampler_view(pipe, res, &sv_templ);
+         struct pipe_surface *surface_temp = pipe->create_surface(pipe, res, &surf_templ);
+         pipe_resource_reference(&res, NULL);
+
+         vl_matrix_filter_render(vmixer->sharpness.filter,
+                                 sampler_view, surface_temp);
 
-      if(surface != dst->surface) {
          pipe_sampler_view_reference(&sampler_view, NULL);
          pipe_surface_reference(&surface, NULL);
+
+         sampler_view = sampler_view_temp;
+         surface = surface_temp;
       }
    }
+
+   if (vmixer->bicubic.filter)
+      vl_bicubic_filter_render(vmixer->bicubic.filter,
+                               sampler_view, dst->surface,
+                               RectToPipe(destination_video_rect, &rect),
+                               RectToPipe(destination_rect, &clip));
+
+   if(surface != dst->surface) {
+      pipe_sampler_view_reference(&sampler_view, NULL);
+      pipe_surface_reference(&surface, NULL);
+   }
    pipe_mutex_unlock(vmixer->device->mutex);
 
    return VDP_STATUS_OK;
index 8ddf2c1b55cbe4022d50abbf29deac545ec7b72f..98a8011f0a603de01d26a8645927e3d5d27e5cdf 100644 (file)
@@ -146,7 +146,6 @@ vlVdpOutputSurfaceDestroy(VdpOutputSurface surface)
    pipe = vlsurface->device->context;
 
    pipe_mutex_lock(vlsurface->device->mutex);
-   vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
 
    pipe_surface_reference(&vlsurface->surface, NULL);
    pipe_sampler_view_reference(&vlsurface->sampler_view, NULL);
@@ -211,7 +210,6 @@ vlVdpOutputSurfaceGetBitsNative(VdpOutputSurface surface,
        return VDP_STATUS_INVALID_POINTER;
 
    pipe_mutex_lock(vlsurface->device->mutex);
-   vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
 
    res = vlsurface->sampler_view->texture;
    box = RectToPipeBox(source_rect, res);
@@ -256,7 +254,6 @@ vlVdpOutputSurfacePutBitsNative(VdpOutputSurface surface,
        return VDP_STATUS_INVALID_POINTER;
 
    pipe_mutex_lock(vlsurface->device->mutex);
-   vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
 
    dst_box = RectToPipeBox(destination_rect, vlsurface->sampler_view->texture);
    pipe->texture_subdata(pipe, vlsurface->sampler_view->texture, 0,
@@ -334,7 +331,6 @@ vlVdpOutputSurfacePutBitsIndexed(VdpOutputSurface surface,
    res_tmpl.bind = PIPE_BIND_SAMPLER_VIEW;
 
    pipe_mutex_lock(vlsurface->device->mutex);
-   vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
 
    if (!CheckSurfaceParams(context->screen, &res_tmpl))
       goto error_resource;
@@ -452,7 +448,6 @@ vlVdpOutputSurfacePutBitsYCbCr(VdpOutputSurface surface,
        return VDP_STATUS_INVALID_POINTER;
 
    pipe_mutex_lock(vlsurface->device->mutex);
-   vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
    memset(&vtmpl, 0, sizeof(vtmpl));
    vtmpl.buffer_format = format;
    vtmpl.chroma_format = FormatYCBCRToPipeChroma(source_ycbcr_format);
@@ -671,7 +666,6 @@ vlVdpOutputSurfaceRenderOutputSurface(VdpOutputSurface destination_surface,
    }
 
    pipe_mutex_lock(dst_vlsurface->device->mutex);
-   vlVdpResolveDelayedRendering(dst_vlsurface->device, NULL, NULL);
 
    context = dst_vlsurface->device->context;
    compositor = &dst_vlsurface->device->compositor;
@@ -746,7 +740,6 @@ vlVdpOutputSurfaceRenderBitmapSurface(VdpOutputSurface destination_surface,
    cstate = &dst_vlsurface->cstate;
 
    pipe_mutex_lock(dst_vlsurface->device->mutex);
-   vlVdpResolveDelayedRendering(dst_vlsurface->device, NULL, NULL);
 
    blend = BlenderToPipe(context, blend_state);
 
@@ -774,7 +767,6 @@ struct pipe_resource *vlVdpOutputSurfaceGallium(VdpOutputSurface surface)
       return NULL;
 
    pipe_mutex_lock(vlsurface->device->mutex);
-   vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
    vlsurface->device->context->flush(vlsurface->device->context, NULL, 0);
    pipe_mutex_unlock(vlsurface->device->mutex);
 
@@ -796,7 +788,6 @@ VdpStatus vlVdpOutputSurfaceDMABuf(VdpOutputSurface surface,
       return VDP_STATUS_INVALID_HANDLE;
 
    pipe_mutex_lock(vlsurface->device->mutex);
-   vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
    vlsurface->device->context->flush(vlsurface->device->context, NULL, 0);
 
    memset(&whandle, 0, sizeof(struct winsys_handle));
index b2c8aea45c9db2ff04c26fb0cf0787ce4041035b..d4793692f902305e457308fc9e949532b9c5d59e 100644 (file)
@@ -251,27 +251,15 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue,
       dst_clip.x1 = clip_width ? clip_width : surf_draw->width;
       dst_clip.y1 = clip_height ? clip_height : surf_draw->height;
 
-      if (pq->device->delayed_rendering.surface == surface &&
-          dst_clip.x1 == surf_draw->width && dst_clip.y1 == surf_draw->height) {
-
-         // TODO: we correctly support the clipping here, but not the pq background color in the clipped area....
-         cstate = pq->device->delayed_rendering.cstate;
-         vl_compositor_set_dst_clip(cstate, &dst_clip);
-         vlVdpResolveDelayedRendering(pq->device, surf_draw, dirty_area);
-
-      } else {
-         vlVdpResolveDelayedRendering(pq->device, NULL, NULL);
-
-         src_rect.x0 = 0;
-         src_rect.y0 = 0;
-         src_rect.x1 = surf_draw->width;
-         src_rect.y1 = surf_draw->height;
-
-         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, true);
-      }
+      src_rect.x0 = 0;
+      src_rect.y0 = 0;
+      src_rect.x1 = surf_draw->width;
+      src_rect.y1 = surf_draw->height;
+
+      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, true);
    }
 
    vscreen->set_next_timestamp(vscreen, earliest_presentation_time);
index bcd4bb181c7a72fc7aba279599cb97186cf1d322..490a0bd308a1d845d8527deb1080d33e0bcd4dda 100644 (file)
@@ -351,11 +351,6 @@ typedef struct
    struct vl_compositor compositor;
    struct pipe_sampler_view *dummy_sv;
    pipe_mutex mutex;
-
-   struct {
-      struct vl_compositor_state *cstate;
-      VdpOutputSurface surface;
-   } delayed_rendering;
 } vlVdpDevice;
 
 typedef struct
@@ -458,10 +453,6 @@ VdpDeviceCreateX11 vdp_imp_device_create_x11;
 
 void vlVdpDefaultSamplerViewTemplate(struct pipe_sampler_view *templ, struct pipe_resource *res);
 
-/* Delayed rendering funtionality */
-void vlVdpResolveDelayedRendering(vlVdpDevice *dev, struct pipe_surface *surface, struct u_rect *dirty_area);
-void vlVdpSave4DelayedRendering(vlVdpDevice *dev, VdpOutputSurface surface, struct vl_compositor_state *cstate);
-
 /* Internal function pointers */
 VdpGetErrorString vlVdpGetErrorString;
 VdpDeviceDestroy vlVdpDeviceDestroy;