| 1 |
/* |
| 2 |
* Copyright (C) 2018-2023 Intel Corporation |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: MIT |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
#include "shared/test/common/helpers/debug_manager_state_restore.h" |
| 9 |
|
| 10 |
#include "opencl/source/sharings/va/cl_va_api.h" |
| 11 |
#include "opencl/test/unit_test/api/cl_api_tests.h" |
| 12 |
|
| 13 |
using namespace NEO; |
| 14 |
|
| 15 |
using ClGetExtensionFunctionAddressTests = ApiTests; |
| 16 |
|
| 17 |
namespace ULT { |
| 18 |
|
| 19 |
TEST_F(ClGetExtensionFunctionAddressTests, GivenClCreateFromVaMediaSurfaceIntelWhenGettingFunctionAddressThenCorrectPointerReturned) { |
| 20 |
auto retVal = clGetExtensionFunctionAddress("clCreateFromVA_APIMediaSurfaceINTEL"); |
| 21 |
EXPECT_EQ(retVal, reinterpret_cast<void *>(clCreateFromVA_APIMediaSurfaceINTEL)); |
| 22 |
} |
| 23 |
|
| 24 |
TEST_F(ClGetExtensionFunctionAddressTests, GivenClEnqueueAcquireVaApiMediaSurfacesIntelWhenGettingFunctionAddressThenCorrectPointerReturned) { |
| 25 |
auto retVal = clGetExtensionFunctionAddress("clEnqueueAcquireVA_APIMediaSurfacesINTEL"); |
| 26 |
EXPECT_EQ(retVal, reinterpret_cast<void *>(clEnqueueAcquireVA_APIMediaSurfacesINTEL)); |
| 27 |
} |
| 28 |
|
| 29 |
TEST_F(ClGetExtensionFunctionAddressTests, GivenClEnqueueReleaseVaApiMediaSurfacesIntelWhenGettingFunctionAddressThenCorrectPointerReturned) { |
| 30 |
auto retVal = clGetExtensionFunctionAddress("clEnqueueReleaseVA_APIMediaSurfacesINTEL"); |
| 31 |
EXPECT_EQ(retVal, reinterpret_cast<void *>(clEnqueueReleaseVA_APIMediaSurfacesINTEL)); |
| 32 |
} |
| 33 |
|
| 34 |
TEST_F(ClGetExtensionFunctionAddressTests, GivenClGetDeviceIDsFromVaApiMediaAdapterIntelWhenGettingFunctionAddressThenCorrectPointerReturned) { |
| 35 |
auto retVal = clGetExtensionFunctionAddress("clGetDeviceIDsFromVA_APIMediaAdapterINTEL"); |
| 36 |
EXPECT_EQ(retVal, reinterpret_cast<void *>(clGetDeviceIDsFromVA_APIMediaAdapterINTEL)); |
| 37 |
} |
| 38 |
|
| 39 |
TEST_F(ClGetExtensionFunctionAddressTests, givenEnabledFormatQueryWhenGettingFuncionAddressThenCorrectAddressIsReturned) { |
| 40 |
DebugManagerStateRestore restorer; |
| 41 |
debugManager.flags.EnableFormatQuery.set(true); |
| 42 |
|
| 43 |
auto retVal = clGetExtensionFunctionAddress("clGetSupportedVA_APIMediaSurfaceFormatsINTEL"); |
| 44 |
EXPECT_EQ(retVal, reinterpret_cast<void *>(clGetSupportedVA_APIMediaSurfaceFormatsINTEL)); |
| 45 |
} |
| 46 |
|
| 47 |
TEST_F(ClGetExtensionFunctionAddressTests, givenDisabledFormatQueryWhenGettingFuncionAddressThenNullptrIsReturned) { |
| 48 |
DebugManagerStateRestore restorer; |
| 49 |
debugManager.flags.EnableFormatQuery.set(false); |
| 50 |
|
| 51 |
auto retVal = clGetExtensionFunctionAddress("clGetSupportedVA_APIMediaSurfaceFormatsINTEL"); |
| 52 |
EXPECT_EQ(retVal, nullptr); |
| 53 |
} |
| 54 |
} // namespace ULT |