aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/intel_screen.c
diff options
context:
space:
mode:
authorBen Widawsky <[email protected]>2016-02-08 11:52:17 -0800
committerBen Widawsky <[email protected]>2016-03-11 11:17:28 -0800
commit38eb6068847708f054b2d2e93f569061b5245852 (patch)
treed0e91947f55e4ca16a45cee2245f8e9a3d23156a /src/mesa/drivers/dri/i965/intel_screen.c
parent9908b13af61f0cfaae4b750dfc90230314c53b7b (diff)
i965: Query and store GPU properties from kernel
Certain products are not uniquely identifiable based on device id alone. The kernel exports an interface to help deal with this. This patch merely introduces the consumer of the interface and makes sure nothing breaks. It is also possible to use these values for programming GPGPU mode, and I plan to do that as well. The interface was introduced in libdrm 2.4.60, which is already required, so it should all be fine. v2: Some minor changes recommended by Matt Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/intel_screen.c')
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index ee7c1d7bc2c..64b8524c64b 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -1082,6 +1082,7 @@ static bool
intel_init_bufmgr(struct intel_screen *intelScreen)
{
__DRIscreen *spriv = intelScreen->driScrnPriv;
+ bool devid_override = getenv("INTEL_DEVID_OVERRIDE") != NULL;
intelScreen->no_hw = getenv("INTEL_NO_HW") != NULL;
@@ -1099,6 +1100,25 @@ intel_init_bufmgr(struct intel_screen *intelScreen)
return false;
}
+ intelScreen->subslice_total = -1;
+ intelScreen->eu_total = -1;
+
+ /* Everything below this is for real hardware only */
+ if (intelScreen->no_hw || devid_override)
+ return true;
+
+ intel_get_param(spriv, I915_PARAM_SUBSLICE_TOTAL,
+ &intelScreen->subslice_total);
+ intel_get_param(spriv, I915_PARAM_EU_TOTAL, &intelScreen->eu_total);
+
+ /* Without this information, we cannot get the right Braswell brandstrings,
+ * and we have to use conservative numbers for GPGPU on many platforms, but
+ * otherwise, things will just work.
+ */
+ if (intelScreen->subslice_total == -1 || intelScreen->eu_total == -1)
+ _mesa_warning(NULL,
+ "Kernel 4.1 required to properly query GPU properties.\n");
+
return true;
}