mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Use MemoryClassInstance instead of drm_i915_gem_memory_class_instance
Related-To: NEO-6852 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
4be1ca618d
commit
ea956a863a
@@ -276,16 +276,16 @@ bool DrmAllocation::setMemAdvise(Drm *drm, MemAdviseFlags flags) {
|
||||
}
|
||||
|
||||
if (flags.device_preferred_location != enabledMemAdviseFlags.device_preferred_location) {
|
||||
drm_i915_gem_memory_class_instance region{};
|
||||
MemoryClassInstance region{};
|
||||
for (auto handleId = 0u; handleId < EngineLimits::maxHandleCount; handleId++) {
|
||||
auto bo = bufferObjects[handleId];
|
||||
if (bo != nullptr) {
|
||||
if (flags.device_preferred_location) {
|
||||
region.memory_class = I915_MEMORY_CLASS_DEVICE;
|
||||
region.memory_instance = handleId;
|
||||
region.memoryClass = I915_MEMORY_CLASS_DEVICE;
|
||||
region.memoryInstance = handleId;
|
||||
} else {
|
||||
region.memory_class = -1;
|
||||
region.memory_instance = 0;
|
||||
region.memoryClass = -1;
|
||||
region.memoryInstance = 0;
|
||||
}
|
||||
success &= ioctlHelper->setVmBoAdvise(drm, bo->peekHandle(), ioctlHelper->getPreferredLocationAdvise(), ®ion);
|
||||
}
|
||||
|
||||
@@ -74,4 +74,8 @@ static_assert(offsetof(QueryTopologyInfo, euOffset) == offsetof(drm_i915_query_t
|
||||
static_assert(offsetof(QueryTopologyInfo, euStride) == offsetof(drm_i915_query_topology_info, eu_stride));
|
||||
static_assert(offsetof(QueryTopologyInfo, data) == offsetof(drm_i915_query_topology_info, data));
|
||||
|
||||
static_assert(sizeof(MemoryClassInstance) == sizeof(drm_i915_gem_memory_class_instance));
|
||||
static_assert(offsetof(MemoryClassInstance, memoryClass) == offsetof(drm_i915_gem_memory_class_instance, memory_class));
|
||||
static_assert(offsetof(MemoryClassInstance, memoryInstance) == offsetof(drm_i915_gem_memory_class_instance, memory_instance));
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -83,4 +83,9 @@ struct QueryTopologyInfo {
|
||||
uint8_t data[];
|
||||
};
|
||||
|
||||
struct MemoryClassInstance {
|
||||
uint16_t memoryClass;
|
||||
uint16_t memoryInstance;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -28,11 +28,6 @@ struct HardwareInfo;
|
||||
|
||||
extern IoctlHelper *ioctlHelperFactory[IGFX_MAX_PRODUCT];
|
||||
|
||||
struct MemoryClassInstance {
|
||||
uint16_t memoryClass;
|
||||
uint16_t memoryInstance;
|
||||
};
|
||||
|
||||
struct MemoryRegion {
|
||||
MemoryClassInstance region;
|
||||
uint64_t probedSize;
|
||||
|
||||
@@ -556,4 +556,8 @@ bool IoctlHelperPrelim20::isDebugAttachAvailable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static_assert(sizeof(MemoryClassInstance) == sizeof(prelim_drm_i915_gem_memory_class_instance));
|
||||
static_assert(offsetof(MemoryClassInstance, memoryClass) == offsetof(prelim_drm_i915_gem_memory_class_instance, memory_class));
|
||||
static_assert(offsetof(MemoryClassInstance, memoryInstance) == offsetof(prelim_drm_i915_gem_memory_class_instance, memory_instance));
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -156,7 +156,7 @@ int DrmMockPrelimContext::handlePrelimRequest(unsigned long request, void *arg)
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
auto data = reinterpret_cast<prelim_drm_i915_gem_memory_class_instance *>(extension->param.data);
|
||||
auto data = reinterpret_cast<MemoryClassInstance *>(extension->param.data);
|
||||
if (!data) {
|
||||
return EINVAL;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ int DrmMockPrelimContext::handlePrelimRequest(unsigned long request, void *arg)
|
||||
|
||||
receivedCreateGemExt->memoryRegions.clear();
|
||||
for (uint32_t i = 0; i < extension->param.size; i++) {
|
||||
receivedCreateGemExt->memoryRegions.push_back({data[i].memory_class, data[i].memory_instance});
|
||||
receivedCreateGemExt->memoryRegions.push_back({data[i].memoryClass, data[i].memoryInstance});
|
||||
}
|
||||
|
||||
const auto firstMemoryRegion = receivedCreateGemExt->memoryRegions[0];
|
||||
|
||||
@@ -247,6 +247,6 @@ HWTEST2_F(MemoryInfoTest, givenMemoryInfoWithRegionsWhenCreatingGemExtWithSingle
|
||||
EXPECT_EQ(1u, handle);
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(1u, drm->ioctlCallsCount);
|
||||
EXPECT_EQ(I915_MEMORY_CLASS_DEVICE, drm->memRegions.memory_class);
|
||||
EXPECT_EQ(I915_MEMORY_CLASS_DEVICE, drm->memRegions.memoryClass);
|
||||
EXPECT_EQ(1024u, drm->createExt.size);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class DrmTipMock : public DrmMock {
|
||||
|
||||
//DRM_IOCTL_I915_GEM_CREATE_EXT
|
||||
drm_i915_gem_create_ext createExt{};
|
||||
drm_i915_gem_memory_class_instance memRegions{};
|
||||
MemoryClassInstance memRegions{};
|
||||
uint32_t numRegions = 0;
|
||||
int gemCreateExtRetVal = 0;
|
||||
|
||||
@@ -106,11 +106,11 @@ class DrmTipMock : public DrmMock {
|
||||
return EINVAL;
|
||||
}
|
||||
this->numRegions = extMemRegions->num_regions;
|
||||
this->memRegions = *reinterpret_cast<drm_i915_gem_memory_class_instance *>(extMemRegions->regions);
|
||||
this->memRegions = *reinterpret_cast<MemoryClassInstance *>(extMemRegions->regions);
|
||||
if (this->numRegions == 0) {
|
||||
return EINVAL;
|
||||
}
|
||||
if ((this->memRegions.memory_class != I915_MEMORY_CLASS_SYSTEM) && (this->memRegions.memory_class != I915_MEMORY_CLASS_DEVICE)) {
|
||||
if ((this->memRegions.memoryClass != I915_MEMORY_CLASS_SYSTEM) && (this->memRegions.memoryClass != I915_MEMORY_CLASS_DEVICE)) {
|
||||
return EINVAL;
|
||||
}
|
||||
return gemCreateExtRetVal;
|
||||
|
||||
@@ -70,7 +70,7 @@ class DrmMockProdDg1 : public DrmTipMock {
|
||||
return EINVAL;
|
||||
}
|
||||
numRegions = regionParam->size;
|
||||
memRegions = *reinterpret_cast<drm_i915_gem_memory_class_instance *>(regionParam->data);
|
||||
memRegions = *reinterpret_cast<MemoryClassInstance *>(regionParam->data);
|
||||
return gemCreateExtRetVal;
|
||||
}
|
||||
return -1;
|
||||
|
||||
@@ -30,7 +30,7 @@ DG1TEST_F(IoctlHelperTestsDg1, givenDg1WhenCreateGemExtThenReturnCorrectValue) {
|
||||
EXPECT_EQ(1u, handle);
|
||||
EXPECT_EQ(1u, drm->numRegions);
|
||||
EXPECT_EQ(1024u, drm->createExt.size);
|
||||
EXPECT_EQ(I915_MEMORY_CLASS_DEVICE, drm->memRegions.memory_class);
|
||||
EXPECT_EQ(I915_MEMORY_CLASS_DEVICE, drm->memRegions.memoryClass);
|
||||
}
|
||||
|
||||
DG1TEST_F(IoctlHelperTestsDg1, givenDg1WithDrmTipWhenCreateGemExtWithDebugFlagThenPrintDebugInfo) {
|
||||
|
||||
@@ -96,7 +96,7 @@ TEST(IoctlHelperTestsUpstream, givenUpstreamWhenCreateGemExtThenReturnCorrectVal
|
||||
EXPECT_EQ(1u, handle);
|
||||
EXPECT_EQ(1u, drm->numRegions);
|
||||
EXPECT_EQ(1024u, drm->createExt.size);
|
||||
EXPECT_EQ(I915_MEMORY_CLASS_DEVICE, drm->memRegions.memory_class);
|
||||
EXPECT_EQ(I915_MEMORY_CLASS_DEVICE, drm->memRegions.memoryClass);
|
||||
}
|
||||
|
||||
TEST(IoctlHelperTestsUpstream, givenUpstreamWhenCreateGemExtWithDebugFlagThenPrintDebugInfo) {
|
||||
|
||||
@@ -35,12 +35,12 @@ int handlePrelimRequests(unsigned long request, void *arg, int ioctlRetVal, int
|
||||
(setparamRegion.param.param != (PRELIM_I915_OBJECT_PARAM | PRELIM_I915_PARAM_MEMORY_REGIONS))) {
|
||||
return EINVAL;
|
||||
}
|
||||
auto data = reinterpret_cast<prelim_drm_i915_gem_memory_class_instance *>(setparamRegion.param.data);
|
||||
auto data = reinterpret_cast<MemoryClassInstance *>(setparamRegion.param.data);
|
||||
if (data == nullptr) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if ((data->memory_class != PRELIM_I915_MEMORY_CLASS_SYSTEM) && (data->memory_class != PRELIM_I915_MEMORY_CLASS_DEVICE)) {
|
||||
if ((data->memoryClass != PRELIM_I915_MEMORY_CLASS_SYSTEM) && (data->memoryClass != PRELIM_I915_MEMORY_CLASS_DEVICE)) {
|
||||
return EINVAL;
|
||||
}
|
||||
} else if (request == PRELIM_DRM_IOCTL_I915_GEM_CLOS_RESERVE) {
|
||||
|
||||
Reference in New Issue
Block a user