[Mesa-dev] [PATCH] i965: Skip register write checks if cmd_parser_version >= 2.

Kenneth Graunke kenneth at whitecape.org
Wed Oct 19 19:25:51 UTC 2016


If the kernel advertises a new enough command parser version, then we
can just assume that register writes will work and not bother executing
commands on the GPU to test it.

This should speed up context creation.

>From the command parser version history (i915_cmd_parser.c):

  * 1. Initial version. Checks batches and reports violations, but leaves
  *    hardware parsing enabled (so does not allow new use cases).
  * 2. Allow access to the MI_PREDICATE_SRC0 and
  *    MI_PREDICATE_SRC1 registers.

Both of the things we check for were added before version 2, but
1 doesn't sound sufficient.  The point is to skip work on modern
kernels, so requiring version 2 will work.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/intel_extensions.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
index 66079b5..2a5a3b7 100644
--- a/src/mesa/drivers/dri/i965/intel_extensions.c
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c
@@ -46,6 +46,10 @@ can_do_pipelined_register_writes(struct brw_context *brw)
    if (brw->gen != 7)
       return true;
 
+   /* No need to execute commands to check if the kernel advertises it. */
+   if (brw->screen->cmd_parser_version >= 2)
+      return true;
+
    static int result = -1;
    if (result != -1)
       return result;
@@ -106,6 +110,10 @@ can_write_oacontrol(struct brw_context *brw)
    if (brw->gen < 6 || brw->gen >= 8)
       return false;
 
+   /* No need to execute commands to check if the kernel advertises it. */
+   if (brw->screen->cmd_parser_version >= 2)
+      return true;
+
    static int result = -1;
    if (result != -1)
       return result;
-- 
2.10.0



More information about the mesa-dev mailing list