summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorU. Artie Eoff <ullysses.a.eoff@intel.com>2016-09-26 13:11:44 -0700
committerSean V Kelley <seanvk@posteo.de>2016-09-28 12:55:19 -0700
commitf4adf3fe4d9bfa2fc8675abf73f6e3ad28881b7c (patch)
treeeafe4eac32ea5953a948c34d9d0f5e5ff5d00704 /test
parent55050bdfb168ec17db081bfa57ddedfd3e8ed222 (diff)
test: add wrapper for CreateSurfaces2
Add support for calling i965_CreateSurfaces2 so that we can pass VASurfaceAttributes. This is needed to set a particular surface pixel format in some tests. We must call i965_CreateSurfaces2 via the vtable since it is a static function within the i965_drv_video.c file... thus hidden. Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Diffstat (limited to 'test')
-rw-r--r--test/i965_test_fixture.cpp20
-rw-r--r--test/i965_test_fixture.h10
2 files changed, 23 insertions, 7 deletions
diff --git a/test/i965_test_fixture.cpp b/test/i965_test_fixture.cpp
index d7f30c2..dd81430 100644
--- a/test/i965_test_fixture.cpp
+++ b/test/i965_test_fixture.cpp
@@ -97,12 +97,24 @@ I965TestFixture::operator VADisplay()
return m_vaDisplay;
}
-Surfaces I965TestFixture::createSurfaces(int w, int h, int format, size_t count)
+Surfaces I965TestFixture::createSurfaces(int w, int h, int format, size_t count,
+ const SurfaceAttribs& attributes)
{
Surfaces surfaces(count, VA_INVALID_ID);
- EXPECT_STATUS(
- i965_CreateSurfaces(
- *this, w, h, format, surfaces.size(), surfaces.data()));
+ if (attributes.empty()) {
+ EXPECT_STATUS(
+ i965_CreateSurfaces(
+ *this, w, h, format, surfaces.size(), surfaces.data()));
+ } else {
+ VADriverContextP ctx(*this);
+ EXPECT_PTR(ctx);
+ if (ctx)
+ EXPECT_STATUS(
+ ctx->vtable->vaCreateSurfaces2(
+ *this, format, w, h, surfaces.data(), surfaces.size(),
+ const_cast<VASurfaceAttrib*>(attributes.data()),
+ attributes.size()));
+ }
for (size_t i(0); i < count; ++i) {
EXPECT_ID(surfaces[i]);
diff --git a/test/i965_test_fixture.h b/test/i965_test_fixture.h
index 511c791..5915852 100644
--- a/test/i965_test_fixture.h
+++ b/test/i965_test_fixture.h
@@ -32,6 +32,7 @@
#include <vector>
typedef std::vector<VASurfaceID> Surfaces;
+typedef std::vector<VASurfaceAttrib> SurfaceAttribs;
typedef std::vector<VAConfigAttrib> ConfigAttribs;
/**
@@ -99,10 +100,13 @@ public:
void terminate();
/**
- * Convenience wrapper for i965_CreateSurfaces. May generate a non-fatal
- * test assertion failure.
+ * Convenience wrapper for i965_CreateSurfaces or i965_CreateSurfaces2.
+ * If SurfaceAttribs are specified then i965_CreateSurfaces2 is used,
+ * otherwise i965_CreateSurfaces is used. May generate a non-fatal test
+ * assertion failure.
*/
- Surfaces createSurfaces(int w, int h, int format, size_t count = 1);
+ Surfaces createSurfaces(int w, int h, int format, size_t count = 1,
+ const SurfaceAttribs& = SurfaceAttribs());
/**
* Convenience wrapper for i965_DestroySurfaces. May generate a non-fatal