Revert "st/va: Convert interlaced NV12 to progressive"
authorThong Thai <thong.thai@amd.com>
Thu, 13 Feb 2020 16:03:12 +0000 (11:03 -0500)
committerMarge Bot <eric+marge@anholt.net>
Thu, 13 Feb 2020 16:43:02 +0000 (16:43 +0000)
This reverts commit 2add63060b51ea2ae432d10e1bd52d6cc0a4dcbb.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2454
Fixes: 2add63060b51 "st/va: Convert interlaced NV12 to progressive"
Signed-off-by: Thong Thai <thong.thai@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3815>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3815>

src/gallium/state_trackers/va/image.c

index 0a54a90cb4cfba5c73e94f28a2ea3c2206364c76..b0e32da3e8ba8b601988c6d10786930b7d290f72 100644 (file)
@@ -223,8 +223,7 @@ vlVaDeriveImage(VADriverContextP ctx, VASurfaceID surface, VAImage *image)
    if (!surf || !surf->buffer)
       return VA_STATUS_ERROR_INVALID_SURFACE;
 
-   if (surf->buffer->interlaced &&
-      surf->buffer->buffer_format != PIPE_FORMAT_NV12)
+   if (surf->buffer->interlaced)
      return VA_STATUS_ERROR_OPERATION_FAILED;
 
    surfaces = surf->buffer->get_surfaces(surf->buffer);
@@ -261,10 +260,6 @@ vlVaDeriveImage(VADriverContextP ctx, VASurfaceID surface, VAImage *image)
          offset = 0;
    }
 
-   img->num_planes = 1;
-   img->offsets[0] = offset;
-   img->data_size  = img->pitches[0] * h;
-
    switch (img->format.fourcc) {
    case VA_FOURCC('U','Y','V','Y'):
    case VA_FOURCC('Y','U','Y','V'):
@@ -280,51 +275,6 @@ vlVaDeriveImage(VADriverContextP ctx, VASurfaceID surface, VAImage *image)
       assert(img->pitches[0] >= (w * 4));
       break;
 
-   case VA_FOURCC('P','0','1','0'):
-   case VA_FOURCC('P','0','1','6'):
-   case VA_FOURCC('N','V','1','2'):
-      if (surf->buffer->interlaced) {
-         struct pipe_video_buffer *new_buffer;
-         struct u_rect src_rect, dst_rect;
-
-         surf->templat.interlaced = false;
-         new_buffer = drv->pipe->create_video_buffer(drv->pipe, &surf->templat);
-
-         /* convert the interlaced to the progressive */
-         src_rect.x0 = dst_rect.x0 = 0;
-         src_rect.x1 = dst_rect.x1 = surf->templat.width;
-         src_rect.y0 = dst_rect.y0 = 0;
-         src_rect.y1 = dst_rect.y1 = surf->templat.height;
-
-         vl_compositor_yuv_deint_full(&drv->cstate, &drv->compositor,
-                           surf->buffer, new_buffer,
-                           &src_rect, &dst_rect,
-                           VL_COMPOSITOR_WEAVE);
-
-         surf->buffer->destroy(surf->buffer);
-         surf->buffer = new_buffer;
-
-         /* recalculate the values now that we have a new surface */
-         surfaces = surf->buffer->get_surfaces(surf->buffer);
-         if (screen->resource_get_info) {
-            screen->resource_get_info(screen, surfaces[0]->texture, &stride,
-                                    &offset);
-            if (!stride)
-               offset = 0;
-         }
-
-         w = align(surf->buffer->width, 2);
-         h = align(surf->buffer->height, 2);
-      }
-
-      img->num_planes = 2;
-      img->pitches[0] = stride > 0 ? stride : w;
-      img->offsets[0] = 0;
-      img->pitches[1] = stride > 0 ? stride : w;
-      img->offsets[1] = (stride > 0 ? stride : w) * h;
-      img->data_size  = (stride > 0 ? stride : w) * h * 3 / 2;
-      break;
-
    default:
       /* VaDeriveImage only supports contiguous planes. But there is now a
          more generic api vlVaExportSurfaceHandle. */
@@ -333,6 +283,9 @@ vlVaDeriveImage(VADriverContextP ctx, VASurfaceID surface, VAImage *image)
       return VA_STATUS_ERROR_OPERATION_FAILED;
    }
 
+   img->num_planes = 1;
+   img->offsets[0] = offset;
+   img->data_size  = img->pitches[0] * h;
 
    img_buf = CALLOC(1, sizeof(vlVaBuffer));
    if (!img_buf) {