[Libva] [PATCH intel-driver 3/4] test: add avce/avcd create config tests

U. Artie Eoff ullysses.a.eoff at intel.com
Wed Oct 5 17:54:26 UTC 2016


Add a common I965ConfigTest parameterized test fixture with
a i965_CreateConfig test case and add the AVC encode/decode
create config test instantiations with associated profile
and entrypoint inputs.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff at intel.com>
---
 test/Makefile.am               |   4 ++
 test/i965_avcd_config_test.cpp |  72 +++++++++++++++++++++++++++
 test/i965_avce_config_test.cpp | 109 +++++++++++++++++++++++++++++++++++++++++
 test/i965_config_test.cpp      |  63 ++++++++++++++++++++++++
 test/i965_config_test.h        |  56 +++++++++++++++++++++
 5 files changed, 304 insertions(+)
 create mode 100644 test/i965_avcd_config_test.cpp
 create mode 100644 test/i965_avce_config_test.cpp
 create mode 100644 test/i965_config_test.cpp
 create mode 100644 test/i965_config_test.h

diff --git a/test/Makefile.am b/test/Makefile.am
index 6448ad5b78b8..07189e56e6cb 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -44,6 +44,7 @@ EXTRA_DIST =								\
 # test_i965_drv_video
 noinst_PROGRAMS = test_i965_drv_video
 noinst_HEADERS =							\
+	i965_config_test.h						\
 	i965_internal_decl.h						\
 	i965_jpeg_test_data.h						\
 	i965_test_environment.h						\
@@ -53,7 +54,10 @@ noinst_HEADERS =							\
 	$(NULL)
 
 test_i965_drv_video_SOURCES =						\
+	i965_avcd_config_test.cpp					\
+	i965_avce_config_test.cpp					\
 	i965_chipset_test.cpp						\
+	i965_config_test.cpp						\
 	i965_initialize_test.cpp					\
 	i965_jpeg_test_data.cpp						\
 	i965_jpeg_decode_test.cpp					\
diff --git a/test/i965_avcd_config_test.cpp b/test/i965_avcd_config_test.cpp
new file mode 100644
index 000000000000..851e86e890dd
--- /dev/null
+++ b/test/i965_avcd_config_test.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2016 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "i965_config_test.h"
+
+namespace AVC {
+namespace Decode {
+
+VAStatus HasDecodeSupport()
+{
+    I965TestEnvironment *env(I965TestEnvironment::instance());
+    EXPECT_PTR(env);
+
+    struct i965_driver_data *i965(*env);
+    EXPECT_PTR(i965);
+
+    return HAS_H264_DECODING(i965) ? VA_STATUS_SUCCESS :
+        VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
+}
+
+VAStatus HasMVCDecodeSupport(const VAProfile& profile)
+{
+    I965TestEnvironment *env(I965TestEnvironment::instance());
+    EXPECT_PTR(env);
+
+    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;
+}
+
+static const std::vector<ConfigTestInput> inputs = {
+    {VAProfileH264Baseline, VAEntrypointVLD,
+        []{return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;}},
+
+    {VAProfileH264ConstrainedBaseline, VAEntrypointVLD, &HasDecodeSupport},
+    {VAProfileH264Main, VAEntrypointVLD, &HasDecodeSupport},
+    {VAProfileH264High, VAEntrypointVLD, &HasDecodeSupport},
+
+    {VAProfileH264MultiviewHigh, VAEntrypointVLD,
+        std::bind(&HasMVCDecodeSupport, VAProfileH264MultiviewHigh)},
+    {VAProfileH264StereoHigh, VAEntrypointVLD,
+        std::bind(&HasMVCDecodeSupport, VAProfileH264StereoHigh)},
+};
+
+INSTANTIATE_TEST_CASE_P(
+    AVCDecode, I965ConfigTest, ::testing::ValuesIn(inputs));
+
+} // namespace Decode
+} // namespace AVC
diff --git a/test/i965_avce_config_test.cpp b/test/i965_avce_config_test.cpp
new file mode 100644
index 000000000000..b30abbc3d4aa
--- /dev/null
+++ b/test/i965_avce_config_test.cpp
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2016 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "i965_config_test.h"
+
+namespace AVC {
+namespace Encode {
+
+VAStatus ProfileNotSupported()
+{
+    return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
+}
+
+VAStatus EntrypointNotSupported()
+{
+    return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
+}
+
+VAStatus HasEncodeSupport()
+{
+    I965TestEnvironment *env(I965TestEnvironment::instance());
+    EXPECT_PTR(env);
+
+    struct i965_driver_data *i965(*env);
+    EXPECT_PTR(i965);
+
+    return HAS_H264_ENCODING(i965) ? VA_STATUS_SUCCESS :
+        EntrypointNotSupported();
+}
+
+VAStatus HasLPEncodeSupport()
+{
+    I965TestEnvironment *env(I965TestEnvironment::instance());
+    EXPECT_PTR(env);
+
+    struct i965_driver_data *i965(*env);
+    EXPECT_PTR(i965);
+
+    if (IS_SKL(i965->intel.device_info))
+        return VA_STATUS_SUCCESS;
+
+    return HAS_LP_H264_ENCODING(i965) ? VA_STATUS_SUCCESS :
+        EntrypointNotSupported();
+}
+
+VAStatus HasMVCEncodeSupport()
+{
+    I965TestEnvironment *env(I965TestEnvironment::instance());
+    EXPECT_PTR(env);
+
+    struct i965_driver_data *i965(*env);
+    EXPECT_PTR(i965);
+
+    return HAS_H264_MVC_ENCODING(i965) ? VA_STATUS_SUCCESS :
+        EntrypointNotSupported();
+}
+
+static const std::vector<ConfigTestInput> inputs = {
+    {VAProfileH264Baseline, VAEntrypointEncSlice, &ProfileNotSupported},
+    {VAProfileH264Baseline, VAEntrypointEncSliceLP, &ProfileNotSupported},
+    {VAProfileH264Baseline, VAEntrypointEncPicture, &ProfileNotSupported},
+
+    {VAProfileH264ConstrainedBaseline, VAEntrypointEncSlice, &HasEncodeSupport},
+    {VAProfileH264ConstrainedBaseline, VAEntrypointEncSliceLP, &HasLPEncodeSupport},
+    {VAProfileH264ConstrainedBaseline, VAEntrypointEncPicture, &EntrypointNotSupported},
+
+    {VAProfileH264Main, VAEntrypointEncSlice, &HasEncodeSupport},
+    {VAProfileH264Main, VAEntrypointEncSliceLP, &HasLPEncodeSupport},
+    {VAProfileH264Main, VAEntrypointEncPicture, &EntrypointNotSupported},
+
+    {VAProfileH264High, VAEntrypointEncSlice, &HasEncodeSupport},
+    {VAProfileH264High, VAEntrypointEncSliceLP, &HasLPEncodeSupport},
+    {VAProfileH264High, VAEntrypointEncPicture, &EntrypointNotSupported},
+
+    {VAProfileH264MultiviewHigh, VAEntrypointEncSlice, &HasMVCEncodeSupport},
+    {VAProfileH264MultiviewHigh, VAEntrypointEncSliceLP, &EntrypointNotSupported},
+    {VAProfileH264MultiviewHigh, VAEntrypointEncPicture, &EntrypointNotSupported},
+
+    {VAProfileH264StereoHigh, VAEntrypointEncSlice, &HasMVCEncodeSupport},
+    {VAProfileH264StereoHigh, VAEntrypointEncSliceLP, &EntrypointNotSupported},
+    {VAProfileH264StereoHigh, VAEntrypointEncPicture, &EntrypointNotSupported},
+};
+
+INSTANTIATE_TEST_CASE_P(
+    AVCEncode, I965ConfigTest, ::testing::ValuesIn(inputs));
+
+} // namespace Encode
+} // namespace AVC
diff --git a/test/i965_config_test.cpp b/test/i965_config_test.cpp
new file mode 100644
index 000000000000..3370bc588452
--- /dev/null
+++ b/test/i965_config_test.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2016 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "i965_config_test.h"
+#include "i965_streamable.h"
+
+std::ostream& operator<<(std::ostream& os, const ConfigTestInput& input)
+{
+    return os << input.profile << " : " << input.entrypoint;
+}
+
+I965ConfigTest::I965ConfigTest()
+    : I965TestFixture()
+    , config(VA_INVALID_ID) // invalid
+{
+    return;
+}
+
+void I965ConfigTest::TearDown()
+{
+    if (config != VA_INVALID_ID) {
+        destroyConfig(config);
+        config = VA_INVALID_ID;
+    }
+    I965TestFixture::TearDown();
+}
+
+TEST_P(I965ConfigTest, Create)
+{
+    const ConfigTestInput& input = GetParam();
+    const VAStatus expect = input.expect();
+
+    RecordProperty("expect_status", toString(VaapiStatus(expect)));
+
+    const VAStatus actual = i965_CreateConfig(
+        *this, input.profile, input.entrypoint, NULL, 0, &config);
+
+    EXPECT_STATUS_EQ(expect, actual);
+
+    if (actual != VA_STATUS_SUCCESS)
+        EXPECT_INVALID_ID(config);
+}
diff --git a/test/i965_config_test.h b/test/i965_config_test.h
new file mode 100644
index 000000000000..79cb9608c2da
--- /dev/null
+++ b/test/i965_config_test.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2016 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef I965_CONFIG_TEST
+#define I965_CONFIG_TEST
+
+#include "i965_test_fixture.h"
+
+#include <functional>
+#include <iostream>
+
+struct ConfigTestInput
+{
+    VAProfile profile;
+    VAEntrypoint entrypoint;
+    std::function<VAStatus (void)> expect;
+
+    friend std::ostream& operator<<(
+        std::ostream& os, const ConfigTestInput& input);
+};
+
+class I965ConfigTest
+    : public I965TestFixture
+    , public ::testing::WithParamInterface<ConfigTestInput>
+{
+public:
+    I965ConfigTest();
+
+protected:
+    virtual void TearDown();
+
+    VAConfigID config;
+};
+
+#endif
-- 
2.1.0



More information about the Libva mailing list