summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2014-05-09 18:30:33 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2014-06-02 19:30:43 +0200
commit0f2e2a97a33881ab3a7f0c079391651c8a0fca78 (patch)
treeac02d23dcab4e939d3dd0766cacec6261a682753 /src
parentcffa75273cd367d41019995c2335241b8e349ef1 (diff)
downloadlibva-intel-driver-0f2e2a97a33881ab3a7f0c079391651c8a0fca78.tar.gz
libva-intel-driver-0f2e2a97a33881ab3a7f0c079391651c8a0fca78.tar.bz2
libva-intel-driver-0f2e2a97a33881ab3a7f0c079391651c8a0fca78.zip
config: fix vaGetConfigAttributes() to validate profile/entrypoint.
Factor out code to validate profile/entrypoint per the underlying hardware capabilities. Also fix vaGetConfigAttributes() to really validate the profile/entrypoint pair. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/i965_drv_video.c145
1 files changed, 78 insertions, 67 deletions
diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
index eb67f53..15d65e5 100755
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -366,6 +366,78 @@ i965_QueryConfigEntrypoints(VADriverContextP ctx,
return n > 0 ? VA_STATUS_SUCCESS : VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
}
+static VAStatus
+i965_validate_config(VADriverContextP ctx, VAProfile profile,
+ VAEntrypoint entrypoint)
+{
+ struct i965_driver_data * const i965 = i965_driver_data(ctx);
+ VAStatus va_status;
+
+ /* Validate profile & entrypoint */
+ switch (profile) {
+ case VAProfileMPEG2Simple:
+ case VAProfileMPEG2Main:
+ if ((HAS_MPEG2_DECODING(i965) && entrypoint == VAEntrypointVLD) ||
+ (HAS_MPEG2_ENCODING(i965) && entrypoint == VAEntrypointEncSlice)) {
+ va_status = VA_STATUS_SUCCESS;
+ } else {
+ va_status = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
+ }
+ break;
+
+ case VAProfileH264ConstrainedBaseline:
+ case VAProfileH264Main:
+ case VAProfileH264High:
+ if ((HAS_H264_DECODING(i965) && entrypoint == VAEntrypointVLD) ||
+ (HAS_H264_ENCODING(i965) && entrypoint == VAEntrypointEncSlice)) {
+ va_status = VA_STATUS_SUCCESS;
+ } else {
+ va_status = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
+ }
+ break;
+
+ case VAProfileVC1Simple:
+ case VAProfileVC1Main:
+ case VAProfileVC1Advanced:
+ if (HAS_VC1_DECODING(i965) && entrypoint == VAEntrypointVLD) {
+ va_status = VA_STATUS_SUCCESS;
+ } else {
+ va_status = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
+ }
+ break;
+
+ case VAProfileNone:
+ if (HAS_VPP(i965) && VAEntrypointVideoProc == entrypoint) {
+ va_status = VA_STATUS_SUCCESS;
+ } else {
+ va_status = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
+ }
+ break;
+
+ case VAProfileJPEGBaseline:
+ if (HAS_JPEG_DECODING(i965) && entrypoint == VAEntrypointVLD) {
+ va_status = VA_STATUS_SUCCESS;
+ } else {
+ va_status = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
+ }
+ break;
+
+ case VAProfileVP8Version0_3:
+ if ((HAS_VP8_DECODING(i965) && entrypoint == VAEntrypointVLD) ||
+ (HAS_VP8_ENCODING(i965) && entrypoint == VAEntrypointEncSlice)) {
+ va_status = VA_STATUS_SUCCESS;
+ } else {
+ va_status = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
+ }
+ break;
+
+ default:
+ va_status = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
+ break;
+ }
+ return va_status;
+}
+
VAStatus
i965_GetConfigAttributes(VADriverContextP ctx,
VAProfile profile,
@@ -373,8 +445,13 @@ i965_GetConfigAttributes(VADriverContextP ctx,
VAConfigAttrib *attrib_list, /* in/out */
int num_attribs)
{
+ VAStatus va_status;
int i;
+ va_status = i965_validate_config(ctx, profile, entrypoint);
+ if (va_status != VA_STATUS_SUCCESS)
+ return va_status;
+
/* Other attributes don't seem to be defined */
/* What to do if we don't know the attribute? */
for (i = 0; i < num_attribs; i++) {
@@ -460,73 +537,7 @@ i965_CreateConfig(VADriverContextP ctx,
int i;
VAStatus vaStatus;
- /* Validate profile & entrypoint */
- switch (profile) {
- case VAProfileMPEG2Simple:
- case VAProfileMPEG2Main:
- if ((HAS_MPEG2_DECODING(i965) && VAEntrypointVLD == entrypoint) ||
- (HAS_MPEG2_ENCODING(i965) && VAEntrypointEncSlice == entrypoint)) {
- vaStatus = VA_STATUS_SUCCESS;
- } else {
- vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
- }
- break;
-
- case VAProfileH264ConstrainedBaseline:
- case VAProfileH264Main:
- case VAProfileH264High:
- if ((HAS_H264_DECODING(i965) && VAEntrypointVLD == entrypoint) ||
- (HAS_H264_ENCODING(i965) && VAEntrypointEncSlice == entrypoint)) {
- vaStatus = VA_STATUS_SUCCESS;
- } else {
- vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
- }
-
- break;
-
- case VAProfileVC1Simple:
- case VAProfileVC1Main:
- case VAProfileVC1Advanced:
- if (HAS_VC1_DECODING(i965) && VAEntrypointVLD == entrypoint) {
- vaStatus = VA_STATUS_SUCCESS;
- } else {
- vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
- }
-
- break;
-
- case VAProfileNone:
- if (HAS_VPP(i965) && VAEntrypointVideoProc == entrypoint) {
- vaStatus = VA_STATUS_SUCCESS;
- } else {
- vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
- }
-
- break;
-
- case VAProfileJPEGBaseline:
- if (HAS_JPEG_DECODING(i965) && VAEntrypointVLD == entrypoint) {
- vaStatus = VA_STATUS_SUCCESS;
- } else {
- vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
- }
-
- break;
-
- case VAProfileVP8Version0_3:
- if ((HAS_VP8_DECODING(i965) && VAEntrypointVLD == entrypoint) ||
- (HAS_VP8_ENCODING(i965) && VAEntrypointEncSlice == entrypoint))
- vaStatus = VA_STATUS_SUCCESS;
- else
- vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
-
- break;
-
- default:
- vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
- break;
- }
-
+ vaStatus = i965_validate_config(ctx, profile, entrypoint);
if (VA_STATUS_SUCCESS != vaStatus) {
return vaStatus;
}