mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Add new VADevice class to handle clGetDeviceIDsFromVA_APIMediaAdapterINTEL
Related-To: NEO-5110 Change-Id: I72ec529313579959926a77ee91eb23c7c3bcbdbe Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
0fd9800cc1
commit
beeaae0e26
@@ -6,6 +6,8 @@
|
||||
|
||||
set(RUNTIME_SRCS_SHARINGS_VA
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${BRANCH_DIR_SUFFIX}/va_device.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/va_device.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${BRANCH_DIR_SUFFIX}/va_extension.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cl_va_api.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cl_va_api.h
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "opencl/source/command_queue/command_queue.h"
|
||||
#include "opencl/source/context/context.h"
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/source/sharings/va/va_device.h"
|
||||
#include "opencl/source/sharings/va/va_sharing.h"
|
||||
#include "opencl/source/sharings/va/va_surface.h"
|
||||
|
||||
@@ -71,7 +72,8 @@ clGetDeviceIDsFromVA_APIMediaAdapterINTEL(cl_platform_id platform, cl_va_api_dev
|
||||
if (status != CL_SUCCESS) {
|
||||
status = CL_INVALID_PLATFORM;
|
||||
} else {
|
||||
cl_device_id device = pPlatform->getClDevice(0);
|
||||
VADevice vaDevice{};
|
||||
cl_device_id device = vaDevice.getDeviceFromVA(pPlatform, mediaAdapter);
|
||||
GetInfoHelper::set(devices, device);
|
||||
GetInfoHelper::set(numDevices, 1u);
|
||||
}
|
||||
|
||||
25
opencl/source/sharings/va/va_device.cpp
Normal file
25
opencl/source/sharings/va/va_device.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/source/sharings/va/va_device.h"
|
||||
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/source/platform/platform.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
VADevice::VADevice() {
|
||||
}
|
||||
|
||||
ClDevice *VADevice::getDeviceFromVA(Platform *pPlatform, VADisplay vaDisplay) {
|
||||
return pPlatform->getClDevice(0);
|
||||
}
|
||||
|
||||
VADevice::~VADevice() {
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
33
opencl/source/sharings/va/va_device.h
Normal file
33
opencl/source/sharings/va/va_device.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CL/cl_va_api_media_sharing_intel.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace NEO {
|
||||
class ClDevice;
|
||||
class Platform;
|
||||
|
||||
class VADevice {
|
||||
public:
|
||||
VADevice();
|
||||
virtual ~VADevice();
|
||||
|
||||
ClDevice *getDeviceFromVA(Platform *pPlatform, VADisplay vaDisplay);
|
||||
|
||||
static std::function<void *(const char *, int)> fdlopen;
|
||||
static std::function<void *(void *handle, const char *symbol)> fdlsym;
|
||||
static std::function<int(void *handle)> fdlclose;
|
||||
|
||||
protected:
|
||||
void *vaLibHandle = nullptr;
|
||||
void *vaGetDevice = nullptr;
|
||||
};
|
||||
} // namespace NEO
|
||||
@@ -14,6 +14,7 @@ set(IGDRCL_SRCS_tests_sharings_va
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel_va_image_arg_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_va_sharing.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/va_base_object_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/va_device_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/va_sharing_linux_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/va_sharing_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/va_sharing_factory_tests.cpp
|
||||
|
||||
25
opencl/test/unit_test/sharings/va/va_device_tests.cpp
Normal file
25
opencl/test/unit_test/sharings/va/va_device_tests.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/source/sharings/va/va_device.h"
|
||||
#include "opencl/test/unit_test/fixtures/platform_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using VaDeviceTests = Test<PlatformFixture>;
|
||||
|
||||
TEST_F(VaDeviceTests, givenVADeviceWhenGetDeviceFromVAIsCalledThenRootDeviceIsReturned) {
|
||||
VADisplay vaDisplay = nullptr;
|
||||
|
||||
VADevice vaDevice{};
|
||||
ClDevice *device = vaDevice.getDeviceFromVA(pPlatform, vaDisplay);
|
||||
|
||||
EXPECT_EQ(pPlatform->getClDevice(0), device);
|
||||
}
|
||||
Reference in New Issue
Block a user