Kenneth Graunke <[email protected]> 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 <[email protected]>
> ---
>  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
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Attachment: signature.asc
Description: PGP signature

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to