mirror of https://github.com/intel/libva-utils.git
test/fixture: remove legacy config and surface methods
These fixture methods have been replaced with consolidated and more flexible methods and are no longer used. Also, remove associated legacy member variables. Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
This commit is contained in:
parent
258f28b122
commit
3185565776
|
@ -48,12 +48,7 @@ VAAPIFixture::VAAPIFixture()
|
|||
, m_contextID(VA_INVALID_ID)
|
||||
, m_bufferID(VA_INVALID_ID)
|
||||
{
|
||||
m_profileList.clear();
|
||||
m_entrypointList.clear();
|
||||
m_configAttribList.clear();
|
||||
m_configAttribToCreateConfig.clear();
|
||||
m_querySurfaceAttribList.clear();
|
||||
m_surfaceID.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
VAAPIFixture::~VAAPIFixture()
|
||||
|
@ -282,91 +277,6 @@ void VAAPIFixture::destroyConfig(const VAStatus& expectation)
|
|||
m_configID = VA_INVALID_ID;
|
||||
}
|
||||
|
||||
void VAAPIFixture::doFillConfigAttribList()
|
||||
{
|
||||
m_configAttribList.clear();
|
||||
// fill it with all the VAConfigAttribs known
|
||||
for (auto& it : g_vaConfigAttribTypes) {
|
||||
VAConfigAttrib configAttrib;
|
||||
|
||||
configAttrib.type = it;
|
||||
|
||||
m_configAttribList.push_back(configAttrib);
|
||||
}
|
||||
|
||||
EXPECT_EQ(m_configAttribList.size(), g_vaConfigAttribTypes.size());
|
||||
}
|
||||
|
||||
void VAAPIFixture::doGetConfigAttributes(const VAProfile& profile,
|
||||
const VAEntrypoint& entrypoint)
|
||||
{
|
||||
int numAttributes = m_configAttribList.size();
|
||||
ASSERT_STATUS(vaGetConfigAttributes(m_vaDisplay, profile, entrypoint,
|
||||
&m_configAttribList[0], numAttributes));
|
||||
}
|
||||
|
||||
void VAAPIFixture::doGetConfigAttributes(const VAProfile& profile,
|
||||
const VAEntrypoint& entrypoint, ConfigAttributes& configAttrib)
|
||||
{
|
||||
int numAttributes = configAttrib.size();
|
||||
ASSERT_STATUS(vaGetConfigAttributes(m_vaDisplay, profile, entrypoint,
|
||||
&configAttrib[0], numAttributes));
|
||||
}
|
||||
|
||||
const ConfigAttributes& VAAPIFixture::getConfigAttribList() const
|
||||
{
|
||||
return m_configAttribList;
|
||||
}
|
||||
|
||||
const ConfigAttributes& VAAPIFixture::getQueryConfigAttribList() const
|
||||
{
|
||||
return m_queryConfigAttribList;
|
||||
}
|
||||
|
||||
void VAAPIFixture::doCheckAttribsMatch(
|
||||
const ConfigAttributes& configAttrib) const
|
||||
{
|
||||
auto itOne = m_queryConfigAttribList.begin();
|
||||
auto itTwo = configAttrib.begin();
|
||||
auto diff = 0;
|
||||
|
||||
EXPECT_EQ(configAttrib.size(), m_queryConfigAttribList.size());
|
||||
|
||||
while (itOne != m_queryConfigAttribList.end()
|
||||
&& itTwo != configAttrib.end()) {
|
||||
if (itOne->value != itTwo->value || itOne->type != itTwo->type) {
|
||||
diff++;
|
||||
}
|
||||
itOne++;
|
||||
itTwo++;
|
||||
}
|
||||
|
||||
EXPECT_TRUE(diff == 0);
|
||||
}
|
||||
|
||||
void VAAPIFixture::doCreateConfigWithAttrib(const VAProfile& profile,
|
||||
const VAEntrypoint& entrypoint)
|
||||
{
|
||||
m_configAttribToCreateConfig.clear();
|
||||
for (auto& it : m_configAttribList) {
|
||||
if (it.value != VA_ATTRIB_NOT_SUPPORTED)
|
||||
m_configAttribToCreateConfig.push_back(it);
|
||||
}
|
||||
|
||||
ASSERT_STATUS(vaCreateConfig(
|
||||
m_vaDisplay, profile, entrypoint, &m_configAttribToCreateConfig[0],
|
||||
m_configAttribToCreateConfig.size(), &m_configID));
|
||||
|
||||
EXPECT_ID(m_configID);
|
||||
|
||||
doQueryConfigAttributes(profile, entrypoint);
|
||||
}
|
||||
|
||||
void VAAPIFixture::doDestroyConfig()
|
||||
{
|
||||
ASSERT_STATUS(vaDestroyConfig(m_vaDisplay, m_configID));
|
||||
}
|
||||
|
||||
void VAAPIFixture::querySurfaceAttributes(SurfaceAttributes& attribs) const
|
||||
{
|
||||
ASSERT_TRUE(attribs.empty())
|
||||
|
@ -496,230 +406,6 @@ void VAAPIFixture::destroySurfaces(Surfaces& surfaces) const
|
|||
}
|
||||
}
|
||||
|
||||
void VAAPIFixture::doQuerySurfacesWithConfigAttribs(const VAProfile& profile,
|
||||
const VAEntrypoint& entrypoint)
|
||||
{
|
||||
uint32_t queryNumSurfaceAttribs;
|
||||
|
||||
doCreateConfigWithAttrib(profile, entrypoint);
|
||||
|
||||
ASSERT_STATUS(vaQuerySurfaceAttributes(m_vaDisplay, m_configID,
|
||||
NULL,
|
||||
&queryNumSurfaceAttribs));
|
||||
EXPECT_TRUE(queryNumSurfaceAttribs > 0);
|
||||
m_querySurfaceAttribList.resize(queryNumSurfaceAttribs);
|
||||
|
||||
ASSERT_STATUS(vaQuerySurfaceAttributes(m_vaDisplay, m_configID,
|
||||
&m_querySurfaceAttribList[0],
|
||||
&queryNumSurfaceAttribs));
|
||||
|
||||
EXPECT_TRUE(queryNumSurfaceAttribs > 0);
|
||||
EXPECT_TRUE(queryNumSurfaceAttribs <= m_querySurfaceAttribList.size());
|
||||
m_querySurfaceAttribList.resize(queryNumSurfaceAttribs);
|
||||
|
||||
for (auto& it : m_querySurfaceAttribList) {
|
||||
|
||||
unsigned int flags
|
||||
= 0 | VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
|
||||
|
||||
EXPECT_NE(it.flags & flags,
|
||||
(unsigned int)VA_SURFACE_ATTRIB_NOT_SUPPORTED);
|
||||
EXPECT_TRUE((it.value.type >= VAGenericValueTypeInteger)
|
||||
&& it.value.type <= VAGenericValueTypeFunc);
|
||||
}
|
||||
}
|
||||
|
||||
inline bool isSurfaceAttribInList(const VASurfaceAttrib& surfaceAttrib,
|
||||
const VASurfaceAttribType& surfaceAttribType)
|
||||
{
|
||||
return surfaceAttrib.type == surfaceAttribType;
|
||||
}
|
||||
|
||||
void VAAPIFixture::doGetMaxSurfaceResolution(const VAProfile& profile,
|
||||
const VAEntrypoint& entrypoint, Resolution& maxResolution)
|
||||
{
|
||||
SurfaceAttributes::iterator it;
|
||||
doQuerySurfacesNoConfigAttribs(profile, entrypoint);
|
||||
it = std::find_if(m_querySurfaceAttribList.begin(),
|
||||
m_querySurfaceAttribList.end(),
|
||||
std::bind(isSurfaceAttribInList, std::placeholders::_1,
|
||||
VASurfaceAttribMaxWidth));
|
||||
|
||||
if (it != m_querySurfaceAttribList.end()) {
|
||||
EXPECT_EQ(it->value.type, VAGenericValueTypeInteger);
|
||||
ASSERT_LE(
|
||||
it->value.type, std::numeric_limits<Resolution::DataType>::max());
|
||||
maxResolution.width = it->value.value.i;
|
||||
} else {
|
||||
maxResolution.width = std::numeric_limits<Resolution::DataType>::max();
|
||||
}
|
||||
|
||||
it = std::find_if(m_querySurfaceAttribList.begin(),
|
||||
m_querySurfaceAttribList.end(),
|
||||
std::bind(isSurfaceAttribInList, std::placeholders::_1,
|
||||
VASurfaceAttribMaxHeight));
|
||||
|
||||
if (it != m_querySurfaceAttribList.end()) {
|
||||
EXPECT_EQ(it->value.type, VAGenericValueTypeInteger);
|
||||
ASSERT_LE(
|
||||
it->value.type, std::numeric_limits<Resolution::DataType>::max());
|
||||
maxResolution.height = it->value.value.i;
|
||||
} else {
|
||||
maxResolution.height = std::numeric_limits<Resolution::DataType>::max();
|
||||
}
|
||||
}
|
||||
|
||||
void VAAPIFixture::doGetMinSurfaceResolution(const VAProfile& profile,
|
||||
const VAEntrypoint& entrypoint, Resolution& minResolution)
|
||||
{
|
||||
SurfaceAttributes::iterator it;
|
||||
doQuerySurfacesNoConfigAttribs(profile, entrypoint);
|
||||
it = std::find_if(m_querySurfaceAttribList.begin(),
|
||||
m_querySurfaceAttribList.end(),
|
||||
std::bind(isSurfaceAttribInList, std::placeholders::_1,
|
||||
VASurfaceAttribMinWidth));
|
||||
|
||||
if (it != m_querySurfaceAttribList.end()) {
|
||||
EXPECT_EQ(it->value.type, VAGenericValueTypeInteger);
|
||||
ASSERT_GE(it->value.type, 1);
|
||||
minResolution.width = it->value.value.i;
|
||||
} else {
|
||||
minResolution.width = 1;
|
||||
}
|
||||
|
||||
it = std::find_if(m_querySurfaceAttribList.begin(),
|
||||
m_querySurfaceAttribList.end(),
|
||||
std::bind(isSurfaceAttribInList, std::placeholders::_1,
|
||||
VASurfaceAttribMinHeight));
|
||||
|
||||
if (it != m_querySurfaceAttribList.end()) {
|
||||
EXPECT_EQ(it->value.type, VAGenericValueTypeInteger);
|
||||
ASSERT_GE(it->value.type, 1);
|
||||
minResolution.height = it->value.value.i;
|
||||
} else {
|
||||
minResolution.height = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void VAAPIFixture::doCreateConfigNoAttrib(const VAProfile& profile,
|
||||
const VAEntrypoint& entrypoint)
|
||||
{
|
||||
|
||||
ASSERT_STATUS(
|
||||
vaCreateConfig(m_vaDisplay, profile, entrypoint, NULL, 0, &m_configID));
|
||||
|
||||
EXPECT_ID(m_configID);
|
||||
|
||||
doQueryConfigAttributes(profile, entrypoint);
|
||||
}
|
||||
|
||||
void VAAPIFixture::doQueryConfigAttributes(const VAProfile& profile,
|
||||
const VAEntrypoint& entrypoint, const VAStatus& expectation)
|
||||
{
|
||||
VAProfile queryProfile;
|
||||
VAEntrypoint queryEntrypoint;
|
||||
int queryNumConfigAttribs;
|
||||
|
||||
m_queryConfigAttribList.resize(m_maxConfigAttributes); // va-api requirement
|
||||
|
||||
ASSERT_STATUS_EQ(expectation,
|
||||
vaQueryConfigAttributes(m_vaDisplay, m_configID,
|
||||
&queryProfile, &queryEntrypoint,
|
||||
&m_queryConfigAttribList[0],
|
||||
&queryNumConfigAttribs));
|
||||
|
||||
if (expectation == VA_STATUS_SUCCESS) {
|
||||
m_queryConfigAttribList.resize(queryNumConfigAttribs);
|
||||
EXPECT_EQ(queryProfile, profile);
|
||||
EXPECT_EQ(queryEntrypoint, entrypoint);
|
||||
EXPECT_TRUE(queryNumConfigAttribs > 0);
|
||||
|
||||
m_queryConfigAttribList.resize(queryNumConfigAttribs);
|
||||
|
||||
// reported Config Attributes should be supported
|
||||
for (auto& it : m_queryConfigAttribList) {
|
||||
EXPECT_NE(it.value, VA_ATTRIB_NOT_SUPPORTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VAAPIFixture::doQuerySurfacesNoConfigAttribs(const VAProfile& profile,
|
||||
const VAEntrypoint& entrypoint)
|
||||
{
|
||||
uint32_t queryNumSurfaceAttribs;
|
||||
|
||||
doCreateConfigNoAttrib(profile, entrypoint);
|
||||
|
||||
ASSERT_STATUS(vaQuerySurfaceAttributes(m_vaDisplay, m_configID,
|
||||
NULL,
|
||||
&queryNumSurfaceAttribs));
|
||||
EXPECT_TRUE(queryNumSurfaceAttribs > 0);
|
||||
m_querySurfaceAttribList.resize(queryNumSurfaceAttribs);
|
||||
|
||||
ASSERT_STATUS(vaQuerySurfaceAttributes(m_vaDisplay, m_configID,
|
||||
&m_querySurfaceAttribList[0],
|
||||
&queryNumSurfaceAttribs));
|
||||
|
||||
EXPECT_TRUE(queryNumSurfaceAttribs > 0);
|
||||
EXPECT_TRUE(queryNumSurfaceAttribs <= m_querySurfaceAttribList.size());
|
||||
m_querySurfaceAttribList.resize(queryNumSurfaceAttribs);
|
||||
|
||||
for (auto& it : m_querySurfaceAttribList) {
|
||||
|
||||
unsigned int flags
|
||||
= 0 | VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
|
||||
|
||||
EXPECT_NE(it.flags & flags,
|
||||
(unsigned int)VA_SURFACE_ATTRIB_NOT_SUPPORTED);
|
||||
EXPECT_TRUE((it.value.type >= VAGenericValueTypeInteger)
|
||||
&& it.value.type <= VAGenericValueTypeFunc);
|
||||
}
|
||||
}
|
||||
|
||||
inline bool isConfigAttribInList(const VAConfigAttrib& configAttrib,
|
||||
const VAConfigAttribType& type)
|
||||
{
|
||||
return configAttrib.type == type;
|
||||
}
|
||||
|
||||
void VAAPIFixture::doCreateSurfaces(const VAProfile& profile,
|
||||
const VAEntrypoint& entrypoint, const Resolution& resolution)
|
||||
{
|
||||
VASurfaceAttrib* attribList = NULL;
|
||||
uint32_t numAttribs = 0;
|
||||
// when ConfigAttribs were not queried just do YUV420 as it is considered
|
||||
// the universal supported format by the driver. RT formats depend on
|
||||
// profile and entrypoint.
|
||||
unsigned int formats = VA_RT_FORMAT_YUV420;
|
||||
|
||||
m_surfaceID.resize(10);
|
||||
|
||||
if (!m_querySurfaceAttribList.empty()) {
|
||||
numAttribs = m_querySurfaceAttribList.size();
|
||||
attribList = &m_querySurfaceAttribList[0];
|
||||
}
|
||||
|
||||
if (!m_queryConfigAttribList.empty()) {
|
||||
ConfigAttributes::iterator it = std::find_if(
|
||||
m_queryConfigAttribList.begin(), m_queryConfigAttribList.end(),
|
||||
std::bind(isConfigAttribInList, std::placeholders::_1,
|
||||
VAConfigAttribRTFormat));
|
||||
formats = it->value;
|
||||
}
|
||||
|
||||
for (auto& itFormat : g_vaRTFormats) {
|
||||
unsigned int currentFormat = formats & itFormat;
|
||||
|
||||
if (currentFormat) {
|
||||
|
||||
ASSERT_STATUS(vaCreateSurfaces(
|
||||
m_vaDisplay, currentFormat, resolution.width, resolution.height,
|
||||
&m_surfaceID[0], 10, attribList, numAttribs));
|
||||
formats &= ~itFormat;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VAAPIFixture::doCreateContext(const Resolution& resolution,
|
||||
const VAStatus& expectation)
|
||||
{
|
||||
|
@ -727,8 +413,7 @@ void VAAPIFixture::doCreateContext(const Resolution& resolution,
|
|||
ASSERT_STATUS_EQ(expectation,
|
||||
vaCreateContext(m_vaDisplay, m_configID, resolution.width,
|
||||
resolution.height, VA_PROGRESSIVE,
|
||||
&m_surfaceID[0], m_surfaceID.size(),
|
||||
&m_contextID));
|
||||
NULL, 0, &m_contextID));
|
||||
}
|
||||
|
||||
void VAAPIFixture::doDestroyContext(const VAStatus& expectation)
|
||||
|
@ -747,41 +432,6 @@ void VAAPIFixture::doDestroyBuffer()
|
|||
ASSERT_STATUS(vaDestroyBuffer(m_vaDisplay, m_bufferID));
|
||||
}
|
||||
|
||||
void VAAPIFixture::doCreateConfig(const VAProfile& profile,
|
||||
const VAEntrypoint& entrypoint)
|
||||
{
|
||||
m_configID = VA_INVALID_ID;
|
||||
ASSERT_STATUS(
|
||||
vaCreateConfig(m_vaDisplay, profile, entrypoint, NULL, 0, &m_configID));
|
||||
EXPECT_ID(m_configID);
|
||||
}
|
||||
|
||||
void VAAPIFixture::doCreateConfigToFail(const VAProfile& profile,
|
||||
const VAEntrypoint& entrypoint, int error)
|
||||
{
|
||||
VAStatus vaStatus = VA_STATUS_SUCCESS;
|
||||
|
||||
m_configID = VA_INVALID_ID;
|
||||
|
||||
vaStatus = vaCreateConfig(m_vaDisplay, profile, entrypoint, NULL, 0,
|
||||
&m_configID);
|
||||
ASSERT_STATUS_EQ(error, vaStatus);
|
||||
|
||||
if (VA_STATUS_SUCCESS == error) {
|
||||
EXPECT_ID(m_configID);
|
||||
} else {
|
||||
EXPECT_INVALID_ID(m_configID);
|
||||
}
|
||||
|
||||
m_queryConfigAttribList.resize(m_maxConfigAttributes); // va-api requirement
|
||||
|
||||
doQueryConfigAttributes(profile, entrypoint,
|
||||
VA_STATUS_ERROR_INVALID_CONFIG);
|
||||
|
||||
ASSERT_STATUS_EQ(VA_STATUS_ERROR_INVALID_CONFIG,
|
||||
vaDestroyConfig(m_vaDisplay, m_configID));
|
||||
}
|
||||
|
||||
void VAAPIFixture::doTerminate()
|
||||
{
|
||||
EXPECT_STATUS(vaTerminate(m_vaDisplay));
|
||||
|
|
|
@ -54,34 +54,11 @@ public:
|
|||
const Entrypoints& getSupportedEntrypointList() const;
|
||||
bool doFindEntrypointInList(const VAEntrypoint&) const;
|
||||
|
||||
void doFillConfigAttribList();
|
||||
void doGetConfigAttributes(const VAProfile&, const VAEntrypoint&);
|
||||
void doGetConfigAttributes(const VAProfile&, const VAEntrypoint&,
|
||||
ConfigAttributes& configAttrib);
|
||||
const ConfigAttributes& getConfigAttribList() const;
|
||||
const ConfigAttributes& getQueryConfigAttribList() const;
|
||||
void doCheckAttribsMatch(const ConfigAttributes&) const;
|
||||
void doCreateConfigWithAttrib(const VAProfile&, const VAEntrypoint&);
|
||||
void doQueryConfigAttributes(const VAProfile&, const VAEntrypoint&,
|
||||
const VAStatus& expectation = VA_STATUS_SUCCESS);
|
||||
void doQuerySurfacesWithConfigAttribs(const VAProfile&,
|
||||
const VAEntrypoint&);
|
||||
void doQuerySurfacesNoConfigAttribs(const VAProfile&, const VAEntrypoint&);
|
||||
void doCreateSurfaces(const VAProfile&, const VAEntrypoint&,
|
||||
const Resolution&);
|
||||
void doGetMaxSurfaceResolution(const VAProfile&, const VAEntrypoint&,
|
||||
Resolution&);
|
||||
void doGetMinSurfaceResolution(const VAProfile&, const VAEntrypoint&,
|
||||
Resolution&);
|
||||
void doCreateContext(const Resolution&,
|
||||
const VAStatus& expectation = VA_STATUS_SUCCESS);
|
||||
void doDestroyContext(const VAStatus& expectation = VA_STATUS_SUCCESS);
|
||||
void doCreateBuffer(const VABufferType&);
|
||||
void doDestroyBuffer();
|
||||
void doCreateConfigNoAttrib(const VAProfile&, const VAEntrypoint&);
|
||||
void doCreateConfig(const VAProfile&, const VAEntrypoint&);
|
||||
void doCreateConfigToFail(const VAProfile&, const VAEntrypoint&, int error);
|
||||
void doDestroyConfig();
|
||||
|
||||
void doLogSkipTest(const VAProfile&, const VAEntrypoint&) const;
|
||||
|
||||
|
@ -140,13 +117,8 @@ private:
|
|||
|
||||
Profiles m_profileList;
|
||||
Entrypoints m_entrypointList;
|
||||
ConfigAttributes m_configAttribList;
|
||||
ConfigAttributes m_configAttribToCreateConfig;
|
||||
ConfigAttributes m_queryConfigAttribList;
|
||||
SurfaceAttributes m_querySurfaceAttribList;
|
||||
Surfaces m_surfaceID;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace VAAPI
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue