[Mesa-dev] [PATCH 12/20] mesa: implement buffer/texture barriers for semaphore signal/wait v2

Jon Turney jon.turney at dronecode.org.uk
Wed Jan 31 15:20:49 UTC 2018


On 23/01/2018 18:05, Andres Rodriguez wrote:
> Make sure memory is accessible to the external client, for the specified
> memory object, before the signal/after the wait.
> 
> v2: fixed flush order with respect to wait/signal emission
> 
> Signed-off-by: Andres Rodriguez <andresx7 at gmail.com>
> ---
>   src/mesa/main/dd.h                              | 14 ++++++-
>   src/mesa/main/externalobjects.c                 | 38 +++++++++++++++---
>   src/mesa/state_tracker/st_cb_semaphoreobjects.c | 53 +++++++++++++++++++++++--
>   3 files changed, 95 insertions(+), 10 deletions(-)
[...]
> diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c
> index 4fb3ca07a9..c070d7a28d 100644
> --- a/src/mesa/main/externalobjects.c
> +++ b/src/mesa/main/externalobjects.c
> @@ -23,6 +23,7 @@
>   
>   #include "macros.h"
>   #include "mtypes.h"
> +#include "bufferobj.h"
>   #include "context.h"
>   #include "externalobjects.h"
>   #include "teximage.h"
> @@ -716,7 +717,8 @@ _mesa_WaitSemaphoreEXT(GLuint semaphore,
>   {
>      GET_CURRENT_CONTEXT(ctx);
>      struct gl_semaphore_object *semObj;
> -
> +   struct gl_buffer_object **bufObjs;
> +   struct gl_texture_object **texObjs;
>   
>      if (!ctx->Extensions.EXT_semaphore) {
>         _mesa_error(ctx, GL_INVALID_OPERATION, "glWaitSemaphoreEXT(unsupported)");
> @@ -732,8 +734,20 @@ _mesa_WaitSemaphoreEXT(GLuint semaphore,
>      FLUSH_VERTICES( ctx, 0 );
>      FLUSH_CURRENT( ctx, 0 );
>   
> -   /* TODO: memory barriers and layout transitions */
> -   ctx->Driver.ServerWaitSemaphoreObject(ctx, semObj);
> +   bufObjs = alloca(sizeof(struct gl_buffer_object **) * numBufferBarriers);
> +   for (unsigned i = 0; i < numBufferBarriers; i++) {
> +      bufObjs[i] = _mesa_lookup_bufferobj(ctx, buffers[i]);
> +   }
> +
> +   texObjs = alloca(sizeof(struct gl_texture_object **) * numTextureBarriers);
> +   for (unsigned i = 0; i < numTextureBarriers; i++) {
> +      texObjs[i] = _mesa_lookup_texture(ctx, textures[i]);
> +   }
> +
> +   ctx->Driver.ServerWaitSemaphoreObject(ctx, semObj,
> +                                         numBufferBarriers, bufObjs,
> +                                         numTextureBarriers, texObjs,
> +                                         srcLayouts);
>   }
>   
>   void GLAPIENTRY
> @@ -746,6 +760,8 @@ _mesa_SignalSemaphoreEXT(GLuint semaphore,
>   {
>      GET_CURRENT_CONTEXT(ctx);
>      struct gl_semaphore_object *semObj;
> +   struct gl_buffer_object **bufObjs;
> +   struct gl_texture_object **texObjs;
>   
>      if (!ctx->Extensions.EXT_semaphore) {
>         _mesa_error(ctx, GL_INVALID_OPERATION, "glSignalSemaphoreEXT(unsupported)");
> @@ -761,8 +777,20 @@ _mesa_SignalSemaphoreEXT(GLuint semaphore,
>      FLUSH_VERTICES( ctx, 0 );
>      FLUSH_CURRENT( ctx, 0 );
>   
> -   /* TODO: memory barriers and layout transitions */
> -   ctx->Driver.ServerSignalSemaphoreObject(ctx, semObj);
> +   bufObjs = alloca(sizeof(struct gl_buffer_object **) * numBufferBarriers);
> +   for (unsigned i = 0; i < numBufferBarriers; i++) {
> +      bufObjs[i] = _mesa_lookup_bufferobj(ctx, buffers[i]);
> +   }
> +
> +   texObjs = alloca(sizeof(struct gl_texture_object **) * numTextureBarriers);
> +   for (unsigned i = 0; i < numTextureBarriers; i++) {
> +      texObjs[i] = _mesa_lookup_texture(ctx, textures[i]);
> +   }
> +
> +   ctx->Driver.ServerSignalSemaphoreObject(ctx, semObj,
> +                                           numBufferBarriers, bufObjs,
> +                                           numTextureBarriers, texObjs,
> +                                           dstLayouts);
>   }
[...]

This adds a use of alloca(), without a corresponding #include.

Patch attached.

See also:
https://lists.freedesktop.org/archives/mesa-dev/2017-December/180073.html
https://lists.freedesktop.org/archives/mesa-dev/2016-July/122346.html

-------------- next part --------------
From 46a2c9bbd03234120594d50b48cbad73a355d240 Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney at dronecode.org.uk>
Date: Wed, 31 Jan 2018 12:46:22 +0000
Subject: [PATCH] Fix use of alloca() without #include <c99_alloca.h>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix use of alloca() without #include <c99_alloca.h> in 29b9bd05

../src/mesa/main/externalobjects.c:737:14: error: implicit declaration of function ‘alloca’ [-Werror=implicit-function-declaration]

Signed-off-by: Jon Turney <jon.turney at dronecode.org.uk>
---
 src/mesa/main/externalobjects.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c
index 463debd268..4648932a9b 100644
--- a/src/mesa/main/externalobjects.c
+++ b/src/mesa/main/externalobjects.c
@@ -21,6 +21,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
+#include "c99_alloca.h"
 #include "macros.h"
 #include "mtypes.h"
 #include "bufferobj.h"
-- 
2.16.1



More information about the mesa-dev mailing list