diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2018-01-08 05:41:34 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2018-01-08 05:41:34 +0000 |
commit | c00801de923e125863aaf8180439d59d610b2517 (patch) | |
tree | e2896aa2785f3cf2151aeeb3c95fb5cc09a2fe02 /lib/mesa/src/gallium/winsys/svga/drm/vmw_fence.c | |
parent | be30e6efb92db21299b936c0e068e7088941e9c9 (diff) |
Revert to Mesa 13.0.6 again.
Corruption has again been reported on Intel hardware running Xorg with
the modesetting driver (which uses OpenGL based acceleration instead of
SNA acceleration the intel driver defaults to).
Reported in various forms on Sandy Bridge (X220), Ivy Bridge (X230) and
Haswell (X240). Confirmed to not occur with the intel driver but the
xserver was changed to default to the modesetting driver on >= gen4
hardware (except Ironlake).
One means of triggering this is to open a large pdf with xpdf on an
idle machine and highlight a section of the document.
There have been reports of gpu hangs on gen4 intel hardware
(T500 with GM45, X61 with 965GM) when starting Xorg as well.
Diffstat (limited to 'lib/mesa/src/gallium/winsys/svga/drm/vmw_fence.c')
-rw-r--r-- | lib/mesa/src/gallium/winsys/svga/drm/vmw_fence.c | 98 |
1 files changed, 17 insertions, 81 deletions
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_fence.c b/lib/mesa/src/gallium/winsys/svga/drm/vmw_fence.c index 061f588c8..bcf473a93 100644 --- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_fence.c +++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_fence.c @@ -22,8 +22,6 @@ * SOFTWARE. * **********************************************************/ -#include <libsync.h> - #include "util/u_memory.h" #include "util/u_atomic.h" #include "util/list.h" @@ -34,7 +32,7 @@ #include "vmw_screen.h" #include "vmw_fence.h" -struct vmw_fence_ops +struct vmw_fence_ops { /* * Immutable members. @@ -42,7 +40,7 @@ struct vmw_fence_ops struct pb_fence_ops base; struct vmw_winsys_screen *vws; - mtx_t mutex; + pipe_mutex mutex; /* * Protected by mutex; @@ -60,8 +58,6 @@ struct vmw_fence uint32_t mask; int32_t signalled; uint32_t seqno; - int32_t fence_fd; - boolean imported; /* TRUE if imported from another process */ }; /** @@ -105,10 +101,10 @@ vmw_fences_release(struct vmw_fence_ops *ops) { struct vmw_fence *fence, *n; - mtx_lock(&ops->mutex); + pipe_mutex_lock(ops->mutex); LIST_FOR_EACH_ENTRY_SAFE(fence, n, &ops->not_signaled, ops_list) LIST_DELINIT(&fence->ops_list); - mtx_unlock(&ops->mutex); + pipe_mutex_unlock(ops->mutex); } /** @@ -134,7 +130,7 @@ vmw_fences_signal(struct pb_fence_ops *fence_ops, return; ops = vmw_fence_ops(fence_ops); - mtx_lock(&ops->mutex); + pipe_mutex_lock(ops->mutex); if (!has_emitted) { emitted = ops->last_emitted; @@ -156,7 +152,7 @@ vmw_fences_signal(struct pb_fence_ops *fence_ops, ops->last_emitted = emitted; out_unlock: - mtx_unlock(&ops->mutex); + pipe_mutex_unlock(ops->mutex); } @@ -179,16 +175,15 @@ vmw_fence(struct pipe_fence_handle *fence) * @fence_ops: The fence_ops manager to register with. * @handle: Handle identifying the kernel fence object. * @mask: Mask of flags that this fence object may signal. - * @fd: File descriptor to associate with the fence * * Returns NULL on failure. */ struct pipe_fence_handle * vmw_fence_create(struct pb_fence_ops *fence_ops, uint32_t handle, - uint32_t seqno, uint32_t mask, int32_t fd) + uint32_t seqno, uint32_t mask) { struct vmw_fence *fence = CALLOC_STRUCT(vmw_fence); - struct vmw_fence_ops *ops = NULL; + struct vmw_fence_ops *ops = vmw_fence_ops(fence_ops); if (!fence) return NULL; @@ -197,21 +192,8 @@ vmw_fence_create(struct pb_fence_ops *fence_ops, uint32_t handle, fence->handle = handle; fence->mask = mask; fence->seqno = seqno; - fence->fence_fd = fd; p_atomic_set(&fence->signalled, 0); - - /* - * If the fence was not created by our device, then we won't - * manage it with our ops - */ - if (!fence_ops) { - fence->imported = true; - return (struct pipe_fence_handle *) fence; - } - - ops = vmw_fence_ops(fence_ops); - - mtx_lock(&ops->mutex); + pipe_mutex_lock(ops->mutex); if (vmw_fence_seq_is_signaled(seqno, ops->last_signaled, seqno)) { p_atomic_set(&fence->signalled, 1); @@ -221,28 +203,13 @@ vmw_fence_create(struct pb_fence_ops *fence_ops, uint32_t handle, LIST_ADDTAIL(&fence->ops_list, &ops->not_signaled); } - mtx_unlock(&ops->mutex); + pipe_mutex_unlock(ops->mutex); return (struct pipe_fence_handle *) fence; } /** - * vmw_fence_destroy - Frees a vmw fence object. - * - * Also closes the file handle associated with the object, if any - */ -static -void vmw_fence_destroy(struct vmw_fence *vfence) -{ - if (vfence->fence_fd != -1) - close(vfence->fence_fd); - - FREE(vfence); -} - - -/** * vmw_fence_reference - Reference / unreference a vmw fence object. * * @vws: Pointer to the winsys screen. @@ -260,15 +227,13 @@ vmw_fence_reference(struct vmw_winsys_screen *vws, if (p_atomic_dec_zero(&vfence->refcount)) { struct vmw_fence_ops *ops = vmw_fence_ops(vws->fence_ops); - if (!vfence->imported) { - vmw_ioctl_fence_unref(vws, vfence->handle); + vmw_ioctl_fence_unref(vws, vfence->handle); - mtx_lock(&ops->mutex); - LIST_DELINIT(&vfence->ops_list); - mtx_unlock(&ops->mutex); - } + pipe_mutex_lock(ops->mutex); + LIST_DELINIT(&vfence->ops_list); + pipe_mutex_unlock(ops->mutex); - vmw_fence_destroy(vfence); + FREE(vfence); } } @@ -335,7 +300,6 @@ vmw_fence_signalled(struct vmw_winsys_screen *vws, * * @vws: Pointer to the winsys screen. * @fence: Handle to the fence object. - * @timeout: How long to wait before timing out. * @flag: Fence flags to wait for. If the fence object can't signal * a flag, it is assumed to be already signaled. * @@ -344,7 +308,6 @@ vmw_fence_signalled(struct vmw_winsys_screen *vws, int vmw_fence_finish(struct vmw_winsys_screen *vws, struct pipe_fence_handle *fence, - uint64_t timeout, unsigned flag) { struct vmw_fence *vfence; @@ -356,16 +319,6 @@ vmw_fence_finish(struct vmw_winsys_screen *vws, return 0; vfence = vmw_fence(fence); - - if (vfence->imported) { - ret = sync_wait(vfence->fence_fd, timeout / 1000000); - - if (!ret) - p_atomic_set(&vfence->signalled, 1); - - return !!ret; - } - old = p_atomic_read(&vfence->signalled); vflags &= ~vfence->mask; @@ -386,23 +339,6 @@ vmw_fence_finish(struct vmw_winsys_screen *vws, return ret; } -/** - * vmw_fence_get_fd - * - * Returns the file descriptor associated with the fence - */ -int -vmw_fence_get_fd(struct pipe_fence_handle *fence) -{ - struct vmw_fence *vfence; - - if (!fence) - return -1; - - vfence = vmw_fence(fence); - return vfence->fence_fd; -} - /** * vmw_fence_ops_fence_reference - wrapper for the pb_fence_ops api. @@ -447,7 +383,7 @@ vmw_fence_ops_fence_finish(struct pb_fence_ops *ops, { struct vmw_winsys_screen *vws = vmw_fence_ops(ops)->vws; - return vmw_fence_finish(vws, fence, PIPE_TIMEOUT_INFINITE, flag); + return vmw_fence_finish(vws, fence, flag); } @@ -485,7 +421,7 @@ vmw_fence_ops_create(struct vmw_winsys_screen *vws) if(!ops) return NULL; - (void) mtx_init(&ops->mutex, mtx_plain); + pipe_mutex_init(ops->mutex); LIST_INITHEAD(&ops->not_signaled); ops->base.destroy = &vmw_fence_ops_destroy; ops->base.fence_reference = &vmw_fence_ops_fence_reference; |