mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
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:
committed by
Compute-Runtime-Automation
parent
c1ab4aa3e0
commit
c94b6581c2
@@ -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;
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user