st/va: move YUV content to deinterlaced buffer when reallocated for encoder
authorLeo Liu <leo.liu@amd.com>
Tue, 29 Aug 2017 03:07:33 +0000 (23:07 -0400)
committerLeo Liu <leo.liu@amd.com>
Thu, 7 Sep 2017 17:32:36 +0000 (13:32 -0400)
v2: use deinterlace common function
v3: make sure deinterlace only

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
src/gallium/state_trackers/va/picture.c

index ee099fad6eec57fbd1d561bf0b185556fea6025a..19df52cb83e3e318b56de960b735d03f3430b6a0 100644 (file)
@@ -660,13 +660,22 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
    }
 
    if (realloc) {
-      surf->buffer->destroy(surf->buffer);
+      struct pipe_video_buffer *old_buf = surf->buffer;
 
       if (vlVaHandleSurfaceAllocate(ctx, surf, &surf->templat) != VA_STATUS_SUCCESS) {
          mtx_unlock(&drv->mutex);
          return VA_STATUS_ERROR_ALLOCATION_FAILED;
       }
 
+      if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
+         if (old_buf->interlaced)
+            vl_compositor_yuv_deint(&drv->cstate, &drv->compositor, old_buf, surf->buffer);
+         else
+            /* Can't convert from progressive to interlaced yet */
+            return VA_STATUS_ERROR_INVALID_SURFACE;
+      }
+
+      old_buf->destroy(old_buf);
       context->target = surf->buffer;
    }