[Libva] [PATCH intel-driver v2 3/7] test: add wrapper for CreateSurfaces2

U. Artie Eoff ullysses.a.eoff at intel.com
Mon Sep 26 20:11:44 UTC 2016


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 at intel.com>
---
 test/i965_test_fixture.cpp | 20 ++++++++++++++++----
 test/i965_test_fixture.h   | 10 +++++++---
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/test/i965_test_fixture.cpp b/test/i965_test_fixture.cpp
index d7f30c2ed4f3..dd8143031fe9 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 511c791fe9be..5915852c0f4b 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
-- 
2.4.11



More information about the Libva mailing list