surface: fix geometry (size, layout) of grayscale surfaces.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 14 May 2014 11:33:07 +0000 (13:33 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 2 Jun 2014 17:30:43 +0000 (19:30 +0200)
Fix size of the allocated buffer used to represent grayscale (Y800)
surfaces. Only the luminance component is needed, thus implying a
single plane.

Likewise, update render routines to only submit the first plane.
The existing render kernels readily only care about that single
plane.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
src/gen8_render.c
src/i965_drv_video.c
src/i965_render.c

index ca731d2..074fec4 100644 (file)
@@ -276,6 +276,9 @@ gen8_render_src_surfaces_state(
     gen8_render_src_surface_state(ctx, 1, region, 0, rw, rh, region_pitch, I965_SURFACEFORMAT_R8_UNORM, flags);     /* Y */
     gen8_render_src_surface_state(ctx, 2, region, 0, rw, rh, region_pitch, I965_SURFACEFORMAT_R8_UNORM, flags);
 
+    if (obj_surface->fourcc == VA_FOURCC_Y800) /* single plane for grayscale */
+        return;
+
     if (obj_surface->fourcc == VA_FOURCC_NV12) {
         gen8_render_src_surface_state(ctx, 3, region,
                                       region_pitch * obj_surface->y_cb_offset,
index bf15208..7a0320b 100755 (executable)
@@ -861,6 +861,7 @@ bpp_1stplane_by_fourcc(unsigned int fourcc)
         case VA_FOURCC_YUY2:
             return 2;
 
+        case VA_FOURCC_Y800:
         case VA_FOURCC_YV12:
         case VA_FOURCC_IMC3:
         case VA_FOURCC_IYUV:
@@ -2868,13 +2869,13 @@ i965_check_alloc_surface_bo(VADriverContextP ctx,
 
         case VA_FOURCC_Y800:
             assert(subsampling == SUBSAMPLE_YUV400);
-            obj_surface->cb_cr_pitch = obj_surface->width;
+            obj_surface->cb_cr_pitch = 0;
             obj_surface->cb_cr_width = 0;
             obj_surface->cb_cr_height = 0;
-            obj_surface->y_cb_offset = obj_surface->height;
-            obj_surface->y_cr_offset = obj_surface->y_cb_offset + ALIGN(obj_surface->cb_cr_height, 32);
+            obj_surface->y_cb_offset = 0;
+            obj_surface->y_cr_offset = 0;
             region_width = obj_surface->width;
-            region_height = obj_surface->height + ALIGN(obj_surface->cb_cr_height, 32) * 2;
+            region_height = obj_surface->height;
 
             break;
 
index aed78c0..9d0e846 100644 (file)
@@ -876,6 +876,9 @@ i965_render_src_surfaces_state(
     i965_render_src_surface_state(ctx, 1, region, 0, rw, rh, region_pitch, I965_SURFACEFORMAT_R8_UNORM, flags);     /* Y */
     i965_render_src_surface_state(ctx, 2, region, 0, rw, rh, region_pitch, I965_SURFACEFORMAT_R8_UNORM, flags);
 
+    if (obj_surface->fourcc == VA_FOURCC_Y800) /* single plane for grayscale */
+        return;
+
     if (obj_surface->fourcc == VA_FOURCC_NV12) {
         i965_render_src_surface_state(ctx, 3, region,
                                       region_pitch * obj_surface->y_cb_offset,