intel: Add intel_memory_class_instance
This is a KMD independent struct to hold memory class and instance values. drm_i915_gem_memory_class_instance usage will be gradually replaced. Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20948>
This commit is contained in:

committed by
Marge Bot

parent
cc0b749890
commit
9fc224631c
@@ -2346,12 +2346,12 @@ static bool
|
||||
iris_bufmgr_get_meminfo(struct iris_bufmgr *bufmgr,
|
||||
struct intel_device_info *devinfo)
|
||||
{
|
||||
bufmgr->sys.region.memory_class = devinfo->mem.sram.mem_class;
|
||||
bufmgr->sys.region.memory_instance = devinfo->mem.sram.mem_instance;
|
||||
bufmgr->sys.region.memory_class = devinfo->mem.sram.mem.klass;
|
||||
bufmgr->sys.region.memory_instance = devinfo->mem.sram.mem.instance;
|
||||
bufmgr->sys.size = devinfo->mem.sram.mappable.size;
|
||||
|
||||
bufmgr->vram.region.memory_class = devinfo->mem.vram.mem_class;
|
||||
bufmgr->vram.region.memory_instance = devinfo->mem.vram.mem_instance;
|
||||
bufmgr->vram.region.memory_class = devinfo->mem.vram.mem.klass;
|
||||
bufmgr->vram.region.memory_instance = devinfo->mem.vram.mem.instance;
|
||||
bufmgr->vram.size = devinfo->mem.vram.mappable.size;
|
||||
|
||||
return true;
|
||||
|
@@ -338,12 +338,12 @@ intel_device_info_i915_query_regions(struct intel_device_info *devinfo, int fd,
|
||||
switch (mem->region.memory_class) {
|
||||
case I915_MEMORY_CLASS_SYSTEM: {
|
||||
if (!update) {
|
||||
devinfo->mem.sram.mem_class = mem->region.memory_class;
|
||||
devinfo->mem.sram.mem_instance = mem->region.memory_instance;
|
||||
devinfo->mem.sram.mem.klass = mem->region.memory_class;
|
||||
devinfo->mem.sram.mem.instance = mem->region.memory_instance;
|
||||
devinfo->mem.sram.mappable.size = mem->probed_size;
|
||||
} else {
|
||||
assert(devinfo->mem.sram.mem_class == mem->region.memory_class);
|
||||
assert(devinfo->mem.sram.mem_instance == mem->region.memory_instance);
|
||||
assert(devinfo->mem.sram.mem.klass == mem->region.memory_class);
|
||||
assert(devinfo->mem.sram.mem.instance == mem->region.memory_instance);
|
||||
assert(devinfo->mem.sram.mappable.size == mem->probed_size);
|
||||
}
|
||||
/* The kernel uAPI only reports an accurate unallocated_size value
|
||||
@@ -356,8 +356,8 @@ intel_device_info_i915_query_regions(struct intel_device_info *devinfo, int fd,
|
||||
}
|
||||
case I915_MEMORY_CLASS_DEVICE:
|
||||
if (!update) {
|
||||
devinfo->mem.vram.mem_class = mem->region.memory_class;
|
||||
devinfo->mem.vram.mem_instance = mem->region.memory_instance;
|
||||
devinfo->mem.vram.mem.klass = mem->region.memory_class;
|
||||
devinfo->mem.vram.mem.instance = mem->region.memory_instance;
|
||||
if (mem->probed_cpu_visible_size > 0) {
|
||||
devinfo->mem.vram.mappable.size = mem->probed_cpu_visible_size;
|
||||
devinfo->mem.vram.unmappable.size =
|
||||
@@ -371,8 +371,8 @@ intel_device_info_i915_query_regions(struct intel_device_info *devinfo, int fd,
|
||||
devinfo->mem.vram.unmappable.size = 0;
|
||||
}
|
||||
} else {
|
||||
assert(devinfo->mem.vram.mem_class == mem->region.memory_class);
|
||||
assert(devinfo->mem.vram.mem_instance == mem->region.memory_instance);
|
||||
assert(devinfo->mem.vram.mem.klass == mem->region.memory_class);
|
||||
assert(devinfo->mem.vram.mem.instance == mem->region.memory_instance);
|
||||
assert((devinfo->mem.vram.mappable.size +
|
||||
devinfo->mem.vram.unmappable.size) == mem->probed_size);
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@ print_regions_info(const struct intel_device_info *devinfo)
|
||||
fprintf(stdout, " sram:\n");
|
||||
if (devinfo->mem.use_class_instance) {
|
||||
fprintf(stdout, " class: %d; instance: %d\n",
|
||||
devinfo->mem.sram.mem_class, devinfo->mem.sram.mem_instance);
|
||||
devinfo->mem.sram.mem.klass, devinfo->mem.sram.mem.instance);
|
||||
}
|
||||
fprintf(stdout, " mappable: %" PRId64 "; ",
|
||||
devinfo->mem.sram.mappable.size);
|
||||
@@ -75,7 +75,7 @@ print_regions_info(const struct intel_device_info *devinfo)
|
||||
fprintf(stdout, " vram:\n");
|
||||
if (devinfo->mem.use_class_instance) {
|
||||
fprintf(stdout, " class: %d; instance: %d\n",
|
||||
devinfo->mem.vram.mem_class, devinfo->mem.vram.mem_instance);
|
||||
devinfo->mem.vram.mem.klass, devinfo->mem.vram.mem.instance);
|
||||
}
|
||||
fprintf(stdout, " mappable: %" PRId64 "; ",
|
||||
devinfo->mem.vram.mappable.size);
|
||||
|
@@ -92,6 +92,12 @@ enum intel_platform {
|
||||
#define intel_device_info_is_mtl(devinfo) \
|
||||
intel_platform_in_range((devinfo)->platform, MTL)
|
||||
|
||||
struct intel_memory_class_instance {
|
||||
/* Kernel backend specific class value, no translation needed yet */
|
||||
uint16_t klass;
|
||||
uint16_t instance;
|
||||
};
|
||||
|
||||
/**
|
||||
* Intel hardware information and quirks
|
||||
*/
|
||||
@@ -413,8 +419,7 @@ struct intel_device_info
|
||||
struct {
|
||||
bool use_class_instance;
|
||||
struct {
|
||||
uint16_t mem_class;
|
||||
uint16_t mem_instance;
|
||||
struct intel_memory_class_instance mem;
|
||||
struct {
|
||||
uint64_t size;
|
||||
uint64_t free;
|
||||
|
@@ -406,22 +406,22 @@ anv_init_meminfo(struct anv_physical_device *device, int fd)
|
||||
{
|
||||
const struct intel_device_info *devinfo = &device->info;
|
||||
|
||||
device->sys.region.memory_class = devinfo->mem.sram.mem_class;
|
||||
device->sys.region.memory_instance = devinfo->mem.sram.mem_instance;
|
||||
device->sys.region.memory_class = devinfo->mem.sram.mem.klass;
|
||||
device->sys.region.memory_instance = devinfo->mem.sram.mem.instance;
|
||||
device->sys.size =
|
||||
anv_compute_sys_heap_size(device, devinfo->mem.sram.mappable.size);
|
||||
device->sys.available = devinfo->mem.sram.mappable.free;
|
||||
|
||||
device->vram_mappable.region.memory_class = devinfo->mem.vram.mem_class;
|
||||
device->vram_mappable.region.memory_class = devinfo->mem.vram.mem.klass;
|
||||
device->vram_mappable.region.memory_instance =
|
||||
devinfo->mem.vram.mem_instance;
|
||||
devinfo->mem.vram.mem.instance;
|
||||
device->vram_mappable.size = devinfo->mem.vram.mappable.size;
|
||||
device->vram_mappable.available = devinfo->mem.vram.mappable.free;
|
||||
|
||||
device->vram_non_mappable.region.memory_class =
|
||||
devinfo->mem.vram.mem_class;
|
||||
devinfo->mem.vram.mem.klass;
|
||||
device->vram_non_mappable.region.memory_instance =
|
||||
devinfo->mem.vram.mem_instance;
|
||||
devinfo->mem.vram.mem.instance;
|
||||
device->vram_non_mappable.size = devinfo->mem.vram.unmappable.size;
|
||||
device->vram_non_mappable.available = devinfo->mem.vram.unmappable.free;
|
||||
|
||||
|
Reference in New Issue
Block a user