@@ -101,8 +101,9 @@ void *vgem_mmap(int fd, struct vgem_bo *bo, unsigned prot)
struct local_vgem_fence_attach {
uint32_t handle;
uint32_t flags;
+#define LOCAL_VGEM_FENCE_SYNCOBJ 0x2
uint32_t out_fence;
- uint32_t pad;
+ uint32_t syncobj;
};
struct local_vgem_fence_signal {
@@ -167,6 +168,28 @@ uint32_t vgem_fence_attach(int fd, struct vgem_bo *bo, unsigned flags)
return arg.out_fence;
}
+uint32_t vgem_fence_attach_syncobj(int fd, uint32_t syncobj)
+{
+ struct local_vgem_fence_attach arg;
+ struct vgem_bo bo;
+
+ /* Create a dummy BO so the import works */
+ bo.width = 1;
+ bo.height = 1;
+ bo.bpp = 4;
+ vgem_create(fd, &bo);
+
+ memset(&arg, 0, sizeof(arg));
+ arg.handle = bo.handle;
+ arg.syncobj = syncobj;
+ arg.flags = LOCAL_VGEM_FENCE_SYNCOBJ;
+ igt_assert_eq(__vgem_fence_attach(fd, &arg), 0);
+
+ gem_close(fd, bo.handle);
+
+ return arg.out_fence;
+}
+
static int ioctl_vgem_fence_signal(int fd, struct local_vgem_fence_signal *arg)
{
int err = 0;
@@ -44,6 +44,7 @@ bool vgem_fence_has_flag(int fd, unsigned flags);
uint32_t vgem_fence_attach(int fd, struct vgem_bo *bo, unsigned flags);
#define VGEM_FENCE_WRITE 0x1
#define WIP_VGEM_FENCE_NOTIMEOUT 0x2
+uint32_t vgem_fence_attach_syncobj(int fd, uint32_t syncobj);
int __vgem_fence_signal(int fd, uint32_t fence);
void vgem_fence_signal(int fd, uint32_t fence);
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> --- lib/igt_vgem.c | 25 ++++++++++++++++++++++++- lib/igt_vgem.h | 1 + 2 files changed, 25 insertions(+), 1 deletion(-)