diff options
author | Bas Nieuwenhuizen <[email protected]> | 2018-01-25 16:48:17 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2018-01-26 19:53:02 +0000 |
commit | a5bdf2abf9d87c34ab5ebec5a2bbf78b4e19db5b (patch) | |
tree | f346986003e5110fb3790e2c13417261bf3b4a44 /src/gallium | |
parent | 305b0b135612dfe80b95f20e22fb5a526f8fa886 (diff) |
radeonsi: Export signalled sync file instead of -1.
-1 is considered an error for EGL_ANDROID_native_fence_sync, so
we need to actually create a sync file.
Fixes: f536f45250 "radeonsi: implement sync_file import/export"
Reviewed-by: Dave Airlie <[email protected]>
(cherry picked from commit 5a3404d443e0c6e8e9a44d7f8dccf96c5ac18f0f)
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/radeon/radeon_winsys.h | 5 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_fence.c | 2 | ||||
-rw-r--r-- | src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 22 |
3 files changed, 29 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h index d1c761f4eea..307f8efaec0 100644 --- a/src/gallium/drivers/radeon/radeon_winsys.h +++ b/src/gallium/drivers/radeon/radeon_winsys.h @@ -611,6 +611,11 @@ struct radeon_winsys { struct pipe_fence_handle *fence); /** + * Return a sync file FD that is already signalled. + */ + int (*export_signalled_sync_file)(struct radeon_winsys *ws); + + /** * Initialize surface * * \param ws The winsys this function is called from. diff --git a/src/gallium/drivers/radeonsi/si_fence.c b/src/gallium/drivers/radeonsi/si_fence.c index 5f320803aae..47d68dbc337 100644 --- a/src/gallium/drivers/radeonsi/si_fence.c +++ b/src/gallium/drivers/radeonsi/si_fence.c @@ -356,6 +356,8 @@ static int si_fence_get_fd(struct pipe_screen *screen, /* If we don't have FDs at this point, it means we don't have fences * either. */ + if (sdma_fd == -1 && gfx_fd == -1) + return ws->export_signalled_sync_file(ws); if (sdma_fd == -1) return gfx_fd; if (gfx_fd == -1) diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c index 63cd63287fd..0c778534606 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c @@ -114,6 +114,27 @@ static int amdgpu_fence_export_sync_file(struct radeon_winsys *rws, return fd; } +static int amdgpu_export_signalled_sync_file(struct radeon_winsys *rws) +{ + struct amdgpu_winsys *ws = amdgpu_winsys(rws); + uint32_t syncobj; + int fd = -1; + + int r = amdgpu_cs_create_syncobj2(ws->dev, DRM_SYNCOBJ_CREATE_SIGNALED, + &syncobj); + if (r) { + return -1; + } + + r = amdgpu_cs_syncobj_export_sync_file(ws->dev, syncobj, &fd); + if (r) { + fd = -1; + } + + amdgpu_cs_destroy_syncobj(ws->dev, syncobj); + return fd; +} + static void amdgpu_fence_submitted(struct pipe_fence_handle *fence, uint64_t seq_no, uint64_t *user_fence_cpu_address) @@ -1560,4 +1581,5 @@ void amdgpu_cs_init_functions(struct amdgpu_winsys *ws) ws->base.fence_reference = amdgpu_fence_reference; ws->base.fence_import_sync_file = amdgpu_fence_import_sync_file; ws->base.fence_export_sync_file = amdgpu_fence_export_sync_file; + ws->base.export_signalled_sync_file = amdgpu_export_signalled_sync_file; } |