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

Francisco Jerez currojerez at riseup.net
Tue Oct 25 18:16:56 UTC 2016


Kenneth Graunke <kenneth at whitecape.org> writes:

> 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;
> +

I'm not sure this gives you any guarantees that the command parser is
going to be active?  Has the command parser been enabled by default on
all kernel versions exposing cmd_parser_version >= 2?  Wouldn't this
break things if the command parser is disabled in the kernel command
line?  [Currently it would just cause some extensions to be disabled]

>     static int result = -1;
>     if (result != -1)
>        return result;
> -- 
> 2.10.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161025/33b1df20/attachment.sig>


More information about the mesa-dev mailing list