aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2012-11-14 14:26:22 -0800
committerTimothy Arceri <[email protected]>2017-03-16 14:14:18 +1100
commit77630841da53ec90415aee37fcc0ec4cf76941e1 (patch)
tree5b09e4e37a3f717293619bc34bcb6cdfffa0bf19
parent5bc527d39d2973f24ce062f23094177a660023c6 (diff)
mesa: Add SetBackgroundContext to dd_function_table
Acked-by: Timothy Arceri <[email protected]> Acked-by: Marek Olšák <[email protected]> Tested-by: Dieter Nützel <[email protected]> Tested-by: Mike Lothian <[email protected]>
-rw-r--r--src/mesa/drivers/common/driverfuncs.c3
-rw-r--r--src/mesa/main/dd.h18
2 files changed, 21 insertions, 0 deletions
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 6069138e35d..642cd91ce1f 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -201,6 +201,9 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
/* GL_ARB_texture_multisample */
driver->GetSamplePosition = NULL;
+
+ /* Multithreading */
+ driver->SetBackgroundContext = NULL;
}
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 63fc62103a7..f300ad6cc00 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -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);
};