summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Nguyen <brnguyen@nvidia.com>2014-11-12 12:53:07 -0800
committerbrnguyen <brnguyen@nvidia.com>2015-01-29 15:44:21 -0800
commit4f1a13cbdac9b20e91558ccb8d06fbff6bfea4fc (patch)
tree0267008821dbe3a210a4edddfc77d51bc422528a /src
parent39656dd52e4f3079a9e03d092f94e7536a3354f4 (diff)
[GLdispatchABI.h] Add a new releasePatch() entrypoint patching callback
This callback notifies vendors when they no longer "own" patched top-level libglvnd entrypoints. This allows vendors to safely take advantage of optimizations which may modify entrypoint code outside of the finalizePatch() callback.
Diffstat (limited to 'src')
-rw-r--r--src/GLdispatch/GLdispatch.c6
-rw-r--r--src/GLdispatch/GLdispatchABI.h13
2 files changed, 17 insertions, 2 deletions
diff --git a/src/GLdispatch/GLdispatch.c b/src/GLdispatch/GLdispatch.c
index d046ac0..b999f9f 100644
--- a/src/GLdispatch/GLdispatch.c
+++ b/src/GLdispatch/GLdispatch.c
@@ -578,6 +578,12 @@ static int PatchEntrypoints(
return 1;
}
+ if (stubCurrentPatchCb) {
+ // Notify the previous vendor that it no longer owns these
+ // entrypoints.
+ stubCurrentPatchCb->releasePatch();
+ }
+
if (patchCb) {
GLboolean needOffsets;
diff --git a/src/GLdispatch/GLdispatchABI.h b/src/GLdispatch/GLdispatchABI.h
index 39ac961..1d7fcb5 100644
--- a/src/GLdispatch/GLdispatchABI.h
+++ b/src/GLdispatch/GLdispatchABI.h
@@ -87,10 +87,19 @@ typedef struct __GLdispatchPatchCallbacksRec {
void (*getOffsetHook)(void *(*lookupStubOffset)(const char *funcName));
/*
- * Called by libglvnd to finish the top-level entrypoint patch. libglvnd
- * must have called the __GLdispatchInitiatePatch callback first!
+ * Called by libglvnd to finish the initial top-level entrypoint patch.
+ * libglvnd must have called the __GLdispatchInitiatePatch callback first!
+ * After this function is called, the vendor "owns" the top-level
+ * entrypoints and may change them at will until GLdispatch calls the
+ * releasePatch callback below.
*/
void (*finalizePatch)(void);
+
+ /*
+ * Called by libglvnd to notify the current vendor that it no longer owns
+ * the top-level entrypoints.
+ */
+ void (*releasePatch)(void);
} __GLdispatchPatchCallbacks;
#if defined(__cplusplus)