summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2012-03-27 14:55:23 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2012-03-27 14:55:23 +0800
commit546fdcfa2f4dd162fdd19187255a57272d4f1745 (patch)
tree8490ead9b8cbad6fa1a93fc0a148d4fd38b48856
parenta97985da277cd48302cfcb0374604874fc77ef7d (diff)
Check the max resolution supported by hardware when create VA context
It will avoid GPU hang when try to play unsupported large resolution videos. Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
-rw-r--r--src/i965_drv_video.c14
-rw-r--r--src/i965_drv_video.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
index ffed364..cb600f3 100644
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -144,12 +144,16 @@ extern struct hw_context *g4x_dec_hw_context_init(VADriverContextP, VAProfile);
static struct hw_codec_info g4x_hw_codec_info = {
.dec_hw_context_init = g4x_dec_hw_context_init,
.enc_hw_context_init = NULL,
+ .max_width = 2048,
+ .max_height = 2048,
};
extern struct hw_context *ironlake_dec_hw_context_init(VADriverContextP, VAProfile);
static struct hw_codec_info ironlake_hw_codec_info = {
.dec_hw_context_init = ironlake_dec_hw_context_init,
.enc_hw_context_init = NULL,
+ .max_width = 2048,
+ .max_height = 2048,
};
extern struct hw_context *gen6_dec_hw_context_init(VADriverContextP, VAProfile);
@@ -157,12 +161,16 @@ extern struct hw_context *gen6_enc_hw_context_init(VADriverContextP, VAProfile);
static struct hw_codec_info gen6_hw_codec_info = {
.dec_hw_context_init = gen6_dec_hw_context_init,
.enc_hw_context_init = gen6_enc_hw_context_init,
+ .max_width = 2048,
+ .max_height = 2048,
};
extern struct hw_context *gen7_dec_hw_context_init(VADriverContextP, VAProfile);
static struct hw_codec_info gen7_hw_codec_info = {
.dec_hw_context_init = gen7_dec_hw_context_init,
.enc_hw_context_init = gen6_enc_hw_context_init,
+ .max_width = 4096,
+ .max_height = 4096,
};
VAStatus
@@ -838,6 +846,12 @@ i965_CreateContext(VADriverContextP ctx,
return vaStatus;
}
+ if (picture_width > i965->codec_info->max_width ||
+ picture_height > i965->codec_info->max_height) {
+ vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
+ return vaStatus;
+ }
+
/* Validate flag */
/* Validate picture dimensions */
contextID = NEW_CONTEXT_ID();
diff --git a/src/i965_drv_video.h b/src/i965_drv_video.h
index 03b4c5d..ab993bc 100644
--- a/src/i965_drv_video.h
+++ b/src/i965_drv_video.h
@@ -209,6 +209,8 @@ struct hw_codec_info
{
struct hw_context *(*dec_hw_context_init)(VADriverContextP, VAProfile);
struct hw_context *(*enc_hw_context_init)(VADriverContextP, VAProfile);
+ int max_width;
+ int max_height;
};