mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Move set domain cpu logic to ioctl helper
Related-To: NEO-6999 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
b49e2237c5
commit
3d1c990e37
@@ -1043,15 +1043,9 @@ bool DrmMemoryManager::setDomainCpu(GraphicsAllocation &graphicsAllocation, bool
|
||||
if (bo == nullptr)
|
||||
return false;
|
||||
|
||||
// move a buffer object to the CPU read, and possibly write domain, including waiting on flushes to occur
|
||||
GemSetDomain setDomain = {};
|
||||
setDomain.handle = bo->peekHandle();
|
||||
setDomain.readDomains = I915_GEM_DOMAIN_CPU;
|
||||
setDomain.writeDomain = writeEnable ? I915_GEM_DOMAIN_CPU : 0;
|
||||
|
||||
auto &drm = this->getDrm(graphicsAllocation.getRootDeviceIndex());
|
||||
auto ioctlHelper = drm.getIoctlHelper();
|
||||
return ioctlHelper->ioctl(DrmIoctl::GemSetDomain, &setDomain) == 0;
|
||||
return ioctlHelper->setDomainCpu(bo->peekHandle(), writeEnable);
|
||||
}
|
||||
|
||||
void *DrmMemoryManager::lockResourceImpl(GraphicsAllocation &graphicsAllocation) {
|
||||
|
||||
@@ -133,6 +133,14 @@ std::vector<MemoryRegion> IoctlHelper::translateToMemoryRegions(const std::vecto
|
||||
return memRegions;
|
||||
}
|
||||
|
||||
bool IoctlHelper::setDomainCpu(uint32_t handle, bool writeEnable) {
|
||||
drm_i915_gem_set_domain setDomain{};
|
||||
setDomain.handle = handle;
|
||||
setDomain.read_domains = I915_GEM_DOMAIN_CPU;
|
||||
setDomain.write_domain = writeEnable ? I915_GEM_DOMAIN_CPU : 0;
|
||||
return this->ioctl(DrmIoctl::GemSetDomain, &setDomain) == 0u;
|
||||
}
|
||||
|
||||
unsigned int IoctlHelper::getIoctlRequestValueBase(DrmIoctl ioctlRequest) const {
|
||||
switch (ioctlRequest) {
|
||||
case DrmIoctl::Getparam:
|
||||
|
||||
@@ -124,6 +124,7 @@ class IoctlHelper {
|
||||
void logExecBuffer(const ExecBuffer &execBuffer, std::stringstream &logger);
|
||||
int getDrmParamValueBase(DrmParam drmParam) const;
|
||||
unsigned int getIoctlRequestValueBase(DrmIoctl ioctlRequest) const;
|
||||
bool setDomainCpu(uint32_t handle, bool writeEnable);
|
||||
|
||||
std::string getDrmParamStringBase(DrmParam param) const;
|
||||
std::string getIoctlStringBase(DrmIoctl ioctlRequest) const;
|
||||
|
||||
Reference in New Issue
Block a user