From 21ab4c9f31674b113c24177398ed39f29b7cd8e6 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Sun, 11 Dec 2016 08:40:05 +0000 Subject: Import Mesa 13.0.2 --- lib/mesa/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib/mesa/src/gallium/winsys/virgl/drm') diff --git a/lib/mesa/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/lib/mesa/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c index ba009882e..86e0470e6 100644 --- a/lib/mesa/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c +++ b/lib/mesa/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c @@ -380,6 +380,12 @@ virgl_drm_winsys_resource_create_handle(struct virgl_winsys *qws, struct virgl_hw_res *res; uint32_t handle = whandle->handle; + if (whandle->offset != 0) { + fprintf(stderr, "attempt to import unsupported winsys offset %u\n", + whandle->offset); + return NULL; + } + pipe_mutex_lock(qdws->bo_handles_mutex); if (whandle->type == DRM_API_HANDLE_TYPE_SHARED) { @@ -483,6 +489,9 @@ static boolean virgl_drm_winsys_resource_get_handle(struct virgl_winsys *qws, } else if (whandle->type == DRM_API_HANDLE_TYPE_FD) { if (drmPrimeHandleToFD(qdws->fd, res->bo_handle, DRM_CLOEXEC, (int*)&whandle->handle)) return FALSE; + pipe_mutex_lock(qdws->bo_handles_mutex); + util_hash_table_set(qdws->bo_handles, (void *)(uintptr_t)res->bo_handle, res); + pipe_mutex_unlock(qdws->bo_handles_mutex); } whandle->stride = stride; return TRUE; @@ -728,7 +737,7 @@ static bool virgl_fence_wait(struct virgl_winsys *vws, struct virgl_hw_res *res = virgl_hw_res(fence); if (timeout == 0) - return virgl_drm_resource_is_busy(vdws, res); + return !virgl_drm_resource_is_busy(vdws, res); if (timeout != PIPE_TIMEOUT_INFINITE) { int64_t start_time = os_time_get(); @@ -858,7 +867,7 @@ virgl_drm_screen_create(int fd) virgl_screen(pscreen)->refcnt++; } else { struct virgl_winsys *vws; - int dup_fd = dup(fd); + int dup_fd = fcntl(fd, F_DUPFD_CLOEXEC, 3); vws = virgl_drm_winsys_create(dup_fd); -- cgit v1.2.3