[Mesa-dev] [PATCH 10/20] mesa: add support for semaphore object signal/wait v2
Brian Paul
brianp at vmware.com
Tue Jan 23 18:19:52 UTC 2018
On 01/23/2018 11:05 AM, Andres Rodriguez wrote:
> Memory synchronization is left for a future patch.
>
> v2: flush vertices/bitmaps moved to mesa/main
>
> Signed-off-by: Andres Rodriguez <andresx7 at gmail.com>
> ---
> src/mesa/main/dd.h | 14 ++++++++++++++
> src/mesa/main/externalobjects.c | 38 ++++++++++++++++++++++++++++++++++++++
> 2 files changed, 52 insertions(+)
>
> diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
> index 376dd35ae9..abbc4d5f5c 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 b72fe13d04..4fb3ca07a9 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 );
Old code sometimes had spaces after '(' and before ')', but let's not do
that anymore.
-Brian
>
> + /* TODO: memory barriers and layout transitions */
> + ctx->Driver.ServerSignalSemaphoreObject(ctx, semObj);
> }
>
> void GLAPIENTRY
>
More information about the mesa-dev
mailing list