iris: handle PIPE_FD_TYPE_SYNCOBJ type
Add support for importing syncobj semaphore types from fd handles. v2: * Used a C99 initializer instead of memset for drm_syncobj_handle in iris_fence.c Signed-off-by: Eleni Maria Stea <estea@igalia.com> Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Reviewed-by: Rohan Garg <rohan.garg@collabora.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7042>
This commit is contained in:

committed by
Marge Bot

parent
bddaa9339c
commit
aa1d298b33
@@ -495,18 +495,23 @@ iris_fence_create_fd(struct pipe_context *ctx,
|
|||||||
int fd,
|
int fd,
|
||||||
enum pipe_fd_type type)
|
enum pipe_fd_type type)
|
||||||
{
|
{
|
||||||
assert(type == PIPE_FD_TYPE_NATIVE_SYNC);
|
assert(type == PIPE_FD_TYPE_NATIVE_SYNC || type == PIPE_FD_TYPE_SYNCOBJ);
|
||||||
|
|
||||||
struct iris_screen *screen = (struct iris_screen *)ctx->screen;
|
struct iris_screen *screen = (struct iris_screen *)ctx->screen;
|
||||||
struct drm_syncobj_handle args = {
|
struct drm_syncobj_handle args = {
|
||||||
.handle = gem_syncobj_create(screen->fd, DRM_SYNCOBJ_CREATE_SIGNALED),
|
|
||||||
.flags = DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE,
|
|
||||||
.fd = fd,
|
.fd = fd,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (type == PIPE_FD_TYPE_NATIVE_SYNC) {
|
||||||
|
args.flags = DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE;
|
||||||
|
args.handle = gem_syncobj_create(screen->fd, DRM_SYNCOBJ_CREATE_SIGNALED);
|
||||||
|
}
|
||||||
|
|
||||||
if (gen_ioctl(screen->fd, DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, &args) == -1) {
|
if (gen_ioctl(screen->fd, DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, &args) == -1) {
|
||||||
fprintf(stderr, "DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE failed: %s\n",
|
fprintf(stderr, "DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE failed: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
gem_syncobj_destroy(screen->fd, args.handle);
|
if (type == PIPE_FD_TYPE_NATIVE_SYNC)
|
||||||
|
gem_syncobj_destroy(screen->fd, args.handle);
|
||||||
*out = NULL;
|
*out = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user