mesa: Add SetBackgroundContext to dd_function_table
authorPaul Berry <stereotype441@gmail.com>
Wed, 14 Nov 2012 22:26:22 +0000 (14:26 -0800)
committerTimothy Arceri <tarceri@itsqueeze.com>
Thu, 16 Mar 2017 03:14:18 +0000 (14:14 +1100)
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
src/mesa/drivers/common/driverfuncs.c
src/mesa/main/dd.h

index 6069138..642cd91 100644 (file)
@@ -201,6 +201,9 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
 
    /* GL_ARB_texture_multisample */
    driver->GetSamplePosition = NULL;
+
+   /* Multithreading */
+   driver->SetBackgroundContext = NULL;
 }
 
 
index 63fc621..f300ad6 100644 (file)
@@ -1025,6 +1025,24 @@ struct dd_function_table {
     */
    void (*QueryMemoryInfo)(struct gl_context *ctx,
                            struct gl_memory_info *info);
+
+   /**
+    * Indicate that this thread is being used by Mesa as a background drawing
+    * thread for the given GL context.
+    *
+    * If this function is called more than once from any given thread, each
+    * subsequent call overrides the context that was passed in the previous
+    * call.  Mesa takes advantage of this to re-use a background thread to
+    * perform drawing on behalf of multiple contexts.
+    *
+    * Mesa may sometimes call this function from a non-background thread
+    * (i.e. a thread that has already been bound to a context using
+    * __DriverAPIRec::MakeCurrent()); when this happens, ctx will be equal to
+    * the context that is bound to this thread.
+    *
+    * Mesa will only call this function if GL multithreading is enabled.
+    */
+   void (*SetBackgroundContext)(struct gl_context *ctx);
 };