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)
72 VAConfigID id = VA_INVALID_ID;
75 *this, profile, entrypoint,
76 const_cast<VAConfigAttrib*>(attribs.data()), attribs.size(), &id));
82 void I965TestFixture::destroyConfig(VAConfigID id)
84 EXPECT_STATUS(i965_DestroyConfig(*this, id));
87 VAContextID I965TestFixture::createContext(
88 VAConfigID config, int w, int h, int flags, const Surfaces& targets)
90 VAContextID id = VA_INVALID_ID;
93 *this, config, w, h, flags,
94 const_cast<VASurfaceID*>(targets.data()), targets.size(), &id));
100 void I965TestFixture::destroyContext(VAContextID id)
102 EXPECT_STATUS(i965_DestroyContext(*this, id));
105 VABufferID I965TestFixture::createBuffer(
106 VAContextID context, VABufferType type,
107 unsigned size, unsigned num, const void *data)
111 i965_CreateBuffer(*this, context, type, size, num, (void*)data, &id));
117 void I965TestFixture::beginPicture(VAContextID context, VASurfaceID target)
120 i965_BeginPicture(*this, context, target));
123 void I965TestFixture::renderPicture(
124 VAContextID context, VABufferID *bufs, int num_bufs)
127 i965_RenderPicture(*this, context, bufs, num_bufs));
130 void I965TestFixture::endPicture(VAContextID context)
133 i965_EndPicture(*this, context));
136 void I965TestFixture::destroyBuffer(VABufferID id)
139 i965_DestroyBuffer(*this, id));
142 void I965TestFixture::deriveImage(VASurfaceID surface, VAImage &image)
145 i965_DeriveImage(*this, surface, &image));
148 void I965TestFixture::destroyImage(VAImage &image)
151 i965_DestroyImage(*this, image.image_id));
154 void I965TestFixture::syncSurface(VASurfaceID surface)
157 i965_SyncSurface(*this, surface));