Debian Codegraph @

opencl/test/unit_test/sharings/va/va_base_object_tests.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 2018-2025 Intel Corporation
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 */
7
8 #include "opencl/source/sharings/sharing_factory.h"
9 #include "opencl/test/unit_test/mocks/mock_command_queue.h"
10 #include "opencl/test/unit_test/mocks/mock_platform.h"
11
12 #include "gtest/gtest.h"
13
14 namespace NEO {
15
16 template <typename TypeParam>
17 struct VABaseObjectTests : public ::testing::Test {
18 void SetUp() override {
19 }
20
21 void TearDown() override {
22 }
23 };
24
25 typedef ::testing::Types<
26 MockPlatform,
27 MockCommandQueue>
28 BaseObjectTypes;
29
30 TYPED_TEST_SUITE(VABaseObjectTests, BaseObjectTypes);
31
32 TYPED_TEST(VABaseObjectTests, GivenCommonRuntimeThenDispatchTableAtFirstPointerInObject) {
33 TypeParam objectDrv;
34
35 // Automatic downcasting to _cl_type *.
36 typename TypeParam::BaseType *objectCL = &objectDrv;
37 sharingFactory.fillGlobalDispatchTable();
38
39 // Common runtime casts to generic type assuming
40 // the dispatch table is the first ptr in the structure
41 auto genericObject = reinterpret_cast<ClDispatch *>(objectCL);
42 EXPECT_EQ(reinterpret_cast<void *>(clCreateFromVA_APIMediaSurfaceINTEL),
43 genericObject->dispatch.crtDispatch->clCreateFromVA_APIMediaSurfaceINTEL);
44
45 EXPECT_EQ(reinterpret_cast<void *>(clEnqueueAcquireVA_APIMediaSurfacesINTEL),
46 genericObject->dispatch.crtDispatch->clEnqueueAcquireVA_APIMediaSurfacesINTEL);
47
48 EXPECT_EQ(reinterpret_cast<void *>(clEnqueueReleaseVA_APIMediaSurfacesINTEL),
49 genericObject->dispatch.crtDispatch->clEnqueueReleaseVA_APIMediaSurfacesINTEL);
50
51 EXPECT_EQ(reinterpret_cast<void *>(clGetDeviceIDsFromVA_APIMediaAdapterINTEL),
52 genericObject->dispatch.crtDispatch->clGetDeviceIDsFromVA_APIMediaAdapterINTEL);
53 }
54 } // namespace NEO