i965: Fix eu/subslice warning
authorBen Widawsky <benjamin.widawsky@intel.com>
Thu, 7 Apr 2016 17:53:13 +0000 (10:53 -0700)
committerBen Widawsky <benjamin.widawsky@intel.com>
Fri, 8 Apr 2016 18:52:29 +0000 (11:52 -0700)
Older gen platforms do not actually return a value for sublice and eu total
(IMO, confusingly) they return -ENODEV. This patch defers the SSEU setup until
we have the actual GPU generation to avoid useless warnings when running on
older platforms with older kernels.

Reported-by: Mark Janes <mark.a.janes@intel.com>
Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/intel_screen.c

index 8c687b3ae1c1bd40a6ab9c8a5d9e469b5be38355..b596017c65494fb9a6b3cbe453d5df272bfd31b0 100644 (file)
@@ -1081,13 +1081,21 @@ intelDestroyBuffer(__DRIdrawable * driDrawPriv)
 static void
 intel_detect_sseu(struct intel_screen *intelScreen)
 {
+   assert(intelScreen->devinfo->gen >= 8);
+   int ret;
+
    intelScreen->subslice_total = -1;
    intelScreen->eu_total = -1;
 
-   intel_get_param(intelScreen->driScrnPriv, I915_PARAM_SUBSLICE_TOTAL,
-                   &intelScreen->subslice_total);
-   intel_get_param(intelScreen->driScrnPriv,
-                   I915_PARAM_EU_TOTAL, &intelScreen->eu_total);
+   ret = intel_get_param(intelScreen->driScrnPriv, I915_PARAM_SUBSLICE_TOTAL,
+                         &intelScreen->subslice_total);
+   if (ret != -EINVAL)
+      goto err_out;
+
+   ret = intel_get_param(intelScreen->driScrnPriv,
+                         I915_PARAM_EU_TOTAL, &intelScreen->eu_total);
+   if (ret != -EINVAL)
+      goto err_out;
 
    /* Without this information, we cannot get the right Braswell brandstrings,
     * and we have to use conservative numbers for GPGPU on many platforms, but
@@ -1096,13 +1104,19 @@ intel_detect_sseu(struct intel_screen *intelScreen)
    if (intelScreen->subslice_total == -1 || intelScreen->eu_total == -1)
       _mesa_warning(NULL,
                     "Kernel 4.1 required to properly query GPU properties.\n");
+
+   return;
+
+err_out:
+   intelScreen->subslice_total = -1;
+   intelScreen->eu_total = -1;
+   _mesa_warning(NULL, "Failed to query GPU properties.\n");
 }
 
 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;
 
@@ -1120,12 +1134,6 @@ intel_init_bufmgr(struct intel_screen *intelScreen)
       return false;
    }
 
-   /* Everything below this is for real hardware only */
-   if (intelScreen->no_hw || devid_override)
-      return true;
-
-   intel_detect_sseu(intelScreen);
-
    return true;
 }
 
@@ -1480,6 +1488,10 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
    intelScreen->hw_has_swizzling = intel_detect_swizzling(intelScreen);
    intelScreen->hw_has_timestamp = intel_detect_timestamp(intelScreen);
 
+   /* GENs prior to 8 do not support EU/Subslice info */
+   if (intelScreen->devinfo->gen >= 8)
+      intel_detect_sseu(intelScreen);
+
    const char *force_msaa = getenv("INTEL_FORCE_MSAA");
    if (force_msaa) {
       intelScreen->winsys_msaa_samples_override =