Hi Nayan,

yeah, that sounds like a good idea to me. In the meantime I'm taking a look at your lanczos filter once more and try to figure out where those artifacts come from.

The problem with using multiple output surfaces is that DRI2 didn't supported that. E.g. in DRI2 you can only get two textures for each drawable (front and back).

Because of this I came up with the delayed rendering approach to avoid an additional copy of the texture content. For DRI3 we don't have that problem any more.

Steps which needs to be done should be:
1. Read yourself into src/gallium/auxiliary/vl/vl_winsys_dri.c and src/gallium/auxiliary/vl/vl_winsys_dri3.c.

2. Then make sure DRI3 is the default in the VDPAU state tracker and issue a warning when we need to fallback to DRI2.

3. Hack on vl_winsys_dri3.c so that the VDPAU state tracker can allocate multiple textures from it (one for each output surface).

4. Modify the VDPAU state tracker to use this functionality instead of the delayed rendering.

5. Remove the delayed rendering hack.

Regards,
Christian.

Am 29.08.2016 um 12:43 schrieb Nayan Deshmukh:
Hi Christian,

Should I start working on using DRI rather than delayed rendering to
render directly to the surface?
Also, I will need some direction to get started.


Regards,
Nayan.
On Mon, Aug 29, 2016 at 3:26 PM, Christian König
<deathsim...@vodafone.de> wrote:
Am 26.08.2016 um 11:53 schrieb Nayan Deshmukh:
Use temporary buffers so that we don't read and write to the
same surface at the same time. We don't need to use linear
layout now.

v2: rebase the patch against reverted change

Signed-off-by: Nayan Deshmukh <nayan26deshm...@gmail.com>

Reviewed, tested and pushed.

Thanks for the help,
Christian.


---
   src/gallium/state_trackers/vdpau/mixer.c | 75
++++++++++++++++++++++++--------
   1 file changed, 57 insertions(+), 18 deletions(-)

diff --git a/src/gallium/state_trackers/vdpau/mixer.c
b/src/gallium/state_trackers/vdpau/mixer.c
index cb0ef03..c205427 100644
--- a/src/gallium/state_trackers/vdpau/mixer.c
+++ b/src/gallium/state_trackers/vdpau/mixer.c
@@ -240,8 +240,10 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
      struct u_rect rect, clip, *prect, dirty_area;
      unsigned i, layer = 0;
      struct pipe_video_buffer *video_buffer;
-   struct pipe_sampler_view *sampler_view;
-   struct pipe_surface *surface;
+   struct pipe_sampler_view *sampler_view, sv_templ;
+   struct pipe_surface *surface, surf_templ;
+   struct pipe_context *pipe;
+   struct pipe_resource res_tmpl, *res;
        vlVdpVideoMixer *vmixer;
      vlVdpSurface *surf;
@@ -335,25 +337,25 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
      }
      vl_compositor_set_buffer_layer(&vmixer->cstate, compositor, layer,
video_buffer, prect, NULL, deinterlace);
   -   if(vmixer->bicubic.filter) {
-      struct pipe_context *pipe;
-      struct pipe_resource res_tmpl, *res;
-      struct pipe_sampler_view sv_templ;
-      struct pipe_surface surf_templ;
-
+   if (vmixer->bicubic.filter || vmixer->sharpness.filter ||
vmixer->noise_reduction.filter) {
         pipe = vmixer->device->context;
         memset(&res_tmpl, 0, sizeof(res_tmpl));
           res_tmpl.target = PIPE_TEXTURE_2D;
-      res_tmpl.width0 = surf->templat.width;
-      res_tmpl.height0 = surf->templat.height;
         res_tmpl.format = dst->sampler_view->format;
         res_tmpl.depth0 = 1;
         res_tmpl.array_size = 1;
-      res_tmpl.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET |
-                      PIPE_BIND_LINEAR;
+      res_tmpl.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
         res_tmpl.usage = PIPE_USAGE_DEFAULT;
   +      if (!vmixer->bicubic.filter) {
+         res_tmpl.width0 = dst->surface->width;
+         res_tmpl.height0 = dst->surface->height;
+      } else {
+         res_tmpl.width0 = surf->templat.width;
+         res_tmpl.height0 = surf->templat.height;
+      }
+
         res = pipe->screen->resource_create(pipe->screen, &res_tmpl);
           vlVdpDefaultSamplerViewTemplate(&sv_templ, res);
@@ -369,6 +371,9 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
         surface = dst->surface;
         sampler_view = dst->sampler_view;
         dirty_area = dst->dirty_area;
+   }
+
+   if (!vmixer->bicubic.filter) {
         vl_compositor_set_layer_dst_area(&vmixer->cstate, layer++,
RectToPipe(destination_video_rect, &rect));
         vl_compositor_set_dst_clip(&vmixer->cstate,
RectToPipe(destination_rect, &clip));
      }
@@ -394,13 +399,47 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
      else {
         vl_compositor_render(&vmixer->cstate, compositor, surface,
&dirty_area, true);
   -      if (vmixer->noise_reduction.filter)
-         vl_median_filter_render(vmixer->noise_reduction.filter,
-                                 sampler_view, surface);
+      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);
   -      if (vmixer->sharpness.filter)
-         vl_matrix_filter_render(vmixer->sharpness.filter,
-                                 sampler_view, surface);
+            sampler_view = sampler_view_temp;
+            surface = surface_temp;
+         }
+      }
+
+      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);
+
+            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,



_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to