summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2014-05-09 16:16:05 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2014-05-26 12:17:17 +0800
commite437ae5c33ea6547f88cf2bd1b34159fce95b988 (patch)
tree126cf88387eff3cf36d5a90c1789cf5292ea99a1
parenta7343f9148198f25b2c10bf610c95e6ebd4fa189 (diff)
Limit the minimum pitch for linear surface
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@intel.com> (cherry picked from commit 57db5c2524f4e3cb6ae2301bddfdf1c40cdbb626)
-rw-r--r--src/i965_device_info.c12
-rwxr-xr-xsrc/i965_drv_video.c14
-rw-r--r--src/i965_drv_video.h2
3 files changed, 22 insertions, 6 deletions
diff --git a/src/i965_device_info.c b/src/i965_device_info.c
index f040592..f7ce226 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_h264_decoding = 1,
@@ -106,6 +112,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,
@@ -138,6 +146,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,
@@ -174,6 +184,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 96ca997..bf15208 100755
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -955,8 +955,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;
@@ -2606,7 +2608,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)) {
@@ -2615,7 +2617,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);
@@ -2952,7 +2954,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;
@@ -2965,7 +2967,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 856b478..900aed9 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;