summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharmaine Lee <[email protected]>2018-08-09 16:22:52 -0700
committerBrian Paul <[email protected]>2018-09-05 11:22:42 -0600
commitf4f39fa5d9692b60a555cec8d4537f05cc93c9ac (patch)
tree8adeb81719abcf8c4ae11d89966f1e2e1aca4aa6
parent16f17e3a3c1a2f171f882e09bb69ba09a86deb49 (diff)
winsys/drm: Fix assert when try to accumulate an invalid fd
This patch makes sure there is a valid fd before merging it to the context's fd in vmw_svga_winsys_fence_server_sync(). This fixes the assert running webot. No regression running kmscube. Reviewed-by: Sinclair Yeh <[email protected]>
-rw-r--r--src/gallium/winsys/svga/drm/vmw_screen_svga.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gallium/winsys/svga/drm/vmw_screen_svga.c b/src/gallium/winsys/svga/drm/vmw_screen_svga.c
index 7c80642b377..27a8b070166 100644
--- a/src/gallium/winsys/svga/drm/vmw_screen_svga.c
+++ b/src/gallium/winsys/svga/drm/vmw_screen_svga.c
@@ -158,8 +158,13 @@ vmw_svga_winsys_fence_server_sync(struct svga_winsys_screen *sws,
int32_t *context_fd,
struct pipe_fence_handle *fence)
{
- return sync_accumulate("vmwgfx", context_fd,
- sws->fence_get_fd(sws, fence, FALSE));
+ int32_t fd = sws->fence_get_fd(sws, fence, FALSE);
+
+ /* If we don't have fd, we don't need to merge fd into the context's fd. */
+ if (fd == -1)
+ return 0;
+
+ return sync_accumulate("vmwgfx", context_fd, fd);
}