summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2012-11-14 14:26:22 -0800
committerEric Anholt <eric@anholt.net>2013-01-03 09:38:38 -0800
commit3c1b18137ebc464c4c4dd13bd2699364c884c2e6 (patch)
tree8cbe1137b43d18316f2a43a76ca878b500457e44
parent839aa0e4a7a3a55e3be215d0ca569da450e40a60 (diff)
Add SetBackgroundContext to dd_function_table
-rw-r--r--src/mesa/drivers/common/driverfuncs.c3
-rw-r--r--src/mesa/main/dd.h19
2 files changed, 22 insertions, 0 deletions
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 93fa3c745e7..a40d8cc01cf 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -209,6 +209,9 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
/* GL_ARB_texture_storage */
driver->AllocTextureStorage = _swrast_AllocTextureStorage;
+
+ /* Multithreading */
+ driver->SetBackgroundContext = NULL;
}
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 70c53240e73..81553de1ac2 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -829,6 +829,25 @@ struct dd_function_table {
* This should be equivalent to glGetInteger64v(GL_TIMESTAMP);
*/
uint64_t (*GetTimestamp)(struct gl_context *ctx);
+
+ /**
+ * 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 _mesa_enable_multithreading() has
+ * been called on a given context.
+ */
+ void (*SetBackgroundContext)(struct gl_context *ctx);
};