Make drm memory manager independent on drm headers

Related-To: NEO-6999
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2022-07-26 18:11:27 +00:00
committed by Compute-Runtime-Automation
parent c1ab4aa3e0
commit c94b6581c2
3 changed files with 11 additions and 6 deletions

View File

@@ -28,7 +28,6 @@
#include "shared/source/os_interface/linux/allocator_helper.h"
#include "shared/source/os_interface/linux/drm_memory_operations_handler.h"
#include "shared/source/os_interface/linux/drm_wrappers.h"
#include "shared/source/os_interface/linux/i915.h"
#include "shared/source/os_interface/linux/os_context_linux.h"
#include "shared/source/os_interface/os_interface.h"
@@ -1077,13 +1076,13 @@ void DrmMemoryManager::unlockResourceImpl(GraphicsAllocation &graphicsAllocation
}
int DrmMemoryManager::obtainFdFromHandle(int boHandle, uint32_t rootDeviceIndex) {
PrimeHandle openFd{};
openFd.flags = DRM_CLOEXEC | DRM_RDWR;
openFd.handle = boHandle;
auto &drm = this->getDrm(rootDeviceIndex);
auto ioctlHelper = drm.getIoctlHelper();
PrimeHandle openFd{};
openFd.flags = ioctlHelper->getFlagsForPrimeHandleToFd();
openFd.handle = boHandle;
ioctlHelper->ioctl(DrmIoctl::PrimeHandleToFd, &openFd);
return openFd.fileDescriptor;

View File

@@ -141,6 +141,10 @@ bool IoctlHelper::setDomainCpu(uint32_t handle, bool writeEnable) {
return this->ioctl(DrmIoctl::GemSetDomain, &setDomain) == 0u;
}
uint32_t IoctlHelper::getFlagsForPrimeHandleToFd() const {
return DRM_CLOEXEC | DRM_RDWR;
}
unsigned int IoctlHelper::getIoctlRequestValueBase(DrmIoctl ioctlRequest) const {
switch (ioctlRequest) {
case DrmIoctl::Getparam:

View File

@@ -129,6 +129,8 @@ class IoctlHelper {
std::string getDrmParamStringBase(DrmParam param) const;
std::string getIoctlStringBase(DrmIoctl ioctlRequest) const;
uint32_t getFlagsForPrimeHandleToFd() const;
protected:
Drm &drm;
};