2 * Copyright (C) 2016 Intel Corporation. All Rights Reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sub license, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 #include "i965_test_fixture.h"
27 const std::string I965TestFixture::getFullTestName() const
29 const ::testing::TestInfo * const info =
30 ::testing::UnitTest::GetInstance()->current_test_info();
31 return std::string(info->test_case_name())
33 + std::string(info->name());
36 Surfaces I965TestFixture::createSurfaces(int w, int h, int format, size_t count,
37 const SurfaceAttribs& attributes)
39 Surfaces surfaces(count, VA_INVALID_ID);
40 if (attributes.empty()) {
43 *this, w, h, format, surfaces.size(), surfaces.data()));
45 VADriverContextP ctx(*this);
49 ctx->vtable->vaCreateSurfaces2(
50 *this, format, w, h, surfaces.data(), surfaces.size(),
51 const_cast<VASurfaceAttrib*>(attributes.data()),
56 for (size_t i(0); i < count; ++i) {
57 EXPECT_ID(surfaces[i]);
63 void I965TestFixture::destroySurfaces(Surfaces& surfaces)
66 i965_DestroySurfaces(*this, surfaces.data(), surfaces.size()));
69 VAConfigID I965TestFixture::createConfig(
70 VAProfile profile, VAEntrypoint entrypoint, const ConfigAttribs& attribs,
71 const VAStatus expect)
73 VAConfigID id = VA_INVALID_ID;
77 *this, profile, entrypoint,
78 const_cast<VAConfigAttrib*>(attribs.data()), attribs.size(), &id));
79 if (expect == VA_STATUS_SUCCESS) {
82 EXPECT_INVALID_ID(id);
87 void I965TestFixture::destroyConfig(VAConfigID id)
89 EXPECT_STATUS(i965_DestroyConfig(*this, id));
92 VAContextID I965TestFixture::createContext(
93 VAConfigID config, int w, int h, int flags, const Surfaces& targets)
95 VAContextID id = VA_INVALID_ID;
98 *this, config, w, h, flags,
99 const_cast<VASurfaceID*>(targets.data()), targets.size(), &id));
105 void I965TestFixture::destroyContext(VAContextID id)
107 EXPECT_STATUS(i965_DestroyContext(*this, id));
110 VABufferID I965TestFixture::createBuffer(
111 VAContextID context, VABufferType type,
112 unsigned size, unsigned num, const void *data)
116 i965_CreateBuffer(*this, context, type, size, num, (void*)data, &id));
122 void I965TestFixture::beginPicture(VAContextID context, VASurfaceID target)
125 i965_BeginPicture(*this, context, target));
128 void I965TestFixture::renderPicture(
129 VAContextID context, VABufferID *bufs, int num_bufs)
132 i965_RenderPicture(*this, context, bufs, num_bufs));
135 void I965TestFixture::endPicture(VAContextID context)
138 i965_EndPicture(*this, context));
141 void I965TestFixture::destroyBuffer(VABufferID id)
144 i965_DestroyBuffer(*this, id));
147 void I965TestFixture::deriveImage(VASurfaceID surface, VAImage &image)
150 i965_DeriveImage(*this, surface, &image));
153 void I965TestFixture::destroyImage(VAImage &image)
156 i965_DestroyImage(*this, image.image_id));
159 void I965TestFixture::syncSurface(VASurfaceID surface)
162 i965_SyncSurface(*this, surface));