mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 08:53:55 +08:00
Create a wrapper for drm_i915_gem_set_domain
Related-To: NEO-6852 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
c47c6b9d94
commit
d5771d2e93
@@ -1075,10 +1075,10 @@ bool DrmMemoryManager::setDomainCpu(GraphicsAllocation &graphicsAllocation, bool
|
||||
return false;
|
||||
|
||||
// move a buffer object to the CPU read, and possibly write domain, including waiting on flushes to occur
|
||||
drm_i915_gem_set_domain setDomain = {};
|
||||
GemSetDomain setDomain = {};
|
||||
setDomain.handle = bo->peekHandle();
|
||||
setDomain.read_domains = I915_GEM_DOMAIN_CPU;
|
||||
setDomain.write_domain = writeEnable ? I915_GEM_DOMAIN_CPU : 0;
|
||||
setDomain.readDomains = I915_GEM_DOMAIN_CPU;
|
||||
setDomain.writeDomain = writeEnable ? I915_GEM_DOMAIN_CPU : 0;
|
||||
|
||||
return getDrm(graphicsAllocation.getRootDeviceIndex()).ioctl(DRM_IOCTL_I915_GEM_SET_DOMAIN, &setDomain) == 0;
|
||||
}
|
||||
|
||||
@@ -92,4 +92,10 @@ static_assert(offsetof(GemMmap, offset) == offsetof(drm_i915_gem_mmap, offset));
|
||||
static_assert(offsetof(GemMmap, size) == offsetof(drm_i915_gem_mmap, size));
|
||||
static_assert(offsetof(GemMmap, addrPtr) == offsetof(drm_i915_gem_mmap, addr_ptr));
|
||||
static_assert(offsetof(GemMmap, flags) == offsetof(drm_i915_gem_mmap, flags));
|
||||
|
||||
static_assert(sizeof(GemSetDomain) == sizeof(drm_i915_gem_set_domain));
|
||||
static_assert(offsetof(GemSetDomain, handle) == offsetof(drm_i915_gem_set_domain, handle));
|
||||
static_assert(offsetof(GemSetDomain, readDomains) == offsetof(drm_i915_gem_set_domain, read_domains));
|
||||
static_assert(offsetof(GemSetDomain, writeDomain) == offsetof(drm_i915_gem_set_domain, write_domain));
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -104,4 +104,10 @@ struct GemMmap {
|
||||
uint64_t addrPtr;
|
||||
uint64_t flags;
|
||||
};
|
||||
|
||||
struct GemSetDomain {
|
||||
uint32_t handle;
|
||||
uint32_t readDomains;
|
||||
uint32_t writeDomain;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -132,10 +132,10 @@ int DrmMockCustom::ioctl(unsigned long request, void *arg) {
|
||||
ioctl_cnt.gemMmap++;
|
||||
} break;
|
||||
case DRM_IOCTL_I915_GEM_SET_DOMAIN: {
|
||||
auto setDomainParams = (drm_i915_gem_set_domain *)arg;
|
||||
auto setDomainParams = static_cast<NEO::GemSetDomain *>(arg);
|
||||
setDomainHandle = setDomainParams->handle;
|
||||
setDomainReadDomains = setDomainParams->read_domains;
|
||||
setDomainWriteDomain = setDomainParams->write_domain;
|
||||
setDomainReadDomains = setDomainParams->readDomains;
|
||||
setDomainWriteDomain = setDomainParams->writeDomain;
|
||||
ioctl_cnt.gemSetDomain++;
|
||||
} break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user