Mesa (master): frontends/va/postproc: Convert destination when deinterlacing

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 25 20:13:51 UTC 2020


Module: Mesa
Branch: master
Commit: f09456361c4c753f686b8f155f5c8de3f1feebb9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f09456361c4c753f686b8f155f5c8de3f1feebb9

Author: Thong Thai <thong.thai at amd.com>
Date:   Mon Sep 21 13:56:05 2020 -0400

frontends/va/postproc: Convert destination when deinterlacing

When the VAAPI deinterlacing filter is chained with other VAAPI
post-processing filters, the image might get deinterlaced multiple
times, as the filters after the deinterlacing filter might still see an
interlaced buffer.

Signed-off-by: Thong Thai <thong.thai at amd.com>
Acked-by: Leo Liu <leo.liu at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6803>

---

 src/gallium/frontends/va/postproc.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/gallium/frontends/va/postproc.c b/src/gallium/frontends/va/postproc.c
index f84a5aeeb1f..946761be312 100644
--- a/src/gallium/frontends/va/postproc.c
+++ b/src/gallium/frontends/va/postproc.c
@@ -287,7 +287,7 @@ vlVaHandleVAProcPipelineParameterBufferType(vlVaDriver *drv, vlVaContext *contex
    VARectangle def_src_region, def_dst_region;
    const VARectangle *src_region, *dst_region;
    VAProcPipelineParameterBuffer *param;
-   struct pipe_video_buffer *src;
+   struct pipe_video_buffer *src, *dst;
    vlVaSurface *src_surface, *dst_surface;
    unsigned i;
 
@@ -309,6 +309,21 @@ vlVaHandleVAProcPipelineParameterBufferType(vlVaDriver *drv, vlVaContext *contex
       return VA_STATUS_ERROR_INVALID_SURFACE;
 
    src = src_surface->buffer;
+   dst = dst_surface->buffer;
+
+   /* convert the destination buffer to progressive if we're deinterlacing 
+      otherwise we might end up deinterlacing twice */
+   if (param->num_filters && dst->interlaced) {
+      vlVaSurface *surf;
+      surf = dst_surface;
+      surf->templat.interlaced = false;
+      dst->destroy(dst);
+
+      if (vlVaHandleSurfaceAllocate(drv, surf, &surf->templat) != VA_STATUS_SUCCESS)
+         return VA_STATUS_ERROR_ALLOCATION_FAILED;
+
+      dst = context->target = surf->buffer;
+   }
 
    for (i = 0; i < param->num_filters; i++) {
       vlVaBuffer *buf = handle_table_get(drv->htab, param->filters[i]);



More information about the mesa-commit mailing list