[11/20] mesa/st: add support for semaphore object signal/wait v3

Submitted by Andres Rodriguez on Jan. 23, 2018, 6:05 p.m.

Details

Message ID 20180123180510.10180-12-andresx7@gmail.com
State New
Headers show
Series "Add support for GL_EXT_semaphore" ( rev: 5 4 3 ) in Mesa

Not browsing as part of any series.

Commit Message

Andres Rodriguez Jan. 23, 2018, 6:05 p.m.
Bits to implement ServerWaitSemaphoreObject/ServerSignalSemaphoreObject

v2:
  - corresponding changes for gallium fence->semaphore rename
  - flushing moved to mesa/main

v3: s/semaphore/fence for pipe objects

Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
---
 src/mesa/state_tracker/st_cb_semaphoreobjects.c | 27 +++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/mesa/state_tracker/st_cb_semaphoreobjects.c b/src/mesa/state_tracker/st_cb_semaphoreobjects.c
index 25e3043c40..5510102635 100644
--- a/src/mesa/state_tracker/st_cb_semaphoreobjects.c
+++ b/src/mesa/state_tracker/st_cb_semaphoreobjects.c
@@ -1,5 +1,7 @@ 
+
 #include "main/imports.h"
 #include "main/mtypes.h"
+#include "main/context.h"
 
 #include "main/externalobjects.h"
 
@@ -46,10 +48,35 @@  st_import_semaphoreobj_fd(struct gl_context *ctx,
 #endif
 }
 
+static void
+st_server_wait_semaphore(struct gl_context *ctx,
+                         struct gl_semaphore_object *semObj)
+{
+   struct st_semaphore_object *st_obj = st_semaphore_object(semObj);
+   struct st_context *st = st_context(ctx);
+   struct pipe_context *pipe = st->pipe;
+
+   pipe->fence_server_sync(pipe, st_obj->fence);
+}
+
+static void
+st_server_signal_semaphore(struct gl_context *ctx,
+                           struct gl_semaphore_object *semObj)
+{
+   struct st_semaphore_object *st_obj = st_semaphore_object(semObj);
+   struct st_context *st = st_context(ctx);
+   struct pipe_context *pipe = st->pipe;
+
+   /**TODO FIXME */
+   pipe->fence_server_signal(pipe, st_obj->fence);
+}
+
 void
 st_init_semaphoreobject_functions(struct dd_function_table *functions)
 {
    functions->NewSemaphoreObject = st_semaphoreobj_alloc;
    functions->DeleteSemaphoreObject = st_semaphoreobj_free;
    functions->ImportSemaphoreFd = st_import_semaphoreobj_fd;
+   functions->ServerWaitSemaphoreObject = st_server_wait_semaphore;
+   functions->ServerSignalSemaphoreObject = st_server_signal_semaphore;
 }

Comments

On Tue, Jan 23, 2018 at 7:05 PM, Andres Rodriguez <andresx7@gmail.com> wrote:
> Bits to implement ServerWaitSemaphoreObject/ServerSignalSemaphoreObject
>
> v2:
>   - corresponding changes for gallium fence->semaphore rename
>   - flushing moved to mesa/main
>
> v3: s/semaphore/fence for pipe objects
>
> Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
> ---
>  src/mesa/state_tracker/st_cb_semaphoreobjects.c | 27 +++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>
> diff --git a/src/mesa/state_tracker/st_cb_semaphoreobjects.c b/src/mesa/state_tracker/st_cb_semaphoreobjects.c
> index 25e3043c40..5510102635 100644
> --- a/src/mesa/state_tracker/st_cb_semaphoreobjects.c
> +++ b/src/mesa/state_tracker/st_cb_semaphoreobjects.c
> @@ -1,5 +1,7 @@
> +
>  #include "main/imports.h"
>  #include "main/mtypes.h"
> +#include "main/context.h"
>
>  #include "main/externalobjects.h"
>
> @@ -46,10 +48,35 @@ st_import_semaphoreobj_fd(struct gl_context *ctx,
>  #endif
>  }
>
> +static void
> +st_server_wait_semaphore(struct gl_context *ctx,
> +                         struct gl_semaphore_object *semObj)
> +{
> +   struct st_semaphore_object *st_obj = st_semaphore_object(semObj);
> +   struct st_context *st = st_context(ctx);
> +   struct pipe_context *pipe = st->pipe;
> +

st_flush_bitmap_cache(st); should be called here.

> +   pipe->fence_server_sync(pipe, st_obj->fence);
> +}
> +
> +static void
> +st_server_signal_semaphore(struct gl_context *ctx,
> +                           struct gl_semaphore_object *semObj)
> +{
> +   struct st_semaphore_object *st_obj = st_semaphore_object(semObj);
> +   struct st_context *st = st_context(ctx);
> +   struct pipe_context *pipe = st->pipe;
> +

st_flush_bitmap_cache(st); should be called here.

> +   /**TODO FIXME */
> +   pipe->fence_server_signal(pipe, st_obj->fence);
> +}
> +

Marek