radeonsi: add support for importing PIPE_FD_TYPE_SYNCOBJ semaphores
authorAndres Rodriguez <andresx7@gmail.com>
Fri, 15 Dec 2017 05:13:50 +0000 (00:13 -0500)
committerAndres Rodriguez <andresx7@gmail.com>
Tue, 30 Jan 2018 20:13:49 +0000 (15:13 -0500)
Hook up importing semaphores of type PIPE_FD_TYPE_SYNCOBJ

Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_fence.c

index d3a68e50e1c13f2e5095a20bb5413c5742fe1d5d..ef80b38aa67bb79eb6d7b273823e5240a0994bc0 100644 (file)
@@ -305,18 +305,32 @@ static void si_create_fence_fd(struct pipe_context *ctx,
        struct radeon_winsys *ws = sscreen->ws;
        struct si_multi_fence *rfence;
 
-       assert(type == PIPE_FD_TYPE_NATIVE_SYNC);
-
        *pfence = NULL;
 
-       if (!sscreen->info.has_fence_to_handle)
-               return;
-
        rfence = si_create_multi_fence();
        if (!rfence)
                return;
 
-       rfence->gfx = ws->fence_import_sync_file(ws, fd);
+       switch (type) {
+       case PIPE_FD_TYPE_NATIVE_SYNC:
+               if (!sscreen->info.has_fence_to_handle)
+                       goto finish;
+
+               rfence->gfx = ws->fence_import_sync_file(ws, fd);
+               break;
+
+       case PIPE_FD_TYPE_SYNCOBJ:
+               if (!sscreen->info.has_syncobj)
+                       goto finish;
+
+               rfence->gfx = ws->fence_import_syncobj(ws, fd);
+               break;
+
+       default:
+               unreachable("bad fence fd type when importing");
+       }
+
+finish:
        if (!rfence->gfx) {
                FREE(rfence);
                return;