diff options
author | U. Artie Eoff <ullysses.a.eoff@intel.com> | 2016-10-05 10:54:26 -0700 |
---|---|---|
committer | Sean V Kelley <seanvk@posteo.de> | 2016-10-06 14:02:50 -0700 |
commit | 91caa8167d5b6b16ee8c58bd238f8a4773a4707a (patch) | |
tree | 2135604121a958d62c7f643e7dcf3d55b4475a75 /test | |
parent | d36e351ef5d073f24aca0e0fb6dd3171d9b1914c (diff) |
test: add avce/avcd create config tests
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@intel.com>
Reviewed-by: Sean V Kelley <seanvk@posteo.de>
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 4 | ||||
-rw-r--r-- | test/i965_avcd_config_test.cpp | 72 | ||||
-rw-r--r-- | test/i965_avce_config_test.cpp | 109 | ||||
-rw-r--r-- | test/i965_config_test.cpp | 63 | ||||
-rw-r--r-- | test/i965_config_test.h | 56 |
5 files changed, 304 insertions, 0 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 6448ad5..07189e5 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 0000000..851e86e --- /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 0000000..b30abbc --- /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 0000000..3370bc5 --- /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 0000000..79cb960 --- /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 |