[Libva] [PATCH 1/2] Limit the minimum pitch for linear surface

Xiang, Haihao haihao.xiang at intel.com
Fri May 9 01:53:01 PDT 2014


From: "Xiang, Haihao" <haihao.xiang at intel.com>

pitch must be 64 at least for linear surface for most functions on IVB/HSW/BDW
such VEBOX, Data port media read/write

https://bugs.freedesktop.org/show_bug.cgi?id=72522

Signed-off-by: Xiang, Haihao <haihao.xiang at intel.com>
---
 src/i965_device_info.c | 12 ++++++++++++
 src/i965_drv_video.c   | 14 ++++++++------
 src/i965_drv_video.h   |  2 ++
 3 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/src/i965_device_info.c b/src/i965_device_info.c
index 35a75b4..505cd5a 100644
--- a/src/i965_device_info.c
+++ b/src/i965_device_info.c
@@ -40,6 +40,8 @@ static const struct hw_codec_info g4x_hw_codec_info = {
 
     .max_width = 2048,
     .max_height = 2048,
+    .min_linear_wpitch = 16,
+    .min_linear_hpitch = 16,
 
     .has_mpeg2_decoding = 1,
 
@@ -58,6 +60,8 @@ static const struct hw_codec_info ilk_hw_codec_info = {
 
     .max_width = 2048,
     .max_height = 2048,
+    .min_linear_wpitch = 16,
+    .min_linear_hpitch = 16,
 
     .has_mpeg2_decoding = 1,
     .has_h264_decoding = 1,
@@ -78,6 +82,8 @@ static const struct hw_codec_info snb_hw_codec_info = {
 
     .max_width = 2048,
     .max_height = 2048,
+    .min_linear_wpitch = 16,
+    .min_linear_hpitch = 16,
 
     .has_mpeg2_decoding = 1,
     .has_mpeg2_encoding = 1,
@@ -107,6 +113,8 @@ static const struct hw_codec_info ivb_hw_codec_info = {
 
     .max_width = 4096,
     .max_height = 4096,
+    .min_linear_wpitch = 64,
+    .min_linear_hpitch = 16,
 
     .has_mpeg2_decoding = 1,
     .has_mpeg2_encoding = 1,
@@ -140,6 +148,8 @@ static const struct hw_codec_info hsw_hw_codec_info = {
 
     .max_width = 4096,
     .max_height = 4096,
+    .min_linear_wpitch = 64,
+    .min_linear_hpitch = 16,
 
     .has_mpeg2_decoding = 1,
     .has_mpeg2_encoding = 1,
@@ -179,6 +189,8 @@ static const struct hw_codec_info bdw_hw_codec_info = {
 
     .max_width = 4096,
     .max_height = 4096,
+    .min_linear_wpitch = 64,
+    .min_linear_hpitch = 16,
 
     .has_mpeg2_decoding = 1,
     .has_mpeg2_encoding = 1,
diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
index fa51651..84f632f 100755
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -987,8 +987,10 @@ i965_CreateSurfaces2(
            obj_surface->obj_subpic[j] = NULL;
         }
 
-        obj_surface->width = ALIGN(width, 16);
-        obj_surface->height = ALIGN(height, 16);
+        assert(i965->codec_info->min_linear_wpitch);
+        assert(i965->codec_info->min_linear_hpitch);
+        obj_surface->width = ALIGN(width, i965->codec_info->min_linear_wpitch);
+        obj_surface->height = ALIGN(height, i965->codec_info->min_linear_hpitch);
         obj_surface->flags = SURFACE_REFERENCED;
         obj_surface->fourcc = 0;
         obj_surface->bo = NULL;
@@ -2641,7 +2643,7 @@ i965_CreateImage(VADriverContextP ctx,
     image->image_id       = image_id;
     image->buf            = VA_INVALID_ID;
 
-    awidth = ALIGN(width, 64);
+    awidth = ALIGN(width, i965->codec_info->min_linear_wpitch);
 
     if ((format->fourcc == VA_FOURCC_YV12) ||
     		(format->fourcc == VA_FOURCC_I420)) {
@@ -2650,7 +2652,7 @@ i965_CreateImage(VADriverContextP ctx,
 	}
     }
 
-    aheight = ALIGN(height, 16);
+    aheight = ALIGN(height, i965->codec_info->min_linear_hpitch);
     size    = awidth * aheight;
     size2    = (awidth / 2) * (aheight / 2);
 
@@ -2987,7 +2989,7 @@ i965_check_alloc_surface_bo(VADriverContextP ctx,
 
         case VA_FOURCC_YUY2:
         case VA_FOURCC_UYVY:
-            obj_surface->width = ALIGN(obj_surface->orig_width * 2, 16);
+            obj_surface->width = ALIGN(obj_surface->orig_width * 2, i965->codec_info->min_linear_wpitch);
             obj_surface->y_cb_offset = 0;
             obj_surface->y_cr_offset = 0;
             obj_surface->cb_cr_width = obj_surface->orig_width / 2;
@@ -3000,7 +3002,7 @@ i965_check_alloc_surface_bo(VADriverContextP ctx,
         case VA_FOURCC_RGBX:
         case VA_FOURCC_BGRA:
         case VA_FOURCC_BGRX:
-            obj_surface->width = ALIGN(obj_surface->orig_width * 4, 16);
+            obj_surface->width = ALIGN(obj_surface->orig_width * 4, i965->codec_info->min_linear_wpitch);
             region_width = obj_surface->width;
             region_height = obj_surface->height;
             break;
diff --git a/src/i965_drv_video.h b/src/i965_drv_video.h
index 0e32f7d..6f890f6 100644
--- a/src/i965_drv_video.h
+++ b/src/i965_drv_video.h
@@ -291,6 +291,8 @@ struct hw_codec_info
 
     int max_width;
     int max_height;
+    int min_linear_wpitch;
+    int min_linear_hpitch;
 
     unsigned int has_mpeg2_decoding:1;
     unsigned int has_mpeg2_encoding:1;
-- 
1.8.3.2



More information about the Libva mailing list