OSDN Git Service

i965: Use drm_intel_get_aperture_sizes instead of hard-coded 2GiB
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 11 Nov 2013 18:57:55 +0000 (10:57 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 13 Nov 2013 22:49:27 +0000 (14:49 -0800)
Systems with little physical memory installed will report less than
2GiB, and some systems may (hypothetically?) have a larger address space
for the GPU.  My IVB still reports 1534.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: "10.0" <mesa-stable@lists.freedesktop.org>
src/mesa/drivers/dri/i965/intel_screen.c

index 6bcfe2c..10ebfb1 100644 (file)
@@ -824,10 +824,14 @@ brw_query_renderer_integer(__DRIscreen *psp, int param, int *value)
       /* Once a batch uses more than 75% of the maximum mappable size, we
        * assume that there's some fragmentation, and we start doing extra
        * flushing, etc.  That's the big cliff apps will care about.
-       *
-       * Can only map 2G onto the GPU through the GTT.
        */
-      const unsigned gpu_mappable_megabytes = 2 * 1024 * 3 / 4;
+      size_t aper_size;
+      size_t mappable_size;
+
+      drm_intel_get_aperture_sizes(psp->fd, &mappable_size, &aper_size);
+
+      const unsigned gpu_mappable_megabytes =
+         (aper_size / (1024 * 1024)) * 3 / 4;
 
       const long system_memory_pages = sysconf(_SC_PHYS_PAGES);
       const long system_page_size = sysconf(_SC_PAGE_SIZE);