gallium/u_threaded: drop and ignore all non-async debug callbacks
authorMarek Olšák <marek.olsak@amd.com>
Thu, 11 May 2017 23:25:49 +0000 (01:25 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 15 May 2017 11:01:33 +0000 (13:01 +0200)
This is necessary to comply with OpenGL.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/auxiliary/util/u_threaded_context.c
src/gallium/auxiliary/util/u_threaded_context.h

index b44430f..50cb820 100644 (file)
@@ -1592,6 +1592,13 @@ tc_set_debug_callback(struct pipe_context *_pipe,
    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);
 }
index ea58d4c..f139230 100644 (file)
@@ -55,9 +55,7 @@
  *    - 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