Module: Mesa
Branch: main
Commit: acc6457ff46a65f1a2c7f835b3050f55b0e663de
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=acc6457ff46a65f1a2c7f835b3050f55b0e663de

Author: Jordan Justen <[email protected]>
Date:   Mon May 16 02:33:11 2022 -0700

intel/dev: Use i915 region probed_cpu_visible_size when non-zero

Signed-off-by: Jordan Justen <[email protected]>
Reviewed-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16739>

---

 src/intel/dev/intel_device_info.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/intel/dev/intel_device_info.c 
b/src/intel/dev/intel_device_info.c
index 28263c1e6df..29cbb849cad 100644
--- a/src/intel/dev/intel_device_info.c
+++ b/src/intel/dev/intel_device_info.c
@@ -1625,7 +1625,18 @@ query_regions(struct intel_device_info *devinfo, int fd, 
bool update)
          if (!update) {
             devinfo->mem.vram.mem_class = mem->region.memory_class;
             devinfo->mem.vram.mem_instance = mem->region.memory_instance;
-            devinfo->mem.vram.mappable.size = mem->probed_size;
+            if (mem->probed_cpu_visible_size > 0) {
+               devinfo->mem.vram.mappable.size = mem->probed_cpu_visible_size;
+               devinfo->mem.vram.unmappable.size =
+                  mem->probed_size - mem->probed_cpu_visible_size;
+            } else {
+               /* We are running on an older kernel without support for the
+                * small-bar uapi. These kernels only support systems where the
+                * entire vram is mappable.
+                */
+               devinfo->mem.vram.mappable.size = mem->probed_size;
+               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);

Reply via email to