diff options
author | Andres Rodriguez <[email protected]> | 2017-10-16 20:10:31 -0400 |
---|---|---|
committer | Andres Rodriguez <[email protected]> | 2018-01-30 15:13:49 -0500 |
commit | 89b52891fd37293e596c75f49fb5202d83155677 (patch) | |
tree | 341bc1720cba1280e5ed42af2018d2bbfadaca03 /src/mesa | |
parent | 260f7fcc46f5feb10a3bc5fe5f29f8f08a0c202c (diff) |
mesa: add support for semaphore object signal/wait v3
Memory synchronization is left for a future patch.
v2: flush vertices/bitmaps moved to mesa/main
v3: removed spaces before/after braces
Signed-off-by: Andres Rodriguez <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/dd.h | 14 | ||||
-rw-r--r-- | src/mesa/main/externalobjects.c | 38 |
2 files changed, 52 insertions, 0 deletions
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index c80af0be074..8216752ccaf 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -1150,6 +1150,20 @@ struct dd_function_table { */ void (*DeleteSemaphoreObject)(struct gl_context *ctx, struct gl_semaphore_object *semObj); + + /** + * Introduce an operation to wait for the semaphore object in the GL + * server's command stream + */ + void (*ServerWaitSemaphoreObject)(struct gl_context *ctx, + struct gl_semaphore_object *semObj); + + /** + * Introduce an operation to signal the semaphore object in the GL + * server's command stream + */ + void (*ServerSignalSemaphoreObject)(struct gl_context *ctx, + struct gl_semaphore_object *semObj); /*@}*/ /** diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c index b72fe13d048..9ba70c8e7f8 100644 --- a/src/mesa/main/externalobjects.c +++ b/src/mesa/main/externalobjects.c @@ -23,6 +23,7 @@ #include "macros.h" #include "mtypes.h" +#include "context.h" #include "externalobjects.h" #include "teximage.h" #include "texobj.h" @@ -713,7 +714,26 @@ _mesa_WaitSemaphoreEXT(GLuint semaphore, const GLuint *textures, const GLenum *srcLayouts) { + GET_CURRENT_CONTEXT(ctx); + struct gl_semaphore_object *semObj; + + + if (!ctx->Extensions.EXT_semaphore) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glWaitSemaphoreEXT(unsupported)"); + return; + } + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + semObj = _mesa_lookup_semaphore_object(ctx, semaphore); + if (!semObj) + return; + + FLUSH_VERTICES(ctx, 0); + FLUSH_CURRENT(ctx, 0); + /* TODO: memory barriers and layout transitions */ + ctx->Driver.ServerWaitSemaphoreObject(ctx, semObj); } void GLAPIENTRY @@ -724,7 +744,25 @@ _mesa_SignalSemaphoreEXT(GLuint semaphore, const GLuint *textures, const GLenum *dstLayouts) { + GET_CURRENT_CONTEXT(ctx); + struct gl_semaphore_object *semObj; + + if (!ctx->Extensions.EXT_semaphore) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glSignalSemaphoreEXT(unsupported)"); + return; + } + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + semObj = _mesa_lookup_semaphore_object(ctx, semaphore); + if (!semObj) + return; + + FLUSH_VERTICES(ctx, 0); + FLUSH_CURRENT(ctx, 0); + /* TODO: memory barriers and layout transitions */ + ctx->Driver.ServerSignalSemaphoreObject(ctx, semObj); } void GLAPIENTRY |