[Mesa-dev] [PATCH] gallium/u_threaded: drop and ignore all non-async debug callbacks

Nicolai Hähnle nhaehnle at gmail.com
Fri May 12 19:45:56 UTC 2017


On 12.05.2017 21:06, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> This is necessary to comply with OpenGL.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>


> ---
>  src/gallium/auxiliary/util/u_threaded_context.c | 7 +++++++
>  src/gallium/auxiliary/util/u_threaded_context.h | 4 +---
>  2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
> index b44430f..50cb820 100644
> --- a/src/gallium/auxiliary/util/u_threaded_context.c
> +++ b/src/gallium/auxiliary/util/u_threaded_context.c
> @@ -1585,20 +1585,27 @@ tc_dump_debug_state(struct pipe_context *_pipe, FILE *stream,
>     pipe->dump_debug_state(pipe, stream, flags);
>  }
>
>  static void
>  tc_set_debug_callback(struct pipe_context *_pipe,
>                        const struct pipe_debug_callback *cb)
>  {
>     struct threaded_context *tc = threaded_context(_pipe);
>     struct pipe_context *pipe = tc->pipe;
>
> +   /* Drop all synchronous debug callbacks. Drivers are expected to be OK
> +    * with this. shader-db will use an environment variable to disable
> +    * the threaded context.
> +    */
> +   if (cb && cb->debug_message && !cb->async)
> +      return;
> +
>     tc_sync(tc);
>     pipe->set_debug_callback(pipe, cb);
>  }
>
>  static void
>  tc_create_fence_fd(struct pipe_context *_pipe,
>                     struct pipe_fence_handle **fence, int fd)
>  {
>     struct threaded_context *tc = threaded_context(_pipe);
>     struct pipe_context *pipe = tc->pipe;
> diff --git a/src/gallium/auxiliary/util/u_threaded_context.h b/src/gallium/auxiliary/util/u_threaded_context.h
> index ea58d4c..f139230 100644
> --- a/src/gallium/auxiliary/util/u_threaded_context.h
> +++ b/src/gallium/auxiliary/util/u_threaded_context.h
> @@ -48,23 +48,21 @@
>   *
>   * 3) The threaded context must not be enabled for contexts that can use video
>   *    codecs.
>   *
>   * 4) Changes in driver behavior:
>   *    - begin_query and end_query always return true; return values from
>   *      the driver are ignored.
>   *    - generate_mipmap uses is_format_supported to determine success;
>   *      the return value from the driver is ignored.
>   *    - resource_commit always returns true; failures are ignored.
> - *    - If a non-async debug callback is set, the threaded context keeps using
> - *      asynchronous execution. This is OK for shader-db, but the driver
> - *      shouldn't use the debug callback in any other way.
> + *    - set_debug_callback is skipped if the callback is synchronous.
>   *
>   *
>   * Thread-safety requirements on context functions
>   * -----------------------------------------------
>   *
>   * These pipe_context functions are executed directly, so they shouldn't use
>   * pipe_context in an unsafe way. They are de-facto screen functions now:
>   * - create_query
>   * - create_batch_query
>   * - create_*_state (all CSOs and shaders)
>


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list