radv/amdgpu: wrap sync fd import/export.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 18 Dec 2017 19:33:07 +0000 (20:33 +0100)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 18 Dec 2017 21:13:31 +0000 (22:13 +0100)
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_radeon_winsys.h
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c

index e851c3edf86a68bcf8f70e82cbae3506f38e5c0a..45f58f063a471c9c7f08cc4b44ec3be6a9e9f724 100644 (file)
@@ -281,6 +281,11 @@ struct radeon_winsys {
        int (*export_syncobj)(struct radeon_winsys *ws, uint32_t syncobj, int *fd);
        int (*import_syncobj)(struct radeon_winsys *ws, int fd, uint32_t *syncobj);
 
+       int (*export_syncobj_to_sync_file)(struct radeon_winsys *ws, uint32_t syncobj, int *fd);
+
+       /* Note that this, unlike the normal import, uses an existing syncobj. */
+       int (*import_syncobj_from_sync_file)(struct radeon_winsys *ws, uint32_t syncobj, int fd);
+
 };
 
 static inline void radeon_emit(struct radeon_winsys_cs *cs, uint32_t value)
index e4d444b85245628b47b49d1a1699b156a3a3ca45..4578a9b54849837b1c5d7b9d9b19728a701ade44 100644 (file)
@@ -1336,6 +1336,25 @@ static int radv_amdgpu_import_syncobj(struct radeon_winsys *_ws,
        return amdgpu_cs_import_syncobj(ws->dev, fd, syncobj);
 }
 
+
+static int radv_amdgpu_export_syncobj_to_sync_file(struct radeon_winsys *_ws,
+                                                   uint32_t syncobj,
+                                                   int *fd)
+{
+       struct radv_amdgpu_winsys *ws = radv_amdgpu_winsys(_ws);
+
+       return amdgpu_cs_syncobj_export_sync_file(ws->dev, syncobj, fd);
+}
+
+static int radv_amdgpu_import_syncobj_from_sync_file(struct radeon_winsys *_ws,
+                                                     uint32_t syncobj,
+                                                     int fd)
+{
+       struct radv_amdgpu_winsys *ws = radv_amdgpu_winsys(_ws);
+
+       return amdgpu_cs_syncobj_import_sync_file(ws->dev, syncobj, fd);
+}
+
 void radv_amdgpu_cs_init_functions(struct radv_amdgpu_winsys *ws)
 {
        ws->base.ctx_create = radv_amdgpu_ctx_create;
@@ -1361,5 +1380,7 @@ void radv_amdgpu_cs_init_functions(struct radv_amdgpu_winsys *ws)
        ws->base.wait_syncobj = radv_amdgpu_wait_syncobj;
        ws->base.export_syncobj = radv_amdgpu_export_syncobj;
        ws->base.import_syncobj = radv_amdgpu_import_syncobj;
+       ws->base.export_syncobj_to_sync_file = radv_amdgpu_export_syncobj_to_sync_file;
+       ws->base.import_syncobj_from_sync_file = radv_amdgpu_import_syncobj_from_sync_file;
        ws->base.fence_wait = radv_amdgpu_fence_wait;
 }