dri/i9*5: correctly calculate the amount of system memory
authorEmil Velikov <emil.l.velikov@gmail.com>
Sat, 22 Feb 2014 03:04:02 +0000 (03:04 +0000)
committerIan Romanick <ian.d.romanick@intel.com>
Sat, 1 Mar 2014 16:49:59 +0000 (08:49 -0800)
The variable name states megabytes, while we calculate the amount in
kilobytes. Correct this by dividing with the correct amount.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Cc: "10.0 10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i915/intel_screen.c
src/mesa/drivers/dri/i965/intel_screen.c

index b3199b152dbb0e6f1f69aa328f7c59cd588a9803..384cb4689b948e7dc29e4c669daf5bd3f4f16a1c 100644 (file)
@@ -740,7 +740,7 @@ i915_query_renderer_integer(__DRIscreen *psp, int param, unsigned int *value)
          * (uint64_t) system_page_size;
 
       const unsigned system_memory_megabytes =
-         (unsigned) (system_memory_bytes / 1024);
+         (unsigned) (system_memory_bytes / (1024 * 1024));
 
       value[0] = MIN2(system_memory_megabytes, gpu_mappable_megabytes);
       return 0;
index 799da51c53fff92d75903044f5278343b94cca62..464cebf1e719fb6459da63ea51f58611824d3a24 100644 (file)
@@ -842,7 +842,7 @@ brw_query_renderer_integer(__DRIscreen *psp, int param, unsigned int *value)
          * (uint64_t) system_page_size;
 
       const unsigned system_memory_megabytes =
-         (unsigned) (system_memory_bytes / 1024);
+         (unsigned) (system_memory_bytes / (1024 * 1024));
 
       value[0] = MIN2(system_memory_megabytes, gpu_mappable_megabytes);
       return 0;