[Libva] [PATCH] Downgrade the alignment requirement for linear surface on BDW+

Zhao Yakui yakui.zhao at intel.com
Mon Jun 27 04:09:05 UTC 2016


When sharing the YUY2/UYVY buffer with other driver, the current alignment is too
strict, which causes that it is not handled correctly by other driver.(The current
alignment is considered based on I420/YV12)

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

Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
---
 src/i965_device_info.c | 10 +++++-----
 src/i965_drv_video.c   |  4 ++++
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/i965_device_info.c b/src/i965_device_info.c
index 239961c..47fd50a 100644
--- a/src/i965_device_info.c
+++ b/src/i965_device_info.c
@@ -239,7 +239,7 @@ static struct hw_codec_info bdw_hw_codec_info = {
 
     .max_width = 4096,
     .max_height = 4096,
-    .min_linear_wpitch = 128,
+    .min_linear_wpitch = 64,
     .min_linear_hpitch = 16,
 
     .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
@@ -282,7 +282,7 @@ static struct hw_codec_info chv_hw_codec_info = {
 
     .max_width = 4096,
     .max_height = 4096,
-    .min_linear_wpitch = 128,
+    .min_linear_wpitch = 64,
     .min_linear_hpitch = 16,
 
     .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
@@ -332,7 +332,7 @@ static struct hw_codec_info skl_hw_codec_info = {
 
     .max_width = 4096,  /* default. See max_resolution */
     .max_height = 4096, /* default. See max_resolution */
-    .min_linear_wpitch = 128,
+    .min_linear_wpitch = 64,
     .min_linear_hpitch = 16,
 
     .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
@@ -384,7 +384,7 @@ static struct hw_codec_info bxt_hw_codec_info = {
 
     .max_width = 4096,  /* default. See max_resolution */
     .max_height = 4096, /* default. See max_resolution */
-    .min_linear_wpitch = 128,
+    .min_linear_wpitch = 64,
     .min_linear_hpitch = 16,
 
     .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
@@ -437,7 +437,7 @@ static struct hw_codec_info kbl_hw_codec_info = {
 
     .max_width = 4096,   /* default. See max_resolution */
     .max_height = 4096,  /* default. See max_resolution */
-    .min_linear_wpitch = 128,
+    .min_linear_wpitch = 64,
     .min_linear_hpitch = 16,
 
     .h264_mvc_dec_profiles = (VA_PROFILE_MASK(H264StereoHigh) |
diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
index 66cdb9e..ad48f22 100644
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -4162,10 +4162,12 @@ i965_check_alloc_surface_bo(VADriverContextP ctx,
 
         case VA_FOURCC_YV16:
             obj_surface->cb_cr_width = obj_surface->orig_width / 2;
+            obj_surface->width = ALIGN(obj_surface->cb_cr_width, i965->codec_info->min_linear_wpitch) * 2;
             obj_surface->cb_cr_height = obj_surface->orig_height;
             obj_surface->y_cr_offset = obj_surface->height;
             obj_surface->y_cb_offset = obj_surface->y_cr_offset + ALIGN(obj_surface->cb_cr_height, 32) / 2;
             obj_surface->cb_cr_pitch = obj_surface->width / 2;
+            region_width = obj_surface->width;
             region_height = obj_surface->height + ALIGN(obj_surface->cb_cr_height, 32);
             break;
 
@@ -4180,8 +4182,10 @@ i965_check_alloc_surface_bo(VADriverContextP ctx,
             }
 
             obj_surface->cb_cr_width = obj_surface->orig_width / 2;
+            obj_surface->width = ALIGN(obj_surface->cb_cr_width, i965->codec_info->min_linear_wpitch) * 2;
             obj_surface->cb_cr_height = obj_surface->orig_height / 2;
             obj_surface->cb_cr_pitch = obj_surface->width / 2;
+            region_width = obj_surface->width;
             region_height = obj_surface->height + obj_surface->height / 2;
             break;
 
-- 
1.8.2-rc2



More information about the Libva mailing list