i965: Only enable ARB_query_buffer_object for newer kernels on Haswell.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 5 May 2016 08:57:30 +0000 (01:57 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 9 May 2016 21:59:58 +0000 (14:59 -0700)
On Haswell, we need version 6 of the kernel command parser in order to
write the math registers.  Our implementation of ARB_query_buffer_object
heavily relies on MI_MATH, so we should only advertise it when MI_MATH
is available.  We also need MI_LOAD_REGISTER_REG, which requires version
7 of the command parser.

To make these checks easier, introduce a screen->has_mi_math_and_lrr
flag that will be set when both commands are supported.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/mesa/drivers/dri/i965/intel_extensions.c
src/mesa/drivers/dri/i965/intel_screen.c
src/mesa/drivers/dri/i965/intel_screen.h

index 588df1abf9ddd194a05fb527d218c049d94a619c..8d98788a8381d976403bd19263bfad74f17524ef 100644 (file)
@@ -366,7 +366,7 @@ intelInitExtensions(struct gl_context *ctx)
       }
    }
 
-   if (brw->gen >= 8 || brw->is_haswell) {
+   if (brw->intelScreen->has_mi_math_and_lrr) {
       ctx->Extensions.ARB_query_buffer_object = true;
    }
 
index db9d94d3b34cc97a362131ca751f49b0e32b3ded..f9b54842eb93607eb5c6b074ebb3614c94dfcb27 100644 (file)
@@ -1531,6 +1531,14 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
    if (ret == -1)
       intelScreen->cmd_parser_version = 0;
 
+   /* Haswell requires command parser version 6 in order to write to the
+    * MI_MATH GPR registers, and version 7 in order to use
+    * MI_LOAD_REGISTER_REG (which all users of MI_MATH use).
+    */
+   intelScreen->has_mi_math_and_lrr = intelScreen->devinfo->gen >= 8 ||
+                                      (intelScreen->devinfo->is_haswell &&
+                                       intelScreen->cmd_parser_version >= 7);
+
    psp->extensions = !intelScreen->has_context_reset_notification
       ? intelScreenExtensions : intelRobustScreenExtensions;
 
index 01d45d0c0166afdf0e2f4004754c99d53f44f7fe..98f9d24901cd9efbdc231fac0d530dd535727a52 100644 (file)
@@ -55,6 +55,12 @@ struct intel_screen
     */
    bool has_resource_streamer;
 
+   /**
+    * Does the current hardware and kernel support MI_MATH and
+    * MI_LOAD_REGISTER_REG?
+    */
+   bool has_mi_math_and_lrr;
+
    /**
     * Does the kernel support context reset notifications?
     */