OSDN Git Service

i965_test_config: return properly unsupported profile
authorDaniel Charles <daniel.charles@intel.com>
Thu, 10 Nov 2016 23:08:20 +0000 (15:08 -0800)
committerSean V Kelley <seanvk@posteo.de>
Thu, 10 Nov 2016 23:46:15 +0000 (15:46 -0800)
jpege/jpegd and avce/avcd config tests to check against all supported
entrypoints for a profile.  UNSUPPORTED_PROFILE is expected
when no entrypoints are available for a given profile, else
expect UNSUPPORTED_ENTRYPOINT.

Signed-off-by: Daniel Charles <daniel.charles@intel.com>
Reviewed-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
test/i965_avcd_config_test.cpp
test/i965_avce_config_test.cpp
test/i965_jpegd_config_test.cpp
test/i965_jpege_config_test.cpp

index 851e86e..8bc5e3c 100644 (file)
 namespace AVC {
 namespace Decode {
 
+VAStatus ProfileNotSupported()
+{
+    return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
+}
+
+VAStatus EntrypointNotSupported()
+{
+    return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
+}
+
+// H264*NotSupported functions report properly if profile is not supported or
+// only entrypoint is not supported
+VAStatus H264NotSupported()
+{
+    I965TestEnvironment *env(I965TestEnvironment::instance());
+    EXPECT_PTR(env);
+
+    struct i965_driver_data *i965(*env);
+    EXPECT_PTR(i965);
+
+    if (!HAS_H264_ENCODING(i965)
+        && !HAS_LP_H264_ENCODING(i965))
+        return ProfileNotSupported();
+
+    return EntrypointNotSupported();
+}
+
+VAStatus H264MVCNotSupported()
+{
+    I965TestEnvironment *env(I965TestEnvironment::instance());
+    EXPECT_PTR(env);
+
+    struct i965_driver_data *i965(*env);
+    EXPECT_PTR(i965);
+
+    if (!HAS_H264_MVC_ENCODING(i965))
+        return ProfileNotSupported();
+
+    return EntrypointNotSupported();
+}
 VAStatus HasDecodeSupport()
 {
     I965TestEnvironment *env(I965TestEnvironment::instance());
@@ -35,11 +75,13 @@ VAStatus HasDecodeSupport()
     struct i965_driver_data *i965(*env);
     EXPECT_PTR(i965);
 
-    return HAS_H264_DECODING(i965) ? VA_STATUS_SUCCESS :
-        VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
+    if (HAS_H264_DECODING(i965))
+        return VA_STATUS_SUCCESS;
+
+    return H264NotSupported();
 }
 
-VAStatus HasMVCDecodeSupport(const VAProfile& profile)
+VAStatus HasMVCDecodeSupport()
 {
     I965TestEnvironment *env(I965TestEnvironment::instance());
     EXPECT_PTR(env);
@@ -47,22 +89,23 @@ VAStatus HasMVCDecodeSupport(const VAProfile& profile)
     struct i965_driver_data *i965(*env);
     EXPECT_PTR(i965);
 
-    return HAS_H264_MVC_DECODING_PROFILE(i965, profile) ? VA_STATUS_SUCCESS :
-        VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
+    if (HAS_H264_MVC_DECODING(i965))
+        return VA_STATUS_SUCCESS;
+
+    return H264MVCNotSupported();
 }
 
 static const std::vector<ConfigTestInput> inputs = {
-    {VAProfileH264Baseline, VAEntrypointVLD,
-        []{return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;}},
+    { VAProfileH264Baseline, VAEntrypointVLD, &ProfileNotSupported },
 
-    {VAProfileH264ConstrainedBaseline, VAEntrypointVLD, &HasDecodeSupport},
-    {VAProfileH264Main, VAEntrypointVLD, &HasDecodeSupport},
-    {VAProfileH264High, VAEntrypointVLD, &HasDecodeSupport},
+    { VAProfileH264ConstrainedBaseline, VAEntrypointVLD, &HasDecodeSupport },
+    { VAProfileH264Main, VAEntrypointVLD, &HasDecodeSupport },
+    { VAProfileH264High, VAEntrypointVLD, &HasDecodeSupport },
 
-    {VAProfileH264MultiviewHigh, VAEntrypointVLD,
-        std::bind(&HasMVCDecodeSupport, VAProfileH264MultiviewHigh)},
-    {VAProfileH264StereoHigh, VAEntrypointVLD,
-        std::bind(&HasMVCDecodeSupport, VAProfileH264StereoHigh)},
+    { VAProfileH264MultiviewHigh, VAEntrypointVLD,
+      &HasMVCDecodeSupport },
+    { VAProfileH264StereoHigh, VAEntrypointVLD,
+      &HasMVCDecodeSupport },
 };
 
 INSTANTIATE_TEST_CASE_P(
index b30abbc..4830af9 100644 (file)
@@ -37,6 +37,52 @@ VAStatus EntrypointNotSupported()
     return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
 }
 
+//H264*NotSupported functions report properly if profile is not supported or
+//only entrypoint is not supported
+VAStatus H264NotSupported()
+{
+    I965TestEnvironment *env(I965TestEnvironment::instance());
+    EXPECT_PTR(env);
+
+    struct i965_driver_data *i965(*env);
+    EXPECT_PTR(i965);
+
+    if (!HAS_H264_DECODING(i965)
+        && !HAS_LP_H264_ENCODING(i965))
+        return ProfileNotSupported();
+
+    return EntrypointNotSupported();
+}
+
+VAStatus H264LPNotSupported()
+{
+    I965TestEnvironment *env(I965TestEnvironment::instance());
+    EXPECT_PTR(env);
+
+    struct i965_driver_data *i965(*env);
+    EXPECT_PTR(i965);
+
+    if (!HAS_H264_DECODING(i965)
+        && !HAS_H264_ENCODING(i965))
+        return ProfileNotSupported();
+
+    return EntrypointNotSupported();
+}
+
+VAStatus H264MVCNotSupported()
+{
+    I965TestEnvironment *env(I965TestEnvironment::instance());
+    EXPECT_PTR(env);
+
+    struct i965_driver_data *i965(*env);
+    EXPECT_PTR(i965);
+
+    if (!HAS_H264_MVC_DECODING(i965))
+        return ProfileNotSupported();
+
+    return EntrypointNotSupported();
+}
+
 VAStatus HasEncodeSupport()
 {
     I965TestEnvironment *env(I965TestEnvironment::instance());
@@ -45,8 +91,10 @@ VAStatus HasEncodeSupport()
     struct i965_driver_data *i965(*env);
     EXPECT_PTR(i965);
 
-    return HAS_H264_ENCODING(i965) ? VA_STATUS_SUCCESS :
-        EntrypointNotSupported();
+    if (HAS_H264_ENCODING(i965))
+        return VA_STATUS_SUCCESS;
+
+    return H264NotSupported();
 }
 
 VAStatus HasLPEncodeSupport()
@@ -60,8 +108,10 @@ VAStatus HasLPEncodeSupport()
     if (IS_SKL(i965->intel.device_info))
         return VA_STATUS_SUCCESS;
 
-    return HAS_LP_H264_ENCODING(i965) ? VA_STATUS_SUCCESS :
-        EntrypointNotSupported();
+    if (HAS_LP_H264_ENCODING(i965))
+        return VA_STATUS_SUCCESS;
+
+    return H264LPNotSupported();
 }
 
 VAStatus HasMVCEncodeSupport()
@@ -72,8 +122,10 @@ VAStatus HasMVCEncodeSupport()
     struct i965_driver_data *i965(*env);
     EXPECT_PTR(i965);
 
-    return HAS_H264_MVC_ENCODING(i965) ? VA_STATUS_SUCCESS :
-        EntrypointNotSupported();
+    if (HAS_H264_MVC_ENCODING(i965))
+        return VA_STATUS_SUCCESS;
+
+    return H264MVCNotSupported();
 }
 
 static const std::vector<ConfigTestInput> inputs = {
@@ -83,23 +135,23 @@ static const std::vector<ConfigTestInput> inputs = {
 
     {VAProfileH264ConstrainedBaseline, VAEntrypointEncSlice, &HasEncodeSupport},
     {VAProfileH264ConstrainedBaseline, VAEntrypointEncSliceLP, &HasLPEncodeSupport},
-    {VAProfileH264ConstrainedBaseline, VAEntrypointEncPicture, &EntrypointNotSupported},
+    {VAProfileH264ConstrainedBaseline, VAEntrypointEncPicture, &H264NotSupported},
 
     {VAProfileH264Main, VAEntrypointEncSlice, &HasEncodeSupport},
     {VAProfileH264Main, VAEntrypointEncSliceLP, &HasLPEncodeSupport},
-    {VAProfileH264Main, VAEntrypointEncPicture, &EntrypointNotSupported},
+    {VAProfileH264Main, VAEntrypointEncPicture, &H264NotSupported},
 
     {VAProfileH264High, VAEntrypointEncSlice, &HasEncodeSupport},
     {VAProfileH264High, VAEntrypointEncSliceLP, &HasLPEncodeSupport},
-    {VAProfileH264High, VAEntrypointEncPicture, &EntrypointNotSupported},
+    {VAProfileH264High, VAEntrypointEncPicture, &H264NotSupported},
 
     {VAProfileH264MultiviewHigh, VAEntrypointEncSlice, &HasMVCEncodeSupport},
-    {VAProfileH264MultiviewHigh, VAEntrypointEncSliceLP, &EntrypointNotSupported},
-    {VAProfileH264MultiviewHigh, VAEntrypointEncPicture, &EntrypointNotSupported},
+    {VAProfileH264MultiviewHigh, VAEntrypointEncSliceLP, &H264MVCNotSupported},
+    {VAProfileH264MultiviewHigh, VAEntrypointEncPicture, &H264MVCNotSupported},
 
     {VAProfileH264StereoHigh, VAEntrypointEncSlice, &HasMVCEncodeSupport},
-    {VAProfileH264StereoHigh, VAEntrypointEncSliceLP, &EntrypointNotSupported},
-    {VAProfileH264StereoHigh, VAEntrypointEncPicture, &EntrypointNotSupported},
+    {VAProfileH264StereoHigh, VAEntrypointEncSliceLP, &H264MVCNotSupported},
+    {VAProfileH264StereoHigh, VAEntrypointEncPicture, &H264MVCNotSupported},
 };
 
 INSTANTIATE_TEST_CASE_P(
index 4e2216c..371b827 100644 (file)
 
 namespace JPEG {
 namespace Decode {
+VAStatus ProfileNotSupported()
+{
+    return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
+}
+
+VAStatus EntrypointNotSupported()
+{
+    return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
+}
+
+VAStatus NotSupported()
+{
+    I965TestEnvironment *env(I965TestEnvironment::instance());
+    EXPECT_PTR(env);
+
+    struct i965_driver_data *i965(*env);
+    EXPECT_PTR(i965);
+
+    if (!HAS_JPEG_ENCODING(i965))
+        return ProfileNotSupported();
+
+    return EntrypointNotSupported();
+}
 
 VAStatus HasDecodeSupport()
 {
@@ -35,8 +58,10 @@ VAStatus HasDecodeSupport()
     struct i965_driver_data *i965(*env);
     EXPECT_PTR(i965);
 
-    return HAS_JPEG_DECODING(i965) ? VA_STATUS_SUCCESS :
-        VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
+    if(HAS_JPEG_DECODING(i965))
+        return VA_STATUS_SUCCESS;
+
+    return NotSupported();
 }
 
 static const std::vector<ConfigTestInput> inputs = {
index 924eccb..eb5931d 100644 (file)
 namespace JPEG {
 namespace Encode {
 
+VAStatus ProfileNotSupported()
+{
+    return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
+}
+
 VAStatus EntrypointNotSupported()
 {
     return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
 }
 
+VAStatus NotSupported()
+{
+    I965TestEnvironment *env(I965TestEnvironment::instance());
+    EXPECT_PTR(env);
+
+    struct i965_driver_data *i965(*env);
+    EXPECT_PTR(i965);
+
+    if (!HAS_JPEG_DECODING(i965))
+        return ProfileNotSupported();
+
+    return EntrypointNotSupported();
+}
+
 VAStatus HasEncodeSupport()
 {
     I965TestEnvironment *env(I965TestEnvironment::instance());
@@ -40,14 +59,16 @@ VAStatus HasEncodeSupport()
     struct i965_driver_data *i965(*env);
     EXPECT_PTR(i965);
 
-    return HAS_JPEG_ENCODING(i965) ? VA_STATUS_SUCCESS :
-        EntrypointNotSupported();
+    if (HAS_JPEG_ENCODING(i965))
+        return VA_STATUS_SUCCESS;
+
+    return NotSupported();
 }
 
 static const std::vector<ConfigTestInput> inputs = {
     {VAProfileJPEGBaseline, VAEntrypointEncPicture, &HasEncodeSupport},
-    {VAProfileJPEGBaseline, VAEntrypointEncSlice, &EntrypointNotSupported},
-    {VAProfileJPEGBaseline, VAEntrypointEncSliceLP, &EntrypointNotSupported},
+    {VAProfileJPEGBaseline, VAEntrypointEncSlice, &NotSupported},
+    {VAProfileJPEGBaseline, VAEntrypointEncSliceLP, &NotSupported},
 };
 
 INSTANTIATE_TEST_CASE_P(