[Mesa-dev] [PATCH 02/22] gallium: rename pipe fences to semaphores
Andres Rodriguez
andresx7 at gmail.com
Wed Jan 3 20:40:35 UTC 2018
On 2018-01-03 03:02 PM, Cherniak, Bruce wrote:
>
>> On Dec 21, 2017, at 6:41 PM, Andres Rodriguez <andresx7 at gmail.com> wrote:
>>
>> Rename fences -> semaphores in preparation for upgrading fence
>> functionality.
>>
>> This series renames the following symbols:
>> - pipe_fence_handle -> pipe_semaphore_handle
>> - fence_server_sync -> semaphore_server_sync
>> - create_fence_fd -> create_semaphore_fd
>> - fence_reference -> semaphore_reference
>> - fence_finish -> semaphore_finish
>> - fence_get_fd -> semaphore_get_fd
>> - PIPE_FLUSH_FENCE_FD -> PIPE_FLUSH_SEMAPHORE_FD
>> - PIPE_CAP_NATIVE_FENCE_FD -> PIPE_CAP_NATIVE_SEMAPHORE_FD
>>
>> This patch does not introduce any functionality changes.
>
> Hi Andres. This rename leaves the drivers in a weird mixed nomenclature between
> fence and semaphore. (ex, lp_screen.c below) Is there a plan to clean this up?
>
Hi Bruce,
I tried to minimize the changes to just the gallium interface for this
initial patch. Then once the series lands cleanup other mentions of
fences in local variables, driver functions, etc. that are harder to
catch with an automated approach.
My reasoning is that it helps me avoid a massive amount of conflicts
when I need to rebase this patch. And the rest of the series is still in
flux under review, so I don't want to be constantly carrying that headache.
Once everything settles with the rest of the series, expect a few more
patches to finalize the rename (that I hope will be merged quickly since
they won't have functional changes).
Regards,
Andres
>> Signed-off-by: Andres Rodriguez <andresx7 at gmail.com>
>> ---
>> src/gallium/auxiliary/pipebuffer/pb_buffer.h | 6 +-
>> .../auxiliary/pipebuffer/pb_buffer_fenced.c | 20 +++---
>> .../auxiliary/pipebuffer/pb_buffer_fenced.h | 14 ++--
>> .../auxiliary/pipebuffer/pb_buffer_malloc.c | 2 +-
>> src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c | 2 +-
>> src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c | 2 +-
>> src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c | 2 +-
>> .../auxiliary/pipebuffer/pb_bufmgr_ondemand.c | 2 +-
>> src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c | 2 +-
>> src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c | 2 +-
>> src/gallium/auxiliary/pipebuffer/pb_validate.c | 2 +-
>> src/gallium/auxiliary/pipebuffer/pb_validate.h | 4 +-
>> src/gallium/auxiliary/util/u_tests.c | 54 ++++++++--------
>> src/gallium/auxiliary/util/u_threaded_context.c | 36 +++++------
>> src/gallium/auxiliary/util/u_threaded_context.h | 10 +--
>> .../auxiliary/util/u_threaded_context_calls.h | 2 +-
>> src/gallium/docs/source/context.rst | 8 +--
>> src/gallium/drivers/ddebug/dd_draw.c | 24 +++----
>> src/gallium/drivers/ddebug/dd_pipe.h | 6 +-
>> src/gallium/drivers/ddebug/dd_screen.c | 18 +++---
>> src/gallium/drivers/etnaviv/etnaviv_context.c | 8 +--
>> src/gallium/drivers/etnaviv/etnaviv_fence.c | 38 +++++------
>> src/gallium/drivers/etnaviv/etnaviv_fence.h | 14 ++--
>> src/gallium/drivers/etnaviv/etnaviv_screen.c | 2 +-
>> src/gallium/drivers/freedreno/freedreno_batch.c | 4 +-
>> src/gallium/drivers/freedreno/freedreno_batch.h | 2 +-
>> src/gallium/drivers/freedreno/freedreno_context.c | 16 ++---
>> src/gallium/drivers/freedreno/freedreno_fence.c | 40 ++++++------
>> src/gallium/drivers/freedreno/freedreno_fence.h | 27 ++++----
>> src/gallium/drivers/freedreno/freedreno_gmem.c | 2 +-
>> src/gallium/drivers/freedreno/freedreno_screen.c | 8 +--
>> src/gallium/drivers/i915/i915_batch.h | 2 +-
>> src/gallium/drivers/i915/i915_flush.c | 4 +-
>> src/gallium/drivers/i915/i915_screen.c | 20 +++---
>> src/gallium/drivers/i915/i915_winsys.h | 16 ++---
>> src/gallium/drivers/llvmpipe/lp_context.c | 2 +-
>> src/gallium/drivers/llvmpipe/lp_fence.h | 2 +-
>> src/gallium/drivers/llvmpipe/lp_flush.c | 8 +--
>> src/gallium/drivers/llvmpipe/lp_flush.h | 4 +-
>> src/gallium/drivers/llvmpipe/lp_query.c | 2 +-
>> src/gallium/drivers/llvmpipe/lp_scene.c | 4 +-
>> src/gallium/drivers/llvmpipe/lp_screen.c | 18 +++---
>> src/gallium/drivers/llvmpipe/lp_setup.c | 12 ++--
>> src/gallium/drivers/llvmpipe/lp_setup.h | 4 +-
>> src/gallium/drivers/noop/noop_pipe.c | 16 ++---
>> src/gallium/drivers/nouveau/nouveau_fence.h | 2 +-
>> src/gallium/drivers/nouveau/nouveau_screen.c | 12 ++--
>> src/gallium/drivers/nouveau/nv30/nv30_context.c | 2 +-
>> src/gallium/drivers/nouveau/nv30/nv30_screen.c | 2 +-
>> src/gallium/drivers/nouveau/nv50/nv50_context.c | 2 +-
>> src/gallium/drivers/nouveau/nv50/nv50_screen.c | 2 +-
>> src/gallium/drivers/nouveau/nvc0/nvc0_context.c | 2 +-
>> src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 2 +-
>> src/gallium/drivers/r300/r300_context.c | 2 +-
>> src/gallium/drivers/r300/r300_context.h | 2 +-
>> src/gallium/drivers/r300/r300_flush.c | 8 +--
>> src/gallium/drivers/r300/r300_query.c | 2 +-
>> src/gallium/drivers/r300/r300_screen.c | 18 +++---
>> src/gallium/drivers/r600/r600_hw_context.c | 4 +-
>> src/gallium/drivers/r600/r600_pipe.c | 2 +-
>> src/gallium/drivers/r600/r600_pipe.h | 2 +-
>> src/gallium/drivers/r600/r600_pipe_common.c | 62 +++++++++---------
>> src/gallium/drivers/r600/r600_pipe_common.h | 6 +-
>> src/gallium/drivers/r600/r600_query.c | 6 +-
>> src/gallium/drivers/r600/radeon_vce.c | 2 +-
>> src/gallium/drivers/radeon/r600_pipe_common.c | 10 +--
>> src/gallium/drivers/radeon/r600_pipe_common.h | 6 +-
>> src/gallium/drivers/radeon/r600_query.c | 6 +-
>> src/gallium/drivers/radeon/radeon_vce.c | 2 +-
>> src/gallium/drivers/radeon/radeon_vcn_enc.c | 2 +-
>> src/gallium/drivers/radeon/radeon_winsys.h | 18 +++---
>> src/gallium/drivers/radeonsi/si_fence.c | 74 +++++++++++-----------
>> src/gallium/drivers/radeonsi/si_get.c | 2 +-
>> src/gallium/drivers/radeonsi/si_hw_context.c | 6 +-
>> src/gallium/drivers/radeonsi/si_pipe.c | 2 +-
>> src/gallium/drivers/radeonsi/si_pipe.h | 4 +-
>> src/gallium/drivers/rbug/rbug_context.c | 2 +-
>> src/gallium/drivers/rbug/rbug_screen.c | 18 +++---
>> src/gallium/drivers/softpipe/sp_fence.c | 14 ++--
>> src/gallium/drivers/softpipe/sp_flush.c | 10 +--
>> src/gallium/drivers/softpipe/sp_flush.h | 6 +-
>> src/gallium/drivers/softpipe/sp_screen.c | 2 +-
>> src/gallium/drivers/svga/svga_context.c | 16 ++---
>> src/gallium/drivers/svga/svga_context.h | 2 +-
>> src/gallium/drivers/svga/svga_pipe_flush.c | 24 +++----
>> src/gallium/drivers/svga/svga_pipe_query.c | 16 ++---
>> src/gallium/drivers/svga/svga_resource_texture.c | 8 +--
>> src/gallium/drivers/svga/svga_screen.c | 28 ++++----
>> src/gallium/drivers/svga/svga_screen_cache.c | 6 +-
>> src/gallium/drivers/svga/svga_screen_cache.h | 4 +-
>> src/gallium/drivers/svga/svga_winsys.h | 26 ++++----
>> src/gallium/drivers/swr/swr_context.cpp | 4 +-
>> src/gallium/drivers/swr/swr_draw.cpp | 12 ++--
>> src/gallium/drivers/swr/swr_fence.cpp | 22 +++----
>> src/gallium/drivers/swr/swr_fence.h | 20 +++---
>> src/gallium/drivers/swr/swr_fence_work.cpp | 10 +--
>> src/gallium/drivers/swr/swr_fence_work.h | 8 +--
>> src/gallium/drivers/swr/swr_query.cpp | 10 +--
>> src/gallium/drivers/swr/swr_query.h | 2 +-
>> src/gallium/drivers/swr/swr_screen.cpp | 10 +--
>> src/gallium/drivers/swr/swr_screen.h | 2 +-
>> src/gallium/drivers/swr/swr_state.cpp | 2 +-
>> src/gallium/drivers/trace/tr_context.c | 2 +-
>> src/gallium/drivers/trace/tr_screen.c | 24 +++----
>> src/gallium/drivers/vc4/vc4_context.c | 6 +-
>> src/gallium/drivers/vc4/vc4_fence.c | 14 ++--
>> src/gallium/drivers/vc4/vc4_screen.c | 2 +-
>> src/gallium/drivers/vc5/vc5_context.c | 6 +-
>> src/gallium/drivers/vc5/vc5_fence.c | 14 ++--
>> src/gallium/drivers/vc5/vc5_screen.c | 2 +-
>> src/gallium/drivers/virgl/virgl_context.c | 2 +-
>> src/gallium/drivers/virgl/virgl_screen.c | 18 +++---
>> src/gallium/drivers/virgl/virgl_winsys.h | 12 ++--
>> src/gallium/include/pipe/p_context.h | 18 +++---
>> src/gallium/include/pipe/p_defines.h | 4 +-
>> src/gallium/include/pipe/p_screen.h | 28 ++++----
>> src/gallium/include/pipe/p_video_codec.h | 2 +-
>> src/gallium/include/state_tracker/opencl_interop.h | 2 +-
>> src/gallium/include/state_tracker/st_api.h | 4 +-
>> src/gallium/state_trackers/clover/api/interop.cpp | 2 +-
>> src/gallium/state_trackers/clover/core/event.cpp | 10 +--
>> src/gallium/state_trackers/clover/core/event.hpp | 8 +--
>> src/gallium/state_trackers/clover/core/queue.cpp | 4 +-
>> src/gallium/state_trackers/dri/dri2.c | 6 +-
>> src/gallium/state_trackers/dri/dri_drawable.c | 22 +++----
>> src/gallium/state_trackers/dri/dri_drawable.h | 2 +-
>> src/gallium/state_trackers/dri/dri_helpers.c | 20 +++---
>> src/gallium/state_trackers/glx/xlib/xm_api.c | 6 +-
>> src/gallium/state_trackers/nine/swapchain9.c | 38 +++++------
>> src/gallium/state_trackers/nine/swapchain9.h | 2 +-
>> src/gallium/state_trackers/vdpau/output.c | 2 +-
>> src/gallium/state_trackers/vdpau/presentation.c | 10 +--
>> src/gallium/state_trackers/vdpau/vdpau_private.h | 2 +-
>> src/gallium/state_trackers/wgl/stw_context.c | 2 +-
>> src/gallium/state_trackers/xa/xa_context.c | 10 +--
>> src/gallium/state_trackers/xa/xa_priv.h | 4 +-
>> src/gallium/state_trackers/xvmc/surface.c | 4 +-
>> src/gallium/state_trackers/xvmc/xvmc_private.h | 4 +-
>> src/gallium/tools/trace/dump_state.py | 4 +-
>> src/gallium/winsys/amdgpu/drm/amdgpu_bo.c | 12 ++--
>> src/gallium/winsys/amdgpu/drm/amdgpu_bo.h | 2 +-
>> src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 66 +++++++++----------
>> src/gallium/winsys/amdgpu/drm/amdgpu_cs.h | 16 ++---
>> src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c | 4 +-
>> src/gallium/winsys/i915/drm/i915_drm_fence.c | 20 +++---
>> src/gallium/winsys/i915/drm/i915_drm_winsys.h | 2 +-
>> src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 42 ++++++------
>> src/gallium/winsys/radeon/drm/radeon_drm_cs.h | 4 +-
>> .../winsys/svga/drm/pb_buffer_simple_fenced.c | 20 +++---
>> src/gallium/winsys/svga/drm/vmw_buffer.c | 2 +-
>> src/gallium/winsys/svga/drm/vmw_context.c | 8 +--
>> src/gallium/winsys/svga/drm/vmw_fence.c | 60 +++++++++---------
>> src/gallium/winsys/svga/drm/vmw_fence.h | 18 +++---
>> src/gallium/winsys/svga/drm/vmw_screen.h | 4 +-
>> src/gallium/winsys/svga/drm/vmw_screen_ioctl.c | 6 +-
>> src/gallium/winsys/svga/drm/vmw_screen_svga.c | 40 ++++++------
>> src/gallium/winsys/virgl/drm/virgl_drm_winsys.c | 14 ++--
>> src/gallium/winsys/virgl/drm/virgl_drm_winsys.h | 4 +-
>> .../winsys/virgl/vtest/virgl_vtest_winsys.c | 14 ++--
>> .../winsys/virgl/vtest/virgl_vtest_winsys.h | 4 +-
>> src/mesa/drivers/dri/i915/intel_syncobj.c | 6 +-
>> src/mesa/drivers/dri/i965/brw_sync.c | 10 +--
>> src/mesa/state_tracker/st_cb_flush.c | 8 +--
>> src/mesa/state_tracker/st_cb_flush.h | 4 +-
>> src/mesa/state_tracker/st_cb_syncobj.c | 26 ++++----
>> src/mesa/state_tracker/st_extensions.c | 2 +-
>> src/mesa/state_tracker/st_manager.c | 8 +--
>> 167 files changed, 899 insertions(+), 900 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
>> index 33c2306..011dd8f 100644
>> --- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h
>> +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
>> @@ -57,7 +57,7 @@ extern "C" {
>>
>> struct pb_vtbl;
>> struct pb_validate;
>> -struct pipe_fence_handle;
>> +struct pipe_semaphore_handle;
>>
>>
>> #define PB_USAGE_CPU_READ (1 << 0)
>> @@ -135,7 +135,7 @@ struct pb_vtbl
>> unsigned flags );
>>
>> void (*fence)( struct pb_buffer *buf,
>> - struct pipe_fence_handle *fence );
>> + struct pipe_semaphore_handle *fence );
>>
>> /**
>> * Get the base buffer and the offset.
>> @@ -212,7 +212,7 @@ pb_validate(struct pb_buffer *buf, struct pb_validate *vl, unsigned flags)
>>
>>
>> static inline void
>> -pb_fence(struct pb_buffer *buf, struct pipe_fence_handle *fence)
>> +pb_fence(struct pb_buffer *buf, struct pipe_semaphore_handle *fence)
>> {
>> assert(buf);
>> if (!buf)
>> diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
>> index 7421741..d04405c 100644
>> --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
>> +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
>> @@ -146,7 +146,7 @@ struct fenced_buffer
>> struct pb_validate *vl;
>> unsigned validation_flags;
>>
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>> };
>>
>>
>> @@ -299,7 +299,7 @@ fenced_buffer_remove_locked(struct fenced_manager *fenced_mgr,
>> assert(fenced_buf->fence);
>> assert(fenced_buf->mgr == fenced_mgr);
>>
>> - ops->fence_reference(ops, &fenced_buf->fence, NULL);
>> + ops->semaphore_reference(ops, &fenced_buf->fence, NULL);
>> fenced_buf->flags &= ~PB_USAGE_GPU_READ_WRITE;
>>
>> assert(fenced_buf->head.prev);
>> @@ -342,15 +342,15 @@ fenced_buffer_finish_locked(struct fenced_manager *fenced_mgr,
>> assert(fenced_buf->fence);
>>
>> if (fenced_buf->fence) {
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>> int finished;
>> boolean proceed;
>>
>> - ops->fence_reference(ops, &fence, fenced_buf->fence);
>> + ops->semaphore_reference(ops, &fence, fenced_buf->fence);
>>
>> mtx_unlock(&fenced_mgr->mutex);
>>
>> - finished = ops->fence_finish(ops, fenced_buf->fence, 0);
>> + finished = ops->semaphore_finish(ops, fenced_buf->fence, 0);
>>
>> mtx_lock(&fenced_mgr->mutex);
>>
>> @@ -362,7 +362,7 @@ fenced_buffer_finish_locked(struct fenced_manager *fenced_mgr,
>> */
>> proceed = fence == fenced_buf->fence ? TRUE : FALSE;
>>
>> - ops->fence_reference(ops, &fence, NULL);
>> + ops->semaphore_reference(ops, &fence, NULL);
>>
>> if (proceed && finished == 0) {
>> /* Remove from the fenced list. */
>> @@ -395,7 +395,7 @@ fenced_manager_check_signalled_locked(struct fenced_manager *fenced_mgr,
>> struct pb_fence_ops *ops = fenced_mgr->ops;
>> struct list_head *curr, *next;
>> struct fenced_buffer *fenced_buf;
>> - struct pipe_fence_handle *prev_fence = NULL;
>> + struct pipe_semaphore_handle *prev_fence = NULL;
>> boolean ret = FALSE;
>>
>> curr = fenced_mgr->fenced.next;
>> @@ -407,7 +407,7 @@ fenced_manager_check_signalled_locked(struct fenced_manager *fenced_mgr,
>> int signaled;
>>
>> if (wait) {
>> - signaled = ops->fence_finish(ops, fenced_buf->fence, 0);
>> + signaled = ops->semaphore_finish(ops, fenced_buf->fence, 0);
>>
>> /* Don't return just now. Instead preemptively check if the
>> * following buffers' fences already expired, without further waits.
>> @@ -810,7 +810,7 @@ fenced_buffer_validate(struct pb_buffer *buf,
>>
>> static void
>> fenced_buffer_fence(struct pb_buffer *buf,
>> - struct pipe_fence_handle *fence)
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct fenced_buffer *fenced_buf = fenced_buffer(buf);
>> struct fenced_manager *fenced_mgr = fenced_buf->mgr;
>> @@ -830,7 +830,7 @@ fenced_buffer_fence(struct pb_buffer *buf,
>> assert(!destroyed);
>> }
>> if (fence) {
>> - ops->fence_reference(ops, &fenced_buf->fence, fence);
>> + ops->semaphore_reference(ops, &fenced_buf->fence, fence);
>> fenced_buf->flags |= fenced_buf->validation_flags;
>> fenced_buffer_add_locked(fenced_mgr, fenced_buf);
>> }
>> diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h
>> index afd35b3..e894e58 100644
>> --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h
>> +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h
>> @@ -59,7 +59,7 @@ extern "C" {
>> #endif
>>
>>
>> -struct pipe_fence_handle;
>> +struct pipe_semaphore_handle;
>>
>>
>> /**
>> @@ -73,9 +73,9 @@ struct pb_fence_ops
>> void (*destroy)( struct pb_fence_ops *ops );
>>
>> /** Set ptr = fence, with reference counting */
>> - void (*fence_reference)( struct pb_fence_ops *ops,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *fence );
>> + void (*semaphore_reference)( struct pb_fence_ops *ops,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *fence );
>>
>> /**
>> * Checks whether the fence has been signalled.
>> @@ -83,7 +83,7 @@ struct pb_fence_ops
>> * \return zero on success.
>> */
>> int (*fence_signalled)( struct pb_fence_ops *ops,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> unsigned flag );
>>
>> /**
>> @@ -91,8 +91,8 @@ struct pb_fence_ops
>> * \param flags driver-specific meaning
>> * \return zero on success.
>> */
>> - int (*fence_finish)( struct pb_fence_ops *ops,
>> - struct pipe_fence_handle *fence,
>> + int (*semaphore_finish)( struct pb_fence_ops *ops,
>> + struct pipe_semaphore_handle *fence,
>> unsigned flag );
>> };
>>
>> diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
>> index ea2f2fa..8dca3c7 100644
>> --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
>> +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
>> @@ -96,7 +96,7 @@ malloc_buffer_validate(struct pb_buffer *buf,
>>
>> static void
>> malloc_buffer_fence(struct pb_buffer *buf,
>> - struct pipe_fence_handle *fence)
>> + struct pipe_semaphore_handle *fence)
>> {
>> assert(0);
>> }
>> diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
>> index 24831f6..cacef3f 100644
>> --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
>> +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
>> @@ -149,7 +149,7 @@ pb_cache_buffer_validate(struct pb_buffer *_buf,
>>
>> static void
>> pb_cache_buffer_fence(struct pb_buffer *_buf,
>> - struct pipe_fence_handle *fence)
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct pb_cache_buffer *buf = pb_cache_buffer(_buf);
>> pb_fence(buf->buffer, fence);
>> diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
>> index 3c83de8..054656c 100644
>> --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
>> +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
>> @@ -319,7 +319,7 @@ pb_debug_buffer_validate(struct pb_buffer *_buf,
>>
>> static void
>> pb_debug_buffer_fence(struct pb_buffer *_buf,
>> - struct pipe_fence_handle *fence)
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct pb_debug_buffer *buf = pb_debug_buffer(_buf);
>> pb_fence(buf->buffer, fence);
>> diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
>> index 818cadd..6191a9d 100644
>> --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
>> +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
>> @@ -140,7 +140,7 @@ mm_buffer_validate(struct pb_buffer *buf,
>>
>> static void
>> mm_buffer_fence(struct pb_buffer *buf,
>> - struct pipe_fence_handle *fence)
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct mm_buffer *mm_buf = mm_buffer(buf);
>> struct mm_pb_manager *mm = mm_buf->mgr;
>> diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c
>> index 4885d68..f2fc5b7 100644
>> --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c
>> +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c
>> @@ -191,7 +191,7 @@ pb_ondemand_buffer_validate(struct pb_buffer *_buf,
>>
>> static void
>> pb_ondemand_buffer_fence(struct pb_buffer *_buf,
>> - struct pipe_fence_handle *fence)
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct pb_ondemand_buffer *buf = pb_ondemand_buffer(_buf);
>>
>> diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
>> index 89df2e9..b369cad 100644
>> --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
>> +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
>> @@ -153,7 +153,7 @@ pool_buffer_validate(struct pb_buffer *buf,
>>
>> static void
>> pool_buffer_fence(struct pb_buffer *buf,
>> - struct pipe_fence_handle *fence)
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct pool_buffer *pool_buf = pool_buffer(buf);
>> struct pool_pb_manager *pool = pool_buf->mgr;
>> diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
>> index 5cf7071..8a856aa 100644
>> --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
>> +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
>> @@ -261,7 +261,7 @@ pb_slab_buffer_validate(struct pb_buffer *_buf,
>>
>> static void
>> pb_slab_buffer_fence(struct pb_buffer *_buf,
>> - struct pipe_fence_handle *fence)
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct pb_slab_buffer *buf = pb_slab_buffer(_buf);
>> pb_fence(buf->slab->bo, fence);
>> diff --git a/src/gallium/auxiliary/pipebuffer/pb_validate.c b/src/gallium/auxiliary/pipebuffer/pb_validate.c
>> index 8489842..957ed42 100644
>> --- a/src/gallium/auxiliary/pipebuffer/pb_validate.c
>> +++ b/src/gallium/auxiliary/pipebuffer/pb_validate.c
>> @@ -149,7 +149,7 @@ pb_validate_validate(struct pb_validate *vl)
>>
>> void
>> pb_validate_fence(struct pb_validate *vl,
>> - struct pipe_fence_handle *fence)
>> + struct pipe_semaphore_handle *fence)
>> {
>> unsigned i;
>> for(i = 0; i < vl->used; ++i) {
>> diff --git a/src/gallium/auxiliary/pipebuffer/pb_validate.h b/src/gallium/auxiliary/pipebuffer/pb_validate.h
>> index fa788b0..20fc666 100644
>> --- a/src/gallium/auxiliary/pipebuffer/pb_validate.h
>> +++ b/src/gallium/auxiliary/pipebuffer/pb_validate.h
>> @@ -45,7 +45,7 @@ extern "C" {
>>
>>
>> struct pb_buffer;
>> -struct pipe_fence_handle;
>> +struct pipe_semaphore_handle;
>>
>>
>> /**
>> @@ -81,7 +81,7 @@ pb_validate_validate(struct pb_validate *vl);
>> */
>> void
>> pb_validate_fence(struct pb_validate *vl,
>> - struct pipe_fence_handle *fence);
>> + struct pipe_semaphore_handle *fence);
>>
>> struct pb_validate *
>> pb_validate_create(void);
>> diff --git a/src/gallium/auxiliary/util/u_tests.c b/src/gallium/auxiliary/util/u_tests.c
>> index 6e0d84f..4048160 100644
>> --- a/src/gallium/auxiliary/util/u_tests.c
>> +++ b/src/gallium/auxiliary/util/u_tests.c
>> @@ -504,7 +504,7 @@ test_sync_file_fences(struct pipe_context *ctx)
>> bool pass = true;
>> enum pipe_fd_type fd_type = PIPE_FD_TYPE_NATIVE_SYNC;
>>
>> - if (!screen->get_param(screen, PIPE_CAP_NATIVE_FENCE_FD))
>> + if (!screen->get_param(screen, PIPE_CAP_NATIVE_SEMAPHORE_FD))
>> return;
>>
>> struct cso_context *cso = cso_create_context(ctx, 0);
>> @@ -512,22 +512,22 @@ test_sync_file_fences(struct pipe_context *ctx)
>> pipe_buffer_create(screen, 0, PIPE_USAGE_DEFAULT, 1024 * 1024);
>> struct pipe_resource *tex =
>> util_create_texture2d(screen, 4096, 1024, PIPE_FORMAT_R8_UNORM);
>> - struct pipe_fence_handle *buf_fence = NULL, *tex_fence = NULL;
>> + struct pipe_semaphore_handle *buf_fence = NULL, *tex_fence = NULL;
>>
>> /* Run 2 clears, get fencess. */
>> uint32_t value = 0;
>> ctx->clear_buffer(ctx, buf, 0, buf->width0, &value, sizeof(value));
>> - ctx->flush(ctx, &buf_fence, PIPE_FLUSH_FENCE_FD);
>> + ctx->flush(ctx, &buf_fence, PIPE_FLUSH_SEMAPHORE_FD);
>>
>> struct pipe_box box;
>> u_box_2d(0, 0, tex->width0, tex->height0, &box);
>> ctx->clear_texture(ctx, tex, 0, &box, &value);
>> - ctx->flush(ctx, &tex_fence, PIPE_FLUSH_FENCE_FD);
>> + ctx->flush(ctx, &tex_fence, PIPE_FLUSH_SEMAPHORE_FD);
>> pass = pass && buf_fence && tex_fence;
>>
>> /* Export fences. */
>> - int buf_fd = screen->fence_get_fd(screen, buf_fence);
>> - int tex_fd = screen->fence_get_fd(screen, tex_fence);
>> + int buf_fd = screen->semaphore_get_fd(screen, buf_fence);
>> + int tex_fd = screen->semaphore_get_fd(screen, tex_fence);
>> pass = pass && buf_fd >= 0 && tex_fd >= 0;
>>
>> /* Merge fences. */
>> @@ -535,23 +535,23 @@ test_sync_file_fences(struct pipe_context *ctx)
>> pass = pass && merged_fd >= 0;
>>
>> /* (Re)import all fences. */
>> - struct pipe_fence_handle *re_buf_fence = NULL, *re_tex_fence = NULL;
>> - struct pipe_fence_handle *merged_fence = NULL;
>> - ctx->create_fence_fd(ctx, &re_buf_fence, buf_fd, fd_type);
>> - ctx->create_fence_fd(ctx, &re_tex_fence, tex_fd, fd_type);
>> - ctx->create_fence_fd(ctx, &merged_fence, merged_fd, fd_type);
>> + struct pipe_semaphore_handle *re_buf_fence = NULL, *re_tex_fence = NULL;
>> + struct pipe_semaphore_handle *merged_fence = NULL;
>> + ctx->create_semaphore_fd(ctx, &re_buf_fence, buf_fd, fd_type);
>> + ctx->create_semaphore_fd(ctx, &re_tex_fence, tex_fd, fd_type);
>> + ctx->create_semaphore_fd(ctx, &merged_fence, merged_fd, fd_type);
>> pass = pass && re_buf_fence && re_tex_fence && merged_fence;
>>
>> /* Run another clear after waiting for everything. */
>> - struct pipe_fence_handle *final_fence = NULL;
>> - ctx->fence_server_sync(ctx, merged_fence);
>> + struct pipe_semaphore_handle *final_fence = NULL;
>> + ctx->semaphore_server_sync(ctx, merged_fence);
>> value = 0xff;
>> ctx->clear_buffer(ctx, buf, 0, buf->width0, &value, sizeof(value));
>> - ctx->flush(ctx, &final_fence, PIPE_FLUSH_FENCE_FD);
>> + ctx->flush(ctx, &final_fence, PIPE_FLUSH_SEMAPHORE_FD);
>> pass = pass && final_fence;
>>
>> /* Wait for the last fence. */
>> - int final_fd = screen->fence_get_fd(screen, final_fence);
>> + int final_fd = screen->semaphore_get_fd(screen, final_fence);
>> pass = pass && final_fd >= 0;
>> pass = pass && sync_wait(final_fd, -1) == 0;
>>
>> @@ -560,12 +560,12 @@ test_sync_file_fences(struct pipe_context *ctx)
>> pass = pass && sync_wait(tex_fd, 0) == 0;
>> pass = pass && sync_wait(merged_fd, 0) == 0;
>>
>> - pass = pass && screen->fence_finish(screen, NULL, buf_fence, 0);
>> - pass = pass && screen->fence_finish(screen, NULL, tex_fence, 0);
>> - pass = pass && screen->fence_finish(screen, NULL, re_buf_fence, 0);
>> - pass = pass && screen->fence_finish(screen, NULL, re_tex_fence, 0);
>> - pass = pass && screen->fence_finish(screen, NULL, merged_fence, 0);
>> - pass = pass && screen->fence_finish(screen, NULL, final_fence, 0);
>> + pass = pass && screen->semaphore_finish(screen, NULL, buf_fence, 0);
>> + pass = pass && screen->semaphore_finish(screen, NULL, tex_fence, 0);
>> + pass = pass && screen->semaphore_finish(screen, NULL, re_buf_fence, 0);
>> + pass = pass && screen->semaphore_finish(screen, NULL, re_tex_fence, 0);
>> + pass = pass && screen->semaphore_finish(screen, NULL, merged_fence, 0);
>> + pass = pass && screen->semaphore_finish(screen, NULL, final_fence, 0);
>>
>> /* Cleanup. */
>> #ifndef PIPE_OS_WINDOWS
>> @@ -579,12 +579,12 @@ test_sync_file_fences(struct pipe_context *ctx)
>> close(final_fd);
>> #endif
>>
>> - screen->fence_reference(screen, &buf_fence, NULL);
>> - screen->fence_reference(screen, &tex_fence, NULL);
>> - screen->fence_reference(screen, &re_buf_fence, NULL);
>> - screen->fence_reference(screen, &re_tex_fence, NULL);
>> - screen->fence_reference(screen, &merged_fence, NULL);
>> - screen->fence_reference(screen, &final_fence, NULL);
>> + screen->semaphore_reference(screen, &buf_fence, NULL);
>> + screen->semaphore_reference(screen, &tex_fence, NULL);
>> + screen->semaphore_reference(screen, &re_buf_fence, NULL);
>> + screen->semaphore_reference(screen, &re_tex_fence, NULL);
>> + screen->semaphore_reference(screen, &merged_fence, NULL);
>> + screen->semaphore_reference(screen, &final_fence, NULL);
>>
>> cso_destroy_context(cso);
>> pipe_resource_reference(&buf, NULL);
>> diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
>> index 3ea1797..ab37055 100644
>> --- a/src/gallium/auxiliary/util/u_threaded_context.c
>> +++ b/src/gallium/auxiliary/util/u_threaded_context.c
>> @@ -223,10 +223,10 @@ _tc_sync(struct threaded_context *tc, MAYBE_UNUSED const char *info, MAYBE_UNUSE
>> #define tc_sync_msg(tc, info) _tc_sync(tc, info, __func__)
>>
>> /**
>> - * Call this from fence_finish for same-context fence waits of deferred fences
>> + * Call this from semaphore_finish for same-context fence waits of deferred fences
>> * that haven't been flushed yet.
>> *
>> - * The passed pipe_context must be the one passed to pipe_screen::fence_finish,
>> + * The passed pipe_context must be the one passed to pipe_screen::semaphore_finish,
>> * i.e., the wrapped one.
>> */
>> void
>> @@ -1834,34 +1834,34 @@ tc_set_log_context(struct pipe_context *_pipe, struct u_log_context *log)
>> }
>>
>> static void
>> -tc_create_fence_fd(struct pipe_context *_pipe,
>> - struct pipe_fence_handle **fence, int fd,
>> +tc_create_semaphore_fd(struct pipe_context *_pipe,
>> + struct pipe_semaphore_handle **fence, int fd,
>> enum pipe_fd_type type)
>> {
>> struct threaded_context *tc = threaded_context(_pipe);
>> struct pipe_context *pipe = tc->pipe;
>>
>> tc_sync(tc);
>> - pipe->create_fence_fd(pipe, fence, fd, type);
>> + pipe->create_semaphore_fd(pipe, fence, fd, type);
>> }
>>
>> static void
>> -tc_call_fence_server_sync(struct pipe_context *pipe, union tc_payload *payload)
>> +tc_call_semaphore_server_sync(struct pipe_context *pipe, union tc_payload *payload)
>> {
>> - pipe->fence_server_sync(pipe, payload->fence);
>> - pipe->screen->fence_reference(pipe->screen, &payload->fence, NULL);
>> + pipe->semaphore_server_sync(pipe, payload->fence);
>> + pipe->screen->semaphore_reference(pipe->screen, &payload->fence, NULL);
>> }
>>
>> static void
>> -tc_fence_server_sync(struct pipe_context *_pipe,
>> - struct pipe_fence_handle *fence)
>> +tc_semaphore_server_sync(struct pipe_context *_pipe,
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct threaded_context *tc = threaded_context(_pipe);
>> struct pipe_screen *screen = tc->pipe->screen;
>> - union tc_payload *payload = tc_add_small_call(tc, TC_CALL_fence_server_sync);
>> + union tc_payload *payload = tc_add_small_call(tc, TC_CALL_semaphore_server_sync);
>>
>> payload->fence = NULL;
>> - screen->fence_reference(screen, &payload->fence, fence);
>> + screen->semaphore_reference(screen, &payload->fence, fence);
>> }
>>
>> static struct pipe_video_codec *
>> @@ -1887,7 +1887,7 @@ tc_create_video_buffer(UNUSED struct pipe_context *_pipe,
>>
>> struct tc_flush_payload {
>> struct threaded_context *tc;
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>> unsigned flags;
>> };
>>
>> @@ -1913,14 +1913,14 @@ tc_call_flush(struct pipe_context *pipe, union tc_payload *payload)
>> struct pipe_screen *screen = pipe->screen;
>>
>> pipe->flush(pipe, p->fence ? &p->fence : NULL, p->flags);
>> - screen->fence_reference(screen, &p->fence, NULL);
>> + screen->semaphore_reference(screen, &p->fence, NULL);
>>
>> if (!(p->flags & PIPE_FLUSH_DEFERRED))
>> tc_flush_queries(p->tc);
>> }
>>
>> static void
>> -tc_flush(struct pipe_context *_pipe, struct pipe_fence_handle **fence,
>> +tc_flush(struct pipe_context *_pipe, struct pipe_semaphore_handle **fence,
>> unsigned flags)
>> {
>> struct threaded_context *tc = threaded_context(_pipe);
>> @@ -1953,7 +1953,7 @@ tc_flush(struct pipe_context *_pipe, struct pipe_fence_handle **fence,
>> next->token->tc = tc;
>> }
>>
>> - screen->fence_reference(screen, fence, tc->create_fence(pipe, next->token));
>> + screen->semaphore_reference(screen, fence, tc->create_fence(pipe, next->token));
>> if (!*fence)
>> goto out_of_memory;
>> }
>> @@ -2660,8 +2660,8 @@ threaded_context_create(struct pipe_context *pipe,
>> CTX_INIT(set_log_context);
>> CTX_INIT(emit_string_marker);
>> CTX_INIT(set_debug_callback);
>> - CTX_INIT(create_fence_fd);
>> - CTX_INIT(fence_server_sync);
>> + CTX_INIT(create_semaphore_fd);
>> + CTX_INIT(semaphore_server_sync);
>> CTX_INIT(get_timestamp);
>> CTX_INIT(create_texture_handle);
>> CTX_INIT(delete_texture_handle);
>> diff --git a/src/gallium/auxiliary/util/u_threaded_context.h b/src/gallium/auxiliary/util/u_threaded_context.h
>> index 53c5a7e..963689c 100644
>> --- a/src/gallium/auxiliary/util/u_threaded_context.h
>> +++ b/src/gallium/auxiliary/util/u_threaded_context.h
>> @@ -32,7 +32,7 @@
>> * ---------------------------------------------------
>> *
>> * 1) pipe_context is wrapped. pipe_screen isn't wrapped. All pipe_screen
>> - * driver functions that take a context (fence_finish, texture_get_handle)
>> + * driver functions that take a context (semaphore_finish, texture_get_handle)
>> * should manually unwrap pipe_context by doing:
>> * pipe = threaded_context_unwrap_sync(pipe);
>> *
>> @@ -123,11 +123,11 @@
>> * in a thread-safe way because it is called from a non-driver thread.
>> *
>> * If the threaded_context does not immediately flush the current batch, the
>> - * callback also receives a tc_unflushed_batch_token. If fence_finish is called
>> + * callback also receives a tc_unflushed_batch_token. If semaphore_finish is called
>> * on the returned fence in the context that created the fence,
>> * threaded_context_flush must be called.
>> *
>> - * The driver must implement pipe_context::fence_server_sync properly, since
>> + * The driver must implement pipe_context::semaphore_server_sync properly, since
>> * the threaded context handles PIPE_FLUSH_ASYNC.
>> *
>> *
>> @@ -235,7 +235,7 @@ struct tc_unflushed_batch_token;
>> typedef void (*tc_replace_buffer_storage_func)(struct pipe_context *ctx,
>> struct pipe_resource *dst,
>> struct pipe_resource *src);
>> -typedef struct pipe_fence_handle *(*tc_create_fence_func)(struct pipe_context *ctx,
>> +typedef struct pipe_semaphore_handle *(*tc_create_fence_func)(struct pipe_context *ctx,
>> struct tc_unflushed_batch_token *token);
>>
>> struct threaded_resource {
>> @@ -309,7 +309,7 @@ union tc_payload {
>> struct pipe_query *query;
>> struct pipe_resource *resource;
>> struct pipe_transfer *transfer;
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>> uint64_t handle;
>> };
>>
>> diff --git a/src/gallium/auxiliary/util/u_threaded_context_calls.h b/src/gallium/auxiliary/util/u_threaded_context_calls.h
>> index 675deaa..f5e90fd 100644
>> --- a/src/gallium/auxiliary/util/u_threaded_context_calls.h
>> +++ b/src/gallium/auxiliary/util/u_threaded_context_calls.h
>> @@ -1,6 +1,6 @@
>> CALL(flush)
>> CALL(callback)
>> -CALL(fence_server_sync)
>> +CALL(semaphore_server_sync)
>> CALL(destroy_query)
>> CALL(begin_query)
>> CALL(end_query)
>> diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst
>> index 0ac7340..399b390 100644
>> --- a/src/gallium/docs/source/context.rst
>> +++ b/src/gallium/docs/source/context.rst
>> @@ -527,16 +527,16 @@ Flushing
>> PIPE_FLUSH_END_OF_FRAME: Whether the flush marks the end of frame.
>>
>> PIPE_FLUSH_DEFERRED: It is not required to flush right away, but it is required
>> -to return a valid fence. If fence_finish is called with the returned fence
>> -and the context is still unflushed, and the ctx parameter of fence_finish is
>> -equal to the context where the fence was created, fence_finish will flush
>> +to return a valid fence. If semaphore_finish is called with the returned fence
>> +and the context is still unflushed, and the ctx parameter of semaphore_finish is
>> +equal to the context where the fence was created, semaphore_finish will flush
>> the context.
>>
>> PIPE_FLUSH_ASYNC: The flush is allowed to be asynchronous. Unlike
>> ``PIPE_FLUSH_DEFERRED``, the driver must still ensure that the returned fence
>> will finish in finite time. However, subsequent operations in other contexts of
>> the same screen are no longer guaranteed to happen after the flush. Drivers
>> -which use this flag must implement pipe_context::fence_server_sync.
>> +which use this flag must implement pipe_context::semaphore_server_sync.
>>
>> PIPE_FLUSH_HINT_FINISH: Hints to the driver that the caller will immediately
>> wait for the returned fence.
>> diff --git a/src/gallium/drivers/ddebug/dd_draw.c b/src/gallium/drivers/ddebug/dd_draw.c
>> index c404ea0..47c9863 100644
>> --- a/src/gallium/drivers/ddebug/dd_draw.c
>> +++ b/src/gallium/drivers/ddebug/dd_draw.c
>> @@ -860,9 +860,9 @@ dd_free_record(struct pipe_screen *screen, struct dd_draw_record *record)
>> u_log_page_destroy(record->log_page);
>> dd_unreference_copy_of_call(&record->call);
>> dd_unreference_copy_of_draw_state(&record->draw_state);
>> - screen->fence_reference(screen, &record->prev_bottom_of_pipe, NULL);
>> - screen->fence_reference(screen, &record->top_of_pipe, NULL);
>> - screen->fence_reference(screen, &record->bottom_of_pipe, NULL);
>> + screen->semaphore_reference(screen, &record->prev_bottom_of_pipe, NULL);
>> + screen->semaphore_reference(screen, &record->top_of_pipe, NULL);
>> + screen->semaphore_reference(screen, &record->bottom_of_pipe, NULL);
>> util_queue_fence_destroy(&record->driver_finished);
>> FREE(record);
>> }
>> @@ -908,13 +908,13 @@ dd_maybe_dump_record(struct dd_screen *dscreen, struct dd_draw_record *record)
>> }
>>
>> static const char *
>> -dd_fence_state(struct pipe_screen *screen, struct pipe_fence_handle *fence,
>> +dd_fence_state(struct pipe_screen *screen, struct pipe_semaphore_handle *fence,
>> bool *not_reached)
>> {
>> if (!fence)
>> return "---";
>>
>> - bool ok = screen->fence_finish(screen, NULL, fence, 0);
>> + bool ok = screen->semaphore_finish(screen, NULL, fence, 0);
>>
>> if (not_reached && !ok)
>> *not_reached = true;
>> @@ -938,7 +938,7 @@ dd_report_hang(struct dd_context *dctx)
>>
>> list_for_each_entry(struct dd_draw_record, record, &dctx->records, list) {
>> if (!encountered_hang &&
>> - screen->fence_finish(screen, NULL, record->bottom_of_pipe, 0)) {
>> + screen->semaphore_finish(screen, NULL, record->bottom_of_pipe, 0)) {
>> dd_maybe_dump_record(dscreen, record);
>> continue;
>> }
>> @@ -1003,8 +1003,8 @@ dd_thread_main(void *input)
>>
>> for (;;) {
>> struct list_head records;
>> - struct pipe_fence_handle *fence;
>> - struct pipe_fence_handle *fence2 = NULL;
>> + struct pipe_semaphore_handle *fence;
>> + struct pipe_semaphore_handle *fence2 = NULL;
>>
>> list_replace(&dctx->records, &records);
>> list_inithead(&dctx->records);
>> @@ -1033,10 +1033,10 @@ dd_thread_main(void *input)
>>
>> /* Fences can be NULL legitimately when timeout detection is disabled. */
>> if ((fence &&
>> - !screen->fence_finish(screen, NULL, fence,
>> + !screen->semaphore_finish(screen, NULL, fence,
>> (uint64_t)dscreen->timeout_ms * 1000*1000)) ||
>> (fence2 &&
>> - !screen->fence_finish(screen, NULL, fence2,
>> + !screen->semaphore_finish(screen, NULL, fence2,
>> (uint64_t)dscreen->timeout_ms * 1000*1000))) {
>> mtx_lock(&dctx->mutex);
>> list_splice(&records, &dctx->records);
>> @@ -1083,7 +1083,7 @@ dd_create_record(struct dd_context *dctx)
>>
>> static void
>> dd_context_flush(struct pipe_context *_pipe,
>> - struct pipe_fence_handle **fence, unsigned flags)
>> + struct pipe_semaphore_handle **fence, unsigned flags)
>> {
>> struct dd_context *dctx = dd_context(_pipe);
>> struct pipe_context *pipe = dctx->pipe;
>> @@ -1103,7 +1103,7 @@ dd_before_draw(struct dd_context *dctx, struct dd_draw_record *record)
>> if (dscreen->timeout_ms > 0) {
>> if (dscreen->flush_always && dctx->num_draw_calls >= dscreen->skip_count) {
>> pipe->flush(pipe, &record->prev_bottom_of_pipe, 0);
>> - screen->fence_reference(screen, &record->top_of_pipe, record->prev_bottom_of_pipe);
>> + screen->semaphore_reference(screen, &record->top_of_pipe, record->prev_bottom_of_pipe);
>> } else {
>> pipe->flush(pipe, &record->prev_bottom_of_pipe,
>> PIPE_FLUSH_DEFERRED | PIPE_FLUSH_BOTTOM_OF_PIPE);
>> diff --git a/src/gallium/drivers/ddebug/dd_pipe.h b/src/gallium/drivers/ddebug/dd_pipe.h
>> index 07c4d55..d155df7 100644
>> --- a/src/gallium/drivers/ddebug/dd_pipe.h
>> +++ b/src/gallium/drivers/ddebug/dd_pipe.h
>> @@ -274,9 +274,9 @@ struct dd_draw_record {
>> int64_t time_after;
>> unsigned draw_call;
>>
>> - struct pipe_fence_handle *prev_bottom_of_pipe;
>> - struct pipe_fence_handle *top_of_pipe;
>> - struct pipe_fence_handle *bottom_of_pipe;
>> + struct pipe_semaphore_handle *prev_bottom_of_pipe;
>> + struct pipe_semaphore_handle *top_of_pipe;
>> + struct pipe_semaphore_handle *bottom_of_pipe;
>>
>> struct dd_call call;
>> struct dd_draw_state_copy draw_state;
>> diff --git a/src/gallium/drivers/ddebug/dd_screen.c b/src/gallium/drivers/ddebug/dd_screen.c
>> index 5b2be28..ab04773 100644
>> --- a/src/gallium/drivers/ddebug/dd_screen.c
>> +++ b/src/gallium/drivers/ddebug/dd_screen.c
>> @@ -325,25 +325,25 @@ dd_screen_check_resource_capability(struct pipe_screen *_screen,
>> */
>>
>> static void
>> -dd_screen_fence_reference(struct pipe_screen *_screen,
>> - struct pipe_fence_handle **pdst,
>> - struct pipe_fence_handle *src)
>> +dd_screen_semaphore_reference(struct pipe_screen *_screen,
>> + struct pipe_semaphore_handle **pdst,
>> + struct pipe_semaphore_handle *src)
>> {
>> struct pipe_screen *screen = dd_screen(_screen)->screen;
>>
>> - screen->fence_reference(screen, pdst, src);
>> + screen->semaphore_reference(screen, pdst, src);
>> }
>>
>> static boolean
>> -dd_screen_fence_finish(struct pipe_screen *_screen,
>> +dd_screen_semaphore_finish(struct pipe_screen *_screen,
>> struct pipe_context *_ctx,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout)
>> {
>> struct pipe_screen *screen = dd_screen(_screen)->screen;
>> struct pipe_context *ctx = _ctx ? dd_context(_ctx)->pipe : NULL;
>>
>> - return screen->fence_finish(screen, ctx, fence, timeout);
>> + return screen->semaphore_finish(screen, ctx, fence, timeout);
>> }
>>
>> /********************************************************************
>> @@ -546,8 +546,8 @@ ddebug_screen_create(struct pipe_screen *screen)
>> SCR_INIT(resource_changed);
>> dscreen->base.resource_destroy = dd_screen_resource_destroy;
>> SCR_INIT(flush_frontbuffer);
>> - SCR_INIT(fence_reference);
>> - SCR_INIT(fence_finish);
>> + SCR_INIT(semaphore_reference);
>> + SCR_INIT(semaphore_finish);
>> SCR_INIT(memobj_create_from_handle);
>> SCR_INIT(memobj_destroy);
>> SCR_INIT(get_driver_query_info);
>> diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c
>> index 3038d21..18f71a5 100644
>> --- a/src/gallium/drivers/etnaviv/etnaviv_context.c
>> +++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
>> @@ -305,7 +305,7 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
>> }
>>
>> static void
>> -etna_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
>> +etna_flush(struct pipe_context *pctx, struct pipe_semaphore_handle **fence,
>> enum pipe_flush_flags flags)
>> {
>> struct etna_context *ctx = etna_context(pctx);
>> @@ -315,7 +315,7 @@ etna_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
>> etna_hw_query_suspend(hq, ctx);
>>
>> etna_cmd_stream_flush2(ctx->stream, ctx->in_fence_fd,
>> - (flags & PIPE_FLUSH_FENCE_FD) ? &out_fence_fd :
>> + (flags & PIPE_FLUSH_SEMAPHORE_FD) ? &out_fence_fd :
>> NULL);
>>
>> list_for_each_entry(struct etna_hw_query, hq, &ctx->active_hw_queries, node)
>> @@ -448,8 +448,8 @@ etna_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
>> pctx->draw_vbo = etna_draw_vbo;
>> pctx->flush = etna_flush;
>> pctx->set_debug_callback = etna_set_debug_callback;
>> - pctx->create_fence_fd = etna_create_fence_fd;
>> - pctx->fence_server_sync = etna_fence_server_sync;
>> + pctx->create_semaphore_fd = etna_create_semaphore_fd;
>> + pctx->semaphore_server_sync = etna_semaphore_server_sync;
>>
>> /* creation of compile states */
>> pctx->create_blend_state = etna_blend_state_create;
>> diff --git a/src/gallium/drivers/etnaviv/etnaviv_fence.c b/src/gallium/drivers/etnaviv/etnaviv_fence.c
>> index 22a964a..d2a84d6 100644
>> --- a/src/gallium/drivers/etnaviv/etnaviv_fence.c
>> +++ b/src/gallium/drivers/etnaviv/etnaviv_fence.c
>> @@ -34,7 +34,7 @@
>> #include "util/u_inlines.h"
>> #include "util/u_memory.h"
>>
>> -struct pipe_fence_handle {
>> +struct pipe_semaphore_handle {
>> struct pipe_reference reference;
>> struct etna_context *ctx;
>> struct etna_screen *screen;
>> @@ -43,7 +43,7 @@ struct pipe_fence_handle {
>> };
>>
>> static void
>> -etna_fence_destroy(struct pipe_fence_handle *fence)
>> +etna_fence_destroy(struct pipe_semaphore_handle *fence)
>> {
>> if (fence->fence_fd != -1)
>> close(fence->fence_fd);
>> @@ -51,9 +51,9 @@ etna_fence_destroy(struct pipe_fence_handle *fence)
>> }
>>
>> static void
>> -etna_screen_fence_reference(struct pipe_screen *pscreen,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *fence)
>> +etna_screen_semaphore_reference(struct pipe_screen *pscreen,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *fence)
>> {
>> if (pipe_reference(&(*ptr)->reference, &fence->reference))
>> etna_fence_destroy(*ptr);
>> @@ -62,8 +62,8 @@ etna_screen_fence_reference(struct pipe_screen *pscreen,
>> }
>>
>> static boolean
>> -etna_screen_fence_finish(struct pipe_screen *pscreen, struct pipe_context *ctx,
>> - struct pipe_fence_handle *fence, uint64_t timeout)
>> +etna_screen_semaphore_finish(struct pipe_screen *pscreen, struct pipe_context *ctx,
>> + struct pipe_semaphore_handle *fence, uint64_t timeout)
>> {
>> if (fence->fence_fd != -1)
>> return !sync_wait(fence->fence_fd, timeout / 1000000);
>> @@ -75,8 +75,8 @@ etna_screen_fence_finish(struct pipe_screen *pscreen, struct pipe_context *ctx,
>> }
>>
>> void
>> -etna_create_fence_fd(struct pipe_context *pctx,
>> - struct pipe_fence_handle **pfence, int fd,
>> +etna_create_semaphore_fd(struct pipe_context *pctx,
>> + struct pipe_semaphore_handle **pfence, int fd,
>> enum pipe_fd_type type)
>> {
>> assert(type == PIPE_FD_TYPE_NATIVE_SYNC);
>> @@ -84,8 +84,8 @@ etna_create_fence_fd(struct pipe_context *pctx,
>> }
>>
>> void
>> -etna_fence_server_sync(struct pipe_context *pctx,
>> - struct pipe_fence_handle *pfence)
>> +etna_semaphore_server_sync(struct pipe_context *pctx,
>> + struct pipe_semaphore_handle *pfence)
>> {
>> struct etna_context *ctx = etna_context(pctx);
>>
>> @@ -93,19 +93,19 @@ etna_fence_server_sync(struct pipe_context *pctx,
>> }
>>
>> static int
>> -etna_screen_fence_get_fd(struct pipe_screen *pscreen,
>> - struct pipe_fence_handle *pfence)
>> +etna_screen_semaphore_get_fd(struct pipe_screen *pscreen,
>> + struct pipe_semaphore_handle *pfence)
>> {
>> return dup(pfence->fence_fd);
>> }
>>
>> -struct pipe_fence_handle *
>> +struct pipe_semaphore_handle *
>> etna_fence_create(struct pipe_context *pctx, int fence_fd)
>> {
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>> struct etna_context *ctx = etna_context(pctx);
>>
>> - fence = CALLOC_STRUCT(pipe_fence_handle);
>> + fence = CALLOC_STRUCT(pipe_semaphore_handle);
>> if (!fence)
>> return NULL;
>>
>> @@ -122,7 +122,7 @@ etna_fence_create(struct pipe_context *pctx, int fence_fd)
>> void
>> etna_fence_screen_init(struct pipe_screen *pscreen)
>> {
>> - pscreen->fence_reference = etna_screen_fence_reference;
>> - pscreen->fence_finish = etna_screen_fence_finish;
>> - pscreen->fence_get_fd = etna_screen_fence_get_fd;
>> + pscreen->semaphore_reference = etna_screen_semaphore_reference;
>> + pscreen->semaphore_finish = etna_screen_semaphore_finish;
>> + pscreen->semaphore_get_fd = etna_screen_semaphore_get_fd;
>> }
>> diff --git a/src/gallium/drivers/etnaviv/etnaviv_fence.h b/src/gallium/drivers/etnaviv/etnaviv_fence.h
>> index 8b8bb63..ba97235 100644
>> --- a/src/gallium/drivers/etnaviv/etnaviv_fence.h
>> +++ b/src/gallium/drivers/etnaviv/etnaviv_fence.h
>> @@ -31,19 +31,19 @@
>> #include "pipe/p_context.h"
>>
>> void
>> -etna_create_fence_fd(struct pipe_context *pctx,
>> - struct pipe_fence_handle **pfence, int fd,
>> +etna_create_semaphore_fd(struct pipe_context *pctx,
>> + struct pipe_semaphore_handle **pfence, int fd,
>> enum pipe_fd_type type);
>>
>> void
>> -etna_fence_server_sync(struct pipe_context *pctx,
>> - struct pipe_fence_handle *fence);
>> +etna_semaphore_server_sync(struct pipe_context *pctx,
>> + struct pipe_semaphore_handle *fence);
>>
>> int
>> -etna_fence_get_fd(struct pipe_screen *pscreen,
>> - struct pipe_fence_handle *pfence);
>> +etna_semaphore_get_fd(struct pipe_screen *pscreen,
>> + struct pipe_semaphore_handle *pfence);
>>
>> -struct pipe_fence_handle *
>> +struct pipe_semaphore_handle *
>> etna_fence_create(struct pipe_context *pctx, int fence_fd);
>>
>> void
>> diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c
>> index 6d6165e..105e0ee 100644
>> --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
>> +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
>> @@ -142,7 +142,7 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>> case PIPE_CAP_TGSI_TEXCOORD:
>> case PIPE_CAP_VERTEX_COLOR_UNCLAMPED:
>> return 1;
>> - case PIPE_CAP_NATIVE_FENCE_FD:
>> + case PIPE_CAP_NATIVE_SEMAPHORE_FD:
>> return screen->drm_version >= ETNA_DRM_VERSION_FENCE_FD;
>>
>> /* Memory */
>> diff --git a/src/gallium/drivers/freedreno/freedreno_batch.c b/src/gallium/drivers/freedreno/freedreno_batch.c
>> index e44e8e5..8ab1d21 100644
>> --- a/src/gallium/drivers/freedreno/freedreno_batch.c
>> +++ b/src/gallium/drivers/freedreno/freedreno_batch.c
>> @@ -123,9 +123,9 @@ batch_fini(struct fd_batch *batch)
>> close(batch->in_fence_fd);
>>
>> /* in case batch wasn't flushed but fence was created: */
>> - fd_fence_populate(batch->fence, 0, -1);
>> + fd_semaphore_populate(batch->fence, 0, -1);
>>
>> - fd_fence_ref(NULL, &batch->fence, NULL);
>> + fd_semaphore_ref(NULL, &batch->fence, NULL);
>>
>> fd_ringbuffer_del(batch->draw);
>> if (!batch->nondraw) {
>> diff --git a/src/gallium/drivers/freedreno/freedreno_batch.h b/src/gallium/drivers/freedreno/freedreno_batch.h
>> index 56665b7..3c94868 100644
>> --- a/src/gallium/drivers/freedreno/freedreno_batch.h
>> +++ b/src/gallium/drivers/freedreno/freedreno_batch.h
>> @@ -70,7 +70,7 @@ struct fd_batch {
>>
>> int in_fence_fd;
>> bool needs_out_fence_fd;
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>>
>> struct fd_context *ctx;
>>
>> diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c
>> index 66088da..fd4843c 100644
>> --- a/src/gallium/drivers/freedreno/freedreno_context.c
>> +++ b/src/gallium/drivers/freedreno/freedreno_context.c
>> @@ -41,16 +41,16 @@
>> #include "util/u_upload_mgr.h"
>>
>> static void
>> -fd_context_flush(struct pipe_context *pctx, struct pipe_fence_handle **fencep,
>> +fd_context_flush(struct pipe_context *pctx, struct pipe_semaphore_handle **fencep,
>> unsigned flags)
>> {
>> struct fd_context *ctx = fd_context(pctx);
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>>
>> /* Take a ref to the batch's fence (batch can be unref'd when flushed: */
>> - fd_fence_ref(pctx->screen, &fence, ctx->batch->fence);
>> + fd_semaphore_ref(pctx->screen, &fence, ctx->batch->fence);
>>
>> - if (flags & PIPE_FLUSH_FENCE_FD)
>> + if (flags & PIPE_FLUSH_SEMAPHORE_FD)
>> ctx->batch->needs_out_fence_fd = true;
>>
>> if (!ctx->screen->reorder) {
>> @@ -62,9 +62,9 @@ fd_context_flush(struct pipe_context *pctx, struct pipe_fence_handle **fencep,
>> }
>>
>> if (fencep)
>> - fd_fence_ref(pctx->screen, fencep, fence);
>> + fd_semaphore_ref(pctx->screen, fencep, fence);
>>
>> - fd_fence_ref(pctx->screen, &fence, NULL);
>> + fd_semaphore_ref(pctx->screen, &fence, NULL);
>> }
>>
>> static void
>> @@ -281,8 +281,8 @@ fd_context_init(struct fd_context *ctx, struct pipe_screen *pscreen,
>> pctx->flush = fd_context_flush;
>> pctx->emit_string_marker = fd_emit_string_marker;
>> pctx->set_debug_callback = fd_set_debug_callback;
>> - pctx->create_fence_fd = fd_create_fence_fd;
>> - pctx->fence_server_sync = fd_fence_server_sync;
>> + pctx->create_semaphore_fd = fd_create_semaphore_fd;
>> + pctx->semaphore_server_sync = fd_semaphore_server_sync;
>> pctx->texture_barrier = fd_texture_barrier;
>>
>> pctx->stream_uploader = u_upload_create_default(pctx);
>> diff --git a/src/gallium/drivers/freedreno/freedreno_fence.c b/src/gallium/drivers/freedreno/freedreno_fence.c
>> index 1925f72..8e26ca7 100644
>> --- a/src/gallium/drivers/freedreno/freedreno_fence.c
>> +++ b/src/gallium/drivers/freedreno/freedreno_fence.c
>> @@ -34,10 +34,10 @@
>> #include "freedreno_context.h"
>> #include "freedreno_util.h"
>>
>> -struct pipe_fence_handle {
>> +struct pipe_semaphore_handle {
>> struct pipe_reference reference;
>> /* fence holds a weak reference to the batch until the batch is flushed,
>> - * at which point fd_fence_populate() is called and timestamp and possibly
>> + * at which point fd_semaphore_populate() is called and timestamp and possibly
>> * fence_fd become valid and the week reference is dropped.
>> */
>> struct fd_batch *batch;
>> @@ -47,14 +47,14 @@ struct pipe_fence_handle {
>> uint32_t timestamp;
>> };
>>
>> -static void fence_flush(struct pipe_fence_handle *fence)
>> +static void fence_flush(struct pipe_semaphore_handle *fence)
>> {
>> if (fence->batch)
>> fd_batch_flush(fence->batch, true, true);
>> debug_assert(!fence->batch);
>> }
>>
>> -void fd_fence_populate(struct pipe_fence_handle *fence,
>> +void fd_semaphore_populate(struct pipe_semaphore_handle *fence,
>> uint32_t timestamp, int fence_fd)
>> {
>> if (!fence->batch)
>> @@ -64,16 +64,16 @@ void fd_fence_populate(struct pipe_fence_handle *fence,
>> fence->batch = NULL;
>> }
>>
>> -static void fd_fence_destroy(struct pipe_fence_handle *fence)
>> +static void fd_fence_destroy(struct pipe_semaphore_handle *fence)
>> {
>> if (fence->fence_fd != -1)
>> close(fence->fence_fd);
>> FREE(fence);
>> }
>>
>> -void fd_fence_ref(struct pipe_screen *pscreen,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *pfence)
>> +void fd_semaphore_ref(struct pipe_screen *pscreen,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *pfence)
>> {
>> if (pipe_reference(&(*ptr)->reference, &pfence->reference))
>> fd_fence_destroy(*ptr);
>> @@ -81,9 +81,9 @@ void fd_fence_ref(struct pipe_screen *pscreen,
>> *ptr = pfence;
>> }
>>
>> -boolean fd_fence_finish(struct pipe_screen *pscreen,
>> +boolean fd_semaphore_finish(struct pipe_screen *pscreen,
>> struct pipe_context *ctx,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout)
>> {
>> fence_flush(fence);
>> @@ -99,12 +99,12 @@ boolean fd_fence_finish(struct pipe_screen *pscreen,
>> return true;
>> }
>>
>> -static struct pipe_fence_handle * fence_create(struct fd_context *ctx,
>> +static struct pipe_semaphore_handle * fence_create(struct fd_context *ctx,
>> struct fd_batch *batch, uint32_t timestamp, int fence_fd)
>> {
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>>
>> - fence = CALLOC_STRUCT(pipe_fence_handle);
>> + fence = CALLOC_STRUCT(pipe_semaphore_handle);
>> if (!fence)
>> return NULL;
>>
>> @@ -119,16 +119,16 @@ static struct pipe_fence_handle * fence_create(struct fd_context *ctx,
>> return fence;
>> }
>>
>> -void fd_create_fence_fd(struct pipe_context *pctx,
>> - struct pipe_fence_handle **pfence, int fd,
>> +void fd_create_semaphore_fd(struct pipe_context *pctx,
>> + struct pipe_semaphore_handle **pfence, int fd,
>> enum pipe_fd_type type)
>> {
>> assert(type == PIPE_FD_TYPE_NATIVE_SYNC);
>> *pfence = fence_create(fd_context(pctx), NULL, 0, dup(fd));
>> }
>>
>> -void fd_fence_server_sync(struct pipe_context *pctx,
>> - struct pipe_fence_handle *fence)
>> +void fd_semaphore_server_sync(struct pipe_context *pctx,
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct fd_context *ctx = fd_context(pctx);
>> struct fd_batch *batch = ctx->batch;
>> @@ -140,14 +140,14 @@ void fd_fence_server_sync(struct pipe_context *pctx,
>> }
>> }
>>
>> -int fd_fence_get_fd(struct pipe_screen *pscreen,
>> - struct pipe_fence_handle *fence)
>> +int fd_semaphore_get_fd(struct pipe_screen *pscreen,
>> + struct pipe_semaphore_handle *fence)
>> {
>> fence_flush(fence);
>> return dup(fence->fence_fd);
>> }
>>
>> -struct pipe_fence_handle * fd_fence_create(struct fd_batch *batch)
>> +struct pipe_semaphore_handle * fd_fence_create(struct fd_batch *batch)
>> {
>> return fence_create(batch->ctx, batch, 0, -1);
>> }
>> diff --git a/src/gallium/drivers/freedreno/freedreno_fence.h b/src/gallium/drivers/freedreno/freedreno_fence.h
>> index 0842a1d..3e7ed04 100644
>> --- a/src/gallium/drivers/freedreno/freedreno_fence.h
>> +++ b/src/gallium/drivers/freedreno/freedreno_fence.h
>> @@ -31,24 +31,23 @@
>>
>> #include "pipe/p_context.h"
>>
>> -void fd_fence_populate(struct pipe_fence_handle *fence,
>> +void fd_semaphore_populate(struct pipe_semaphore_handle *fence,
>> uint32_t timestamp, int fence_fd);
>> -void fd_fence_ref(struct pipe_screen *pscreen,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *pfence);
>> -boolean fd_fence_finish(struct pipe_screen *screen,
>> +void fd_semaphore_ref(struct pipe_screen *pscreen,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *pfence);
>> +boolean fd_semaphore_finish(struct pipe_screen *screen,
>> struct pipe_context *ctx,
>> - struct pipe_fence_handle *pfence,
>> + struct pipe_semaphore_handle *pfence,
>> uint64_t timeout);
>> -void fd_create_fence_fd(struct pipe_context *pctx,
>> - struct pipe_fence_handle **pfence, int fd,
>> +void fd_create_semaphore_fd(struct pipe_context *pctx,
>> + struct pipe_semaphore_handle **pfence, int fd,
>> enum pipe_fd_type type);
>> -void fd_fence_server_sync(struct pipe_context *pctx,
>> - struct pipe_fence_handle *fence);
>> -int fd_fence_get_fd(struct pipe_screen *pscreen,
>> - struct pipe_fence_handle *pfence);
>> -
>> +void fd_semaphore_server_sync(struct pipe_context *pctx,
>> + struct pipe_semaphore_handle *fence);
>> +int fd_semaphore_get_fd(struct pipe_screen *pscreen,
>> + struct pipe_semaphore_handle *pfence);
>> struct fd_batch;
>> -struct pipe_fence_handle * fd_fence_create(struct fd_batch *batch);
>> +struct pipe_semaphore_handle * fd_fence_create(struct fd_batch *batch);
>>
>> #endif /* FREEDRENO_FENCE_H_ */
>> diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c
>> index 37a2f33..34919eb 100644
>> --- a/src/gallium/drivers/freedreno/freedreno_gmem.c
>> +++ b/src/gallium/drivers/freedreno/freedreno_gmem.c
>> @@ -381,7 +381,7 @@ flush_ring(struct fd_batch *batch)
>> batch->needs_out_fence_fd ? &out_fence_fd : NULL);
>>
>> timestamp = fd_ringbuffer_timestamp(ring);
>> - fd_fence_populate(batch->fence, timestamp, out_fence_fd);
>> + fd_semaphore_populate(batch->fence, timestamp, out_fence_fd);
>> }
>>
>> void
>> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
>> index 0c39947..7db13b1 100644
>> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
>> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
>> @@ -445,7 +445,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>> return 10;
>> case PIPE_CAP_UMA:
>> return 1;
>> - case PIPE_CAP_NATIVE_FENCE_FD:
>> + case PIPE_CAP_NATIVE_SEMAPHORE_FD:
>> return fd_device_version(screen->dev) >= FD_VERSION_FENCE_FD;
>> }
>> debug_printf("unknown param %d\n", param);
>> @@ -917,9 +917,9 @@ fd_screen_create(struct fd_device *dev)
>>
>> pscreen->get_timestamp = fd_screen_get_timestamp;
>>
>> - pscreen->fence_reference = fd_fence_ref;
>> - pscreen->fence_finish = fd_fence_finish;
>> - pscreen->fence_get_fd = fd_fence_get_fd;
>> + pscreen->semaphore_reference = fd_semaphore_ref;
>> + pscreen->semaphore_finish = fd_semaphore_finish;
>> + pscreen->semaphore_get_fd = fd_semaphore_get_fd;
>>
>> slab_create_parent(&screen->transfer_pool, sizeof(struct fd_transfer), 16);
>>
>> diff --git a/src/gallium/drivers/i915/i915_batch.h b/src/gallium/drivers/i915/i915_batch.h
>> index f9e9283..b5ff04c 100644
>> --- a/src/gallium/drivers/i915/i915_batch.h
>> +++ b/src/gallium/drivers/i915/i915_batch.h
>> @@ -54,7 +54,7 @@
>> * i915_flush.c
>> */
>> extern void i915_flush(struct i915_context *i915,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags);
>>
>> #endif
>> diff --git a/src/gallium/drivers/i915/i915_flush.c b/src/gallium/drivers/i915/i915_flush.c
>> index 6311c00..b6abdf8 100644
>> --- a/src/gallium/drivers/i915/i915_flush.c
>> +++ b/src/gallium/drivers/i915/i915_flush.c
>> @@ -39,7 +39,7 @@
>>
>>
>> static void i915_flush_pipe( struct pipe_context *pipe,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags )
>> {
>> struct i915_context *i915 = i915_context(pipe);
>> @@ -73,7 +73,7 @@ void i915_init_flush_functions( struct i915_context *i915 )
>> * XXX might move above function to i915_pipe_flush.c and leave this here.
>> */
>> void i915_flush(struct i915_context *i915,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags)
>> {
>> struct i915_winsys_batchbuffer *batch = i915->batch;
>> diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
>> index 26d0d80..96ee78e 100644
>> --- a/src/gallium/drivers/i915/i915_screen.c
>> +++ b/src/gallium/drivers/i915/i915_screen.c
>> @@ -303,7 +303,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
>> case PIPE_CAP_SAMPLER_VIEW_TARGET:
>> case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
>> case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
>> - case PIPE_CAP_NATIVE_FENCE_FD:
>> + case PIPE_CAP_NATIVE_SEMAPHORE_FD:
>> case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
>> case PIPE_CAP_TGSI_FS_FBFETCH:
>> case PIPE_CAP_TGSI_MUL_ZERO_WINS:
>> @@ -527,19 +527,19 @@ i915_is_format_supported(struct pipe_screen *screen,
>>
>>
>> static void
>> -i915_fence_reference(struct pipe_screen *screen,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *fence)
>> +i915_semaphore_reference(struct pipe_screen *screen,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct i915_screen *is = i915_screen(screen);
>>
>> - is->iws->fence_reference(is->iws, ptr, fence);
>> + is->iws->semaphore_reference(is->iws, ptr, fence);
>> }
>>
>> static boolean
>> -i915_fence_finish(struct pipe_screen *screen,
>> +i915_semaphore_finish(struct pipe_screen *screen,
>> struct pipe_context *ctx,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout)
>> {
>> struct i915_screen *is = i915_screen(screen);
>> @@ -547,7 +547,7 @@ i915_fence_finish(struct pipe_screen *screen,
>> if (!timeout)
>> return is->iws->fence_signalled(is->iws, fence) == 1;
>>
>> - return is->iws->fence_finish(is->iws, fence) == 1;
>> + return is->iws->semaphore_finish(is->iws, fence) == 1;
>> }
>>
>>
>> @@ -633,8 +633,8 @@ i915_screen_create(struct i915_winsys *iws)
>>
>> is->base.context_create = i915_create_context;
>>
>> - is->base.fence_reference = i915_fence_reference;
>> - is->base.fence_finish = i915_fence_finish;
>> + is->base.semaphore_reference = i915_semaphore_reference;
>> + is->base.semaphore_finish = i915_semaphore_finish;
>>
>> i915_init_screen_resource_functions(is);
>>
>> diff --git a/src/gallium/drivers/i915/i915_winsys.h b/src/gallium/drivers/i915/i915_winsys.h
>> index 509e6cc..25d20af 100644
>> --- a/src/gallium/drivers/i915/i915_winsys.h
>> +++ b/src/gallium/drivers/i915/i915_winsys.h
>> @@ -32,7 +32,7 @@ struct i915_winsys;
>> struct i915_winsys_buffer;
>> struct i915_winsys_batchbuffer;
>> struct pipe_resource;
>> -struct pipe_fence_handle;
>> +struct pipe_semaphore_handle;
>> struct winsys_handle;
>>
>> enum i915_winsys_buffer_usage
>> @@ -131,7 +131,7 @@ struct i915_winsys {
>> * Flush a bufferbatch.
>> */
>> void (*batchbuffer_flush)(struct i915_winsys_batchbuffer *batch,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> enum i915_winsys_flush_flags flags);
>>
>> /**
>> @@ -231,21 +231,21 @@ struct i915_winsys {
>> /**
>> * Reference fence and set ptr to fence.
>> */
>> - void (*fence_reference)(struct i915_winsys *iws,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *fence);
>> + void (*semaphore_reference)(struct i915_winsys *iws,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *fence);
>>
>> /**
>> * Check if a fence has finished.
>> */
>> int (*fence_signalled)(struct i915_winsys *iws,
>> - struct pipe_fence_handle *fence);
>> + struct pipe_semaphore_handle *fence);
>>
>> /**
>> * Wait on a fence to finish.
>> */
>> - int (*fence_finish)(struct i915_winsys *iws,
>> - struct pipe_fence_handle *fence);
>> + int (*semaphore_finish)(struct i915_winsys *iws,
>> + struct pipe_semaphore_handle *fence);
>> /*@}*/
>>
>> /**
>> diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c
>> index 613d60f..cc8ad2f 100644
>> --- a/src/gallium/drivers/llvmpipe/lp_context.c
>> +++ b/src/gallium/drivers/llvmpipe/lp_context.c
>> @@ -111,7 +111,7 @@ static void llvmpipe_destroy( struct pipe_context *pipe )
>>
>> static void
>> do_flush( struct pipe_context *pipe,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags)
>> {
>> llvmpipe_flush(pipe, fence, __FUNCTION__);
>> diff --git a/src/gallium/drivers/llvmpipe/lp_fence.h b/src/gallium/drivers/llvmpipe/lp_fence.h
>> index b720264..fed2654 100644
>> --- a/src/gallium/drivers/llvmpipe/lp_fence.h
>> +++ b/src/gallium/drivers/llvmpipe/lp_fence.h
>> @@ -73,7 +73,7 @@ void
>> lp_fence_destroy(struct lp_fence *fence);
>>
>> static inline void
>> -lp_fence_reference(struct lp_fence **ptr,
>> +lp_semaphore_reference(struct lp_fence **ptr,
>> struct lp_fence *f)
>> {
>> struct lp_fence *old = *ptr;
>> diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c
>> index 452753f..ae2b9cb 100644
>> --- a/src/gallium/drivers/llvmpipe/lp_flush.c
>> +++ b/src/gallium/drivers/llvmpipe/lp_flush.c
>> @@ -45,7 +45,7 @@
>> */
>> void
>> llvmpipe_flush( struct pipe_context *pipe,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> const char *reason)
>> {
>> struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
>> @@ -79,12 +79,12 @@ void
>> llvmpipe_finish( struct pipe_context *pipe,
>> const char *reason )
>> {
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>> llvmpipe_flush(pipe, &fence, reason);
>> if (fence) {
>> - pipe->screen->fence_finish(pipe->screen, NULL, fence,
>> + pipe->screen->semaphore_finish(pipe->screen, NULL, fence,
>> PIPE_TIMEOUT_INFINITE);
>> - pipe->screen->fence_reference(pipe->screen, &fence, NULL);
>> + pipe->screen->semaphore_reference(pipe->screen, &fence, NULL);
>> }
>> }
>>
>> diff --git a/src/gallium/drivers/llvmpipe/lp_flush.h b/src/gallium/drivers/llvmpipe/lp_flush.h
>> index 68f5130..2adde6c 100644
>> --- a/src/gallium/drivers/llvmpipe/lp_flush.h
>> +++ b/src/gallium/drivers/llvmpipe/lp_flush.h
>> @@ -31,12 +31,12 @@
>> #include "pipe/p_compiler.h"
>>
>> struct pipe_context;
>> -struct pipe_fence_handle;
>> +struct pipe_semaphore_handle;
>> struct pipe_resource;
>>
>> void
>> llvmpipe_flush(struct pipe_context *pipe,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> const char *reason);
>>
>> void
>> diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c
>> index ad11d8c..81abfd6 100644
>> --- a/src/gallium/drivers/llvmpipe/lp_query.c
>> +++ b/src/gallium/drivers/llvmpipe/lp_query.c
>> @@ -82,7 +82,7 @@ llvmpipe_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
>> if (!lp_fence_signalled(pq->fence))
>> lp_fence_wait(pq->fence);
>>
>> - lp_fence_reference(&pq->fence, NULL);
>> + lp_semaphore_reference(&pq->fence, NULL);
>> }
>>
>> FREE(pq);
>> diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c
>> index dfad9fa..576e21e 100644
>> --- a/src/gallium/drivers/llvmpipe/lp_scene.c
>> +++ b/src/gallium/drivers/llvmpipe/lp_scene.c
>> @@ -89,7 +89,7 @@ lp_scene_create( struct pipe_context *pipe )
>> void
>> lp_scene_destroy(struct lp_scene *scene)
>> {
>> - lp_fence_reference(&scene->fence, NULL);
>> + lp_semaphore_reference(&scene->fence, NULL);
>> mtx_destroy(&scene->mutex);
>> assert(scene->data.head->next == NULL);
>> FREE(scene->data.head);
>> @@ -289,7 +289,7 @@ lp_scene_end_rasterization(struct lp_scene *scene )
>> list->head->used = 0;
>> }
>>
>> - lp_fence_reference(&scene->fence, NULL);
>> + lp_semaphore_reference(&scene->fence, NULL);
>>
>> scene->resources = NULL;
>> scene->scene_size = 0;
>> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
>> index bd58769..973d82a 100644
>> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
>> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
>> @@ -344,7 +344,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>> case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
>> case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
>> case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
>> - case PIPE_CAP_NATIVE_FENCE_FD:
>> + case PIPE_CAP_NATIVE_SEMAPHORE_FD:
>> case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
>> case PIPE_CAP_TGSI_FS_FBFETCH:
>> case PIPE_CAP_TGSI_MUL_ZERO_WINS:
>> @@ -589,14 +589,14 @@ llvmpipe_destroy_screen( struct pipe_screen *_screen )
>> * Fence reference counting.
>> */
>> static void
>> -llvmpipe_fence_reference(struct pipe_screen *screen,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *fence)
>> +llvmpipe_semaphore_reference(struct pipe_screen *screen,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct lp_fence **old = (struct lp_fence **) ptr;
>> struct lp_fence *f = (struct lp_fence *) fence;
>>
>> - lp_fence_reference(old, f);
>> + lp_semaphore_reference(old, f);
>> }
>
> As an example, we're casting semaphore handles to lp_fence pointers and passing
> fences into lp_semaphore_reference. A confusing mix of terminology.
>
>>
>> @@ -604,9 +604,9 @@ llvmpipe_fence_reference(struct pipe_screen *screen,
>> * Wait for the fence to finish.
>> */
>> static boolean
>> -llvmpipe_fence_finish(struct pipe_screen *screen,
>> +llvmpipe_semaphore_finish(struct pipe_screen *screen,
>> struct pipe_context *ctx,
>> - struct pipe_fence_handle *fence_handle,
>> + struct pipe_semaphore_handle *fence_handle,
>> uint64_t timeout)
>> {
>> struct lp_fence *f = (struct lp_fence *) fence_handle;
>> @@ -664,8 +664,8 @@ llvmpipe_create_screen(struct sw_winsys *winsys)
>>
>> screen->base.context_create = llvmpipe_create_context;
>> screen->base.flush_frontbuffer = llvmpipe_flush_frontbuffer;
>> - screen->base.fence_reference = llvmpipe_fence_reference;
>> - screen->base.fence_finish = llvmpipe_fence_finish;
>> + screen->base.semaphore_reference = llvmpipe_semaphore_reference;
>> + screen->base.semaphore_finish = llvmpipe_semaphore_finish;
>>
>> screen->base.get_timestamp = llvmpipe_get_timestamp;
>>
>> diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
>> index c157323..e3e25ff 100644
>> --- a/src/gallium/drivers/llvmpipe/lp_setup.c
>> +++ b/src/gallium/drivers/llvmpipe/lp_setup.c
>> @@ -160,7 +160,7 @@ lp_setup_rasterize_scene( struct lp_setup_context *setup )
>>
>> lp_scene_end_binning(scene);
>>
>> - lp_fence_reference(&setup->last_fence, scene->fence);
>> + lp_semaphore_reference(&setup->last_fence, scene->fence);
>>
>> if (setup->last_fence)
>> setup->last_fence->issued = TRUE;
>> @@ -354,13 +354,13 @@ fail:
>>
>> void
>> lp_setup_flush( struct lp_setup_context *setup,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> const char *reason)
>> {
>> set_scene_state( setup, SETUP_FLUSHED, reason );
>>
>> if (fence) {
>> - lp_fence_reference((struct lp_fence **)fence, setup->last_fence);
>> + lp_semaphore_reference((struct lp_fence **)fence, setup->last_fence);
>> }
>> }
>>
>> @@ -1293,7 +1293,7 @@ lp_setup_destroy( struct lp_setup_context *setup )
>> lp_scene_destroy(scene);
>> }
>>
>> - lp_fence_reference(&setup->last_fence, NULL);
>> + lp_semaphore_reference(&setup->last_fence, NULL);
>>
>> FREE( setup );
>> }
>> @@ -1427,7 +1427,7 @@ lp_setup_end_query(struct lp_setup_context *setup, struct llvmpipe_query *pq)
>> /* pq->fence should be the fence of the *last* scene which
>> * contributed to the query result.
>> */
>> - lp_fence_reference(&pq->fence, setup->scene->fence);
>> + lp_semaphore_reference(&pq->fence, setup->scene->fence);
>>
>> if (pq->type == PIPE_QUERY_OCCLUSION_COUNTER ||
>> pq->type == PIPE_QUERY_OCCLUSION_PREDICATE ||
>> @@ -1459,7 +1459,7 @@ lp_setup_end_query(struct lp_setup_context *setup, struct llvmpipe_query *pq)
>> }
>> }
>> else {
>> - lp_fence_reference(&pq->fence, setup->last_fence);
>> + lp_semaphore_reference(&pq->fence, setup->last_fence);
>> }
>>
>> fail:
>> diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h
>> index a42df2d..bfa1846 100644
>> --- a/src/gallium/drivers/llvmpipe/lp_setup.h
>> +++ b/src/gallium/drivers/llvmpipe/lp_setup.h
>> @@ -43,7 +43,7 @@ struct pipe_framebuffer_state;
>> struct lp_fragment_shader_variant;
>> struct lp_jit_context;
>> struct llvmpipe_query;
>> -struct pipe_fence_handle;
>> +struct pipe_semaphore_handle;
>> struct lp_setup_variant;
>> struct lp_setup_context;
>>
>> @@ -64,7 +64,7 @@ lp_setup_clear(struct lp_setup_context *setup,
>>
>> void
>> lp_setup_flush( struct lp_setup_context *setup,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> const char *reason);
>>
>>
>> diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c
>> index d1e795d..1a2c4c7 100644
>> --- a/src/gallium/drivers/noop/noop_pipe.c
>> +++ b/src/gallium/drivers/noop/noop_pipe.c
>> @@ -281,7 +281,7 @@ noop_flush_resource(struct pipe_context *ctx,
>> * context
>> */
>> static void noop_flush(struct pipe_context *ctx,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags)
>> {
>> if (fence)
>> @@ -435,15 +435,15 @@ static void noop_destroy_screen(struct pipe_screen *screen)
>> FREE(screen);
>> }
>>
>> -static void noop_fence_reference(struct pipe_screen *screen,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *fence)
>> +static void noop_semaphore_reference(struct pipe_screen *screen,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *fence)
>> {
>> }
>>
>> -static boolean noop_fence_finish(struct pipe_screen *screen,
>> +static boolean noop_semaphore_finish(struct pipe_screen *screen,
>> struct pipe_context *ctx,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout)
>> {
>> return true;
>> @@ -490,8 +490,8 @@ struct pipe_screen *noop_screen_create(struct pipe_screen *oscreen)
>> screen->resource_destroy = noop_resource_destroy;
>> screen->flush_frontbuffer = noop_flush_frontbuffer;
>> screen->get_timestamp = noop_get_timestamp;
>> - screen->fence_reference = noop_fence_reference;
>> - screen->fence_finish = noop_fence_finish;
>> + screen->semaphore_reference = noop_semaphore_reference;
>> + screen->semaphore_finish = noop_semaphore_finish;
>> screen->query_memory_info = noop_query_memory_info;
>>
>> return screen;
>> diff --git a/src/gallium/drivers/nouveau/nouveau_fence.h b/src/gallium/drivers/nouveau/nouveau_fence.h
>> index e14572b..1e6b516 100644
>> --- a/src/gallium/drivers/nouveau/nouveau_fence.h
>> +++ b/src/gallium/drivers/nouveau/nouveau_fence.h
>> @@ -57,7 +57,7 @@ nouveau_fence_ref(struct nouveau_fence *fence, struct nouveau_fence **ref)
>> }
>>
>> static inline struct nouveau_fence *
>> -nouveau_fence(struct pipe_fence_handle *fence)
>> +nouveau_fence(struct pipe_semaphore_handle *fence)
>> {
>> return (struct nouveau_fence *)fence;
>> }
>> diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c
>> index c144b39..dde7f57 100644
>> --- a/src/gallium/drivers/nouveau/nouveau_screen.c
>> +++ b/src/gallium/drivers/nouveau/nouveau_screen.c
>> @@ -68,16 +68,16 @@ nouveau_screen_get_disk_shader_cache(struct pipe_screen *pscreen)
>>
>> static void
>> nouveau_screen_fence_ref(struct pipe_screen *pscreen,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *pfence)
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *pfence)
>> {
>> nouveau_fence_ref(nouveau_fence(pfence), (struct nouveau_fence **)ptr);
>> }
>>
>> static boolean
>> -nouveau_screen_fence_finish(struct pipe_screen *screen,
>> +nouveau_screen_semaphore_finish(struct pipe_screen *screen,
>> struct pipe_context *ctx,
>> - struct pipe_fence_handle *pfence,
>> + struct pipe_semaphore_handle *pfence,
>> uint64_t timeout)
>> {
>> if (!timeout)
>> @@ -237,8 +237,8 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
>>
>> pscreen->get_timestamp = nouveau_screen_get_timestamp;
>>
>> - pscreen->fence_reference = nouveau_screen_fence_ref;
>> - pscreen->fence_finish = nouveau_screen_fence_finish;
>> + pscreen->semaphore_reference = nouveau_screen_fence_ref;
>> + pscreen->semaphore_finish = nouveau_screen_semaphore_finish;
>>
>> nouveau_disk_cache_create(screen);
>>
>> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_context.c b/src/gallium/drivers/nouveau/nv30/nv30_context.c
>> index e137525..837a668 100644
>> --- a/src/gallium/drivers/nouveau/nv30/nv30_context.c
>> +++ b/src/gallium/drivers/nouveau/nv30/nv30_context.c
>> @@ -69,7 +69,7 @@ nv30_context_kick_notify(struct nouveau_pushbuf *push)
>> }
>>
>> static void
>> -nv30_context_flush(struct pipe_context *pipe, struct pipe_fence_handle **fence,
>> +nv30_context_flush(struct pipe_context *pipe, struct pipe_semaphore_handle **fence,
>> unsigned flags)
>> {
>> struct nv30_context *nv30 = nv30_context(pipe);
>> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
>> index 37f6cf6..9f3e574 100644
>> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
>> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
>> @@ -204,7 +204,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>> case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
>> case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
>> case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
>> - case PIPE_CAP_NATIVE_FENCE_FD:
>> + case PIPE_CAP_NATIVE_SEMAPHORE_FD:
>> case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
>> case PIPE_CAP_TGSI_FS_FBFETCH:
>> case PIPE_CAP_TGSI_MUL_ZERO_WINS:
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_context.c b/src/gallium/drivers/nouveau/nv50/nv50_context.c
>> index 6124343..81c6796 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv50_context.c
>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_context.c
>> @@ -30,7 +30,7 @@
>>
>> static void
>> nv50_flush(struct pipe_context *pipe,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags)
>> {
>> struct nouveau_screen *screen = nouveau_screen(pipe->screen);
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>> index d9c868c..6dce340 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>> @@ -260,7 +260,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>> case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
>> case PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS:
>> case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
>> - case PIPE_CAP_NATIVE_FENCE_FD:
>> + case PIPE_CAP_NATIVE_SEMAPHORE_FD:
>> case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
>> case PIPE_CAP_TGSI_FS_FBFETCH:
>> case PIPE_CAP_DOUBLES:
>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
>> index d5ef585..b95a429 100644
>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
>> @@ -30,7 +30,7 @@
>>
>> static void
>> nvc0_flush(struct pipe_context *pipe,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags)
>> {
>> struct nvc0_context *nvc0 = nvc0_context(pipe);
>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>> index 2e7b4d7..f4cac68 100644
>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>> @@ -296,7 +296,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>> case PIPE_CAP_PCI_FUNCTION:
>> case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
>> case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
>> - case PIPE_CAP_NATIVE_FENCE_FD:
>> + case PIPE_CAP_NATIVE_SEMAPHORE_FD:
>> case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
>> case PIPE_CAP_INT64_DIVMOD:
>> case PIPE_CAP_SPARSE_BUFFER_PAGE_SIZE:
>> diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
>> index 627ba0c..50cfddf 100644
>> --- a/src/gallium/drivers/r300/r300_context.c
>> +++ b/src/gallium/drivers/r300/r300_context.c
>> @@ -128,7 +128,7 @@ static void r300_destroy_context(struct pipe_context* context)
>> }
>>
>> static void r300_flush_callback(void *data, unsigned flags,
>> - struct pipe_fence_handle **fence)
>> + struct pipe_semaphore_handle **fence)
>> {
>> struct r300_context* const cs_context_copy = data;
>>
>> diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
>> index 2202515..e3e7165 100644
>> --- a/src/gallium/drivers/r300/r300_context.h
>> +++ b/src/gallium/drivers/r300/r300_context.h
>> @@ -720,7 +720,7 @@ bool r300_is_blit_supported(enum pipe_format format);
>> /* r300_flush.c */
>> void r300_flush(struct pipe_context *pipe,
>> unsigned flags,
>> - struct pipe_fence_handle **fence);
>> + struct pipe_semaphore_handle **fence);
>>
>> /* r300_hyperz.c */
>> void r300_update_hyperz_state(struct r300_context* r300);
>> diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c
>> index f6c1bf3..0e2388a 100644
>> --- a/src/gallium/drivers/r300/r300_flush.c
>> +++ b/src/gallium/drivers/r300/r300_flush.c
>> @@ -35,7 +35,7 @@
>>
>>
>> static void r300_flush_and_cleanup(struct r300_context *r300, unsigned flags,
>> - struct pipe_fence_handle **fence)
>> + struct pipe_semaphore_handle **fence)
>> {
>> struct r300_atom *atom;
>>
>> @@ -74,7 +74,7 @@ static void r300_flush_and_cleanup(struct r300_context *r300, unsigned flags,
>>
>> void r300_flush(struct pipe_context *pipe,
>> unsigned flags,
>> - struct pipe_fence_handle **fence)
>> + struct pipe_semaphore_handle **fence)
>> {
>> struct r300_context *r300 = r300_context(pipe);
>>
>> @@ -113,7 +113,7 @@ void r300_flush(struct pipe_context *pipe,
>> }
>>
>> if (fence && *fence)
>> - r300->rws->fence_reference(fence, NULL);
>> + r300->rws->semaphore_reference(fence, NULL);
>> r300_flush_and_cleanup(r300, flags, fence);
>> }
>>
>> @@ -126,7 +126,7 @@ void r300_flush(struct pipe_context *pipe,
>> }
>>
>> static void r300_flush_wrapped(struct pipe_context *pipe,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags)
>> {
>> if (flags & PIPE_FLUSH_HINT_FINISH)
>> diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c
>> index 014055b..2163f20 100644
>> --- a/src/gallium/drivers/r300/r300_query.c
>> +++ b/src/gallium/drivers/r300/r300_query.c
>> @@ -122,7 +122,7 @@ static bool r300_end_query(struct pipe_context* pipe,
>> if (q->type == PIPE_QUERY_GPU_FINISHED) {
>> pb_reference(&q->buf, NULL);
>> r300_flush(pipe, PIPE_FLUSH_ASYNC,
>> - (struct pipe_fence_handle**)&q->buf);
>> + (struct pipe_semaphore_handle**)&q->buf);
>> return true;
>> }
>>
>> diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
>> index 99d6302..875a356 100644
>> --- a/src/gallium/drivers/r300/r300_screen.c
>> +++ b/src/gallium/drivers/r300/r300_screen.c
>> @@ -226,7 +226,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>> case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
>> case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
>> case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
>> - case PIPE_CAP_NATIVE_FENCE_FD:
>> + case PIPE_CAP_NATIVE_SEMAPHORE_FD:
>> case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
>> case PIPE_CAP_TGSI_FS_FBFETCH:
>> case PIPE_CAP_TGSI_MUL_ZERO_WINS:
>> @@ -723,18 +723,18 @@ static void r300_destroy_screen(struct pipe_screen* pscreen)
>> FREE(r300screen);
>> }
>>
>> -static void r300_fence_reference(struct pipe_screen *screen,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *fence)
>> +static void r300_semaphore_reference(struct pipe_screen *screen,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct radeon_winsys *rws = r300_screen(screen)->rws;
>>
>> - rws->fence_reference(ptr, fence);
>> + rws->semaphore_reference(ptr, fence);
>> }
>>
>> -static boolean r300_fence_finish(struct pipe_screen *screen,
>> +static boolean r300_semaphore_finish(struct pipe_screen *screen,
>> struct pipe_context *ctx,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout)
>> {
>> struct radeon_winsys *rws = r300_screen(screen)->rws;
>> @@ -774,8 +774,8 @@ struct pipe_screen* r300_screen_create(struct radeon_winsys *rws,
>> r300screen->screen.is_format_supported = r300_is_format_supported;
>> r300screen->screen.is_video_format_supported = vl_video_buffer_is_format_supported;
>> r300screen->screen.context_create = r300_create_context;
>> - r300screen->screen.fence_reference = r300_fence_reference;
>> - r300screen->screen.fence_finish = r300_fence_finish;
>> + r300screen->screen.semaphore_reference = r300_semaphore_reference;
>> + r300screen->screen.semaphore_finish = r300_semaphore_finish;
>>
>> r300_init_screen_resource_functions(r300screen);
>>
>> diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
>> index 259e1a8..ea78d5a 100644
>> --- a/src/gallium/drivers/r600/r600_hw_context.c
>> +++ b/src/gallium/drivers/r600/r600_hw_context.c
>> @@ -249,7 +249,7 @@ void r600_flush_emit(struct r600_context *rctx)
>> }
>>
>> void r600_context_gfx_flush(void *context, unsigned flags,
>> - struct pipe_fence_handle **fence)
>> + struct pipe_semaphore_handle **fence)
>> {
>> struct r600_context *ctx = context;
>> struct radeon_winsys_cs *cs = ctx->b.gfx.cs;
>> @@ -291,7 +291,7 @@ void r600_context_gfx_flush(void *context, unsigned flags,
>> /* Flush the CS. */
>> ws->cs_flush(cs, flags, &ctx->b.last_gfx_fence);
>> if (fence)
>> - ws->fence_reference(fence, ctx->b.last_gfx_fence);
>> + ws->semaphore_reference(fence, ctx->b.last_gfx_fence);
>> ctx->b.num_gfx_cs_flushes++;
>>
>> if (ctx->is_debug) {
>> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
>> index 29cffe9..d94b481 100644
>> --- a/src/gallium/drivers/r600/r600_pipe.c
>> +++ b/src/gallium/drivers/r600/r600_pipe.c
>> @@ -391,7 +391,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>> case PIPE_CAP_MAX_WINDOW_RECTANGLES:
>> case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
>> case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
>> - case PIPE_CAP_NATIVE_FENCE_FD:
>> + case PIPE_CAP_NATIVE_SEMAPHORE_FD:
>> case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
>> case PIPE_CAP_TGSI_FS_FBFETCH:
>> case PIPE_CAP_INT64:
>> diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
>> index e042edf..1d2f9b4 100644
>> --- a/src/gallium/drivers/r600/r600_pipe.h
>> +++ b/src/gallium/drivers/r600/r600_pipe.h
>> @@ -744,7 +744,7 @@ void r600_update_db_shader_control(struct r600_context * rctx);
>>
>> /* r600_hw_context.c */
>> void r600_context_gfx_flush(void *context, unsigned flags,
>> - struct pipe_fence_handle **fence);
>> + struct pipe_semaphore_handle **fence);
>> void r600_begin_new_cs(struct r600_context *ctx);
>> void r600_flush_emit(struct r600_context *ctx);
>> void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw, boolean count_draw_in);
>> diff --git a/src/gallium/drivers/r600/r600_pipe_common.c b/src/gallium/drivers/r600/r600_pipe_common.c
>> index e02c43f..0e91e97 100644
>> --- a/src/gallium/drivers/r600/r600_pipe_common.c
>> +++ b/src/gallium/drivers/r600/r600_pipe_common.c
>> @@ -53,8 +53,8 @@
>>
>> struct r600_multi_fence {
>> struct pipe_reference reference;
>> - struct pipe_fence_handle *gfx;
>> - struct pipe_fence_handle *sdma;
>> + struct pipe_semaphore_handle *gfx;
>> + struct pipe_semaphore_handle *sdma;
>>
>> /* If the context wasn't flushed at fence creation, this is non-NULL. */
>> struct {
>> @@ -347,7 +347,7 @@ void r600_postflush_resume_features(struct r600_common_context *ctx)
>> }
>>
>> static void r600_add_fence_dependency(struct r600_common_context *rctx,
>> - struct pipe_fence_handle *fence)
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct radeon_winsys *ws = rctx->ws;
>>
>> @@ -356,8 +356,8 @@ static void r600_add_fence_dependency(struct r600_common_context *rctx,
>> ws->cs_add_fence_dependency(rctx->gfx.cs, fence);
>> }
>>
>> -static void r600_fence_server_sync(struct pipe_context *ctx,
>> - struct pipe_fence_handle *fence)
>> +static void r600_semaphore_server_sync(struct pipe_context *ctx,
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct r600_common_context *rctx = (struct r600_common_context *)ctx;
>> struct r600_multi_fence *rfence = (struct r600_multi_fence *)fence;
>> @@ -369,7 +369,7 @@ static void r600_fence_server_sync(struct pipe_context *ctx,
>> if (rctx->screen->info.drm_major == 2)
>> return;
>>
>> - /* Only imported fences need to be handled by fence_server_sync,
>> + /* Only imported fences need to be handled by semaphore_server_sync,
>> * because the winsys handles synchronizations automatically for BOs
>> * within the process.
>> *
>> @@ -391,14 +391,14 @@ static void r600_fence_server_sync(struct pipe_context *ctx,
>> }
>>
>> static void r600_flush_from_st(struct pipe_context *ctx,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags)
>> {
>> struct pipe_screen *screen = ctx->screen;
>> struct r600_common_context *rctx = (struct r600_common_context *)ctx;
>> struct radeon_winsys *ws = rctx->ws;
>> - struct pipe_fence_handle *gfx_fence = NULL;
>> - struct pipe_fence_handle *sdma_fence = NULL;
>> + struct pipe_semaphore_handle *gfx_fence = NULL;
>> + struct pipe_semaphore_handle *sdma_fence = NULL;
>> bool deferred_fence = false;
>> unsigned rflags = PIPE_FLUSH_ASYNC;
>>
>> @@ -411,14 +411,14 @@ static void r600_flush_from_st(struct pipe_context *ctx,
>>
>> if (!radeon_emitted(rctx->gfx.cs, rctx->initial_gfx_cs_size)) {
>> if (fence)
>> - ws->fence_reference(&gfx_fence, rctx->last_gfx_fence);
>> + ws->semaphore_reference(&gfx_fence, rctx->last_gfx_fence);
>> if (!(flags & PIPE_FLUSH_DEFERRED))
>> ws->cs_sync_flush(rctx->gfx.cs);
>> } else {
>> /* Instead of flushing, create a deferred fence. Constraints:
>> * - The state tracker must allow a deferred flush.
>> * - The state tracker must request a fence.
>> - * Thread safety in fence_finish must be ensured by the state tracker.
>> + * Thread safety in semaphore_finish must be ensured by the state tracker.
>> */
>> if (flags & PIPE_FLUSH_DEFERRED && fence) {
>> gfx_fence = rctx->ws->cs_get_next_fence(rctx->gfx.cs);
>> @@ -433,13 +433,13 @@ static void r600_flush_from_st(struct pipe_context *ctx,
>> struct r600_multi_fence *multi_fence =
>> CALLOC_STRUCT(r600_multi_fence);
>> if (!multi_fence) {
>> - ws->fence_reference(&sdma_fence, NULL);
>> - ws->fence_reference(&gfx_fence, NULL);
>> + ws->semaphore_reference(&sdma_fence, NULL);
>> + ws->semaphore_reference(&gfx_fence, NULL);
>> goto finish;
>> }
>>
>> multi_fence->reference.count = 1;
>> - /* If both fences are NULL, fence_finish will always return true. */
>> + /* If both fences are NULL, semaphore_finish will always return true. */
>> multi_fence->gfx = gfx_fence;
>> multi_fence->sdma = sdma_fence;
>>
>> @@ -448,8 +448,8 @@ static void r600_flush_from_st(struct pipe_context *ctx,
>> multi_fence->gfx_unflushed.ib_index = rctx->num_gfx_cs_flushes;
>> }
>>
>> - screen->fence_reference(screen, fence, NULL);
>> - *fence = (struct pipe_fence_handle*)multi_fence;
>> + screen->semaphore_reference(screen, fence, NULL);
>> + *fence = (struct pipe_semaphore_handle*)multi_fence;
>> }
>> finish:
>> if (!(flags & PIPE_FLUSH_DEFERRED)) {
>> @@ -460,7 +460,7 @@ finish:
>> }
>>
>> static void r600_flush_dma_ring(void *ctx, unsigned flags,
>> - struct pipe_fence_handle **fence)
>> + struct pipe_semaphore_handle **fence)
>> {
>> struct r600_common_context *rctx = (struct r600_common_context *)ctx;
>> struct radeon_winsys_cs *cs = rctx->dma.cs;
>> @@ -471,7 +471,7 @@ static void r600_flush_dma_ring(void *ctx, unsigned flags,
>>
>> if (!radeon_emitted(cs, 0)) {
>> if (fence)
>> - rctx->ws->fence_reference(fence, rctx->last_sdma_fence);
>> + rctx->ws->semaphore_reference(fence, rctx->last_sdma_fence);
>> return;
>> }
>>
>> @@ -480,7 +480,7 @@ static void r600_flush_dma_ring(void *ctx, unsigned flags,
>>
>> rctx->ws->cs_flush(cs, flags, &rctx->last_sdma_fence);
>> if (fence)
>> - rctx->ws->fence_reference(fence, rctx->last_sdma_fence);
>> + rctx->ws->semaphore_reference(fence, rctx->last_sdma_fence);
>>
>> if (check_vm) {
>> /* Use conservative timeout 800ms, after which we won't wait any
>> @@ -662,7 +662,7 @@ bool r600_common_context_init(struct r600_common_context *rctx,
>> rctx->b.texture_subdata = u_default_texture_subdata;
>> rctx->b.flush = r600_flush_from_st;
>> rctx->b.set_debug_callback = r600_set_debug_callback;
>> - rctx->b.fence_server_sync = r600_fence_server_sync;
>> + rctx->b.semaphore_server_sync = r600_semaphore_server_sync;
>> rctx->dma_clear_buffer = r600_dma_clear_buffer_fallback;
>>
>> /* evergreen_compute.c has a special codepath for global buffers.
>> @@ -742,8 +742,8 @@ void r600_common_context_cleanup(struct r600_common_context *rctx)
>> if (rctx->allocator_zeroed_memory) {
>> u_suballocator_destroy(rctx->allocator_zeroed_memory);
>> }
>> - rctx->ws->fence_reference(&rctx->last_gfx_fence, NULL);
>> - rctx->ws->fence_reference(&rctx->last_sdma_fence, NULL);
>> + rctx->ws->semaphore_reference(&rctx->last_gfx_fence, NULL);
>> + rctx->ws->semaphore_reference(&rctx->last_sdma_fence, NULL);
>> r600_resource_reference(&rctx->eop_bug_scratch, NULL);
>> }
>>
>> @@ -1151,25 +1151,25 @@ static uint64_t r600_get_timestamp(struct pipe_screen *screen)
>> rscreen->info.clock_crystal_freq;
>> }
>>
>> -static void r600_fence_reference(struct pipe_screen *screen,
>> - struct pipe_fence_handle **dst,
>> - struct pipe_fence_handle *src)
>> +static void r600_semaphore_reference(struct pipe_screen *screen,
>> + struct pipe_semaphore_handle **dst,
>> + struct pipe_semaphore_handle *src)
>> {
>> struct radeon_winsys *ws = ((struct r600_common_screen*)screen)->ws;
>> struct r600_multi_fence **rdst = (struct r600_multi_fence **)dst;
>> struct r600_multi_fence *rsrc = (struct r600_multi_fence *)src;
>>
>> if (pipe_reference(&(*rdst)->reference, &rsrc->reference)) {
>> - ws->fence_reference(&(*rdst)->gfx, NULL);
>> - ws->fence_reference(&(*rdst)->sdma, NULL);
>> + ws->semaphore_reference(&(*rdst)->gfx, NULL);
>> + ws->semaphore_reference(&(*rdst)->sdma, NULL);
>> FREE(*rdst);
>> }
>> *rdst = rsrc;
>> }
>>
>> -static boolean r600_fence_finish(struct pipe_screen *screen,
>> +static boolean r600_semaphore_finish(struct pipe_screen *screen,
>> struct pipe_context *ctx,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout)
>> {
>> struct radeon_winsys *rws = ((struct r600_common_screen*)screen)->ws;
>> @@ -1304,8 +1304,8 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
>> rscreen->b.get_compute_param = r600_get_compute_param;
>> rscreen->b.get_paramf = r600_get_paramf;
>> rscreen->b.get_timestamp = r600_get_timestamp;
>> - rscreen->b.fence_finish = r600_fence_finish;
>> - rscreen->b.fence_reference = r600_fence_reference;
>> + rscreen->b.semaphore_finish = r600_semaphore_finish;
>> + rscreen->b.semaphore_reference = r600_semaphore_reference;
>> rscreen->b.resource_destroy = u_resource_destroy_vtbl;
>> rscreen->b.resource_from_user_memory = r600_buffer_from_user_memory;
>> rscreen->b.query_memory_info = r600_query_memory_info;
>> diff --git a/src/gallium/drivers/r600/r600_pipe_common.h b/src/gallium/drivers/r600/r600_pipe_common.h
>> index c8b971a..3603d29 100644
>> --- a/src/gallium/drivers/r600/r600_pipe_common.h
>> +++ b/src/gallium/drivers/r600/r600_pipe_common.h
>> @@ -490,7 +490,7 @@ struct r600_viewports {
>> struct r600_ring {
>> struct radeon_winsys_cs *cs;
>> void (*flush)(void *ctx, unsigned flags,
>> - struct pipe_fence_handle **fence);
>> + struct pipe_semaphore_handle **fence);
>> };
>>
>> /* Saved CS data for debugging features. */
>> @@ -512,8 +512,8 @@ struct r600_common_context {
>> enum chip_class chip_class;
>> struct r600_ring gfx;
>> struct r600_ring dma;
>> - struct pipe_fence_handle *last_gfx_fence;
>> - struct pipe_fence_handle *last_sdma_fence;
>> + struct pipe_semaphore_handle *last_gfx_fence;
>> + struct pipe_semaphore_handle *last_sdma_fence;
>> struct r600_resource *eop_bug_scratch;
>> unsigned num_gfx_cs_flushes;
>> unsigned initial_gfx_cs_size;
>> diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c
>> index 987da9a..2683eab 100644
>> --- a/src/gallium/drivers/r600/r600_query.c
>> +++ b/src/gallium/drivers/r600/r600_query.c
>> @@ -51,7 +51,7 @@ struct r600_query_sw {
>> uint64_t end_time;
>>
>> /* Fence for GPU_FINISHED. */
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>> };
>>
>> static void r600_query_sw_destroy(struct r600_common_screen *rscreen,
>> @@ -59,7 +59,7 @@ static void r600_query_sw_destroy(struct r600_common_screen *rscreen,
>> {
>> struct r600_query_sw *query = (struct r600_query_sw *)rquery;
>>
>> - rscreen->b.fence_reference(&rscreen->b, &query->fence, NULL);
>> + rscreen->b.semaphore_reference(&rscreen->b, &query->fence, NULL);
>> FREE(query);
>> }
>>
>> @@ -421,7 +421,7 @@ static bool r600_query_sw_get_result(struct r600_common_context *rctx,
>> struct pipe_screen *screen = rctx->b.screen;
>> struct pipe_context *ctx = rquery->b.flushed ? NULL : &rctx->b;
>>
>> - result->b = screen->fence_finish(screen, ctx, query->fence,
>> + result->b = screen->semaphore_finish(screen, ctx, query->fence,
>> wait ? PIPE_TIMEOUT_INFINITE : 0);
>> return result->b;
>> }
>> diff --git a/src/gallium/drivers/r600/radeon_vce.c b/src/gallium/drivers/r600/radeon_vce.c
>> index 533bc18..290d9b6 100644
>> --- a/src/gallium/drivers/r600/radeon_vce.c
>> +++ b/src/gallium/drivers/r600/radeon_vce.c
>> @@ -379,7 +379,7 @@ static void rvce_flush(struct pipe_video_codec *encoder)
>> }
>>
>> static void rvce_cs_flush(void *ctx, unsigned flags,
>> - struct pipe_fence_handle **fence)
>> + struct pipe_semaphore_handle **fence)
>> {
>> // just ignored
>> }
>> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
>> index 9e45a9f..d163942 100644
>> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
>> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
>> @@ -241,7 +241,7 @@ void si_need_dma_space(struct r600_common_context *ctx, unsigned num_dw,
>> }
>>
>> static void r600_flush_dma_ring(void *ctx, unsigned flags,
>> - struct pipe_fence_handle **fence)
>> + struct pipe_semaphore_handle **fence)
>> {
>> struct r600_common_context *rctx = (struct r600_common_context *)ctx;
>> struct radeon_winsys_cs *cs = rctx->dma.cs;
>> @@ -252,7 +252,7 @@ static void r600_flush_dma_ring(void *ctx, unsigned flags,
>>
>> if (!radeon_emitted(cs, 0)) {
>> if (fence)
>> - rctx->ws->fence_reference(fence, rctx->last_sdma_fence);
>> + rctx->ws->semaphore_reference(fence, rctx->last_sdma_fence);
>> return;
>> }
>>
>> @@ -261,7 +261,7 @@ static void r600_flush_dma_ring(void *ctx, unsigned flags,
>>
>> rctx->ws->cs_flush(cs, flags, &rctx->last_sdma_fence);
>> if (fence)
>> - rctx->ws->fence_reference(fence, rctx->last_sdma_fence);
>> + rctx->ws->semaphore_reference(fence, rctx->last_sdma_fence);
>>
>> if (check_vm) {
>> /* Use conservative timeout 800ms, after which we won't wait any
>> @@ -515,8 +515,8 @@ void si_common_context_cleanup(struct r600_common_context *rctx)
>> if (rctx->allocator_zeroed_memory) {
>> u_suballocator_destroy(rctx->allocator_zeroed_memory);
>> }
>> - rctx->ws->fence_reference(&rctx->last_gfx_fence, NULL);
>> - rctx->ws->fence_reference(&rctx->last_sdma_fence, NULL);
>> + rctx->ws->semaphore_reference(&rctx->last_gfx_fence, NULL);
>> + rctx->ws->semaphore_reference(&rctx->last_sdma_fence, NULL);
>> r600_resource_reference(&rctx->eop_bug_scratch, NULL);
>> }
>>
>> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
>> index a8e632c..e2e9f27 100644
>> --- a/src/gallium/drivers/radeon/r600_pipe_common.h
>> +++ b/src/gallium/drivers/radeon/r600_pipe_common.h
>> @@ -370,7 +370,7 @@ struct r600_atom {
>> struct r600_ring {
>> struct radeon_winsys_cs *cs;
>> void (*flush)(void *ctx, unsigned flags,
>> - struct pipe_fence_handle **fence);
>> + struct pipe_semaphore_handle **fence);
>> };
>>
>> /* Saved CS data for debugging features. */
>> @@ -392,8 +392,8 @@ struct r600_common_context {
>> enum chip_class chip_class;
>> struct r600_ring gfx;
>> struct r600_ring dma;
>> - struct pipe_fence_handle *last_gfx_fence;
>> - struct pipe_fence_handle *last_sdma_fence;
>> + struct pipe_semaphore_handle *last_gfx_fence;
>> + struct pipe_semaphore_handle *last_sdma_fence;
>> struct r600_resource *eop_bug_scratch;
>> struct u_upload_mgr *cached_gtt_allocator;
>> unsigned num_gfx_cs_flushes;
>> diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c
>> index e736875..ab858d5 100644
>> --- a/src/gallium/drivers/radeon/r600_query.c
>> +++ b/src/gallium/drivers/radeon/r600_query.c
>> @@ -52,7 +52,7 @@ struct r600_query_sw {
>> uint64_t end_time;
>>
>> /* Fence for GPU_FINISHED. */
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>> };
>>
>> static void r600_query_sw_destroy(struct si_screen *sscreen,
>> @@ -60,7 +60,7 @@ static void r600_query_sw_destroy(struct si_screen *sscreen,
>> {
>> struct r600_query_sw *query = (struct r600_query_sw *)rquery;
>>
>> - sscreen->b.fence_reference(&sscreen->b, &query->fence, NULL);
>> + sscreen->b.semaphore_reference(&sscreen->b, &query->fence, NULL);
>> FREE(query);
>> }
>>
>> @@ -429,7 +429,7 @@ static bool r600_query_sw_get_result(struct r600_common_context *rctx,
>> struct pipe_screen *screen = rctx->b.screen;
>> struct pipe_context *ctx = rquery->b.flushed ? NULL : &rctx->b;
>>
>> - result->b = screen->fence_finish(screen, ctx, query->fence,
>> + result->b = screen->semaphore_finish(screen, ctx, query->fence,
>> wait ? PIPE_TIMEOUT_INFINITE : 0);
>> return result->b;
>> }
>> diff --git a/src/gallium/drivers/radeon/radeon_vce.c b/src/gallium/drivers/radeon/radeon_vce.c
>> index 427bf01e..b281e14 100644
>> --- a/src/gallium/drivers/radeon/radeon_vce.c
>> +++ b/src/gallium/drivers/radeon/radeon_vce.c
>> @@ -379,7 +379,7 @@ static void rvce_flush(struct pipe_video_codec *encoder)
>> }
>>
>> static void rvce_cs_flush(void *ctx, unsigned flags,
>> - struct pipe_fence_handle **fence)
>> + struct pipe_semaphore_handle **fence)
>> {
>> // just ignored
>> }
>> diff --git a/src/gallium/drivers/radeon/radeon_vcn_enc.c b/src/gallium/drivers/radeon/radeon_vcn_enc.c
>> index 06579c8..c58a997 100644
>> --- a/src/gallium/drivers/radeon/radeon_vcn_enc.c
>> +++ b/src/gallium/drivers/radeon/radeon_vcn_enc.c
>> @@ -66,7 +66,7 @@ static void radeon_enc_flush(struct pipe_video_codec *encoder)
>> }
>>
>> static void radeon_enc_cs_flush(void *ctx, unsigned flags,
>> - struct pipe_fence_handle **fence)
>> + struct pipe_semaphore_handle **fence)
>> {
>> // just ignored
>> }
>> diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h
>> index d1c761f..916a0b4 100644
>> --- a/src/gallium/drivers/radeon/radeon_winsys.h
>> +++ b/src/gallium/drivers/radeon/radeon_winsys.h
>> @@ -453,7 +453,7 @@ struct radeon_winsys {
>> struct radeon_winsys_cs *(*cs_create)(struct radeon_winsys_ctx *ctx,
>> enum ring_type ring_type,
>> void (*flush)(void *ctx, unsigned flags,
>> - struct pipe_fence_handle **fence),
>> + struct pipe_semaphore_handle **fence),
>> void *flush_ctx);
>>
>> /**
>> @@ -537,7 +537,7 @@ struct radeon_winsys {
>> */
>> int (*cs_flush)(struct radeon_winsys_cs *cs,
>> unsigned flags,
>> - struct pipe_fence_handle **fence);
>> + struct pipe_semaphore_handle **fence);
>>
>> /**
>> * Create a fence before the CS is flushed.
>> @@ -546,7 +546,7 @@ struct radeon_winsys {
>> * The fence must not be used for anything except \ref cs_add_fence_dependency
>> * before the flush.
>> */
>> - struct pipe_fence_handle *(*cs_get_next_fence)(struct radeon_winsys_cs *cs);
>> + struct pipe_semaphore_handle *(*cs_get_next_fence)(struct radeon_winsys_cs *cs);
>>
>> /**
>> * Return true if a buffer is referenced by a command stream.
>> @@ -580,7 +580,7 @@ struct radeon_winsys {
>> * the fence before execution.
>> */
>> void (*cs_add_fence_dependency)(struct radeon_winsys_cs *cs,
>> - struct pipe_fence_handle *fence);
>> + struct pipe_semaphore_handle *fence);
>>
>> /**
>> * Wait for the fence and return true if the fence has been signalled.
>> @@ -589,26 +589,26 @@ struct radeon_winsys {
>> * is signalled.
>> */
>> bool (*fence_wait)(struct radeon_winsys *ws,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout);
>>
>> /**
>> * Reference counting for fences.
>> */
>> - void (*fence_reference)(struct pipe_fence_handle **dst,
>> - struct pipe_fence_handle *src);
>> + void (*semaphore_reference)(struct pipe_semaphore_handle **dst,
>> + struct pipe_semaphore_handle *src);
>>
>> /**
>> * Create a new fence object corresponding to the given sync_file.
>> */
>> - struct pipe_fence_handle *(*fence_import_sync_file)(struct radeon_winsys *ws,
>> + struct pipe_semaphore_handle *(*fence_import_sync_file)(struct radeon_winsys *ws,
>> int fd);
>>
>> /**
>> * Return a sync_file FD corresponding to the given fence object.
>> */
>> int (*fence_export_sync_file)(struct radeon_winsys *ws,
>> - struct pipe_fence_handle *fence);
>> + struct pipe_semaphore_handle *fence);
>>
>> /**
>> * Initialize surface
>> diff --git a/src/gallium/drivers/radeonsi/si_fence.c b/src/gallium/drivers/radeonsi/si_fence.c
>> index dbf4c51..3b30eb0 100644
>> --- a/src/gallium/drivers/radeonsi/si_fence.c
>> +++ b/src/gallium/drivers/radeonsi/si_fence.c
>> @@ -39,8 +39,8 @@ struct si_fine_fence {
>>
>> struct si_multi_fence {
>> struct pipe_reference reference;
>> - struct pipe_fence_handle *gfx;
>> - struct pipe_fence_handle *sdma;
>> + struct pipe_semaphore_handle *gfx;
>> + struct pipe_semaphore_handle *sdma;
>> struct tc_unflushed_batch_token *tc_token;
>> struct util_queue_fence ready;
>>
>> @@ -54,7 +54,7 @@ struct si_multi_fence {
>> };
>>
>> static void si_add_fence_dependency(struct r600_common_context *rctx,
>> - struct pipe_fence_handle *fence)
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct radeon_winsys *ws = rctx->ws;
>>
>> @@ -63,17 +63,17 @@ static void si_add_fence_dependency(struct r600_common_context *rctx,
>> ws->cs_add_fence_dependency(rctx->gfx.cs, fence);
>> }
>>
>> -static void si_fence_reference(struct pipe_screen *screen,
>> - struct pipe_fence_handle **dst,
>> - struct pipe_fence_handle *src)
>> +static void si_semaphore_reference(struct pipe_screen *screen,
>> + struct pipe_semaphore_handle **dst,
>> + struct pipe_semaphore_handle *src)
>> {
>> struct radeon_winsys *ws = ((struct si_screen*)screen)->ws;
>> struct si_multi_fence **rdst = (struct si_multi_fence **)dst;
>> struct si_multi_fence *rsrc = (struct si_multi_fence *)src;
>>
>> if (pipe_reference(&(*rdst)->reference, &rsrc->reference)) {
>> - ws->fence_reference(&(*rdst)->gfx, NULL);
>> - ws->fence_reference(&(*rdst)->sdma, NULL);
>> + ws->semaphore_reference(&(*rdst)->gfx, NULL);
>> + ws->semaphore_reference(&(*rdst)->sdma, NULL);
>> tc_unflushed_batch_token_reference(&(*rdst)->tc_token, NULL);
>> r600_resource_reference(&(*rdst)->fine.buf, NULL);
>> FREE(*rdst);
>> @@ -93,7 +93,7 @@ static struct si_multi_fence *si_create_multi_fence()
>> return fence;
>> }
>>
>> -struct pipe_fence_handle *si_create_fence(struct pipe_context *ctx,
>> +struct pipe_semaphore_handle *si_create_fence(struct pipe_context *ctx,
>> struct tc_unflushed_batch_token *tc_token)
>> {
>> struct si_multi_fence *fence = si_create_multi_fence();
>> @@ -103,11 +103,11 @@ struct pipe_fence_handle *si_create_fence(struct pipe_context *ctx,
>> util_queue_fence_reset(&fence->ready);
>> tc_unflushed_batch_token_reference(&fence->tc_token, tc_token);
>>
>> - return (struct pipe_fence_handle *)fence;
>> + return (struct pipe_semaphore_handle *)fence;
>> }
>>
>> -static void si_fence_server_sync(struct pipe_context *ctx,
>> - struct pipe_fence_handle *fence)
>> +static void si_semaphore_server_sync(struct pipe_context *ctx,
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct r600_common_context *rctx = (struct r600_common_context *)ctx;
>> struct si_multi_fence *rfence = (struct si_multi_fence *)fence;
>> @@ -181,9 +181,9 @@ static void si_fine_fence_set(struct si_context *ctx,
>> }
>> }
>>
>> -static boolean si_fence_finish(struct pipe_screen *screen,
>> +static boolean si_semaphore_finish(struct pipe_screen *screen,
>> struct pipe_context *ctx,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout)
>> {
>> struct radeon_winsys *rws = ((struct si_screen*)screen)->ws;
>> @@ -236,7 +236,7 @@ static boolean si_fence_finish(struct pipe_screen *screen,
>>
>> if (rfence->fine.buf &&
>> si_fine_fence_signaled(rws, &rfence->fine)) {
>> - rws->fence_reference(&rfence->gfx, NULL);
>> + rws->semaphore_reference(&rfence->gfx, NULL);
>> r600_resource_reference(&rfence->fine.buf, NULL);
>> return true;
>> }
>> @@ -297,8 +297,8 @@ static boolean si_fence_finish(struct pipe_screen *screen,
>> return false;
>> }
>>
>> -static void si_create_fence_fd(struct pipe_context *ctx,
>> - struct pipe_fence_handle **pfence, int fd,
>> +static void si_create_semaphore_fd(struct pipe_context *ctx,
>> + struct pipe_semaphore_handle **pfence, int fd,
>> enum pipe_fd_type type)
>> {
>> struct si_screen *sscreen = (struct si_screen*)ctx->screen;
>> @@ -322,11 +322,11 @@ static void si_create_fence_fd(struct pipe_context *ctx,
>> return;
>> }
>>
>> - *pfence = (struct pipe_fence_handle*)rfence;
>> + *pfence = (struct pipe_semaphore_handle*)rfence;
>> }
>>
>> -static int si_fence_get_fd(struct pipe_screen *screen,
>> - struct pipe_fence_handle *fence)
>> +static int si_semaphore_get_fd(struct pipe_screen *screen,
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct si_screen *sscreen = (struct si_screen*)screen;
>> struct radeon_winsys *ws = sscreen->ws;
>> @@ -371,14 +371,14 @@ static int si_fence_get_fd(struct pipe_screen *screen,
>> }
>>
>> static void si_flush_from_st(struct pipe_context *ctx,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags)
>> {
>> struct pipe_screen *screen = ctx->screen;
>> struct r600_common_context *rctx = (struct r600_common_context *)ctx;
>> struct radeon_winsys *ws = rctx->ws;
>> - struct pipe_fence_handle *gfx_fence = NULL;
>> - struct pipe_fence_handle *sdma_fence = NULL;
>> + struct pipe_semaphore_handle *gfx_fence = NULL;
>> + struct pipe_semaphore_handle *sdma_fence = NULL;
>> bool deferred_fence = false;
>> struct si_fine_fence fine = {};
>> unsigned rflags = PIPE_FLUSH_ASYNC;
>> @@ -399,18 +399,18 @@ static void si_flush_from_st(struct pipe_context *ctx,
>>
>> if (!radeon_emitted(rctx->gfx.cs, rctx->initial_gfx_cs_size)) {
>> if (fence)
>> - ws->fence_reference(&gfx_fence, rctx->last_gfx_fence);
>> + ws->semaphore_reference(&gfx_fence, rctx->last_gfx_fence);
>> if (!(flags & PIPE_FLUSH_DEFERRED))
>> ws->cs_sync_flush(rctx->gfx.cs);
>> } else {
>> /* Instead of flushing, create a deferred fence. Constraints:
>> * - The state tracker must allow a deferred flush.
>> * - The state tracker must request a fence.
>> - * - fence_get_fd is not allowed.
>> - * Thread safety in fence_finish must be ensured by the state tracker.
>> + * - semaphore_get_fd is not allowed.
>> + * Thread safety in semaphore_finish must be ensured by the state tracker.
>> */
>> if (flags & PIPE_FLUSH_DEFERRED &&
>> - !(flags & PIPE_FLUSH_FENCE_FD) &&
>> + !(flags & PIPE_FLUSH_SEMAPHORE_FD) &&
>> fence) {
>> gfx_fence = rctx->ws->cs_get_next_fence(rctx->gfx.cs);
>> deferred_fence = true;
>> @@ -429,16 +429,16 @@ static void si_flush_from_st(struct pipe_context *ctx,
>> } else {
>> multi_fence = si_create_multi_fence();
>> if (!multi_fence) {
>> - ws->fence_reference(&sdma_fence, NULL);
>> - ws->fence_reference(&gfx_fence, NULL);
>> + ws->semaphore_reference(&sdma_fence, NULL);
>> + ws->semaphore_reference(&gfx_fence, NULL);
>> goto finish;
>> }
>>
>> - screen->fence_reference(screen, fence, NULL);
>> - *fence = (struct pipe_fence_handle*)multi_fence;
>> + screen->semaphore_reference(screen, fence, NULL);
>> + *fence = (struct pipe_semaphore_handle*)multi_fence;
>> }
>>
>> - /* If both fences are NULL, fence_finish will always return true. */
>> + /* If both fences are NULL, semaphore_finish will always return true. */
>> multi_fence->gfx = gfx_fence;
>> multi_fence->sdma = sdma_fence;
>>
>> @@ -467,13 +467,13 @@ finish:
>> void si_init_fence_functions(struct si_context *ctx)
>> {
>> ctx->b.b.flush = si_flush_from_st;
>> - ctx->b.b.create_fence_fd = si_create_fence_fd;
>> - ctx->b.b.fence_server_sync = si_fence_server_sync;
>> + ctx->b.b.create_semaphore_fd = si_create_semaphore_fd;
>> + ctx->b.b.semaphore_server_sync = si_semaphore_server_sync;
>> }
>>
>> void si_init_screen_fence_functions(struct si_screen *screen)
>> {
>> - screen->b.fence_finish = si_fence_finish;
>> - screen->b.fence_reference = si_fence_reference;
>> - screen->b.fence_get_fd = si_fence_get_fd;
>> + screen->b.semaphore_finish = si_semaphore_finish;
>> + screen->b.semaphore_reference = si_semaphore_reference;
>> + screen->b.semaphore_get_fd = si_semaphore_get_fd;
>> }
>> diff --git a/src/gallium/drivers/radeonsi/si_get.c b/src/gallium/drivers/radeonsi/si_get.c
>> index 1c84a25..8909898 100644
>> --- a/src/gallium/drivers/radeonsi/si_get.c
>> +++ b/src/gallium/drivers/radeonsi/si_get.c
>> @@ -276,7 +276,7 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>> case PIPE_CAP_MAX_COMBINED_SHADER_OUTPUT_RESOURCES:
>> return 0;
>>
>> - case PIPE_CAP_NATIVE_FENCE_FD:
>> + case PIPE_CAP_NATIVE_SEMAPHORE_FD:
>> return sscreen->info.has_sync_file;
>>
>> case PIPE_CAP_QUERY_BUFFER_OBJECT:
>> diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c b/src/gallium/drivers/radeonsi/si_hw_context.c
>> index 3823be0..16e362e 100644
>> --- a/src/gallium/drivers/radeonsi/si_hw_context.c
>> +++ b/src/gallium/drivers/radeonsi/si_hw_context.c
>> @@ -67,7 +67,7 @@ void si_need_cs_space(struct si_context *ctx)
>> }
>>
>> void si_context_gfx_flush(void *context, unsigned flags,
>> - struct pipe_fence_handle **fence)
>> + struct pipe_semaphore_handle **fence)
>> {
>> struct si_context *ctx = context;
>> struct radeon_winsys_cs *cs = ctx->b.gfx.cs;
>> @@ -129,10 +129,10 @@ void si_context_gfx_flush(void *context, unsigned flags,
>> /* Flush the CS. */
>> ws->cs_flush(cs, flags, &ctx->b.last_gfx_fence);
>> if (fence)
>> - ws->fence_reference(fence, ctx->b.last_gfx_fence);
>> + ws->semaphore_reference(fence, ctx->b.last_gfx_fence);
>>
>> /* This must be after cs_flush returns, since the context's API
>> - * thread can concurrently read this value in si_fence_finish. */
>> + * thread can concurrently read this value in si_semaphore_finish. */
>> ctx->b.num_gfx_cs_flushes++;
>>
>> /* Check VM faults if needed. */
>> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
>> index 676d199..abbce25 100644
>> --- a/src/gallium/drivers/radeonsi/si_pipe.c
>> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
>> @@ -454,7 +454,7 @@ static struct pipe_context *si_pipe_create_context(struct pipe_screen *screen,
>> return ctx;
>>
>> /* Use asynchronous flushes only on amdgpu, since the radeon
>> - * implementation for fence_server_sync is incomplete. */
>> + * implementation for semaphore_server_sync is incomplete. */
>> return threaded_context_create(ctx, &sscreen->pool_transfers,
>> si_replace_buffer_storage,
>> sscreen->info.drm_major >= 3 ? si_create_fence : NULL,
>> diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
>> index 3a959f9..d8735b1 100644
>> --- a/src/gallium/drivers/radeonsi/si_pipe.h
>> +++ b/src/gallium/drivers/radeonsi/si_pipe.h
>> @@ -705,7 +705,7 @@ void si_init_dma_functions(struct si_context *sctx);
>> /* si_fence.c */
>> void si_init_fence_functions(struct si_context *ctx);
>> void si_init_screen_fence_functions(struct si_screen *screen);
>> -struct pipe_fence_handle *si_create_fence(struct pipe_context *ctx,
>> +struct pipe_semaphore_handle *si_create_fence(struct pipe_context *ctx,
>> struct tc_unflushed_batch_token *tc_token);
>>
>> /* si_get.c */
>> @@ -715,7 +715,7 @@ void si_init_screen_get_functions(struct si_screen *sscreen);
>> /* si_hw_context.c */
>> void si_destroy_saved_cs(struct si_saved_cs *scs);
>> void si_context_gfx_flush(void *context, unsigned flags,
>> - struct pipe_fence_handle **fence);
>> + struct pipe_semaphore_handle **fence);
>> void si_begin_new_cs(struct si_context *ctx);
>> void si_need_cs_space(struct si_context *ctx);
>>
>> diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c
>> index e1f3c4f..224e4ca 100644
>> --- a/src/gallium/drivers/rbug/rbug_context.c
>> +++ b/src/gallium/drivers/rbug/rbug_context.c
>> @@ -988,7 +988,7 @@ rbug_clear_depth_stencil(struct pipe_context *_pipe,
>>
>> static void
>> rbug_flush(struct pipe_context *_pipe,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags)
>> {
>> struct rbug_context *rb_pipe = rbug_context(_pipe);
>> diff --git a/src/gallium/drivers/rbug/rbug_screen.c b/src/gallium/drivers/rbug/rbug_screen.c
>> index 2477edb..ef9f915 100644
>> --- a/src/gallium/drivers/rbug/rbug_screen.c
>> +++ b/src/gallium/drivers/rbug/rbug_screen.c
>> @@ -250,29 +250,29 @@ rbug_screen_flush_frontbuffer(struct pipe_screen *_screen,
>> }
>>
>> static void
>> -rbug_screen_fence_reference(struct pipe_screen *_screen,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *fence)
>> +rbug_screen_semaphore_reference(struct pipe_screen *_screen,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct rbug_screen *rb_screen = rbug_screen(_screen);
>> struct pipe_screen *screen = rb_screen->screen;
>>
>> - screen->fence_reference(screen,
>> + screen->semaphore_reference(screen,
>> ptr,
>> fence);
>> }
>>
>> static boolean
>> -rbug_screen_fence_finish(struct pipe_screen *_screen,
>> +rbug_screen_semaphore_finish(struct pipe_screen *_screen,
>> struct pipe_context *_ctx,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout)
>> {
>> struct rbug_screen *rb_screen = rbug_screen(_screen);
>> struct pipe_screen *screen = rb_screen->screen;
>> struct pipe_context *ctx = _ctx ? rbug_context(_ctx)->pipe : NULL;
>>
>> - return screen->fence_finish(screen, ctx, fence, timeout);
>> + return screen->semaphore_finish(screen, ctx, fence, timeout);
>> }
>>
>> boolean
>> @@ -319,8 +319,8 @@ rbug_screen_create(struct pipe_screen *screen)
>> SCR_INIT(resource_changed);
>> rb_screen->base.resource_destroy = rbug_screen_resource_destroy;
>> rb_screen->base.flush_frontbuffer = rbug_screen_flush_frontbuffer;
>> - rb_screen->base.fence_reference = rbug_screen_fence_reference;
>> - rb_screen->base.fence_finish = rbug_screen_fence_finish;
>> + rb_screen->base.semaphore_reference = rbug_screen_semaphore_reference;
>> + rb_screen->base.semaphore_finish = rbug_screen_semaphore_finish;
>>
>> rb_screen->screen = screen;
>>
>> diff --git a/src/gallium/drivers/softpipe/sp_fence.c b/src/gallium/drivers/softpipe/sp_fence.c
>> index 1861b0d..8b43d1b 100644
>> --- a/src/gallium/drivers/softpipe/sp_fence.c
>> +++ b/src/gallium/drivers/softpipe/sp_fence.c
>> @@ -32,18 +32,18 @@
>>
>>
>> static void
>> -softpipe_fence_reference(struct pipe_screen *screen,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *fence)
>> +softpipe_semaphore_reference(struct pipe_screen *screen,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *fence)
>> {
>> *ptr = fence;
>> }
>>
>>
>> static boolean
>> -softpipe_fence_finish(struct pipe_screen *screen,
>> +softpipe_semaphore_finish(struct pipe_screen *screen,
>> struct pipe_context *ctx,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout)
>> {
>> assert(fence);
>> @@ -54,6 +54,6 @@ softpipe_fence_finish(struct pipe_screen *screen,
>> void
>> softpipe_init_screen_fence_funcs(struct pipe_screen *screen)
>> {
>> - screen->fence_reference = softpipe_fence_reference;
>> - screen->fence_finish = softpipe_fence_finish;
>> + screen->semaphore_reference = softpipe_semaphore_reference;
>> + screen->semaphore_finish = softpipe_semaphore_finish;
>> }
>> diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c
>> index 3bf8c49..19c82a0 100644
>> --- a/src/gallium/drivers/softpipe/sp_flush.c
>> +++ b/src/gallium/drivers/softpipe/sp_flush.c
>> @@ -46,7 +46,7 @@
>> void
>> softpipe_flush( struct pipe_context *pipe,
>> unsigned flags,
>> - struct pipe_fence_handle **fence )
>> + struct pipe_semaphore_handle **fence )
>> {
>> struct softpipe_context *softpipe = softpipe_context(pipe);
>> uint i;
>> @@ -96,7 +96,7 @@ softpipe_flush( struct pipe_context *pipe,
>>
>> void
>> softpipe_flush_wrapped(struct pipe_context *pipe,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags)
>> {
>> softpipe_flush(pipe, SP_FLUSH_TEXTURE_CACHE, fence);
>> @@ -141,7 +141,7 @@ softpipe_flush_resource(struct pipe_context *pipe,
>> * Flush and wait.
>> */
>>
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>>
>> if (do_not_block)
>> return FALSE;
>> @@ -153,9 +153,9 @@ softpipe_flush_resource(struct pipe_context *pipe,
>> * This is for illustrative purposes only, as softpipe does not
>> * have fences.
>> */
>> - pipe->screen->fence_finish(pipe->screen, NULL, fence,
>> + pipe->screen->semaphore_finish(pipe->screen, NULL, fence,
>> PIPE_TIMEOUT_INFINITE);
>> - pipe->screen->fence_reference(pipe->screen, &fence, NULL);
>> + pipe->screen->semaphore_reference(pipe->screen, &fence, NULL);
>> }
>> } else {
>> /*
>> diff --git a/src/gallium/drivers/softpipe/sp_flush.h b/src/gallium/drivers/softpipe/sp_flush.h
>> index abbc098..0f173b1 100644
>> --- a/src/gallium/drivers/softpipe/sp_flush.h
>> +++ b/src/gallium/drivers/softpipe/sp_flush.h
>> @@ -31,18 +31,18 @@
>> #include "pipe/p_compiler.h"
>>
>> struct pipe_context;
>> -struct pipe_fence_handle;
>> +struct pipe_semaphore_handle;
>>
>> #define SP_FLUSH_TEXTURE_CACHE 0x2
>>
>> void
>> softpipe_flush(struct pipe_context *pipe,
>> unsigned flags,
>> - struct pipe_fence_handle **fence);
>> + struct pipe_semaphore_handle **fence);
>>
>> void
>> softpipe_flush_wrapped(struct pipe_context *pipe,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags);
>>
>> boolean
>> diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
>> index 08efd14..10395a0 100644
>> --- a/src/gallium/drivers/softpipe/sp_screen.c
>> +++ b/src/gallium/drivers/softpipe/sp_screen.c
>> @@ -295,7 +295,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>> case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
>> case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
>> case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
>> - case PIPE_CAP_NATIVE_FENCE_FD:
>> + case PIPE_CAP_NATIVE_SEMAPHORE_FD:
>> case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
>> case PIPE_CAP_TGSI_FS_FBFETCH:
>> case PIPE_CAP_TGSI_MUL_ZERO_WINS:
>> diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c
>> index 546b9f4..b706fad 100644
>> --- a/src/gallium/drivers/svga/svga_context.c
>> +++ b/src/gallium/drivers/svga/svga_context.c
>> @@ -336,10 +336,10 @@ done:
>>
>> void
>> svga_context_flush(struct svga_context *svga,
>> - struct pipe_fence_handle **pfence)
>> + struct pipe_semaphore_handle **pfence)
>> {
>> struct svga_screen *svgascreen = svga_screen(svga->pipe.screen);
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>> uint64_t t0;
>>
>> SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_CONTEXTFLUSH);
>> @@ -397,14 +397,14 @@ svga_context_flush(struct svga_context *svga,
>>
>> if (SVGA_DEBUG & DEBUG_SYNC) {
>> if (fence)
>> - svga->pipe.screen->fence_finish(svga->pipe.screen, NULL, fence,
>> + svga->pipe.screen->semaphore_finish(svga->pipe.screen, NULL, fence,
>> PIPE_TIMEOUT_INFINITE);
>> }
>>
>> if (pfence)
>> - svgascreen->sws->fence_reference(svgascreen->sws, pfence, fence);
>> + svgascreen->sws->semaphore_reference(svgascreen->sws, pfence, fence);
>>
>> - svgascreen->sws->fence_reference(svgascreen->sws, &fence, NULL);
>> + svgascreen->sws->semaphore_reference(svgascreen->sws, &fence, NULL);
>>
>> SVGA_STATS_TIME_POP(svga_sws(svga));
>> }
>> @@ -417,13 +417,13 @@ void
>> svga_context_finish(struct svga_context *svga)
>> {
>> struct pipe_screen *screen = svga->pipe.screen;
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>>
>> SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_CONTEXTFINISH);
>>
>> svga_context_flush(svga, &fence);
>> - screen->fence_finish(screen, NULL, fence, PIPE_TIMEOUT_INFINITE);
>> - screen->fence_reference(screen, &fence, NULL);
>> + screen->semaphore_finish(screen, NULL, fence, PIPE_TIMEOUT_INFINITE);
>> + screen->semaphore_reference(screen, &fence, NULL);
>>
>> SVGA_STATS_TIME_POP(svga_sws(svga));
>> }
>> diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h
>> index 80c59c0..b3c2e02 100644
>> --- a/src/gallium/drivers/svga/svga_context.h
>> +++ b/src/gallium/drivers/svga/svga_context.h
>> @@ -666,7 +666,7 @@ void svga_cleanup_tss_binding( struct svga_context *svga );
>> void svga_cleanup_framebuffer( struct svga_context *svga );
>>
>> void svga_context_flush( struct svga_context *svga,
>> - struct pipe_fence_handle **pfence );
>> + struct pipe_semaphore_handle **pfence );
>>
>> void svga_context_finish(struct svga_context *svga);
>>
>> diff --git a/src/gallium/drivers/svga/svga_pipe_flush.c b/src/gallium/drivers/svga/svga_pipe_flush.c
>> index 1f4eebc..642d71e 100644
>> --- a/src/gallium/drivers/svga/svga_pipe_flush.c
>> +++ b/src/gallium/drivers/svga/svga_pipe_flush.c
>> @@ -33,7 +33,7 @@
>>
>>
>> static void svga_flush( struct pipe_context *pipe,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags)
>> {
>> struct svga_context *svga = svga_context(pipe);
>> @@ -42,7 +42,7 @@ static void svga_flush( struct pipe_context *pipe,
>> */
>> svga_surfaces_flush( svga );
>>
>> - if (flags & PIPE_FLUSH_FENCE_FD)
>> + if (flags & PIPE_FLUSH_SEMAPHORE_FD)
>> svga->swc->hints |= SVGA_HINT_FLAG_EXPORT_FENCE_FD;
>>
>> /* Flush command queue.
>> @@ -75,16 +75,16 @@ static void svga_flush( struct pipe_context *pipe,
>>
>>
>> /**
>> - * svga_create_fence_fd
>> + * svga_create_semaphore_fd
>> *
>> * Wraps a SVGA fence around an imported file descriptor. This
>> * fd represents a fence from another process/device. The fence created
>> - * here can then be fed into fence_server_sync() so SVGA can synchronize
>> + * here can then be fed into semaphore_server_sync() so SVGA can synchronize
>> * with an external process
>> */
>> static void
>> -svga_create_fence_fd(struct pipe_context *pipe,
>> - struct pipe_fence_handle **fence,
>> +svga_create_semaphore_fd(struct pipe_context *pipe,
>> + struct pipe_semaphore_handle **fence,
>> int fd,
>> enum pipe_fd_type type)
>> {
>> @@ -96,25 +96,25 @@ svga_create_fence_fd(struct pipe_context *pipe,
>>
>>
>> /**
>> - * svga_fence_server_sync
>> + * svga_semaphore_server_sync
>> *
>> * This function imports a fence from another process/device into the current
>> * software context so that SVGA can synchronize with it.
>> */
>> static void
>> -svga_fence_server_sync(struct pipe_context *pipe,
>> - struct pipe_fence_handle *fence)
>> +svga_semaphore_server_sync(struct pipe_context *pipe,
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct svga_winsys_screen *sws = svga_winsys_screen(pipe->screen);
>> struct svga_context *svga = svga_context(pipe);
>>
>> - sws->fence_server_sync(sws, &svga->swc->imported_fence_fd, fence);
>> + sws->semaphore_server_sync(sws, &svga->swc->imported_fence_fd, fence);
>> }
>>
>>
>> void svga_init_flush_functions( struct svga_context *svga )
>> {
>> svga->pipe.flush = svga_flush;
>> - svga->pipe.create_fence_fd = svga_create_fence_fd;
>> - svga->pipe.fence_server_sync = svga_fence_server_sync;
>> + svga->pipe.create_semaphore_fd = svga_create_semaphore_fd;
>> + svga->pipe.semaphore_server_sync = svga_semaphore_server_sync;
>> }
>> diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c
>> index 2692452..2e815a8 100644
>> --- a/src/gallium/drivers/svga/svga_pipe_query.c
>> +++ b/src/gallium/drivers/svga/svga_pipe_query.c
>> @@ -51,7 +51,7 @@ struct svga_query {
>>
>> unsigned id; /** Per-context query identifier */
>>
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>>
>> /** For PIPE_QUERY_OCCLUSION_COUNTER / SVGA3D_QUERYTYPE_OCCLUSION */
>>
>> @@ -138,7 +138,7 @@ begin_query_vgpu9(struct svga_context *svga, struct svga_query *sq)
>> }
>>
>> sq->queryResult->state = SVGA3D_QUERYSTATE_NEW;
>> - sws->fence_reference(sws, &sq->fence, NULL);
>> + sws->semaphore_reference(sws, &sq->fence, NULL);
>>
>> ret = SVGA3D_BeginQuery(svga->swc, sq->svga_type);
>> if (ret != PIPE_OK) {
>> @@ -191,7 +191,7 @@ get_query_result_vgpu9(struct svga_context *svga, struct svga_query *sq,
>> if (state == SVGA3D_QUERYSTATE_PENDING) {
>> if (!wait)
>> return FALSE;
>> - sws->fence_finish(sws, sq->fence, PIPE_TIMEOUT_INFINITE,
>> + sws->semaphore_finish(sws, sq->fence, PIPE_TIMEOUT_INFINITE,
>> SVGA_FENCE_FLAG_QUERY);
>> state = sq->queryResult->state;
>> }
>> @@ -588,7 +588,7 @@ begin_query_vgpu10(struct svga_context *svga, struct svga_query *sq)
>> enum pipe_error ret = PIPE_OK;
>> int status = 0;
>>
>> - sws->fence_reference(sws, &sq->fence, NULL);
>> + sws->semaphore_reference(sws, &sq->fence, NULL);
>>
>> /* Initialize the query state to NEW */
>> status = sws->query_init(sws, sq->gb_query, sq->offset, SVGA3D_QUERYSTATE_NEW);
>> @@ -652,7 +652,7 @@ get_query_result_vgpu10(struct svga_context *svga, struct svga_query *sq,
>> queryState == SVGA3D_QUERYSTATE_NEW) {
>> if (!wait)
>> return FALSE;
>> - sws->fence_finish(sws, sq->fence, PIPE_TIMEOUT_INFINITE,
>> + sws->semaphore_finish(sws, sq->fence, PIPE_TIMEOUT_INFINITE,
>> SVGA_FENCE_FLAG_QUERY);
>> sws->query_get_result(sws, sq->gb_query, sq->offset, &queryState, result, resultLen);
>> }
>> @@ -799,7 +799,7 @@ svga_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
>> } else {
>> sws->buffer_destroy(sws, sq->hwbuf);
>> }
>> - sws->fence_reference(sws, &sq->fence, NULL);
>> + sws->semaphore_reference(sws, &sq->fence, NULL);
>> break;
>> case PIPE_QUERY_PRIMITIVES_GENERATED:
>> case PIPE_QUERY_PRIMITIVES_EMITTED:
>> @@ -807,7 +807,7 @@ svga_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
>> case PIPE_QUERY_TIMESTAMP:
>> assert(svga_have_vgpu10(svga));
>> destroy_query_vgpu10(svga, sq);
>> - sws->fence_reference(sws, &sq->fence, NULL);
>> + sws->semaphore_reference(sws, &sq->fence, NULL);
>> break;
>> case SVGA_QUERY_NUM_DRAW_CALLS:
>> case SVGA_QUERY_NUM_FALLBACKS:
>> @@ -1237,7 +1237,7 @@ svga_render_condition(struct pipe_context *pipe, struct pipe_query *q,
>>
>> if ((mode == PIPE_RENDER_COND_WAIT ||
>> mode == PIPE_RENDER_COND_BY_REGION_WAIT) && sq->fence) {
>> - sws->fence_finish(sws, sq->fence, PIPE_TIMEOUT_INFINITE,
>> + sws->semaphore_finish(sws, sq->fence, PIPE_TIMEOUT_INFINITE,
>> SVGA_FENCE_FLAG_QUERY);
>> }
>> }
>> diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c
>> index 71b8ebe..d991ab9 100644
>> --- a/src/gallium/drivers/svga/svga_resource_texture.c
>> +++ b/src/gallium/drivers/svga/svga_resource_texture.c
>> @@ -105,7 +105,7 @@ svga_transfer_dma(struct svga_context *svga,
>> struct svga_texture *texture = svga_texture(st->base.resource);
>> struct svga_screen *screen = svga_screen(texture->b.b.screen);
>> struct svga_winsys_screen *sws = screen->sws;
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>>
>> assert(!st->use_direct_map);
>>
>> @@ -128,8 +128,8 @@ svga_transfer_dma(struct svga_context *svga,
>>
>> if (transfer == SVGA3D_READ_HOST_VRAM) {
>> svga_context_flush(svga, &fence);
>> - sws->fence_finish(sws, fence, PIPE_TIMEOUT_INFINITE, 0);
>> - sws->fence_reference(sws, &fence, NULL);
>> + sws->semaphore_finish(sws, fence, PIPE_TIMEOUT_INFINITE, 0);
>> + sws->semaphore_reference(sws, &fence, NULL);
>> }
>> }
>> else {
>> @@ -187,7 +187,7 @@ svga_transfer_dma(struct svga_context *svga,
>>
>> if (transfer == SVGA3D_READ_HOST_VRAM) {
>> svga_context_flush(svga, &fence);
>> - sws->fence_finish(sws, fence, PIPE_TIMEOUT_INFINITE, 0);
>> + sws->semaphore_finish(sws, fence, PIPE_TIMEOUT_INFINITE, 0);
>>
>> hw = sws->buffer_map(sws, st->hwbuf, PIPE_TRANSFER_READ);
>> assert(hw);
>> diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
>> index 2f68466..8f20789 100644
>> --- a/src/gallium/drivers/svga/svga_screen.c
>> +++ b/src/gallium/drivers/svga/svga_screen.c
>> @@ -336,7 +336,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
>> case PIPE_CAP_GENERATE_MIPMAP:
>> return sws->have_generate_mipmap_cmd;
>>
>> - case PIPE_CAP_NATIVE_FENCE_FD:
>> + case PIPE_CAP_NATIVE_SEMAPHORE_FD:
>> return sws->have_fence_fd;
>>
>> case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
>> @@ -740,19 +740,19 @@ svga_get_shader_param(struct pipe_screen *screen, enum pipe_shader_type shader,
>>
>>
>> static void
>> -svga_fence_reference(struct pipe_screen *screen,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *fence)
>> +svga_semaphore_reference(struct pipe_screen *screen,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct svga_winsys_screen *sws = svga_screen(screen)->sws;
>> - sws->fence_reference(sws, ptr, fence);
>> + sws->semaphore_reference(sws, ptr, fence);
>> }
>>
>>
>> static boolean
>> -svga_fence_finish(struct pipe_screen *screen,
>> +svga_semaphore_finish(struct pipe_screen *screen,
>> struct pipe_context *ctx,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout)
>> {
>> struct svga_winsys_screen *sws = svga_screen(screen)->sws;
>> @@ -767,7 +767,7 @@ svga_fence_finish(struct pipe_screen *screen,
>> SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "%s fence_ptr %p\n",
>> __FUNCTION__, fence);
>>
>> - retVal = sws->fence_finish(sws, fence, timeout, 0) == 0;
>> + retVal = sws->semaphore_finish(sws, fence, timeout, 0) == 0;
>> }
>>
>> SVGA_STATS_TIME_POP(sws);
>> @@ -777,12 +777,12 @@ svga_fence_finish(struct pipe_screen *screen,
>>
>>
>> static int
>> -svga_fence_get_fd(struct pipe_screen *screen,
>> - struct pipe_fence_handle *fence)
>> +svga_semaphore_get_fd(struct pipe_screen *screen,
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct svga_winsys_screen *sws = svga_screen(screen)->sws;
>>
>> - return sws->fence_get_fd(sws, fence, TRUE);
>> + return sws->semaphore_get_fd(sws, fence, TRUE);
>> }
>>
>>
>> @@ -949,9 +949,9 @@ svga_screen_create(struct svga_winsys_screen *sws)
>> screen->get_timestamp = NULL;
>> screen->is_format_supported = svga_is_format_supported;
>> screen->context_create = svga_context_create;
>> - screen->fence_reference = svga_fence_reference;
>> - screen->fence_finish = svga_fence_finish;
>> - screen->fence_get_fd = svga_fence_get_fd;
>> + screen->semaphore_reference = svga_semaphore_reference;
>> + screen->semaphore_finish = svga_semaphore_finish;
>> + screen->semaphore_get_fd = svga_semaphore_get_fd;
>>
>> screen->get_driver_query_info = svga_get_driver_query_info;
>> svgascreen->sws = sws;
>> diff --git a/src/gallium/drivers/svga/svga_screen_cache.c b/src/gallium/drivers/svga/svga_screen_cache.c
>> index 0c2b594..e39a128 100644
>> --- a/src/gallium/drivers/svga/svga_screen_cache.c
>> +++ b/src/gallium/drivers/svga/svga_screen_cache.c
>> @@ -313,7 +313,7 @@ svga_screen_cache_add(struct svga_screen *svgascreen,
>> void
>> svga_screen_cache_flush(struct svga_screen *svgascreen,
>> struct svga_context *svga,
>> - struct pipe_fence_handle *fence)
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct svga_host_surface_cache *cache = &svgascreen->cache;
>> struct svga_winsys_screen *sws = svgascreen->sws;
>> @@ -335,7 +335,7 @@ svga_screen_cache_flush(struct svga_screen *svgascreen,
>> /* remove entry from the invalidated list */
>> LIST_DEL(&entry->head);
>>
>> - sws->fence_reference(sws, &entry->fence, fence);
>> + sws->semaphore_reference(sws, &entry->fence, fence);
>>
>> /* Add entry to the unused list */
>> LIST_ADD(&entry->head, &cache->unused);
>> @@ -412,7 +412,7 @@ svga_screen_cache_cleanup(struct svga_screen *svgascreen)
>> }
>>
>> if (cache->entries[i].fence)
>> - sws->fence_reference(sws, &cache->entries[i].fence, NULL);
>> + sws->semaphore_reference(sws, &cache->entries[i].fence, NULL);
>> }
>>
>> mtx_destroy(&cache->mutex);
>> diff --git a/src/gallium/drivers/svga/svga_screen_cache.h b/src/gallium/drivers/svga/svga_screen_cache.h
>> index 03b809a..d209ada 100644
>> --- a/src/gallium/drivers/svga/svga_screen_cache.h
>> +++ b/src/gallium/drivers/svga/svga_screen_cache.h
>> @@ -86,7 +86,7 @@ struct svga_host_surface_cache_entry
>> struct svga_host_surface_cache_key key;
>> struct svga_winsys_surface *handle;
>>
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>> };
>>
>>
>> @@ -138,7 +138,7 @@ svga_screen_cache_cleanup(struct svga_screen *svgascreen);
>> void
>> svga_screen_cache_flush(struct svga_screen *svgascreen,
>> struct svga_context *svga,
>> - struct pipe_fence_handle *fence);
>> + struct pipe_semaphore_handle *fence);
>>
>> enum pipe_error
>> svga_screen_cache_init(struct svga_screen *svgascreen);
>> diff --git a/src/gallium/drivers/svga/svga_winsys.h b/src/gallium/drivers/svga/svga_winsys.h
>> index e74d1ca..7e8bca0 100644
>> --- a/src/gallium/drivers/svga/svga_winsys.h
>> +++ b/src/gallium/drivers/svga/svga_winsys.h
>> @@ -49,7 +49,7 @@ struct svga_winsys_buffer;
>> struct pipe_screen;
>> struct pipe_context;
>> struct pipe_debug_callback;
>> -struct pipe_fence_handle;
>> +struct pipe_semaphore_handle;
>> struct pipe_resource;
>> struct svga_region;
>> struct winsys_handle;
>> @@ -359,7 +359,7 @@ struct svga_winsys_context
>>
>> enum pipe_error
>> (*flush)(struct svga_winsys_context *swc,
>> - struct pipe_fence_handle **pfence);
>> + struct pipe_semaphore_handle **pfence);
>>
>> /**
>> * Context ID used to fill in the commands
>> @@ -616,9 +616,9 @@ struct svga_winsys_screen
>> * Reference a fence object.
>> */
>> void
>> - (*fence_reference)( struct svga_winsys_screen *sws,
>> - struct pipe_fence_handle **pdst,
>> - struct pipe_fence_handle *src );
>> + (*semaphore_reference)( struct svga_winsys_screen *sws,
>> + struct pipe_semaphore_handle **pdst,
>> + struct pipe_semaphore_handle *src );
>>
>> /**
>> * Checks whether the fence has been signalled.
>> @@ -626,7 +626,7 @@ struct svga_winsys_screen
>> * \return zero on success.
>> */
>> int (*fence_signalled)( struct svga_winsys_screen *sws,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> unsigned flag );
>>
>> /**
>> @@ -636,8 +636,8 @@ struct svga_winsys_screen
>> * \param flags driver-specific meaning
>> * \return zero on success.
>> */
>> - int (*fence_finish)( struct svga_winsys_screen *sws,
>> - struct pipe_fence_handle *fence,
>> + int (*semaphore_finish)( struct svga_winsys_screen *sws,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout,
>> unsigned flag );
>>
>> @@ -646,8 +646,8 @@ struct svga_winsys_screen
>> * \param duplicate duplicate the fd before returning it
>> * \return zero on success.
>> */
>> - int (*fence_get_fd)( struct svga_winsys_screen *sws,
>> - struct pipe_fence_handle *fence,
>> + int (*semaphore_get_fd)( struct svga_winsys_screen *sws,
>> + struct pipe_semaphore_handle *fence,
>> boolean duplicate );
>>
>> /**
>> @@ -655,7 +655,7 @@ struct svga_winsys_screen
>> * \return zero on success.
>> */
>> void (*fence_create_fd)( struct svga_winsys_screen *sws,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> int32_t fd );
>>
>> /**
>> @@ -663,9 +663,9 @@ struct svga_winsys_screen
>> * \param context_fd FD the context will be waiting on
>> * \return zero on success
>> */
>> - int (*fence_server_sync)( struct svga_winsys_screen *sws,
>> + int (*semaphore_server_sync)( struct svga_winsys_screen *sws,
>> int32_t *context_fd,
>> - struct pipe_fence_handle *fence );
>> + struct pipe_semaphore_handle *fence );
>>
>> /**
>> ** BEGIN new functions for guest-backed surfaces.
>> diff --git a/src/gallium/drivers/swr/swr_context.cpp b/src/gallium/drivers/swr/swr_context.cpp
>> index b61720c..bd68b36 100644
>> --- a/src/gallium/drivers/swr/swr_context.cpp
>> +++ b/src/gallium/drivers/swr/swr_context.cpp
>> @@ -124,7 +124,7 @@ swr_transfer_map(struct pipe_context *pipe,
>> if (!swr_is_fence_pending(screen->flush_fence))
>> swr_fence_submit(swr_context(pipe), screen->flush_fence);
>>
>> - swr_fence_finish(pipe->screen, NULL, screen->flush_fence, 0);
>> + swr_semaphore_finish(pipe->screen, NULL, screen->flush_fence, 0);
>> swr_resource_unused(resource);
>> }
>> }
>> @@ -253,7 +253,7 @@ swr_resource_copy(struct pipe_context *pipe,
>> swr_store_dirty_resource(pipe, src, SWR_TILE_RESOLVED);
>> swr_store_dirty_resource(pipe, dst, SWR_TILE_RESOLVED);
>>
>> - swr_fence_finish(pipe->screen, NULL, screen->flush_fence, 0);
>> + swr_semaphore_finish(pipe->screen, NULL, screen->flush_fence, 0);
>> swr_resource_unused(src);
>> swr_resource_unused(dst);
>>
>> diff --git a/src/gallium/drivers/swr/swr_draw.cpp b/src/gallium/drivers/swr/swr_draw.cpp
>> index a94cdd6..bc8f09d 100644
>> --- a/src/gallium/drivers/swr/swr_draw.cpp
>> +++ b/src/gallium/drivers/swr/swr_draw.cpp
>> @@ -232,14 +232,14 @@ swr_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
>> if (ctx->dirty & SWR_LARGE_CLIENT_DRAW) {
>> struct swr_screen *screen = swr_screen(pipe->screen);
>> swr_fence_submit(ctx, screen->flush_fence);
>> - swr_fence_finish(pipe->screen, NULL, screen->flush_fence, 0);
>> + swr_semaphore_finish(pipe->screen, NULL, screen->flush_fence, 0);
>> }
>> }
>>
>>
>> static void
>> swr_flush(struct pipe_context *pipe,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags)
>> {
>> struct swr_context *ctx = swr_context(pipe);
>> @@ -257,17 +257,17 @@ swr_flush(struct pipe_context *pipe,
>> }
>>
>> if (fence)
>> - swr_fence_reference(pipe->screen, fence, screen->flush_fence);
>> + swr_semaphore_reference(pipe->screen, fence, screen->flush_fence);
>> }
>>
>> void
>> swr_finish(struct pipe_context *pipe)
>> {
>> - struct pipe_fence_handle *fence = nullptr;
>> + struct pipe_semaphore_handle *fence = nullptr;
>>
>> swr_flush(pipe, &fence, 0);
>> - swr_fence_finish(pipe->screen, NULL, fence, 0);
>> - swr_fence_reference(pipe->screen, &fence, NULL);
>> + swr_semaphore_finish(pipe->screen, NULL, fence, 0);
>> + swr_semaphore_reference(pipe->screen, &fence, NULL);
>> }
>>
>> /*
>> diff --git a/src/gallium/drivers/swr/swr_fence.cpp b/src/gallium/drivers/swr/swr_fence.cpp
>> index 3005eb9..a9642d3 100644
>> --- a/src/gallium/drivers/swr/swr_fence.cpp
>> +++ b/src/gallium/drivers/swr/swr_fence.cpp
>> @@ -53,7 +53,7 @@ swr_fence_cb(uint64_t userData, uint64_t userData2, uint64_t userData3)
>> * Submit an existing fence.
>> */
>> void
>> -swr_fence_submit(struct swr_context *ctx, struct pipe_fence_handle *fh)
>> +swr_fence_submit(struct swr_context *ctx, struct pipe_semaphore_handle *fh)
>> {
>> struct swr_fence *fence = swr_fence(fh);
>>
>> @@ -65,7 +65,7 @@ swr_fence_submit(struct swr_context *ctx, struct pipe_fence_handle *fh)
>> /*
>> * Create a new fence object.
>> */
>> -struct pipe_fence_handle *
>> +struct pipe_semaphore_handle *
>> swr_fence_create()
>> {
>> static int fence_id = 0;
>> @@ -77,7 +77,7 @@ swr_fence_create()
>> fence->id = fence_id++;
>> fence->work.tail = &fence->work.head;
>>
>> - return (struct pipe_fence_handle *)fence;
>> + return (struct pipe_semaphore_handle *)fence;
>> }
>>
>> /** Destroy a fence. Called when refcount hits zero. */
>> @@ -93,9 +93,9 @@ swr_fence_destroy(struct swr_fence *fence)
>> * Set ptr = fence, with reference counting
>> */
>> void
>> -swr_fence_reference(struct pipe_screen *screen,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *f)
>> +swr_semaphore_reference(struct pipe_screen *screen,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *f)
>> {
>> struct swr_fence *fence = swr_fence(f);
>> struct swr_fence *old;
>> @@ -108,7 +108,7 @@ swr_fence_reference(struct pipe_screen *screen,
>> }
>>
>> if (pipe_reference(&old->reference, &fence->reference)) {
>> - swr_fence_finish(screen, NULL, (struct pipe_fence_handle *) old, 0);
>> + swr_semaphore_finish(screen, NULL, (struct pipe_semaphore_handle *) old, 0);
>> swr_fence_destroy(old);
>> }
>> }
>> @@ -118,9 +118,9 @@ swr_fence_reference(struct pipe_screen *screen,
>> * Wait for the fence to finish.
>> */
>> boolean
>> -swr_fence_finish(struct pipe_screen *screen,
>> +swr_semaphore_finish(struct pipe_screen *screen,
>> struct pipe_context *ctx,
>> - struct pipe_fence_handle *fence_handle,
>> + struct pipe_semaphore_handle *fence_handle,
>> uint64_t timeout)
>> {
>> while (!swr_is_fence_done(fence_handle))
>> @@ -142,8 +142,8 @@ swr_get_timestamp(struct pipe_screen *screen)
>> void
>> swr_fence_init(struct pipe_screen *p_screen)
>> {
>> - p_screen->fence_reference = swr_fence_reference;
>> - p_screen->fence_finish = swr_fence_finish;
>> + p_screen->semaphore_reference = swr_semaphore_reference;
>> + p_screen->semaphore_finish = swr_semaphore_finish;
>> p_screen->get_timestamp = swr_get_timestamp;
>>
>> /* Create persistant StoreTiles "flush" fence, used to signal completion
>> diff --git a/src/gallium/drivers/swr/swr_fence.h b/src/gallium/drivers/swr/swr_fence.h
>> index 4766b5b..2fbf0e5 100644
>> --- a/src/gallium/drivers/swr/swr_fence.h
>> +++ b/src/gallium/drivers/swr/swr_fence.h
>> @@ -48,21 +48,21 @@ struct swr_fence {
>>
>>
>> static inline struct swr_fence *
>> -swr_fence(struct pipe_fence_handle *fence)
>> +swr_fence(struct pipe_semaphore_handle *fence)
>> {
>> return (struct swr_fence *)fence;
>> }
>>
>>
>> static INLINE boolean
>> -swr_is_fence_done(struct pipe_fence_handle *fence_handle)
>> +swr_is_fence_done(struct pipe_semaphore_handle *fence_handle)
>> {
>> struct swr_fence *fence = swr_fence(fence_handle);
>> return (fence->read == fence->write);
>> }
>>
>> static INLINE boolean
>> -swr_is_fence_pending(struct pipe_fence_handle *fence_handle)
>> +swr_is_fence_pending(struct pipe_semaphore_handle *fence_handle)
>> {
>> return swr_fence(fence_handle)->pending;
>> }
>> @@ -70,19 +70,19 @@ swr_is_fence_pending(struct pipe_fence_handle *fence_handle)
>>
>> void swr_fence_init(struct pipe_screen *screen);
>>
>> -struct pipe_fence_handle *swr_fence_create();
>> +struct pipe_semaphore_handle *swr_fence_create();
>>
>> -void swr_fence_reference(struct pipe_screen *screen,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *f);
>> +void swr_semaphore_reference(struct pipe_screen *screen,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *f);
>>
>> -boolean swr_fence_finish(struct pipe_screen *screen,
>> +boolean swr_semaphore_finish(struct pipe_screen *screen,
>> struct pipe_context *ctx,
>> - struct pipe_fence_handle *fence_handle,
>> + struct pipe_semaphore_handle *fence_handle,
>> uint64_t timeout);
>>
>> void
>> -swr_fence_submit(struct swr_context *ctx, struct pipe_fence_handle *fence);
>> +swr_fence_submit(struct swr_context *ctx, struct pipe_semaphore_handle *fence);
>>
>> uint64_t swr_get_timestamp(struct pipe_screen *screen);
>>
>> diff --git a/src/gallium/drivers/swr/swr_fence_work.cpp b/src/gallium/drivers/swr/swr_fence_work.cpp
>> index 594ebaa..8c53e81 100644
>> --- a/src/gallium/drivers/swr/swr_fence_work.cpp
>> +++ b/src/gallium/drivers/swr/swr_fence_work.cpp
>> @@ -57,7 +57,7 @@ swr_fence_do_work(struct swr_fence *fence)
>> * Called by one of the specialized work routines below
>> */
>> static inline void
>> -swr_add_fence_work(struct pipe_fence_handle *fh,
>> +swr_add_fence_work(struct pipe_semaphore_handle *fh,
>> struct swr_fence_work *work)
>> {
>> /* If no fence, just do the work now */
>> @@ -106,7 +106,7 @@ swr_delete_gs_cb(struct swr_fence_work *work)
>> }
>>
>> bool
>> -swr_fence_work_free(struct pipe_fence_handle *fence, void *data,
>> +swr_fence_work_free(struct pipe_semaphore_handle *fence, void *data,
>> bool aligned_free)
>> {
>> struct swr_fence_work *work = CALLOC_STRUCT(swr_fence_work);
>> @@ -124,7 +124,7 @@ swr_fence_work_free(struct pipe_fence_handle *fence, void *data,
>> }
>>
>> bool
>> -swr_fence_work_delete_vs(struct pipe_fence_handle *fence,
>> +swr_fence_work_delete_vs(struct pipe_semaphore_handle *fence,
>> struct swr_vertex_shader *swr_vs)
>> {
>> struct swr_fence_work *work = CALLOC_STRUCT(swr_fence_work);
>> @@ -139,7 +139,7 @@ swr_fence_work_delete_vs(struct pipe_fence_handle *fence,
>> }
>>
>> bool
>> -swr_fence_work_delete_fs(struct pipe_fence_handle *fence,
>> +swr_fence_work_delete_fs(struct pipe_semaphore_handle *fence,
>> struct swr_fragment_shader *swr_fs)
>> {
>> struct swr_fence_work *work = CALLOC_STRUCT(swr_fence_work);
>> @@ -154,7 +154,7 @@ swr_fence_work_delete_fs(struct pipe_fence_handle *fence,
>> }
>>
>> bool
>> -swr_fence_work_delete_gs(struct pipe_fence_handle *fence,
>> +swr_fence_work_delete_gs(struct pipe_semaphore_handle *fence,
>> struct swr_geometry_shader *swr_gs)
>> {
>> struct swr_fence_work *work = CALLOC_STRUCT(swr_fence_work);
>> diff --git a/src/gallium/drivers/swr/swr_fence_work.h b/src/gallium/drivers/swr/swr_fence_work.h
>> index a1e72fd..2b03a52 100644
>> --- a/src/gallium/drivers/swr/swr_fence_work.h
>> +++ b/src/gallium/drivers/swr/swr_fence_work.h
>> @@ -39,12 +39,12 @@ struct swr_fence_work {
>>
>> void swr_fence_do_work(struct swr_fence *fence);
>>
>> -bool swr_fence_work_free(struct pipe_fence_handle *fence, void *data,
>> +bool swr_fence_work_free(struct pipe_semaphore_handle *fence, void *data,
>> bool aligned_free = false);
>> -bool swr_fence_work_delete_vs(struct pipe_fence_handle *fence,
>> +bool swr_fence_work_delete_vs(struct pipe_semaphore_handle *fence,
>> struct swr_vertex_shader *swr_vs);
>> -bool swr_fence_work_delete_fs(struct pipe_fence_handle *fence,
>> +bool swr_fence_work_delete_fs(struct pipe_semaphore_handle *fence,
>> struct swr_fragment_shader *swr_vs);
>> -bool swr_fence_work_delete_gs(struct pipe_fence_handle *fence,
>> +bool swr_fence_work_delete_gs(struct pipe_semaphore_handle *fence,
>> struct swr_geometry_shader *swr_gs);
>> #endif
>> diff --git a/src/gallium/drivers/swr/swr_query.cpp b/src/gallium/drivers/swr/swr_query.cpp
>> index ea31de6..519744d 100644
>> --- a/src/gallium/drivers/swr/swr_query.cpp
>> +++ b/src/gallium/drivers/swr/swr_query.cpp
>> @@ -64,8 +64,8 @@ swr_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
>>
>> if (pq->fence) {
>> if (swr_is_fence_pending(pq->fence))
>> - swr_fence_finish(pipe->screen, NULL, pq->fence, 0);
>> - swr_fence_reference(pipe->screen, &pq->fence, NULL);
>> + swr_semaphore_finish(pipe->screen, NULL, pq->fence, 0);
>> + swr_semaphore_reference(pipe->screen, &pq->fence, NULL);
>> }
>>
>> AlignedFree(pq);
>> @@ -85,8 +85,8 @@ swr_get_query_result(struct pipe_context *pipe,
>> if (!wait && !swr_is_fence_done(pq->fence))
>> return FALSE;
>>
>> - swr_fence_finish(pipe->screen, NULL, pq->fence, 0);
>> - swr_fence_reference(pipe->screen, &pq->fence, NULL);
>> + swr_semaphore_finish(pipe->screen, NULL, pq->fence, 0);
>> + swr_semaphore_reference(pipe->screen, &pq->fence, NULL);
>> }
>>
>> /* All values are reset to 0 at swr_begin_query, except starting timestamp.
>> @@ -211,7 +211,7 @@ swr_end_query(struct pipe_context *pipe, struct pipe_query *q)
>> * completion. */
>> if (!pq->fence) {
>> struct swr_screen *screen = swr_screen(pipe->screen);
>> - swr_fence_reference(pipe->screen, &pq->fence, screen->flush_fence);
>> + swr_semaphore_reference(pipe->screen, &pq->fence, screen->flush_fence);
>> }
>> swr_fence_submit(ctx, pq->fence);
>>
>> diff --git a/src/gallium/drivers/swr/swr_query.h b/src/gallium/drivers/swr/swr_query.h
>> index 1c736e4..cc5c32c 100644
>> --- a/src/gallium/drivers/swr/swr_query.h
>> +++ b/src/gallium/drivers/swr/swr_query.h
>> @@ -39,7 +39,7 @@ OSALIGNLINE(struct) swr_query {
>> unsigned index;
>>
>> struct swr_query_result result;
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>> };
>>
>> extern void swr_query_init(struct pipe_context *pipe);
>> diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
>> index 71a07eb..2a92551 100644
>> --- a/src/gallium/drivers/swr/swr_screen.cpp
>> +++ b/src/gallium/drivers/swr/swr_screen.cpp
>> @@ -322,7 +322,7 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param)
>> case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
>> case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
>> case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
>> - case PIPE_CAP_NATIVE_FENCE_FD:
>> + case PIPE_CAP_NATIVE_SEMAPHORE_FD:
>> case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
>> case PIPE_CAP_TGSI_FS_FBFETCH:
>> case PIPE_CAP_TGSI_MUL_ZERO_WINS:
>> @@ -976,7 +976,7 @@ swr_resource_destroy(struct pipe_screen *p_screen, struct pipe_resource *pt)
>> if (spr->display_target) {
>> /* If resource is display target, winsys manages the buffer and will
>> * free it on displaytarget_destroy. */
>> - swr_fence_finish(p_screen, NULL, screen->flush_fence, 0);
>> + swr_semaphore_finish(p_screen, NULL, screen->flush_fence, 0);
>>
>> struct sw_winsys *winsys = screen->winsys;
>> winsys->displaytarget_destroy(winsys, spr->display_target);
>> @@ -1029,7 +1029,7 @@ swr_flush_frontbuffer(struct pipe_screen *p_screen,
>> struct swr_context *ctx = swr_context(pipe);
>>
>> if (pipe) {
>> - swr_fence_finish(p_screen, NULL, screen->flush_fence, 0);
>> + swr_semaphore_finish(p_screen, NULL, screen->flush_fence, 0);
>> swr_resource_unused(resource);
>> ctx->api.pfnSwrEndFrame(ctx->swrContext);
>> }
>> @@ -1062,8 +1062,8 @@ swr_destroy_screen(struct pipe_screen *p_screen)
>>
>> fprintf(stderr, "SWR destroy screen!\n");
>>
>> - swr_fence_finish(p_screen, NULL, screen->flush_fence, 0);
>> - swr_fence_reference(p_screen, &screen->flush_fence, NULL);
>> + swr_semaphore_finish(p_screen, NULL, screen->flush_fence, 0);
>> + swr_semaphore_reference(p_screen, &screen->flush_fence, NULL);
>>
>> JitDestroyContext(screen->hJitMgr);
>> #if USE_SIMD16_SHADERS
>> diff --git a/src/gallium/drivers/swr/swr_screen.h b/src/gallium/drivers/swr/swr_screen.h
>> index 81b1a18..ab84ece 100644
>> --- a/src/gallium/drivers/swr/swr_screen.h
>> +++ b/src/gallium/drivers/swr/swr_screen.h
>> @@ -39,7 +39,7 @@ struct swr_screen {
>> struct pipe_screen base;
>> struct pipe_context *pipe;
>>
>> - struct pipe_fence_handle *flush_fence;
>> + struct pipe_semaphore_handle *flush_fence;
>>
>> struct sw_winsys *winsys;
>>
>> diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp
>> index 4530d37..e06dbf7 100644
>> --- a/src/gallium/drivers/swr/swr_state.cpp
>> +++ b/src/gallium/drivers/swr/swr_state.cpp
>> @@ -1819,7 +1819,7 @@ swr_update_derived(struct pipe_context *pipe,
>>
>> /* Ensure that any in-progress attachment change StoreTiles finish */
>> if (swr_is_fence_pending(screen->flush_fence))
>> - swr_fence_finish(pipe->screen, NULL, screen->flush_fence, 0);
>> + swr_semaphore_finish(pipe->screen, NULL, screen->flush_fence, 0);
>>
>> /* Finally, update the in-use status of all resources involved in draw */
>> swr_update_resource_status(pipe, p_draw_info);
>> diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
>> index 6d918d4..cbd2940 100644
>> --- a/src/gallium/drivers/trace/tr_context.c
>> +++ b/src/gallium/drivers/trace/tr_context.c
>> @@ -1294,7 +1294,7 @@ trace_context_clear_texture(struct pipe_context *_pipe,
>>
>> static void
>> trace_context_flush(struct pipe_context *_pipe,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags)
>> {
>> struct trace_context *tr_ctx = trace_context(_pipe);
>> diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
>> index d5a8124..fa7d297 100644
>> --- a/src/gallium/drivers/trace/tr_screen.c
>> +++ b/src/gallium/drivers/trace/tr_screen.c
>> @@ -470,33 +470,33 @@ trace_screen_resource_destroy(struct pipe_screen *_screen,
>>
>>
>> static void
>> -trace_screen_fence_reference(struct pipe_screen *_screen,
>> - struct pipe_fence_handle **pdst,
>> - struct pipe_fence_handle *src)
>> +trace_screen_semaphore_reference(struct pipe_screen *_screen,
>> + struct pipe_semaphore_handle **pdst,
>> + struct pipe_semaphore_handle *src)
>> {
>> struct trace_screen *tr_scr = trace_screen(_screen);
>> struct pipe_screen *screen = tr_scr->screen;
>> - struct pipe_fence_handle *dst;
>> + struct pipe_semaphore_handle *dst;
>>
>> assert(pdst);
>> dst = *pdst;
>>
>> - trace_dump_call_begin("pipe_screen", "fence_reference");
>> + trace_dump_call_begin("pipe_screen", "semaphore_reference");
>>
>> trace_dump_arg(ptr, screen);
>> trace_dump_arg(ptr, dst);
>> trace_dump_arg(ptr, src);
>>
>> - screen->fence_reference(screen, pdst, src);
>> + screen->semaphore_reference(screen, pdst, src);
>>
>> trace_dump_call_end();
>> }
>>
>>
>> static boolean
>> -trace_screen_fence_finish(struct pipe_screen *_screen,
>> +trace_screen_semaphore_finish(struct pipe_screen *_screen,
>> struct pipe_context *_ctx,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout)
>> {
>> struct trace_screen *tr_scr = trace_screen(_screen);
>> @@ -504,14 +504,14 @@ trace_screen_fence_finish(struct pipe_screen *_screen,
>> struct pipe_context *ctx = _ctx ? trace_context(_ctx)->pipe : NULL;
>> int result;
>>
>> - trace_dump_call_begin("pipe_screen", "fence_finish");
>> + trace_dump_call_begin("pipe_screen", "semaphore_finish");
>>
>> trace_dump_arg(ptr, screen);
>> trace_dump_arg(ptr, ctx);
>> trace_dump_arg(ptr, fence);
>> trace_dump_arg(uint, timeout);
>>
>> - result = screen->fence_finish(screen, ctx, fence, timeout);
>> + result = screen->semaphore_finish(screen, ctx, fence, timeout);
>>
>> trace_dump_ret(bool, result);
>>
>> @@ -651,8 +651,8 @@ trace_screen_create(struct pipe_screen *screen)
>> SCR_INIT(resource_from_memobj);
>> SCR_INIT(resource_changed);
>> tr_scr->base.resource_destroy = trace_screen_resource_destroy;
>> - tr_scr->base.fence_reference = trace_screen_fence_reference;
>> - tr_scr->base.fence_finish = trace_screen_fence_finish;
>> + tr_scr->base.semaphore_reference = trace_screen_semaphore_reference;
>> + tr_scr->base.semaphore_finish = trace_screen_semaphore_finish;
>> SCR_INIT(memobj_create_from_handle);
>> SCR_INIT(memobj_destroy);
>> tr_scr->base.flush_frontbuffer = trace_screen_flush_frontbuffer;
>> diff --git a/src/gallium/drivers/vc4/vc4_context.c b/src/gallium/drivers/vc4/vc4_context.c
>> index a9e7ff9..e61d0f9 100644
>> --- a/src/gallium/drivers/vc4/vc4_context.c
>> +++ b/src/gallium/drivers/vc4/vc4_context.c
>> @@ -50,7 +50,7 @@ vc4_flush(struct pipe_context *pctx)
>> }
>>
>> static void
>> -vc4_pipe_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
>> +vc4_pipe_flush(struct pipe_context *pctx, struct pipe_semaphore_handle **fence,
>> unsigned flags)
>> {
>> struct vc4_context *vc4 = vc4_context(pctx);
>> @@ -61,8 +61,8 @@ vc4_pipe_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
>> struct pipe_screen *screen = pctx->screen;
>> struct vc4_fence *f = vc4_fence_create(vc4->screen,
>> vc4->last_emit_seqno);
>> - screen->fence_reference(screen, fence, NULL);
>> - *fence = (struct pipe_fence_handle *)f;
>> + screen->semaphore_reference(screen, fence, NULL);
>> + *fence = (struct pipe_semaphore_handle *)f;
>> }
>> }
>>
>> diff --git a/src/gallium/drivers/vc4/vc4_fence.c b/src/gallium/drivers/vc4/vc4_fence.c
>> index f61e7c6..94717ec 100644
>> --- a/src/gallium/drivers/vc4/vc4_fence.c
>> +++ b/src/gallium/drivers/vc4/vc4_fence.c
>> @@ -45,9 +45,9 @@ struct vc4_fence {
>> };
>>
>> static void
>> -vc4_fence_reference(struct pipe_screen *pscreen,
>> - struct pipe_fence_handle **pp,
>> - struct pipe_fence_handle *pf)
>> +vc4_semaphore_reference(struct pipe_screen *pscreen,
>> + struct pipe_semaphore_handle **pp,
>> + struct pipe_semaphore_handle *pf)
>> {
>> struct vc4_fence **p = (struct vc4_fence **)pp;
>> struct vc4_fence *f = (struct vc4_fence *)pf;
>> @@ -60,9 +60,9 @@ vc4_fence_reference(struct pipe_screen *pscreen,
>> }
>>
>> static boolean
>> -vc4_fence_finish(struct pipe_screen *pscreen,
>> +vc4_semaphore_finish(struct pipe_screen *pscreen,
>> struct pipe_context *ctx,
>> - struct pipe_fence_handle *pf,
>> + struct pipe_semaphore_handle *pf,
>> uint64_t timeout_ns)
>> {
>> struct vc4_screen *screen = vc4_screen(pscreen);
>> @@ -88,6 +88,6 @@ vc4_fence_create(struct vc4_screen *screen, uint64_t seqno)
>> void
>> vc4_fence_init(struct vc4_screen *screen)
>> {
>> - screen->base.fence_reference = vc4_fence_reference;
>> - screen->base.fence_finish = vc4_fence_finish;
>> + screen->base.semaphore_reference = vc4_semaphore_reference;
>> + screen->base.semaphore_finish = vc4_semaphore_finish;
>> }
>> diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
>> index 74dd9d5..30abe5e 100644
>> --- a/src/gallium/drivers/vc4/vc4_screen.c
>> +++ b/src/gallium/drivers/vc4/vc4_screen.c
>> @@ -266,7 +266,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>> case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
>> case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
>> case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
>> - case PIPE_CAP_NATIVE_FENCE_FD:
>> + case PIPE_CAP_NATIVE_SEMAPHORE_FD:
>> case PIPE_CAP_TGSI_FS_FBFETCH:
>> case PIPE_CAP_TGSI_MUL_ZERO_WINS:
>> case PIPE_CAP_DOUBLES:
>> diff --git a/src/gallium/drivers/vc5/vc5_context.c b/src/gallium/drivers/vc5/vc5_context.c
>> index d27f41b..1c3794a 100644
>> --- a/src/gallium/drivers/vc5/vc5_context.c
>> +++ b/src/gallium/drivers/vc5/vc5_context.c
>> @@ -51,7 +51,7 @@ vc5_flush(struct pipe_context *pctx)
>> }
>>
>> static void
>> -vc5_pipe_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
>> +vc5_pipe_flush(struct pipe_context *pctx, struct pipe_semaphore_handle **fence,
>> unsigned flags)
>> {
>> struct vc5_context *vc5 = vc5_context(pctx);
>> @@ -62,8 +62,8 @@ vc5_pipe_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
>> struct pipe_screen *screen = pctx->screen;
>> struct vc5_fence *f = vc5_fence_create(vc5->screen,
>> vc5->last_emit_seqno);
>> - screen->fence_reference(screen, fence, NULL);
>> - *fence = (struct pipe_fence_handle *)f;
>> + screen->semaphore_reference(screen, fence, NULL);
>> + *fence = (struct pipe_semaphore_handle *)f;
>> }
>> }
>>
>> diff --git a/src/gallium/drivers/vc5/vc5_fence.c b/src/gallium/drivers/vc5/vc5_fence.c
>> index 08de9bc..6bec343 100644
>> --- a/src/gallium/drivers/vc5/vc5_fence.c
>> +++ b/src/gallium/drivers/vc5/vc5_fence.c
>> @@ -45,9 +45,9 @@ struct vc5_fence {
>> };
>>
>> static void
>> -vc5_fence_reference(struct pipe_screen *pscreen,
>> - struct pipe_fence_handle **pp,
>> - struct pipe_fence_handle *pf)
>> +vc5_semaphore_reference(struct pipe_screen *pscreen,
>> + struct pipe_semaphore_handle **pp,
>> + struct pipe_semaphore_handle *pf)
>> {
>> struct vc5_fence **p = (struct vc5_fence **)pp;
>> struct vc5_fence *f = (struct vc5_fence *)pf;
>> @@ -60,9 +60,9 @@ vc5_fence_reference(struct pipe_screen *pscreen,
>> }
>>
>> static boolean
>> -vc5_fence_finish(struct pipe_screen *pscreen,
>> +vc5_semaphore_finish(struct pipe_screen *pscreen,
>> struct pipe_context *ctx,
>> - struct pipe_fence_handle *pf,
>> + struct pipe_semaphore_handle *pf,
>> uint64_t timeout_ns)
>> {
>> struct vc5_screen *screen = vc5_screen(pscreen);
>> @@ -88,6 +88,6 @@ vc5_fence_create(struct vc5_screen *screen, uint64_t seqno)
>> void
>> vc5_fence_init(struct vc5_screen *screen)
>> {
>> - screen->base.fence_reference = vc5_fence_reference;
>> - screen->base.fence_finish = vc5_fence_finish;
>> + screen->base.semaphore_reference = vc5_semaphore_reference;
>> + screen->base.semaphore_finish = vc5_semaphore_finish;
>> }
>> diff --git a/src/gallium/drivers/vc5/vc5_screen.c b/src/gallium/drivers/vc5/vc5_screen.c
>> index 36e34de..77f002f 100644
>> --- a/src/gallium/drivers/vc5/vc5_screen.c
>> +++ b/src/gallium/drivers/vc5/vc5_screen.c
>> @@ -239,7 +239,7 @@ vc5_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>> case PIPE_CAP_POLYGON_MODE_FILL_RECTANGLE:
>> case PIPE_CAP_TGSI_CLOCK:
>> case PIPE_CAP_TGSI_TEX_TXF_LZ:
>> - case PIPE_CAP_NATIVE_FENCE_FD:
>> + case PIPE_CAP_NATIVE_SEMAPHORE_FD:
>> case PIPE_CAP_TGSI_MUL_ZERO_WINS:
>> case PIPE_CAP_NIR_SAMPLERS_AS_DEREF:
>> case PIPE_CAP_QUERY_SO_OVERFLOW:
>> diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c
>> index f1b6ef4..e2a3a46 100644
>> --- a/src/gallium/drivers/virgl/virgl_context.c
>> +++ b/src/gallium/drivers/virgl/virgl_context.c
>> @@ -630,7 +630,7 @@ static void virgl_flush_eq(struct virgl_context *ctx, void *closure)
>> }
>>
>> static void virgl_flush_from_st(struct pipe_context *ctx,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> enum pipe_flush_flags flags)
>> {
>> struct virgl_context *vctx = virgl_context(ctx);
>> diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c
>> index 725f7db..21e1e25 100644
>> --- a/src/gallium/drivers/virgl/virgl_screen.c
>> +++ b/src/gallium/drivers/virgl/virgl_screen.c
>> @@ -283,7 +283,7 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
>> case PIPE_CAP_UMA:
>> case PIPE_CAP_VIDEO_MEMORY:
>> return 0;
>> - case PIPE_CAP_NATIVE_FENCE_FD:
>> + case PIPE_CAP_NATIVE_SEMAPHORE_FD:
>> return 0;
>> }
>> /* should only get here on unhandled cases */
>> @@ -548,19 +548,19 @@ static void virgl_flush_frontbuffer(struct pipe_screen *screen,
>> sub_box);
>> }
>>
>> -static void virgl_fence_reference(struct pipe_screen *screen,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *fence)
>> +static void virgl_semaphore_reference(struct pipe_screen *screen,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct virgl_screen *vscreen = virgl_screen(screen);
>> struct virgl_winsys *vws = vscreen->vws;
>>
>> - vws->fence_reference(vws, ptr, fence);
>> + vws->semaphore_reference(vws, ptr, fence);
>> }
>>
>> -static boolean virgl_fence_finish(struct pipe_screen *screen,
>> +static boolean virgl_semaphore_finish(struct pipe_screen *screen,
>> struct pipe_context *ctx,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout)
>> {
>> struct virgl_screen *vscreen = virgl_screen(screen);
>> @@ -607,9 +607,9 @@ virgl_create_screen(struct virgl_winsys *vws)
>> screen->base.context_create = virgl_context_create;
>> screen->base.flush_frontbuffer = virgl_flush_frontbuffer;
>> screen->base.get_timestamp = virgl_get_timestamp;
>> - screen->base.fence_reference = virgl_fence_reference;
>> + screen->base.semaphore_reference = virgl_semaphore_reference;
>> //screen->base.fence_signalled = virgl_fence_signalled;
>> - screen->base.fence_finish = virgl_fence_finish;
>> + screen->base.semaphore_finish = virgl_semaphore_finish;
>>
>> virgl_init_screen_resource_functions(&screen->base);
>>
>> diff --git a/src/gallium/drivers/virgl/virgl_winsys.h b/src/gallium/drivers/virgl/virgl_winsys.h
>> index ea21f2b..af0b997 100644
>> --- a/src/gallium/drivers/virgl/virgl_winsys.h
>> +++ b/src/gallium/drivers/virgl/virgl_winsys.h
>> @@ -27,7 +27,7 @@
>> #include "virgl_hw.h"
>>
>> struct pipe_box;
>> -struct pipe_fence_handle;
>> +struct pipe_semaphore_handle;
>> struct winsys_handle;
>> struct virgl_hw_res;
>>
>> @@ -92,14 +92,14 @@ struct virgl_winsys {
>> int (*get_caps)(struct virgl_winsys *vws, struct virgl_drm_caps *caps);
>>
>> /* fence */
>> - struct pipe_fence_handle *(*cs_create_fence)(struct virgl_winsys *vws);
>> + struct pipe_semaphore_handle *(*cs_create_fence)(struct virgl_winsys *vws);
>> bool (*fence_wait)(struct virgl_winsys *vws,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout);
>>
>> - void (*fence_reference)(struct virgl_winsys *vws,
>> - struct pipe_fence_handle **dst,
>> - struct pipe_fence_handle *src);
>> + void (*semaphore_reference)(struct virgl_winsys *vws,
>> + struct pipe_semaphore_handle **dst,
>> + struct pipe_semaphore_handle *src);
>>
>> /* for sw paths */
>> void (*flush_frontbuffer)(struct virgl_winsys *vws,
>> diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
>> index 1c7f52c..750a69a 100644
>> --- a/src/gallium/include/pipe/p_context.h
>> +++ b/src/gallium/include/pipe/p_context.h
>> @@ -50,7 +50,7 @@ struct pipe_depth_stencil_alpha_state;
>> struct pipe_device_reset_callback;
>> struct pipe_draw_info;
>> struct pipe_grid_info;
>> -struct pipe_fence_handle;
>> +struct pipe_semaphore_handle;
>> struct pipe_framebuffer_state;
>> struct pipe_image_view;
>> struct pipe_query;
>> @@ -493,7 +493,7 @@ struct pipe_context {
>> * Subsequent operations on other contexts of the same screen are guaranteed
>> * to execute after the flushed commands, unless PIPE_FLUSH_ASYNC is used.
>> *
>> - * NOTE: use screen->fence_reference() (or equivalent) to transfer
>> + * NOTE: use screen->semaphore_reference() (or equivalent) to transfer
>> * new fence ref to **fence, to ensure that previous fence is unref'd
>> *
>> * \param fence if not NULL, an old fence to unref and transfer a
>> @@ -501,7 +501,7 @@ struct pipe_context {
>> * \param flags bitfield of enum pipe_flush_flags values.
>> */
>> void (*flush)(struct pipe_context *pipe,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags);
>>
>> /**
>> @@ -514,16 +514,16 @@ struct pipe_context {
>> * \param fd fd representing the fence object
>> * \param type indicates which fence types backs fd
>> */
>> - void (*create_fence_fd)(struct pipe_context *pipe,
>> - struct pipe_fence_handle **fence,
>> - int fd,
>> - enum pipe_fd_type type);
>> + void (*create_semaphore_fd)(struct pipe_context *pipe,
>> + struct pipe_semaphore_handle **fence,
>> + int fd,
>> + enum pipe_fd_type type);
>>
>> /**
>> * Insert commands to have GPU wait for fence to be signaled.
>> */
>> - void (*fence_server_sync)(struct pipe_context *pipe,
>> - struct pipe_fence_handle *fence);
>> + void (*semaphore_server_sync)(struct pipe_context *pipe,
>> + struct pipe_semaphore_handle *fence);
>>
>> /**
>> * Create a view on a texture to be used by a shader stage.
>> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
>> index 3ae3e14..972c2c2 100644
>> --- a/src/gallium/include/pipe/p_defines.h
>> +++ b/src/gallium/include/pipe/p_defines.h
>> @@ -351,7 +351,7 @@ enum pipe_flush_flags
>> {
>> PIPE_FLUSH_END_OF_FRAME = (1 << 0),
>> PIPE_FLUSH_DEFERRED = (1 << 1),
>> - PIPE_FLUSH_FENCE_FD = (1 << 2),
>> + PIPE_FLUSH_SEMAPHORE_FD = (1 << 2),
>> PIPE_FLUSH_ASYNC = (1 << 3),
>> PIPE_FLUSH_HINT_FINISH = (1 << 4),
>> PIPE_FLUSH_TOP_OF_PIPE = (1 << 5),
>> @@ -760,7 +760,7 @@ enum pipe_cap
>> PIPE_CAP_TGSI_ARRAY_COMPONENTS,
>> PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS,
>> PIPE_CAP_TGSI_CAN_READ_OUTPUTS,
>> - PIPE_CAP_NATIVE_FENCE_FD,
>> + PIPE_CAP_NATIVE_SEMAPHORE_FD,
>> PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY,
>> PIPE_CAP_TGSI_FS_FBFETCH,
>> PIPE_CAP_TGSI_MUL_ZERO_WINS,
>> diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
>> index 101e229..57b9357 100644
>> --- a/src/gallium/include/pipe/p_screen.h
>> +++ b/src/gallium/include/pipe/p_screen.h
>> @@ -52,7 +52,7 @@ extern "C" {
>>
>> /** Opaque types */
>> struct winsys_handle;
>> -struct pipe_fence_handle;
>> +struct pipe_semaphore_handle;
>> struct pipe_resource;
>> struct pipe_surface;
>> struct pipe_transfer;
>> @@ -277,36 +277,36 @@ struct pipe_screen {
>> struct pipe_box *subbox );
>>
>> /** Set ptr = fence, with reference counting */
>> - void (*fence_reference)( struct pipe_screen *screen,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *fence );
>> + void (*semaphore_reference)( struct pipe_screen *screen,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *fence );
>>
>> /**
>> * Wait for the fence to finish.
>> *
>> * If the fence was created with PIPE_FLUSH_DEFERRED, and the context is
>> - * still unflushed, and the ctx parameter of fence_finish is equal to
>> - * the context where the fence was created, fence_finish will flush
>> + * still unflushed, and the ctx parameter of semaphore_finish is equal to
>> + * the context where the fence was created, semaphore_finish will flush
>> * the context prior to waiting for the fence.
>> *
>> * In all other cases, the ctx parameter has no effect.
>> *
>> * \param timeout in nanoseconds (may be PIPE_TIMEOUT_INFINITE).
>> */
>> - boolean (*fence_finish)(struct pipe_screen *screen,
>> - struct pipe_context *ctx,
>> - struct pipe_fence_handle *fence,
>> - uint64_t timeout);
>> + boolean (*semaphore_finish)(struct pipe_screen *screen,
>> + struct pipe_context *ctx,
>> + struct pipe_semaphore_handle *fence,
>> + uint64_t timeout);
>>
>> /**
>> - * For fences created with PIPE_FLUSH_FENCE_FD (exported fd) or
>> - * by create_fence_fd() (imported fd), return the native fence fd
>> + * For fences created with PIPE_FLUSH_SEMAPHORE_FD (exported fd) or
>> + * by create_semaphore_fd() (imported fd), return the native fence fd
>> * associated with the fence. This may return -1 for fences
>> * created with PIPE_FLUSH_DEFERRED if the fence command has not
>> * been flushed yet.
>> */
>> - int (*fence_get_fd)(struct pipe_screen *screen,
>> - struct pipe_fence_handle *fence);
>> + int (*semaphore_get_fd)(struct pipe_screen *screen,
>> + struct pipe_semaphore_handle *fence);
>>
>> /**
>> * Returns a driver-specific query.
>> diff --git a/src/gallium/include/pipe/p_video_codec.h b/src/gallium/include/pipe/p_video_codec.h
>> index ab8b4fc..884a09d 100644
>> --- a/src/gallium/include/pipe/p_video_codec.h
>> +++ b/src/gallium/include/pipe/p_video_codec.h
>> @@ -38,7 +38,7 @@ struct pipe_screen;
>> struct pipe_surface;
>> struct pipe_macroblock;
>> struct pipe_picture_desc;
>> -struct pipe_fence_handle;
>> +struct pipe_semaphore_handle;
>>
>> /**
>> * Gallium video codec for a specific format/profile
>> diff --git a/src/gallium/include/state_tracker/opencl_interop.h b/src/gallium/include/state_tracker/opencl_interop.h
>> index 4983644..35c8c42 100644
>> --- a/src/gallium/include/state_tracker/opencl_interop.h
>> +++ b/src/gallium/include/state_tracker/opencl_interop.h
>> @@ -35,6 +35,6 @@
>> typedef bool (*opencl_dri_event_add_ref_t)(void *cl_event);
>> typedef bool (*opencl_dri_event_release_t)(void *cl_event);
>> typedef bool (*opencl_dri_event_wait_t)(void *cl_event, uint64_t timeout);
>> -typedef struct pipe_fence_handle *(*opencl_dri_event_get_fence_t)(void *cl_event);
>> +typedef struct pipe_semaphore_handle *(*opencl_dri_event_get_fence_t)(void *cl_event);
>>
>> #endif /* OPENCL_INTEROP_H */
>> diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h
>> index 44d6b47..96ff6da 100644
>> --- a/src/gallium/include/state_tracker/st_api.h
>> +++ b/src/gallium/include/state_tracker/st_api.h
>> @@ -165,7 +165,7 @@ enum st_manager_param {
>>
>> struct pipe_context;
>> struct pipe_resource;
>> -struct pipe_fence_handle;
>> +struct pipe_semaphore_handle;
>> struct util_queue_monitoring;
>>
>> /**
>> @@ -381,7 +381,7 @@ struct st_context_iface
>> * Flush all drawing from context to the pipe also flushes the pipe.
>> */
>> void (*flush)(struct st_context_iface *stctxi, unsigned flags,
>> - struct pipe_fence_handle **fence);
>> + struct pipe_semaphore_handle **fence);
>>
>> /**
>> * Replace the texture image of a texture object at the specified level.
>> diff --git a/src/gallium/state_trackers/clover/api/interop.cpp b/src/gallium/state_trackers/clover/api/interop.cpp
>> index b96069f..2999173 100644
>> --- a/src/gallium/state_trackers/clover/api/interop.cpp
>> +++ b/src/gallium/state_trackers/clover/api/interop.cpp
>> @@ -58,7 +58,7 @@ opencl_dri_event_wait(cl_event event, uint64_t timeout) try {
>> return false;
>> }
>>
>> -PUBLIC struct pipe_fence_handle *
>> +PUBLIC struct pipe_semaphore_handle *
>> opencl_dri_event_get_fence(cl_event event) try {
>> return obj(event).fence();
>>
>> diff --git a/src/gallium/state_trackers/clover/core/event.cpp b/src/gallium/state_trackers/clover/core/event.cpp
>> index cd5d786..29cbac5 100644
>> --- a/src/gallium/state_trackers/clover/core/event.cpp
>> +++ b/src/gallium/state_trackers/clover/core/event.cpp
>> @@ -133,7 +133,7 @@ hard_event::hard_event(command_queue &q, cl_command_type command,
>>
>> hard_event::~hard_event() {
>> pipe_screen *screen = queue()->device().pipe;
>> - screen->fence_reference(screen, &_fence, NULL);
>> + screen->semaphore_reference(screen, &_fence, NULL);
>> }
>>
>> cl_int
>> @@ -146,7 +146,7 @@ hard_event::status() const {
>> else if (!_fence)
>> return CL_QUEUED;
>>
>> - else if (!screen->fence_finish(screen, NULL, _fence, 0))
>> + else if (!screen->semaphore_finish(screen, NULL, _fence, 0))
>> return CL_SUBMITTED;
>>
>> else
>> @@ -173,7 +173,7 @@ hard_event::wait() const {
>> queue()->flush();
>>
>> if (!_fence ||
>> - !screen->fence_finish(screen, NULL, _fence, PIPE_TIMEOUT_INFINITE))
>> + !screen->semaphore_finish(screen, NULL, _fence, PIPE_TIMEOUT_INFINITE))
>> throw error(CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST);
>> }
>>
>> @@ -198,9 +198,9 @@ hard_event::time_end() const {
>> }
>>
>> void
>> -hard_event::fence(pipe_fence_handle *fence) {
>> +hard_event::fence(pipe_semaphore_handle *fence) {
>> pipe_screen *screen = queue()->device().pipe;
>> - screen->fence_reference(screen, &_fence, fence);
>> + screen->semaphore_reference(screen, &_fence, fence);
>> }
>>
>> event::action
>> diff --git a/src/gallium/state_trackers/clover/core/event.hpp b/src/gallium/state_trackers/clover/core/event.hpp
>> index 03c97bc..27172b0 100644
>> --- a/src/gallium/state_trackers/clover/core/event.hpp
>> +++ b/src/gallium/state_trackers/clover/core/event.hpp
>> @@ -72,7 +72,7 @@ namespace clover {
>> void wait_signalled() const;
>> virtual void wait() const;
>>
>> - virtual struct pipe_fence_handle *fence() const {
>> + virtual struct pipe_semaphore_handle *fence() const {
>> return NULL;
>> }
>>
>> @@ -128,17 +128,17 @@ namespace clover {
>>
>> friend class command_queue;
>>
>> - virtual struct pipe_fence_handle *fence() const {
>> + virtual struct pipe_semaphore_handle *fence() const {
>> return _fence;
>> }
>>
>> private:
>> - virtual void fence(pipe_fence_handle *fence);
>> + virtual void fence(pipe_semaphore_handle *fence);
>> action profile(command_queue &q, const action &action) const;
>>
>> const intrusive_ref<command_queue> _queue;
>> cl_command_type _command;
>> - pipe_fence_handle *_fence;
>> + pipe_semaphore_handle *_fence;
>> lazy<cl_ulong> _time_queued, _time_submit, _time_start, _time_end;
>> };
>>
>> diff --git a/src/gallium/state_trackers/clover/core/queue.cpp b/src/gallium/state_trackers/clover/core/queue.cpp
>> index c91b97a..298593c 100644
>> --- a/src/gallium/state_trackers/clover/core/queue.cpp
>> +++ b/src/gallium/state_trackers/clover/core/queue.cpp
>> @@ -66,7 +66,7 @@ command_queue::~command_queue() {
>> void
>> command_queue::flush() {
>> pipe_screen *screen = device().pipe;
>> - pipe_fence_handle *fence = NULL;
>> + pipe_semaphore_handle *fence = NULL;
>>
>> std::lock_guard<std::mutex> lock(queued_events_mutex);
>> if (!queued_events.empty()) {
>> @@ -78,7 +78,7 @@ command_queue::flush() {
>> queued_events.pop_front();
>> }
>>
>> - screen->fence_reference(screen, &fence, NULL);
>> + screen->semaphore_reference(screen, &fence, NULL);
>> }
>> }
>>
>> diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
>> index d5ae9cb..d99eb31 100644
>> --- a/src/gallium/state_trackers/dri/dri2.c
>> +++ b/src/gallium/state_trackers/dri/dri2.c
>> @@ -1502,7 +1502,7 @@ dri2_blit_image(__DRIcontext *context, __DRIimage *dst, __DRIimage *src,
>> struct dri_context *ctx = dri_context(context);
>> struct pipe_context *pipe = ctx->st->pipe;
>> struct pipe_screen *screen;
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>> struct pipe_blit_info blit;
>>
>> if (!dst || !src)
>> @@ -1535,8 +1535,8 @@ dri2_blit_image(__DRIcontext *context, __DRIimage *dst, __DRIimage *src,
>> screen = dri_screen(ctx->sPriv)->base.screen;
>> pipe->flush_resource(pipe, dst->texture);
>> ctx->st->flush(ctx->st, 0, &fence);
>> - (void) screen->fence_finish(screen, NULL, fence, PIPE_TIMEOUT_INFINITE);
>> - screen->fence_reference(screen, &fence, NULL);
>> + (void) screen->semaphore_finish(screen, NULL, fence, PIPE_TIMEOUT_INFINITE);
>> + screen->semaphore_reference(screen, &fence, NULL);
>> }
>> }
>>
>> diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
>> index 92ce9d2..0e2cf10 100644
>> --- a/src/gallium/state_trackers/dri/dri_drawable.c
>> +++ b/src/gallium/state_trackers/dri/dri_drawable.c
>> @@ -335,18 +335,18 @@ dri_drawable_get_format(struct dri_drawable *drawable,
>> * pull fences off the queue until the number is less than the desired
>> * number of fences, and return the last fence pulled.
>> */
>> -static struct pipe_fence_handle *
>> +static struct pipe_semaphore_handle *
>> swap_fences_pop_front(struct dri_drawable *draw)
>> {
>> struct pipe_screen *screen = draw->screen->base.screen;
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>>
>> if (draw->desired_fences == 0)
>> return NULL;
>>
>> if (draw->cur_fences >= draw->desired_fences) {
>> - screen->fence_reference(screen, &fence, draw->swap_fences[draw->tail]);
>> - screen->fence_reference(screen, &draw->swap_fences[draw->tail++], NULL);
>> + screen->semaphore_reference(screen, &fence, draw->swap_fences[draw->tail]);
>> + screen->semaphore_reference(screen, &draw->swap_fences[draw->tail++], NULL);
>> draw->tail &= DRI_SWAP_FENCES_MASK;
>> --draw->cur_fences;
>> }
>> @@ -362,7 +362,7 @@ swap_fences_pop_front(struct dri_drawable *draw)
>> */
>> static void
>> swap_fences_push_back(struct dri_drawable *draw,
>> - struct pipe_fence_handle *fence)
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct pipe_screen *screen = draw->screen->base.screen;
>>
>> @@ -373,7 +373,7 @@ swap_fences_push_back(struct dri_drawable *draw,
>> swap_fences_pop_front(draw);
>>
>> draw->cur_fences++;
>> - screen->fence_reference(screen, &draw->swap_fences[draw->head++],
>> + screen->semaphore_reference(screen, &draw->swap_fences[draw->head++],
>> fence);
>> draw->head &= DRI_SWAP_FENCES_MASK;
>> }
>> @@ -390,7 +390,7 @@ swap_fences_unref(struct dri_drawable *draw)
>> struct pipe_screen *screen = draw->screen->base.screen;
>>
>> while(draw->cur_fences) {
>> - screen->fence_reference(screen, &draw->swap_fences[draw->tail++], NULL);
>> + screen->semaphore_reference(screen, &draw->swap_fences[draw->tail++], NULL);
>> draw->tail &= DRI_SWAP_FENCES_MASK;
>> --draw->cur_fences;
>> }
>> @@ -556,19 +556,19 @@ dri_flush(__DRIcontext *cPriv,
>> * flush method returns a fence even if there are no commands to flush.
>> */
>> struct pipe_screen *screen = drawable->screen->base.screen;
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>>
>> fence = swap_fences_pop_front(drawable);
>> if (fence) {
>> - (void) screen->fence_finish(screen, NULL, fence, PIPE_TIMEOUT_INFINITE);
>> - screen->fence_reference(screen, &fence, NULL);
>> + (void) screen->semaphore_finish(screen, NULL, fence, PIPE_TIMEOUT_INFINITE);
>> + screen->semaphore_reference(screen, &fence, NULL);
>> }
>>
>> st->flush(st, flush_flags, &fence);
>>
>> if (fence) {
>> swap_fences_push_back(drawable, fence);
>> - screen->fence_reference(screen, &fence, NULL);
>> + screen->semaphore_reference(screen, &fence, NULL);
>> }
>> }
>> else if (flags & (__DRI2_FLUSH_DRAWABLE | __DRI2_FLUSH_CONTEXT)) {
>> diff --git a/src/gallium/state_trackers/dri/dri_drawable.h b/src/gallium/state_trackers/dri/dri_drawable.h
>> index 7c45004..822bdfc 100644
>> --- a/src/gallium/state_trackers/dri/dri_drawable.h
>> +++ b/src/gallium/state_trackers/dri/dri_drawable.h
>> @@ -60,7 +60,7 @@ struct dri_drawable
>> struct pipe_resource *msaa_textures[ST_ATTACHMENT_COUNT];
>> unsigned int texture_mask, texture_stamp;
>>
>> - struct pipe_fence_handle *swap_fences[DRI_SWAP_FENCES_MAX];
>> + struct pipe_semaphore_handle *swap_fences[DRI_SWAP_FENCES_MAX];
>> unsigned int cur_fences;
>> unsigned int head;
>> unsigned int tail;
>> diff --git a/src/gallium/state_trackers/dri/dri_helpers.c b/src/gallium/state_trackers/dri/dri_helpers.c
>> index f1501bf..9bc7dd3 100644
>> --- a/src/gallium/state_trackers/dri/dri_helpers.c
>> +++ b/src/gallium/state_trackers/dri/dri_helpers.c
>> @@ -71,7 +71,7 @@ dri2_load_opencl_interop(struct dri_screen *screen)
>>
>> struct dri2_fence {
>> struct dri_screen *driscreen;
>> - struct pipe_fence_handle *pipe_fence;
>> + struct pipe_semaphore_handle *pipe_fence;
>> void *cl_event;
>> };
>>
>> @@ -81,7 +81,7 @@ static unsigned dri2_fence_get_caps(__DRIscreen *_screen)
>> struct pipe_screen *screen = driscreen->base.screen;
>> unsigned caps = 0;
>>
>> - if (screen->get_param(screen, PIPE_CAP_NATIVE_FENCE_FD))
>> + if (screen->get_param(screen, PIPE_CAP_NATIVE_SEMAPHORE_FD))
>> caps |= __DRI_FENCE_CAP_NATIVE_FD;
>>
>> return caps;
>> @@ -119,7 +119,7 @@ dri2_create_fence_fd(__DRIcontext *_ctx, int fd)
>> stapi->flush(stapi, ST_FLUSH_FENCE_FD, &fence->pipe_fence);
>> } else {
>> /* importing a foreign fence fd: */
>> - ctx->create_fence_fd(ctx, &fence->pipe_fence, fd, PIPE_FD_TYPE_NATIVE_SYNC);
>> + ctx->create_semaphore_fd(ctx, &fence->pipe_fence, fd, PIPE_FD_TYPE_NATIVE_SYNC);
>> }
>> if (!fence->pipe_fence) {
>> FREE(fence);
>> @@ -137,7 +137,7 @@ dri2_get_fence_fd(__DRIscreen *_screen, void *_fence)
>> struct pipe_screen *screen = driscreen->base.screen;
>> struct dri2_fence *fence = (struct dri2_fence*)_fence;
>>
>> - return screen->fence_get_fd(screen, fence->pipe_fence);
>> + return screen->semaphore_get_fd(screen, fence->pipe_fence);
>> }
>>
>> static void *
>> @@ -172,7 +172,7 @@ dri2_destroy_fence(__DRIscreen *_screen, void *_fence)
>> struct dri2_fence *fence = (struct dri2_fence*)_fence;
>>
>> if (fence->pipe_fence)
>> - screen->fence_reference(screen, &fence->pipe_fence, NULL);
>> + screen->semaphore_reference(screen, &fence->pipe_fence, NULL);
>> else if (fence->cl_event)
>> driscreen->opencl_dri_event_release(fence->cl_event);
>> else
>> @@ -192,13 +192,13 @@ dri2_client_wait_sync(__DRIcontext *_ctx, void *_fence, unsigned flags,
>> /* No need to flush. The context was flushed when the fence was created. */
>>
>> if (fence->pipe_fence)
>> - return screen->fence_finish(screen, NULL, fence->pipe_fence, timeout);
>> + return screen->semaphore_finish(screen, NULL, fence->pipe_fence, timeout);
>> else if (fence->cl_event) {
>> - struct pipe_fence_handle *pipe_fence =
>> + struct pipe_semaphore_handle *pipe_fence =
>> driscreen->opencl_dri_event_get_fence(fence->cl_event);
>>
>> if (pipe_fence)
>> - return screen->fence_finish(screen, NULL, pipe_fence, timeout);
>> + return screen->semaphore_finish(screen, NULL, pipe_fence, timeout);
>> else
>> return driscreen->opencl_dri_event_wait(fence->cl_event, timeout);
>> }
>> @@ -214,8 +214,8 @@ dri2_server_wait_sync(__DRIcontext *_ctx, void *_fence, unsigned flags)
>> struct pipe_context *ctx = dri_context(_ctx)->st->pipe;
>> struct dri2_fence *fence = (struct dri2_fence*)_fence;
>>
>> - if (ctx->fence_server_sync)
>> - ctx->fence_server_sync(ctx, fence->pipe_fence);
>> + if (ctx->semaphore_server_sync)
>> + ctx->semaphore_server_sync(ctx, fence->pipe_fence);
>> }
>>
>> const __DRI2fenceExtension dri2FenceExtension = {
>> diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
>> index 934c0ab..2e679c5 100644
>> --- a/src/gallium/state_trackers/glx/xlib/xm_api.c
>> +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
>> @@ -1389,13 +1389,13 @@ void XMesaFlush( XMesaContext c )
>> {
>> if (c && c->xm_visual->display) {
>> XMesaDisplay xmdpy = xmesa_init_display(c->xm_visual->display);
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>>
>> c->st->flush(c->st, ST_FLUSH_FRONT, &fence);
>> if (fence) {
>> - xmdpy->screen->fence_finish(xmdpy->screen, NULL, fence,
>> + xmdpy->screen->semaphore_finish(xmdpy->screen, NULL, fence,
>> PIPE_TIMEOUT_INFINITE);
>> - xmdpy->screen->fence_reference(xmdpy->screen, &fence, NULL);
>> + xmdpy->screen->semaphore_reference(xmdpy->screen, &fence, NULL);
>> }
>> XFlush( c->xm_visual->display );
>> }
>> diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c
>> index f24a7d0..50a90c1 100644
>> --- a/src/gallium/state_trackers/nine/swapchain9.c
>> +++ b/src/gallium/state_trackers/nine/swapchain9.c
>> @@ -413,18 +413,18 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This,
>> * pull fences off the queue until the number is less than the desired
>> * number of fences, and return the last fence pulled.
>> */
>> -static struct pipe_fence_handle *
>> +static struct pipe_semaphore_handle *
>> swap_fences_pop_front(struct NineSwapChain9 *This)
>> {
>> struct pipe_screen *screen = This->screen;
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>>
>> if (This->desired_fences == 0)
>> return NULL;
>>
>> if (This->cur_fences >= This->desired_fences) {
>> - screen->fence_reference(screen, &fence, This->swap_fences[This->tail]);
>> - screen->fence_reference(screen, &This->swap_fences[This->tail++], NULL);
>> + screen->semaphore_reference(screen, &fence, This->swap_fences[This->tail]);
>> + screen->semaphore_reference(screen, &This->swap_fences[This->tail++], NULL);
>> This->tail &= DRI_SWAP_FENCES_MASK;
>> --This->cur_fences;
>> }
>> @@ -438,17 +438,17 @@ swap_fences_pop_front(struct NineSwapChain9 *This)
>> *
>> */
>>
>> -static struct pipe_fence_handle *
>> +static struct pipe_semaphore_handle *
>> swap_fences_see_front(struct NineSwapChain9 *This)
>> {
>> struct pipe_screen *screen = This->screen;
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>>
>> if (This->desired_fences == 0)
>> return NULL;
>>
>> if (This->cur_fences >= This->desired_fences) {
>> - screen->fence_reference(screen, &fence, This->swap_fences[This->tail]);
>> + screen->semaphore_reference(screen, &fence, This->swap_fences[This->tail]);
>> }
>> return fence;
>> }
>> @@ -462,7 +462,7 @@ swap_fences_see_front(struct NineSwapChain9 *This)
>> */
>> static void
>> swap_fences_push_back(struct NineSwapChain9 *This,
>> - struct pipe_fence_handle *fence)
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct pipe_screen *screen = This->screen;
>>
>> @@ -473,7 +473,7 @@ swap_fences_push_back(struct NineSwapChain9 *This,
>> swap_fences_pop_front(This);
>>
>> This->cur_fences++;
>> - screen->fence_reference(screen, &This->swap_fences[This->head++],
>> + screen->semaphore_reference(screen, &This->swap_fences[This->head++],
>> fence);
>> This->head &= DRI_SWAP_FENCES_MASK;
>> }
>> @@ -490,7 +490,7 @@ swap_fences_unref(struct NineSwapChain9 *This)
>> struct pipe_screen *screen = This->screen;
>>
>> while(This->cur_fences) {
>> - screen->fence_reference(screen, &This->swap_fences[This->tail++], NULL);
>> + screen->semaphore_reference(screen, &This->swap_fences[This->tail++], NULL);
>> This->tail &= DRI_SWAP_FENCES_MASK;
>> --This->cur_fences;
>> }
>> @@ -614,7 +614,7 @@ handle_draw_cursor_and_hud( struct NineSwapChain9 *This, struct pipe_resource *r
>>
>> struct end_present_struct {
>> struct pipe_screen *screen;
>> - struct pipe_fence_handle *fence_to_wait;
>> + struct pipe_semaphore_handle *fence_to_wait;
>> ID3DPresent *present;
>> D3DWindowBuffer *present_handle;
>> HWND hDestWindowOverride;
>> @@ -624,8 +624,8 @@ static void work_present(void *data)
>> {
>> struct end_present_struct *work = data;
>> if (work->fence_to_wait) {
>> - (void) work->screen->fence_finish(work->screen, NULL, work->fence_to_wait, PIPE_TIMEOUT_INFINITE);
>> - work->screen->fence_reference(work->screen, &(work->fence_to_wait), NULL);
>> + (void) work->screen->semaphore_finish(work->screen, NULL, work->fence_to_wait, PIPE_TIMEOUT_INFINITE);
>> + work->screen->semaphore_reference(work->screen, &(work->fence_to_wait), NULL);
>> }
>> ID3DPresent_PresentBuffer(work->present, work->present_handle, work->hDestWindowOverride, NULL, NULL, NULL, 0);
>> free(work);
>> @@ -656,7 +656,7 @@ present( struct NineSwapChain9 *This,
>> {
>> struct pipe_context *pipe;
>> struct pipe_resource *resource;
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>> HRESULT hr;
>> struct pipe_blit_info blit;
>>
>> @@ -738,7 +738,7 @@ present( struct NineSwapChain9 *This,
>> pipe->flush(pipe, &fence, PIPE_FLUSH_END_OF_FRAME);
>> if (fence) {
>> swap_fences_push_back(This, fence);
>> - This->screen->fence_reference(This->screen, &fence, NULL);
>> + This->screen->semaphore_reference(This->screen, &fence, NULL);
>> }
>>
>> This->rendering_done = TRUE;
>> @@ -749,8 +749,8 @@ bypass_rendering:
>> BOOL still_draw = FALSE;
>> fence = swap_fences_see_front(This);
>> if (fence) {
>> - still_draw = !This->screen->fence_finish(This->screen, NULL, fence, 0);
>> - This->screen->fence_reference(This->screen, &fence, NULL);
>> + still_draw = !This->screen->semaphore_finish(This->screen, NULL, fence, 0);
>> + This->screen->semaphore_reference(This->screen, &fence, NULL);
>> }
>> if (still_draw)
>> return D3DERR_WASSTILLDRAWING;
>> @@ -760,8 +760,8 @@ bypass_rendering:
>> This->tasks[0]=NULL;
>> fence = swap_fences_pop_front(This);
>> if (fence) {
>> - (void) This->screen->fence_finish(This->screen, NULL, fence, PIPE_TIMEOUT_INFINITE);
>> - This->screen->fence_reference(This->screen, &fence, NULL);
>> + (void) This->screen->semaphore_finish(This->screen, NULL, fence, PIPE_TIMEOUT_INFINITE);
>> + This->screen->semaphore_reference(This->screen, &fence, NULL);
>> }
>>
>> hr = ID3DPresent_PresentBuffer(This->present, This->present_handles[0], hDestWindowOverride, pSourceRect, pDestRect, pDirtyRegion, dwFlags);
>> diff --git a/src/gallium/state_trackers/nine/swapchain9.h b/src/gallium/state_trackers/nine/swapchain9.h
>> index 0cd3824..ea1e2d9 100644
>> --- a/src/gallium/state_trackers/nine/swapchain9.h
>> +++ b/src/gallium/state_trackers/nine/swapchain9.h
>> @@ -58,7 +58,7 @@ struct NineSwapChain9
>> struct pipe_resource *present_buffers[D3DPRESENT_BACK_BUFFERS_MAX_EX + 1];
>> D3DWindowBuffer *present_handles[D3DPRESENT_BACK_BUFFERS_MAX_EX + 1];
>>
>> - struct pipe_fence_handle *swap_fences[DRI_SWAP_FENCES_MAX];
>> + struct pipe_semaphore_handle *swap_fences[DRI_SWAP_FENCES_MAX];
>> unsigned int cur_fences;
>> unsigned int head;
>> unsigned int tail;
>> diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c
>> index 8ef8268..d73d77b 100644
>> --- a/src/gallium/state_trackers/vdpau/output.c
>> +++ b/src/gallium/state_trackers/vdpau/output.c
>> @@ -156,7 +156,7 @@ vlVdpOutputSurfaceDestroy(VdpOutputSurface surface)
>>
>> pipe_surface_reference(&vlsurface->surface, NULL);
>> pipe_sampler_view_reference(&vlsurface->sampler_view, NULL);
>> - pipe->screen->fence_reference(pipe->screen, &vlsurface->fence, NULL);
>> + pipe->screen->semaphore_reference(pipe->screen, &vlsurface->fence, NULL);
>> vl_compositor_cleanup_state(&vlsurface->cstate);
>> mtx_unlock(&vlsurface->device->mutex);
>>
>> diff --git a/src/gallium/state_trackers/vdpau/presentation.c b/src/gallium/state_trackers/vdpau/presentation.c
>> index 54f15ff..3d8355a 100644
>> --- a/src/gallium/state_trackers/vdpau/presentation.c
>> +++ b/src/gallium/state_trackers/vdpau/presentation.c
>> @@ -266,7 +266,7 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue,
>>
>> // flush before calling flush_frontbuffer so that rendering is flushed
>> // to back buffer so the texture can be copied in flush_frontbuffer
>> - pipe->screen->fence_reference(pipe->screen, &surf->fence, NULL);
>> + pipe->screen->semaphore_reference(pipe->screen, &surf->fence, NULL);
>> pipe->flush(pipe, &surf->fence, 0);
>> pipe->screen->flush_frontbuffer(pipe->screen, tex, 0, 0,
>> vscreen->get_private(vscreen), NULL);
>> @@ -324,8 +324,8 @@ vlVdpPresentationQueueBlockUntilSurfaceIdle(VdpPresentationQueue presentation_qu
>> mtx_lock(&pq->device->mutex);
>> if (surf->fence) {
>> screen = pq->device->vscreen->pscreen;
>> - screen->fence_finish(screen, NULL, surf->fence, PIPE_TIMEOUT_INFINITE);
>> - screen->fence_reference(screen, &surf->fence, NULL);
>> + screen->semaphore_finish(screen, NULL, surf->fence, PIPE_TIMEOUT_INFINITE);
>> + screen->semaphore_reference(screen, &surf->fence, NULL);
>> }
>> mtx_unlock(&pq->device->mutex);
>>
>> @@ -366,8 +366,8 @@ vlVdpPresentationQueueQuerySurfaceStatus(VdpPresentationQueue presentation_queue
>> } else {
>> mtx_lock(&pq->device->mutex);
>> screen = pq->device->vscreen->pscreen;
>> - if (screen->fence_finish(screen, NULL, surf->fence, 0)) {
>> - screen->fence_reference(screen, &surf->fence, NULL);
>> + if (screen->semaphore_finish(screen, NULL, surf->fence, 0)) {
>> + screen->semaphore_reference(screen, &surf->fence, NULL);
>> *status = VDP_PRESENTATION_QUEUE_STATUS_VISIBLE;
>> mtx_unlock(&pq->device->mutex);
>>
>> diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h
>> index b36c0c4..6b77c21 100644
>> --- a/src/gallium/state_trackers/vdpau/vdpau_private.h
>> +++ b/src/gallium/state_trackers/vdpau/vdpau_private.h
>> @@ -416,7 +416,7 @@ typedef struct
>> vlVdpDevice *device;
>> struct pipe_surface *surface;
>> struct pipe_sampler_view *sampler_view;
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>> struct vl_compositor_state cstate;
>> struct u_rect dirty_area;
>> bool send_to_X;
>> diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c
>> index a9e4024..a0807cf 100644
>> --- a/src/gallium/state_trackers/wgl/stw_context.c
>> +++ b/src/gallium/state_trackers/wgl/stw_context.c
>> @@ -446,7 +446,7 @@ stw_make_current(HDC hDrawDC, HDC hReadDC, DHGLRC dhglrc)
>> }
>> } else {
>> if (old_ctx->shared) {
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>> old_ctx->st->flush(old_ctx->st,
>> ST_FLUSH_FRONT | ST_FLUSH_WAIT, &fence);
>> }
>> diff --git a/src/gallium/state_trackers/xa/xa_context.c b/src/gallium/state_trackers/xa/xa_context.c
>> index 1f47170..8b3533e 100644
>> --- a/src/gallium/state_trackers/xa/xa_context.c
>> +++ b/src/gallium/state_trackers/xa/xa_context.c
>> @@ -39,7 +39,7 @@ xa_context_flush(struct xa_context *ctx)
>> {
>> if (ctx->last_fence) {
>> struct pipe_screen *screen = ctx->xa->screen;
>> - screen->fence_reference(screen, &ctx->last_fence, NULL);
>> + screen->semaphore_reference(screen, &ctx->last_fence, NULL);
>> }
>> ctx->pipe->flush(ctx->pipe, &ctx->last_fence, 0);
>> }
>> @@ -368,7 +368,7 @@ xa_fence_get(struct xa_context *ctx)
>> if (ctx->last_fence == NULL)
>> fence->pipe_fence = NULL;
>> else
>> - screen->fence_reference(screen, &fence->pipe_fence, ctx->last_fence);
>> + screen->semaphore_reference(screen, &fence->pipe_fence, ctx->last_fence);
>>
>> return fence;
>> }
>> @@ -383,11 +383,11 @@ xa_fence_wait(struct xa_fence *fence, uint64_t timeout)
>> struct pipe_screen *screen = fence->xa->screen;
>> boolean timed_out;
>>
>> - timed_out = !screen->fence_finish(screen, NULL, fence->pipe_fence, timeout);
>> + timed_out = !screen->semaphore_finish(screen, NULL, fence->pipe_fence, timeout);
>> if (timed_out)
>> return -XA_ERR_BUSY;
>>
>> - screen->fence_reference(screen, &fence->pipe_fence, NULL);
>> + screen->semaphore_reference(screen, &fence->pipe_fence, NULL);
>> }
>> return XA_ERR_NONE;
>> }
>> @@ -401,7 +401,7 @@ xa_fence_destroy(struct xa_fence *fence)
>> if (fence->pipe_fence) {
>> struct pipe_screen *screen = fence->xa->screen;
>>
>> - screen->fence_reference(screen, &fence->pipe_fence, NULL);
>> + screen->semaphore_reference(screen, &fence->pipe_fence, NULL);
>> }
>>
>> free(fence);
>> diff --git a/src/gallium/state_trackers/xa/xa_priv.h b/src/gallium/state_trackers/xa/xa_priv.h
>> index 13a0e86..96277a6 100644
>> --- a/src/gallium/state_trackers/xa/xa_priv.h
>> +++ b/src/gallium/state_trackers/xa/xa_priv.h
>> @@ -51,7 +51,7 @@
>> #define XA_MAX_SAMPLERS 3
>>
>> struct xa_fence {
>> - struct pipe_fence_handle *pipe_fence;
>> + struct pipe_semaphore_handle *pipe_fence;
>> struct xa_tracker *xa;
>> };
>>
>> @@ -102,7 +102,7 @@ struct xa_context {
>> unsigned int fb_width;
>> unsigned int fb_height;
>>
>> - struct pipe_fence_handle *last_fence;
>> + struct pipe_semaphore_handle *last_fence;
>> struct xa_surface *src;
>> struct xa_surface *dst;
>> struct pipe_surface *srf;
>> diff --git a/src/gallium/state_trackers/xvmc/surface.c b/src/gallium/state_trackers/xvmc/surface.c
>> index 329e881..8dd40bd 100644
>> --- a/src/gallium/state_trackers/xvmc/surface.c
>> +++ b/src/gallium/state_trackers/xvmc/surface.c
>> @@ -437,7 +437,7 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
>> }
>>
>> // Workaround for r600g, there seems to be a bug in the fence refcounting code
>> - pipe->screen->fence_reference(pipe->screen, &surface_priv->fence, NULL);
>> + pipe->screen->semaphore_reference(pipe->screen, &surface_priv->fence, NULL);
>>
>> vl_compositor_set_layer_dst_area(cstate, 0, &dst_rect);
>> vl_compositor_set_layer_dst_area(cstate, 1, &dst_rect);
>> @@ -489,7 +489,7 @@ Status XvMCGetSurfaceStatus(Display *dpy, XvMCSurface *surface, int *status)
>> *status = 0;
>>
>> if (surface_priv->fence)
>> - if (!pipe->screen->fence_finish(pipe->screen, NULL, surface_priv->fence, 0))
>> + if (!pipe->screen->semaphore_finish(pipe->screen, NULL, surface_priv->fence, 0))
>> *status |= XVMC_RENDERING;
>>
>> return Success;
>> diff --git a/src/gallium/state_trackers/xvmc/xvmc_private.h b/src/gallium/state_trackers/xvmc/xvmc_private.h
>> index a1d026f..3f4863f 100644
>> --- a/src/gallium/state_trackers/xvmc/xvmc_private.h
>> +++ b/src/gallium/state_trackers/xvmc/xvmc_private.h
>> @@ -46,7 +46,7 @@ struct pipe_video_codec;
>> struct pipe_video_buffer;
>>
>> struct pipe_sampler_view;
>> -struct pipe_fence_handle;
>> +struct pipe_semaphore_handle;
>>
>> typedef struct
>> {
>> @@ -73,7 +73,7 @@ typedef struct
>>
>> XvMCSurface *ref[2];
>>
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>>
>> /* The subpicture associated with this surface, if any. */
>> XvMCSubpicture *subpicture;
>> diff --git a/src/gallium/tools/trace/dump_state.py b/src/gallium/tools/trace/dump_state.py
>> index 4531843..022b378 100755
>> --- a/src/gallium/tools/trace/dump_state.py
>> +++ b/src/gallium/tools/trace/dump_state.py
>> @@ -206,13 +206,13 @@ class Screen(Dispatcher):
>> def resource_destroy(self, resource):
>> self.interpreter.unregister_object(resource)
>>
>> - def fence_finish(self, fence, timeout=None):
>> + def semaphore_finish(self, fence, timeout=None):
>> pass
>>
>> def fence_signalled(self, fence):
>> pass
>>
>> - def fence_reference(self, dst, src):
>> + def semaphore_reference(self, dst, src):
>> pass
>>
>> def flush_frontbuffer(self, resource):
>> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
>> index 4b12735..2cd343a 100644
>> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
>> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
>> @@ -99,7 +99,7 @@ static bool amdgpu_bo_wait(struct pb_buffer *_buf, uint64_t timeout,
>>
>> /* Release the idle fences to avoid checking them again later. */
>> for (unsigned i = 0; i < idle_fences; ++i)
>> - amdgpu_fence_reference(&bo->fences[i], NULL);
>> + amdgpu_semaphore_reference(&bo->fences[i], NULL);
>>
>> memmove(&bo->fences[0], &bo->fences[idle_fences],
>> (bo->num_fences - idle_fences) * sizeof(*bo->fences));
>> @@ -114,10 +114,10 @@ static bool amdgpu_bo_wait(struct pb_buffer *_buf, uint64_t timeout,
>>
>> simple_mtx_lock(&ws->bo_fence_lock);
>> while (bo->num_fences && buffer_idle) {
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>> bool fence_idle = false;
>>
>> - amdgpu_fence_reference(&fence, bo->fences[0]);
>> + amdgpu_semaphore_reference(&fence, bo->fences[0]);
>>
>> /* Wait for the fence. */
>> simple_mtx_unlock(&ws->bo_fence_lock);
>> @@ -131,13 +131,13 @@ static bool amdgpu_bo_wait(struct pb_buffer *_buf, uint64_t timeout,
>> * mind that the fence array may have been modified by other threads.
>> */
>> if (fence_idle && bo->num_fences && bo->fences[0] == fence) {
>> - amdgpu_fence_reference(&bo->fences[0], NULL);
>> + amdgpu_semaphore_reference(&bo->fences[0], NULL);
>> memmove(&bo->fences[0], &bo->fences[1],
>> (bo->num_fences - 1) * sizeof(*bo->fences));
>> bo->num_fences--;
>> }
>>
>> - amdgpu_fence_reference(&fence, NULL);
>> + amdgpu_semaphore_reference(&fence, NULL);
>> }
>> simple_mtx_unlock(&ws->bo_fence_lock);
>>
>> @@ -154,7 +154,7 @@ static enum radeon_bo_domain amdgpu_bo_get_initial_domain(
>> static void amdgpu_bo_remove_fences(struct amdgpu_winsys_bo *bo)
>> {
>> for (unsigned i = 0; i < bo->num_fences; ++i)
>> - amdgpu_fence_reference(&bo->fences[i], NULL);
>> + amdgpu_semaphore_reference(&bo->fences[i], NULL);
>>
>> FREE(bo->fences);
>> bo->num_fences = 0;
>> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h
>> index b3dbb35..7563eac 100644
>> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h
>> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h
>> @@ -110,7 +110,7 @@ struct amdgpu_winsys_bo {
>> /* Fences for buffer synchronization. */
>> unsigned num_fences;
>> unsigned max_fences;
>> - struct pipe_fence_handle **fences;
>> + struct pipe_semaphore_handle **fences;
>>
>> bool is_local;
>> };
>> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>> index 63cd632..ae71708 100644
>> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>> @@ -37,7 +37,7 @@ DEBUG_GET_ONCE_BOOL_OPTION(noop, "RADEON_NOOP", false)
>>
>> /* FENCES */
>>
>> -static struct pipe_fence_handle *
>> +static struct pipe_semaphore_handle *
>> amdgpu_fence_create(struct amdgpu_ctx *ctx, unsigned ip_type,
>> unsigned ip_instance, unsigned ring)
>> {
>> @@ -53,10 +53,10 @@ amdgpu_fence_create(struct amdgpu_ctx *ctx, unsigned ip_type,
>> util_queue_fence_init(&fence->submitted);
>> util_queue_fence_reset(&fence->submitted);
>> p_atomic_inc(&ctx->refcount);
>> - return (struct pipe_fence_handle *)fence;
>> + return (struct pipe_semaphore_handle *)fence;
>> }
>>
>> -static struct pipe_fence_handle *
>> +static struct pipe_semaphore_handle *
>> amdgpu_fence_import_sync_file(struct radeon_winsys *rws, int fd)
>> {
>> struct amdgpu_winsys *ws = amdgpu_winsys(rws);
>> @@ -85,11 +85,11 @@ amdgpu_fence_import_sync_file(struct radeon_winsys *rws, int fd)
>>
>> util_queue_fence_init(&fence->submitted);
>>
>> - return (struct pipe_fence_handle*)fence;
>> + return (struct pipe_semaphore_handle*)fence;
>> }
>>
>> static int amdgpu_fence_export_sync_file(struct radeon_winsys *rws,
>> - struct pipe_fence_handle *pfence)
>> + struct pipe_semaphore_handle *pfence)
>> {
>> struct amdgpu_winsys *ws = amdgpu_winsys(rws);
>> struct amdgpu_fence *fence = (struct amdgpu_fence*)pfence;
>> @@ -114,7 +114,7 @@ static int amdgpu_fence_export_sync_file(struct radeon_winsys *rws,
>> return fd;
>> }
>>
>> -static void amdgpu_fence_submitted(struct pipe_fence_handle *fence,
>> +static void amdgpu_fence_submitted(struct pipe_semaphore_handle *fence,
>> uint64_t seq_no,
>> uint64_t *user_fence_cpu_address)
>> {
>> @@ -125,7 +125,7 @@ static void amdgpu_fence_submitted(struct pipe_fence_handle *fence,
>> util_queue_fence_signal(&rfence->submitted);
>> }
>>
>> -static void amdgpu_fence_signalled(struct pipe_fence_handle *fence)
>> +static void amdgpu_fence_signalled(struct pipe_semaphore_handle *fence)
>> {
>> struct amdgpu_fence *rfence = (struct amdgpu_fence*)fence;
>>
>> @@ -133,7 +133,7 @@ static void amdgpu_fence_signalled(struct pipe_fence_handle *fence)
>> util_queue_fence_signal(&rfence->submitted);
>> }
>>
>> -bool amdgpu_fence_wait(struct pipe_fence_handle *fence, uint64_t timeout,
>> +bool amdgpu_fence_wait(struct pipe_semaphore_handle *fence, uint64_t timeout,
>> bool absolute)
>> {
>> struct amdgpu_fence *rfence = (struct amdgpu_fence*)fence;
>> @@ -203,23 +203,23 @@ bool amdgpu_fence_wait(struct pipe_fence_handle *fence, uint64_t timeout,
>> }
>>
>> static bool amdgpu_fence_wait_rel_timeout(struct radeon_winsys *rws,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout)
>> {
>> return amdgpu_fence_wait(fence, timeout, false);
>> }
>>
>> -static struct pipe_fence_handle *
>> +static struct pipe_semaphore_handle *
>> amdgpu_cs_get_next_fence(struct radeon_winsys_cs *rcs)
>> {
>> struct amdgpu_cs *cs = amdgpu_cs(rcs);
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>>
>> if (debug_get_option_noop())
>> return NULL;
>>
>> if (cs->next_fence) {
>> - amdgpu_fence_reference(&fence, cs->next_fence);
>> + amdgpu_semaphore_reference(&fence, cs->next_fence);
>> return fence;
>> }
>>
>> @@ -230,7 +230,7 @@ amdgpu_cs_get_next_fence(struct radeon_winsys_cs *rcs)
>> if (!fence)
>> return NULL;
>>
>> - amdgpu_fence_reference(&cs->next_fence, fence);
>> + amdgpu_semaphore_reference(&cs->next_fence, fence);
>> return fence;
>> }
>>
>> @@ -817,13 +817,13 @@ static void amdgpu_cs_context_cleanup(struct amdgpu_cs_context *cs)
>> amdgpu_winsys_bo_reference(&cs->sparse_buffers[i].bo, NULL);
>> }
>> for (i = 0; i < cs->num_fence_dependencies; i++)
>> - amdgpu_fence_reference(&cs->fence_dependencies[i], NULL);
>> + amdgpu_semaphore_reference(&cs->fence_dependencies[i], NULL);
>>
>> cs->num_real_buffers = 0;
>> cs->num_slab_buffers = 0;
>> cs->num_sparse_buffers = 0;
>> cs->num_fence_dependencies = 0;
>> - amdgpu_fence_reference(&cs->fence, NULL);
>> + amdgpu_semaphore_reference(&cs->fence, NULL);
>>
>> memset(cs->buffer_indices_hashlist, -1, sizeof(cs->buffer_indices_hashlist));
>> cs->last_added_bo = NULL;
>> @@ -845,7 +845,7 @@ static struct radeon_winsys_cs *
>> amdgpu_cs_create(struct radeon_winsys_ctx *rwctx,
>> enum ring_type ring_type,
>> void (*flush)(void *ctx, unsigned flags,
>> - struct pipe_fence_handle **fence),
>> + struct pipe_semaphore_handle **fence),
>> void *flush_ctx)
>> {
>> struct amdgpu_ctx *ctx = (struct amdgpu_ctx*)rwctx;
>> @@ -1032,7 +1032,7 @@ static bool is_noop_fence_dependency(struct amdgpu_cs *acs,
>> }
>>
>> static void amdgpu_cs_add_fence_dependency(struct radeon_winsys_cs *rws,
>> - struct pipe_fence_handle *pfence)
>> + struct pipe_semaphore_handle *pfence)
>> {
>> struct amdgpu_cs *acs = amdgpu_cs(rws);
>> struct amdgpu_cs_context *cs = acs->csc;
>> @@ -1044,8 +1044,8 @@ static void amdgpu_cs_add_fence_dependency(struct radeon_winsys_cs *rws,
>> return;
>>
>> unsigned idx = add_fence_dependency_entry(cs);
>> - amdgpu_fence_reference(&cs->fence_dependencies[idx],
>> - (struct pipe_fence_handle*)fence);
>> + amdgpu_semaphore_reference(&cs->fence_dependencies[idx],
>> + (struct pipe_semaphore_handle*)fence);
>> }
>>
>> static void amdgpu_add_bo_fence_dependencies(struct amdgpu_cs *acs,
>> @@ -1061,19 +1061,19 @@ static void amdgpu_add_bo_fence_dependencies(struct amdgpu_cs *acs,
>> if (is_noop_fence_dependency(acs, bo_fence))
>> continue;
>>
>> - amdgpu_fence_reference(&bo->fences[new_num_fences], bo->fences[j]);
>> + amdgpu_semaphore_reference(&bo->fences[new_num_fences], bo->fences[j]);
>> new_num_fences++;
>>
>> if (!(buffer->usage & RADEON_USAGE_SYNCHRONIZED))
>> continue;
>>
>> unsigned idx = add_fence_dependency_entry(cs);
>> - amdgpu_fence_reference(&cs->fence_dependencies[idx],
>> - (struct pipe_fence_handle*)bo_fence);
>> + amdgpu_semaphore_reference(&cs->fence_dependencies[idx],
>> + (struct pipe_semaphore_handle*)bo_fence);
>> }
>>
>> for (unsigned j = new_num_fences; j < bo->num_fences; ++j)
>> - amdgpu_fence_reference(&bo->fences[j], NULL);
>> + amdgpu_semaphore_reference(&bo->fences[j], NULL);
>>
>> bo->num_fences = new_num_fences;
>> }
>> @@ -1084,11 +1084,11 @@ static void amdgpu_add_bo_fence_dependencies(struct amdgpu_cs *acs,
>> */
>> void amdgpu_add_fences(struct amdgpu_winsys_bo *bo,
>> unsigned num_fences,
>> - struct pipe_fence_handle **fences)
>> + struct pipe_semaphore_handle **fences)
>> {
>> if (bo->num_fences + num_fences > bo->max_fences) {
>> unsigned new_max_fences = MAX2(bo->num_fences + num_fences, bo->max_fences * 2);
>> - struct pipe_fence_handle **new_fences =
>> + struct pipe_semaphore_handle **new_fences =
>> REALLOC(bo->fences,
>> bo->num_fences * sizeof(*new_fences),
>> new_max_fences * sizeof(*new_fences));
>> @@ -1103,7 +1103,7 @@ void amdgpu_add_fences(struct amdgpu_winsys_bo *bo,
>> return;
>>
>> bo->num_fences--; /* prefer to keep the most recent fence if possible */
>> - amdgpu_fence_reference(&bo->fences[bo->num_fences], NULL);
>> + amdgpu_semaphore_reference(&bo->fences[bo->num_fences], NULL);
>>
>> drop = bo->num_fences + num_fences - bo->max_fences;
>> num_fences -= drop;
>> @@ -1113,13 +1113,13 @@ void amdgpu_add_fences(struct amdgpu_winsys_bo *bo,
>>
>> for (unsigned i = 0; i < num_fences; ++i) {
>> bo->fences[bo->num_fences] = NULL;
>> - amdgpu_fence_reference(&bo->fences[bo->num_fences], fences[i]);
>> + amdgpu_semaphore_reference(&bo->fences[bo->num_fences], fences[i]);
>> bo->num_fences++;
>> }
>> }
>>
>> static void amdgpu_add_fence_dependencies_bo_list(struct amdgpu_cs *acs,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> unsigned num_buffers,
>> struct amdgpu_cs_buffer *buffers)
>> {
>> @@ -1403,7 +1403,7 @@ void amdgpu_cs_sync_flush(struct radeon_winsys_cs *rcs)
>>
>> static int amdgpu_cs_flush(struct radeon_winsys_cs *rcs,
>> unsigned flags,
>> - struct pipe_fence_handle **fence)
>> + struct pipe_semaphore_handle **fence)
>> {
>> struct amdgpu_cs *cs = amdgpu_cs(rcs);
>> struct amdgpu_winsys *ws = cs->ctx->ws;
>> @@ -1459,7 +1459,7 @@ static int amdgpu_cs_flush(struct radeon_winsys_cs *rcs,
>> amdgpu_ib_finalize(&cs->main);
>>
>> /* Create a fence. */
>> - amdgpu_fence_reference(&cur->fence, NULL);
>> + amdgpu_semaphore_reference(&cur->fence, NULL);
>> if (cs->next_fence) {
>> /* just move the reference */
>> cur->fence = cs->next_fence;
>> @@ -1471,7 +1471,7 @@ static int amdgpu_cs_flush(struct radeon_winsys_cs *rcs,
>> cur->ib[IB_MAIN].ring);
>> }
>> if (fence)
>> - amdgpu_fence_reference(fence, cur->fence);
>> + amdgpu_semaphore_reference(fence, cur->fence);
>>
>> amdgpu_cs_sync_flush(rcs);
>>
>> @@ -1526,7 +1526,7 @@ static void amdgpu_cs_destroy(struct radeon_winsys_cs *rcs)
>> FREE(cs->main.base.prev);
>> amdgpu_destroy_cs_context(&cs->csc1);
>> amdgpu_destroy_cs_context(&cs->csc2);
>> - amdgpu_fence_reference(&cs->next_fence, NULL);
>> + amdgpu_semaphore_reference(&cs->next_fence, NULL);
>> FREE(cs);
>> }
>>
>> @@ -1557,7 +1557,7 @@ void amdgpu_cs_init_functions(struct amdgpu_winsys *ws)
>> ws->base.cs_sync_flush = amdgpu_cs_sync_flush;
>> ws->base.cs_add_fence_dependency = amdgpu_cs_add_fence_dependency;
>> ws->base.fence_wait = amdgpu_fence_wait_rel_timeout;
>> - ws->base.fence_reference = amdgpu_fence_reference;
>> + ws->base.semaphore_reference = amdgpu_semaphore_reference;
>> ws->base.fence_import_sync_file = amdgpu_fence_import_sync_file;
>> ws->base.fence_export_sync_file = amdgpu_fence_export_sync_file;
>> }
>> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
>> index fbf44b3..cb46470 100644
>> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
>> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
>> @@ -100,11 +100,11 @@ struct amdgpu_cs_context {
>> unsigned last_added_bo_usage;
>> uint64_t last_added_bo_priority_usage;
>>
>> - struct pipe_fence_handle **fence_dependencies;
>> + struct pipe_semaphore_handle **fence_dependencies;
>> unsigned num_fence_dependencies;
>> unsigned max_fence_dependencies;
>>
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>>
>> /* the error returned from cs_flush for non-async submissions */
>> int error_code;
>> @@ -127,11 +127,11 @@ struct amdgpu_cs {
>> struct amdgpu_cs_context *cst;
>>
>> /* Flush CS. */
>> - void (*flush_cs)(void *ctx, unsigned flags, struct pipe_fence_handle **fence);
>> + void (*flush_cs)(void *ctx, unsigned flags, struct pipe_semaphore_handle **fence);
>> void *flush_data;
>>
>> struct util_queue_fence flush_completed;
>> - struct pipe_fence_handle *next_fence;
>> + struct pipe_semaphore_handle *next_fence;
>> };
>>
>> struct amdgpu_fence {
>> @@ -166,8 +166,8 @@ static inline void amdgpu_ctx_unref(struct amdgpu_ctx *ctx)
>> }
>> }
>>
>> -static inline void amdgpu_fence_reference(struct pipe_fence_handle **dst,
>> - struct pipe_fence_handle *src)
>> +static inline void amdgpu_semaphore_reference(struct pipe_semaphore_handle **dst,
>> + struct pipe_semaphore_handle *src)
>> {
>> struct amdgpu_fence **rdst = (struct amdgpu_fence **)dst;
>> struct amdgpu_fence *rsrc = (struct amdgpu_fence *)src;
>> @@ -252,11 +252,11 @@ amdgpu_bo_is_referenced_by_any_cs(struct amdgpu_winsys_bo *bo)
>> return bo->num_cs_references != 0;
>> }
>>
>> -bool amdgpu_fence_wait(struct pipe_fence_handle *fence, uint64_t timeout,
>> +bool amdgpu_fence_wait(struct pipe_semaphore_handle *fence, uint64_t timeout,
>> bool absolute);
>> void amdgpu_add_fences(struct amdgpu_winsys_bo *bo,
>> unsigned num_fences,
>> - struct pipe_fence_handle **fences);
>> + struct pipe_semaphore_handle **fences);
>> void amdgpu_cs_sync_flush(struct radeon_winsys_cs *rcs);
>> void amdgpu_cs_init_functions(struct amdgpu_winsys *ws);
>> void amdgpu_cs_submit_ib(void *job, int thread_index);
>> diff --git a/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c b/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c
>> index 93ce6f2..4cdb895 100644
>> --- a/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c
>> +++ b/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c
>> @@ -159,7 +159,7 @@ i915_drm_throttle(struct i915_drm_winsys *idws)
>>
>> static void
>> i915_drm_batchbuffer_flush(struct i915_winsys_batchbuffer *ibatch,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> enum i915_winsys_flush_flags flags)
>> {
>> struct i915_drm_batchbuffer *batch = i915_drm_batchbuffer(ibatch);
>> @@ -202,7 +202,7 @@ i915_drm_batchbuffer_flush(struct i915_winsys_batchbuffer *ibatch,
>> #endif
>>
>> if (fence) {
>> - ibatch->iws->fence_reference(ibatch->iws, fence, NULL);
>> + ibatch->iws->semaphore_reference(ibatch->iws, fence, NULL);
>>
>> #ifdef INTEL_RUN_SYNC
>> /* we run synced to GPU so just pass null */
>> diff --git a/src/gallium/winsys/i915/drm/i915_drm_fence.c b/src/gallium/winsys/i915/drm/i915_drm_fence.c
>> index 650ccfc..3c94acf 100644
>> --- a/src/gallium/winsys/i915/drm/i915_drm_fence.c
>> +++ b/src/gallium/winsys/i915/drm/i915_drm_fence.c
>> @@ -17,7 +17,7 @@ struct i915_drm_fence
>> };
>>
>>
>> -struct pipe_fence_handle *
>> +struct pipe_semaphore_handle *
>> i915_drm_fence_create(drm_intel_bo *bo)
>> {
>> struct i915_drm_fence *fence = CALLOC_STRUCT(i915_drm_fence);
>> @@ -29,13 +29,13 @@ i915_drm_fence_create(drm_intel_bo *bo)
>> fence->bo = bo;
>> }
>>
>> - return (struct pipe_fence_handle *)fence;
>> + return (struct pipe_semaphore_handle *)fence;
>> }
>>
>> static void
>> -i915_drm_fence_reference(struct i915_winsys *iws,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *fence)
>> +i915_drm_semaphore_reference(struct i915_winsys *iws,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct i915_drm_fence *old = (struct i915_drm_fence *)*ptr;
>> struct i915_drm_fence *f = (struct i915_drm_fence *)fence;
>> @@ -50,7 +50,7 @@ i915_drm_fence_reference(struct i915_winsys *iws,
>>
>> static int
>> i915_drm_fence_signalled(struct i915_winsys *iws,
>> - struct pipe_fence_handle *fence)
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct i915_drm_fence *f = (struct i915_drm_fence *)fence;
>>
>> @@ -62,8 +62,8 @@ i915_drm_fence_signalled(struct i915_winsys *iws,
>> }
>>
>> static int
>> -i915_drm_fence_finish(struct i915_winsys *iws,
>> - struct pipe_fence_handle *fence)
>> +i915_drm_semaphore_finish(struct i915_winsys *iws,
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct i915_drm_fence *f = (struct i915_drm_fence *)fence;
>>
>> @@ -81,7 +81,7 @@ i915_drm_fence_finish(struct i915_winsys *iws,
>> void
>> i915_drm_winsys_init_fence_functions(struct i915_drm_winsys *idws)
>> {
>> - idws->base.fence_reference = i915_drm_fence_reference;
>> + idws->base.semaphore_reference = i915_drm_semaphore_reference;
>> idws->base.fence_signalled = i915_drm_fence_signalled;
>> - idws->base.fence_finish = i915_drm_fence_finish;
>> + idws->base.semaphore_finish = i915_drm_semaphore_finish;
>> }
>> diff --git a/src/gallium/winsys/i915/drm/i915_drm_winsys.h b/src/gallium/winsys/i915/drm/i915_drm_winsys.h
>> index 56b9e15..b7f3a74 100644
>> --- a/src/gallium/winsys/i915/drm/i915_drm_winsys.h
>> +++ b/src/gallium/winsys/i915/drm/i915_drm_winsys.h
>> @@ -34,7 +34,7 @@ i915_drm_winsys(struct i915_winsys *iws)
>> return (struct i915_drm_winsys *)iws;
>> }
>>
>> -struct pipe_fence_handle * i915_drm_fence_create(drm_intel_bo *bo);
>> +struct pipe_semaphore_handle * i915_drm_fence_create(drm_intel_bo *bo);
>>
>> void i915_drm_winsys_init_batchbuffer_functions(struct i915_drm_winsys *idws);
>> void i915_drm_winsys_init_buffer_functions(struct i915_drm_winsys *idws);
>> diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
>> index 92452e4..40b8fcf 100644
>> --- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
>> +++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
>> @@ -66,10 +66,10 @@
>>
>> #define RELOC_DWORDS (sizeof(struct drm_radeon_cs_reloc) / sizeof(uint32_t))
>>
>> -static struct pipe_fence_handle *
>> +static struct pipe_semaphore_handle *
>> radeon_cs_create_fence(struct radeon_winsys_cs *rcs);
>> -static void radeon_fence_reference(struct pipe_fence_handle **dst,
>> - struct pipe_fence_handle *src);
>> +static void radeon_semaphore_reference(struct pipe_semaphore_handle **dst,
>> + struct pipe_semaphore_handle *src);
>>
>> static struct radeon_winsys_ctx *radeon_drm_ctx_create(struct radeon_winsys *ws)
>> {
>> @@ -149,7 +149,7 @@ static struct radeon_winsys_cs *
>> radeon_drm_cs_create(struct radeon_winsys_ctx *ctx,
>> enum ring_type ring_type,
>> void (*flush)(void *ctx, unsigned flags,
>> - struct pipe_fence_handle **fence),
>> + struct pipe_semaphore_handle **fence),
>> void *flush_ctx)
>> {
>> struct radeon_drm_winsys *ws = (struct radeon_drm_winsys*)ctx;
>> @@ -542,7 +542,7 @@ DEBUG_GET_ONCE_BOOL_OPTION(noop, "RADEON_NOOP", false)
>>
>> static int radeon_drm_cs_flush(struct radeon_winsys_cs *rcs,
>> unsigned flags,
>> - struct pipe_fence_handle **pfence)
>> + struct pipe_semaphore_handle **pfence)
>> {
>> struct radeon_drm_cs *cs = radeon_drm_cs(rcs);
>> struct radeon_cs_context *tmp;
>> @@ -583,7 +583,7 @@ static int radeon_drm_cs_flush(struct radeon_winsys_cs *rcs,
>> }
>>
>> if (pfence || cs->csc->num_slab_buffers) {
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>>
>> if (cs->next_fence) {
>> fence = cs->next_fence;
>> @@ -594,7 +594,7 @@ static int radeon_drm_cs_flush(struct radeon_winsys_cs *rcs,
>>
>> if (fence) {
>> if (pfence)
>> - radeon_fence_reference(pfence, fence);
>> + radeon_semaphore_reference(pfence, fence);
>>
>> mtx_lock(&cs->ws->bo_fence_lock);
>> for (unsigned i = 0; i < cs->csc->num_slab_buffers; ++i) {
>> @@ -604,10 +604,10 @@ static int radeon_drm_cs_flush(struct radeon_winsys_cs *rcs,
>> }
>> mtx_unlock(&cs->ws->bo_fence_lock);
>>
>> - radeon_fence_reference(&fence, NULL);
>> + radeon_semaphore_reference(&fence, NULL);
>> }
>> } else {
>> - radeon_fence_reference(&cs->next_fence, NULL);
>> + radeon_semaphore_reference(&cs->next_fence, NULL);
>> }
>>
>> radeon_drm_cs_sync_flush(rcs);
>> @@ -710,7 +710,7 @@ static void radeon_drm_cs_destroy(struct radeon_winsys_cs *rcs)
>> p_atomic_dec(&cs->ws->num_cs);
>> radeon_destroy_cs_context(&cs->csc1);
>> radeon_destroy_cs_context(&cs->csc2);
>> - radeon_fence_reference(&cs->next_fence, NULL);
>> + radeon_semaphore_reference(&cs->next_fence, NULL);
>> FREE(cs);
>> }
>>
>> @@ -742,7 +742,7 @@ static bool radeon_bo_is_referenced(struct radeon_winsys_cs *rcs,
>>
>> /* FENCES */
>>
>> -static struct pipe_fence_handle *
>> +static struct pipe_semaphore_handle *
>> radeon_cs_create_fence(struct radeon_winsys_cs *rcs)
>> {
>> struct radeon_drm_cs *cs = radeon_drm_cs(rcs);
>> @@ -758,31 +758,31 @@ radeon_cs_create_fence(struct radeon_winsys_cs *rcs)
>> cs->ws->base.cs_add_buffer(rcs, fence,
>> RADEON_USAGE_READWRITE, RADEON_DOMAIN_GTT,
>> RADEON_PRIO_FENCE);
>> - return (struct pipe_fence_handle*)fence;
>> + return (struct pipe_semaphore_handle*)fence;
>> }
>>
>> static bool radeon_fence_wait(struct radeon_winsys *ws,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout)
>> {
>> return ws->buffer_wait((struct pb_buffer*)fence, timeout,
>> RADEON_USAGE_READWRITE);
>> }
>>
>> -static void radeon_fence_reference(struct pipe_fence_handle **dst,
>> - struct pipe_fence_handle *src)
>> +static void radeon_semaphore_reference(struct pipe_semaphore_handle **dst,
>> + struct pipe_semaphore_handle *src)
>> {
>> pb_reference((struct pb_buffer**)dst, (struct pb_buffer*)src);
>> }
>>
>> -static struct pipe_fence_handle *
>> +static struct pipe_semaphore_handle *
>> radeon_drm_cs_get_next_fence(struct radeon_winsys_cs *rcs)
>> {
>> struct radeon_drm_cs *cs = radeon_drm_cs(rcs);
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>>
>> if (cs->next_fence) {
>> - radeon_fence_reference(&fence, cs->next_fence);
>> + radeon_semaphore_reference(&fence, cs->next_fence);
>> return fence;
>> }
>>
>> @@ -790,13 +790,13 @@ radeon_drm_cs_get_next_fence(struct radeon_winsys_cs *rcs)
>> if (!fence)
>> return NULL;
>>
>> - radeon_fence_reference(&cs->next_fence, fence);
>> + radeon_semaphore_reference(&cs->next_fence, fence);
>> return fence;
>> }
>>
>> static void
>> radeon_drm_cs_add_fence_dependency(struct radeon_winsys_cs *cs,
>> - struct pipe_fence_handle *fence)
>> + struct pipe_semaphore_handle *fence)
>> {
>> /* TODO: Handle the following unlikely multi-threaded scenario:
>> *
>> @@ -829,5 +829,5 @@ void radeon_drm_cs_init_functions(struct radeon_drm_winsys *ws)
>> ws->base.cs_sync_flush = radeon_drm_cs_sync_flush;
>> ws->base.cs_add_fence_dependency = radeon_drm_cs_add_fence_dependency;
>> ws->base.fence_wait = radeon_fence_wait;
>> - ws->base.fence_reference = radeon_fence_reference;
>> + ws->base.semaphore_reference = radeon_semaphore_reference;
>> }
>> diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.h b/src/gallium/winsys/radeon/drm/radeon_drm_cs.h
>> index f9b26af..3cf55c9 100644
>> --- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.h
>> +++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.h
>> @@ -82,11 +82,11 @@ struct radeon_drm_cs {
>> struct radeon_drm_winsys *ws;
>>
>> /* Flush CS. */
>> - void (*flush_cs)(void *ctx, unsigned flags, struct pipe_fence_handle **fence);
>> + void (*flush_cs)(void *ctx, unsigned flags, struct pipe_semaphore_handle **fence);
>> void *flush_data;
>>
>> struct util_queue_fence flush_completed;
>> - struct pipe_fence_handle *next_fence;
>> + struct pipe_semaphore_handle *next_fence;
>> };
>>
>> int radeon_lookup_buffer(struct radeon_cs_context *csc, struct radeon_bo *bo);
>> diff --git a/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c b/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c
>> index f7211c2..67a8740 100644
>> --- a/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c
>> +++ b/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c
>> @@ -124,7 +124,7 @@ struct fenced_buffer
>> struct pb_validate *vl;
>> unsigned validation_flags;
>>
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>> };
>>
>>
>> @@ -262,7 +262,7 @@ fenced_buffer_remove_locked(struct fenced_manager *fenced_mgr,
>> assert(fenced_buf->fence);
>> assert(fenced_buf->mgr == fenced_mgr);
>>
>> - ops->fence_reference(ops, &fenced_buf->fence, NULL);
>> + ops->semaphore_reference(ops, &fenced_buf->fence, NULL);
>> fenced_buf->flags &= ~PB_USAGE_GPU_READ_WRITE;
>>
>> assert(fenced_buf->head.prev);
>> @@ -305,15 +305,15 @@ fenced_buffer_finish_locked(struct fenced_manager *fenced_mgr,
>> assert(fenced_buf->fence);
>>
>> if(fenced_buf->fence) {
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>> int finished;
>> boolean proceed;
>>
>> - ops->fence_reference(ops, &fence, fenced_buf->fence);
>> + ops->semaphore_reference(ops, &fence, fenced_buf->fence);
>>
>> mtx_unlock(&fenced_mgr->mutex);
>>
>> - finished = ops->fence_finish(ops, fenced_buf->fence, 0);
>> + finished = ops->semaphore_finish(ops, fenced_buf->fence, 0);
>>
>> mtx_lock(&fenced_mgr->mutex);
>>
>> @@ -326,7 +326,7 @@ fenced_buffer_finish_locked(struct fenced_manager *fenced_mgr,
>> */
>> proceed = fence == fenced_buf->fence ? TRUE : FALSE;
>>
>> - ops->fence_reference(ops, &fence, NULL);
>> + ops->semaphore_reference(ops, &fence, NULL);
>>
>> if(proceed && finished == 0) {
>> /*
>> @@ -364,7 +364,7 @@ fenced_manager_check_signalled_locked(struct fenced_manager *fenced_mgr,
>> struct pb_fence_ops *ops = fenced_mgr->ops;
>> struct list_head *curr, *next;
>> struct fenced_buffer *fenced_buf;
>> - struct pipe_fence_handle *prev_fence = NULL;
>> + struct pipe_semaphore_handle *prev_fence = NULL;
>> boolean ret = FALSE;
>>
>> curr = fenced_mgr->fenced.next;
>> @@ -376,7 +376,7 @@ fenced_manager_check_signalled_locked(struct fenced_manager *fenced_mgr,
>> int signaled;
>>
>> if (wait) {
>> - signaled = ops->fence_finish(ops, fenced_buf->fence, 0);
>> + signaled = ops->semaphore_finish(ops, fenced_buf->fence, 0);
>>
>> /*
>> * Don't return just now. Instead preemptively check if the
>> @@ -643,7 +643,7 @@ done:
>>
>> static void
>> fenced_buffer_fence(struct pb_buffer *buf,
>> - struct pipe_fence_handle *fence)
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct fenced_buffer *fenced_buf = fenced_buffer(buf);
>> struct fenced_manager *fenced_mgr = fenced_buf->mgr;
>> @@ -665,7 +665,7 @@ fenced_buffer_fence(struct pb_buffer *buf,
>> (void) destroyed;
>> }
>> if (fence) {
>> - ops->fence_reference(ops, &fenced_buf->fence, fence);
>> + ops->semaphore_reference(ops, &fenced_buf->fence, fence);
>> fenced_buf->flags |= fenced_buf->validation_flags;
>> fenced_buffer_add_locked(fenced_mgr, fenced_buf);
>> }
>> diff --git a/src/gallium/winsys/svga/drm/vmw_buffer.c b/src/gallium/winsys/svga/drm/vmw_buffer.c
>> index 3ac80c7..d1b893d 100644
>> --- a/src/gallium/winsys/svga/drm/vmw_buffer.c
>> +++ b/src/gallium/winsys/svga/drm/vmw_buffer.c
>> @@ -173,7 +173,7 @@ vmw_gmr_buffer_validate( struct pb_buffer *_buf,
>>
>> static void
>> vmw_gmr_buffer_fence( struct pb_buffer *_buf,
>> - struct pipe_fence_handle *fence )
>> + struct pipe_semaphore_handle *fence )
>> {
>> /* We don't need to do anything, as the pipebuffer library
>> * will take care of delaying the destruction of fenced buffers */
>> diff --git a/src/gallium/winsys/svga/drm/vmw_context.c b/src/gallium/winsys/svga/drm/vmw_context.c
>> index c0ee833..f12d89e 100644
>> --- a/src/gallium/winsys/svga/drm/vmw_context.c
>> +++ b/src/gallium/winsys/svga/drm/vmw_context.c
>> @@ -176,11 +176,11 @@ vmw_translate_to_pb_flags(unsigned flags)
>>
>> static enum pipe_error
>> vmw_swc_flush(struct svga_winsys_context *swc,
>> - struct pipe_fence_handle **pfence)
>> + struct pipe_semaphore_handle **pfence)
>> {
>> struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc);
>> struct vmw_winsys_screen *vws = vswc->vws;
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>> unsigned i;
>> enum pipe_error ret;
>>
>> @@ -294,9 +294,9 @@ vmw_swc_flush(struct svga_winsys_context *swc,
>> }
>>
>> if(pfence)
>> - vmw_fence_reference(vswc->vws, pfence, fence);
>> + vmw_semaphore_reference(vswc->vws, pfence, fence);
>>
>> - vmw_fence_reference(vswc->vws, &fence, NULL);
>> + vmw_semaphore_reference(vswc->vws, &fence, NULL);
>>
>> return ret;
>> }
>> diff --git a/src/gallium/winsys/svga/drm/vmw_fence.c b/src/gallium/winsys/svga/drm/vmw_fence.c
>> index 061f588..97818ac 100644
>> --- a/src/gallium/winsys/svga/drm/vmw_fence.c
>> +++ b/src/gallium/winsys/svga/drm/vmw_fence.c
>> @@ -162,12 +162,12 @@ out_unlock:
>>
>> /**
>> * vmw_fence - return the vmw_fence object identified by a
>> - * struct pipe_fence_handle *
>> + * struct pipe_semaphore_handle *
>> *
>> * @fence: The opaque pipe fence handle.
>> */
>> static inline struct vmw_fence *
>> -vmw_fence(struct pipe_fence_handle *fence)
>> +vmw_fence(struct pipe_semaphore_handle *fence)
>> {
>> return (struct vmw_fence *) fence;
>> }
>> @@ -183,7 +183,7 @@ vmw_fence(struct pipe_fence_handle *fence)
>> *
>> * Returns NULL on failure.
>> */
>> -struct pipe_fence_handle *
>> +struct pipe_semaphore_handle *
>> vmw_fence_create(struct pb_fence_ops *fence_ops, uint32_t handle,
>> uint32_t seqno, uint32_t mask, int32_t fd)
>> {
>> @@ -206,7 +206,7 @@ vmw_fence_create(struct pb_fence_ops *fence_ops, uint32_t handle,
>> */
>> if (!fence_ops) {
>> fence->imported = true;
>> - return (struct pipe_fence_handle *) fence;
>> + return (struct pipe_semaphore_handle *) fence;
>> }
>>
>> ops = vmw_fence_ops(fence_ops);
>> @@ -223,7 +223,7 @@ vmw_fence_create(struct pb_fence_ops *fence_ops, uint32_t handle,
>>
>> mtx_unlock(&ops->mutex);
>>
>> - return (struct pipe_fence_handle *) fence;
>> + return (struct pipe_semaphore_handle *) fence;
>> }
>>
>>
>> @@ -243,16 +243,16 @@ void vmw_fence_destroy(struct vmw_fence *vfence)
>>
>>
>> /**
>> - * vmw_fence_reference - Reference / unreference a vmw fence object.
>> + * vmw_semaphore_reference - Reference / unreference a vmw fence object.
>> *
>> * @vws: Pointer to the winsys screen.
>> * @ptr: Pointer to reference transfer destination.
>> * @fence: Pointer to object to reference. May be NULL.
>> */
>> void
>> -vmw_fence_reference(struct vmw_winsys_screen *vws,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *fence)
>> +vmw_semaphore_reference(struct vmw_winsys_screen *vws,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *fence)
>> {
>> if (*ptr) {
>> struct vmw_fence *vfence = vmw_fence(*ptr);
>> @@ -294,7 +294,7 @@ vmw_fence_reference(struct vmw_winsys_screen *vws,
>> */
>> int
>> vmw_fence_signalled(struct vmw_winsys_screen *vws,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> unsigned flag)
>> {
>> struct vmw_fence *vfence;
>> @@ -331,7 +331,7 @@ vmw_fence_signalled(struct vmw_winsys_screen *vws,
>> }
>>
>> /**
>> - * vmw_fence_finish - Wait for a fence object to signal.
>> + * vmw_semaphore_finish - Wait for a fence object to signal.
>> *
>> * @vws: Pointer to the winsys screen.
>> * @fence: Handle to the fence object.
>> @@ -342,8 +342,8 @@ vmw_fence_signalled(struct vmw_winsys_screen *vws,
>> * Returns 0 if the wait succeeded. Nonzero otherwise.
>> */
>> int
>> -vmw_fence_finish(struct vmw_winsys_screen *vws,
>> - struct pipe_fence_handle *fence,
>> +vmw_semaphore_finish(struct vmw_winsys_screen *vws,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout,
>> unsigned flag)
>> {
>> @@ -372,7 +372,7 @@ vmw_fence_finish(struct vmw_winsys_screen *vws,
>> if ((old & vflags) == vflags)
>> return 0;
>>
>> - ret = vmw_ioctl_fence_finish(vws, vfence->handle, vflags);
>> + ret = vmw_ioctl_semaphore_finish(vws, vfence->handle, vflags);
>>
>> if (ret == 0) {
>> int32_t prev = old;
>> @@ -387,12 +387,12 @@ vmw_fence_finish(struct vmw_winsys_screen *vws,
>> }
>>
>> /**
>> - * vmw_fence_get_fd
>> + * vmw_semaphore_get_fd
>> *
>> * Returns the file descriptor associated with the fence
>> */
>> int
>> -vmw_fence_get_fd(struct pipe_fence_handle *fence)
>> +vmw_semaphore_get_fd(struct pipe_semaphore_handle *fence)
>> {
>> struct vmw_fence *vfence;
>>
>> @@ -405,18 +405,18 @@ vmw_fence_get_fd(struct pipe_fence_handle *fence)
>>
>>
>> /**
>> - * vmw_fence_ops_fence_reference - wrapper for the pb_fence_ops api.
>> + * vmw_fence_ops_semaphore_reference - wrapper for the pb_fence_ops api.
>> *
>> - * wrapper around vmw_fence_reference.
>> + * wrapper around vmw_semaphore_reference.
>> */
>> static void
>> -vmw_fence_ops_fence_reference(struct pb_fence_ops *ops,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *fence)
>> +vmw_fence_ops_semaphore_reference(struct pb_fence_ops *ops,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *fence)
>> {
>> struct vmw_winsys_screen *vws = vmw_fence_ops(ops)->vws;
>>
>> - vmw_fence_reference(vws, ptr, fence);
>> + vmw_semaphore_reference(vws, ptr, fence);
>> }
>>
>> /**
>> @@ -426,7 +426,7 @@ vmw_fence_ops_fence_reference(struct pb_fence_ops *ops,
>> */
>> static int
>> vmw_fence_ops_fence_signalled(struct pb_fence_ops *ops,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> unsigned flag)
>> {
>> struct vmw_winsys_screen *vws = vmw_fence_ops(ops)->vws;
>> @@ -436,18 +436,18 @@ vmw_fence_ops_fence_signalled(struct pb_fence_ops *ops,
>>
>>
>> /**
>> - * vmw_fence_ops_fence_finish - wrapper for the pb_fence_ops api.
>> + * vmw_fence_ops_semaphore_finish - wrapper for the pb_fence_ops api.
>> *
>> - * wrapper around vmw_fence_finish.
>> + * wrapper around vmw_semaphore_finish.
>> */
>> static int
>> -vmw_fence_ops_fence_finish(struct pb_fence_ops *ops,
>> - struct pipe_fence_handle *fence,
>> +vmw_fence_ops_semaphore_finish(struct pb_fence_ops *ops,
>> + struct pipe_semaphore_handle *fence,
>> unsigned flag)
>> {
>> struct vmw_winsys_screen *vws = vmw_fence_ops(ops)->vws;
>>
>> - return vmw_fence_finish(vws, fence, PIPE_TIMEOUT_INFINITE, flag);
>> + return vmw_semaphore_finish(vws, fence, PIPE_TIMEOUT_INFINITE, flag);
>> }
>>
>>
>> @@ -488,9 +488,9 @@ vmw_fence_ops_create(struct vmw_winsys_screen *vws)
>> (void) mtx_init(&ops->mutex, mtx_plain);
>> LIST_INITHEAD(&ops->not_signaled);
>> ops->base.destroy = &vmw_fence_ops_destroy;
>> - ops->base.fence_reference = &vmw_fence_ops_fence_reference;
>> + ops->base.semaphore_reference = &vmw_fence_ops_semaphore_reference;
>> ops->base.fence_signalled = &vmw_fence_ops_fence_signalled;
>> - ops->base.fence_finish = &vmw_fence_ops_fence_finish;
>> + ops->base.semaphore_finish = &vmw_fence_ops_semaphore_finish;
>>
>> ops->vws = vws;
>>
>> diff --git a/src/gallium/winsys/svga/drm/vmw_fence.h b/src/gallium/winsys/svga/drm/vmw_fence.h
>> index aab558f..87ca4af 100644
>> --- a/src/gallium/winsys/svga/drm/vmw_fence.h
>> +++ b/src/gallium/winsys/svga/drm/vmw_fence.h
>> @@ -31,32 +31,32 @@
>> #include "pipe/p_compiler.h"
>> #include "pipebuffer/pb_buffer_fenced.h"
>>
>> -struct pipe_fence_handle;
>> +struct pipe_semaphore_handle;
>> struct pb_fence_ops;
>> struct vmw_winsys_screen;
>>
>>
>> -struct pipe_fence_handle *
>> +struct pipe_semaphore_handle *
>> vmw_fence_create(struct pb_fence_ops *fence_ops,
>> uint32_t handle, uint32_t seqno, uint32_t mask, int32_t fd);
>>
>> int
>> -vmw_fence_finish(struct vmw_winsys_screen *vws,
>> - struct pipe_fence_handle *fence,
>> +vmw_semaphore_finish(struct vmw_winsys_screen *vws,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout,
>> unsigned flag);
>>
>> int
>> -vmw_fence_get_fd(struct pipe_fence_handle *fence);
>> +vmw_semaphore_get_fd(struct pipe_semaphore_handle *fence);
>>
>> int
>> vmw_fence_signalled(struct vmw_winsys_screen *vws,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> unsigned flag);
>> void
>> -vmw_fence_reference(struct vmw_winsys_screen *vws,
>> - struct pipe_fence_handle **ptr,
>> - struct pipe_fence_handle *fence);
>> +vmw_semaphore_reference(struct vmw_winsys_screen *vws,
>> + struct pipe_semaphore_handle **ptr,
>> + struct pipe_semaphore_handle *fence);
>>
>> struct pb_fence_ops *
>> vmw_fence_ops_create(struct vmw_winsys_screen *vws);
>> diff --git a/src/gallium/winsys/svga/drm/vmw_screen.h b/src/gallium/winsys/svga/drm/vmw_screen.h
>> index f21cabb..b5b0954 100644
>> --- a/src/gallium/winsys/svga/drm/vmw_screen.h
>> +++ b/src/gallium/winsys/svga/drm/vmw_screen.h
>> @@ -166,7 +166,7 @@ vmw_ioctl_command(struct vmw_winsys_screen *vws,
>> uint32_t throttle_us,
>> void *commands,
>> uint32_t size,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> int32_t imported_fence_fd,
>> uint32_t flags);
>>
>> @@ -186,7 +186,7 @@ vmw_ioctl_region_unmap(struct vmw_region *region);
>>
>>
>> int
>> -vmw_ioctl_fence_finish(struct vmw_winsys_screen *vws,
>> +vmw_ioctl_semaphore_finish(struct vmw_winsys_screen *vws,
>> uint32_t handle, uint32_t flags);
>>
>> int
>> diff --git a/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c b/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c
>> index 62a2af6..95c0ad4 100644
>> --- a/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c
>> +++ b/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c
>> @@ -414,7 +414,7 @@ vmw_ioctl_surface_destroy(struct vmw_winsys_screen *vws, uint32 sid)
>> void
>> vmw_ioctl_command(struct vmw_winsys_screen *vws, int32_t cid,
>> uint32_t throttle_us, void *commands, uint32_t size,
>> - struct pipe_fence_handle **pfence, int32_t imported_fence_fd,
>> + struct pipe_semaphore_handle **pfence, int32_t imported_fence_fd,
>> uint32_t flags)
>> {
>> struct drm_vmw_execbuf_arg arg;
>> @@ -503,7 +503,7 @@ vmw_ioctl_command(struct vmw_winsys_screen *vws, int32_t cid,
>> /*
>> * Fence creation failed. Need to sync.
>> */
>> - (void) vmw_ioctl_fence_finish(vws, rep.handle, rep.mask);
>> + (void) vmw_ioctl_semaphore_finish(vws, rep.handle, rep.mask);
>> vmw_ioctl_fence_unref(vws, rep.handle);
>> }
>> }
>> @@ -734,7 +734,7 @@ vmw_ioctl_fence_signalled(struct vmw_winsys_screen *vws,
>>
>>
>> int
>> -vmw_ioctl_fence_finish(struct vmw_winsys_screen *vws,
>> +vmw_ioctl_semaphore_finish(struct vmw_winsys_screen *vws,
>> uint32_t handle,
>> uint32_t flags)
>> {
>> diff --git a/src/gallium/winsys/svga/drm/vmw_screen_svga.c b/src/gallium/winsys/svga/drm/vmw_screen_svga.c
>> index 7c80642..f5f4566 100644
>> --- a/src/gallium/winsys/svga/drm/vmw_screen_svga.c
>> +++ b/src/gallium/winsys/svga/drm/vmw_screen_svga.c
>> @@ -100,19 +100,19 @@ vmw_svga_winsys_buffer_create(struct svga_winsys_screen *sws,
>>
>>
>> static void
>> -vmw_svga_winsys_fence_reference(struct svga_winsys_screen *sws,
>> - struct pipe_fence_handle **pdst,
>> - struct pipe_fence_handle *src)
>> +vmw_svga_winsys_semaphore_reference(struct svga_winsys_screen *sws,
>> + struct pipe_semaphore_handle **pdst,
>> + struct pipe_semaphore_handle *src)
>> {
>> struct vmw_winsys_screen *vws = vmw_winsys_screen(sws);
>>
>> - vmw_fence_reference(vws, pdst, src);
>> + vmw_semaphore_reference(vws, pdst, src);
>> }
>>
>>
>> static int
>> vmw_svga_winsys_fence_signalled(struct svga_winsys_screen *sws,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> unsigned flag)
>> {
>> struct vmw_winsys_screen *vws = vmw_winsys_screen(sws);
>> @@ -122,44 +122,44 @@ vmw_svga_winsys_fence_signalled(struct svga_winsys_screen *sws,
>>
>>
>> static int
>> -vmw_svga_winsys_fence_finish(struct svga_winsys_screen *sws,
>> - struct pipe_fence_handle *fence,
>> +vmw_svga_winsys_semaphore_finish(struct svga_winsys_screen *sws,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout,
>> unsigned flag)
>> {
>> struct vmw_winsys_screen *vws = vmw_winsys_screen(sws);
>>
>> - return vmw_fence_finish(vws, fence, timeout, flag);
>> + return vmw_semaphore_finish(vws, fence, timeout, flag);
>> }
>>
>>
>> static int
>> -vmw_svga_winsys_fence_get_fd(struct svga_winsys_screen *sws,
>> - struct pipe_fence_handle *fence,
>> +vmw_svga_winsys_semaphore_get_fd(struct svga_winsys_screen *sws,
>> + struct pipe_semaphore_handle *fence,
>> boolean duplicate)
>> {
>> if (duplicate)
>> - return dup(vmw_fence_get_fd(fence));
>> + return dup(vmw_semaphore_get_fd(fence));
>> else
>> - return vmw_fence_get_fd(fence);
>> + return vmw_semaphore_get_fd(fence);
>> }
>>
>>
>> static void
>> vmw_svga_winsys_fence_create_fd(struct svga_winsys_screen *sws,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> int32_t fd)
>> {
>> *fence = vmw_fence_create(NULL, 0, 0, 0, dup(fd));
>> }
>>
>> static int
>> -vmw_svga_winsys_fence_server_sync(struct svga_winsys_screen *sws,
>> +vmw_svga_winsys_semaphore_server_sync(struct svga_winsys_screen *sws,
>> int32_t *context_fd,
>> - struct pipe_fence_handle *fence)
>> + struct pipe_semaphore_handle *fence)
>> {
>> return sync_accumulate("vmwgfx", context_fd,
>> - sws->fence_get_fd(sws, fence, FALSE));
>> + sws->semaphore_get_fd(sws, fence, FALSE));
>> }
>>
>>
>> @@ -460,14 +460,14 @@ vmw_winsys_screen_init_svga(struct vmw_winsys_screen *vws)
>> vws->base.buffer_map = vmw_svga_winsys_buffer_map;
>> vws->base.buffer_unmap = vmw_svga_winsys_buffer_unmap;
>> vws->base.buffer_destroy = vmw_svga_winsys_buffer_destroy;
>> - vws->base.fence_reference = vmw_svga_winsys_fence_reference;
>> + vws->base.semaphore_reference = vmw_svga_winsys_semaphore_reference;
>> vws->base.fence_signalled = vmw_svga_winsys_fence_signalled;
>> vws->base.shader_create = vmw_svga_winsys_shader_create;
>> vws->base.shader_destroy = vmw_svga_winsys_shader_destroy;
>> - vws->base.fence_finish = vmw_svga_winsys_fence_finish;
>> - vws->base.fence_get_fd = vmw_svga_winsys_fence_get_fd;
>> + vws->base.semaphore_finish = vmw_svga_winsys_semaphore_finish;
>> + vws->base.semaphore_get_fd = vmw_svga_winsys_semaphore_get_fd;
>> vws->base.fence_create_fd = vmw_svga_winsys_fence_create_fd;
>> - vws->base.fence_server_sync = vmw_svga_winsys_fence_server_sync;
>> + vws->base.semaphore_server_sync = vmw_svga_winsys_semaphore_server_sync;
>>
>> vws->base.query_create = vmw_svga_winsys_query_create;
>> vws->base.query_init = vmw_svga_winsys_query_init;
>> diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
>> index 71e652e..f7bab6d 100644
>> --- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
>> +++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
>> @@ -725,7 +725,7 @@ static int handle_compare(void *key1, void *key2)
>> return PTR_TO_UINT(key1) != PTR_TO_UINT(key2);
>> }
>>
>> -static struct pipe_fence_handle *
>> +static struct pipe_semaphore_handle *
>> virgl_cs_create_fence(struct virgl_winsys *vws)
>> {
>> struct virgl_hw_res *res;
>> @@ -736,11 +736,11 @@ virgl_cs_create_fence(struct virgl_winsys *vws)
>> VIRGL_BIND_CUSTOM,
>> 8, 1, 1, 0, 0, 0, 8);
>>
>> - return (struct pipe_fence_handle *)res;
>> + return (struct pipe_semaphore_handle *)res;
>> }
>>
>> static bool virgl_fence_wait(struct virgl_winsys *vws,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout)
>> {
>> struct virgl_drm_winsys *vdws = virgl_drm_winsys(vws);
>> @@ -763,9 +763,9 @@ static bool virgl_fence_wait(struct virgl_winsys *vws,
>> return TRUE;
>> }
>>
>> -static void virgl_fence_reference(struct virgl_winsys *vws,
>> - struct pipe_fence_handle **dst,
>> - struct pipe_fence_handle *src)
>> +static void virgl_semaphore_reference(struct virgl_winsys *vws,
>> + struct pipe_semaphore_handle **dst,
>> + struct pipe_semaphore_handle *src)
>> {
>> struct virgl_drm_winsys *vdws = virgl_drm_winsys(vws);
>> virgl_drm_resource_reference(vdws, (struct virgl_hw_res **)dst,
>> @@ -808,7 +808,7 @@ virgl_drm_winsys_create(int drmFD)
>>
>> qdws->base.cs_create_fence = virgl_cs_create_fence;
>> qdws->base.fence_wait = virgl_fence_wait;
>> - qdws->base.fence_reference = virgl_fence_reference;
>> + qdws->base.semaphore_reference = virgl_semaphore_reference;
>>
>> qdws->base.get_caps = virgl_drm_get_caps;
>> return &qdws->base;
>> diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h
>> index f677215..aefb3c8 100644
>> --- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h
>> +++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h
>> @@ -30,7 +30,7 @@
>>
>> #include "virgl/virgl_winsys.h"
>>
>> -struct pipe_fence_handle;
>> +struct pipe_semaphore_handle;
>> struct util_hash_table;
>>
>> struct virgl_hw_res {
>> @@ -83,7 +83,7 @@ struct virgl_drm_cmd_buf {
>> };
>>
>> static inline struct virgl_hw_res *
>> -virgl_hw_res(struct pipe_fence_handle *f)
>> +virgl_hw_res(struct pipe_semaphore_handle *f)
>> {
>> return (struct virgl_hw_res *)f;
>> }
>> diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
>> index d76be4d..e09520d 100644
>> --- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
>> +++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
>> @@ -522,7 +522,7 @@ static int virgl_vtest_get_caps(struct virgl_winsys *vws,
>> return virgl_vtest_send_get_caps(vtws, caps);
>> }
>>
>> -static struct pipe_fence_handle *
>> +static struct pipe_semaphore_handle *
>> virgl_cs_create_fence(struct virgl_winsys *vws)
>> {
>> struct virgl_hw_res *res;
>> @@ -533,11 +533,11 @@ virgl_cs_create_fence(struct virgl_winsys *vws)
>> PIPE_BIND_CUSTOM,
>> 8, 1, 1, 0, 0, 0, 8);
>>
>> - return (struct pipe_fence_handle *)res;
>> + return (struct pipe_semaphore_handle *)res;
>> }
>>
>> static bool virgl_fence_wait(struct virgl_winsys *vws,
>> - struct pipe_fence_handle *fence,
>> + struct pipe_semaphore_handle *fence,
>> uint64_t timeout)
>> {
>> struct virgl_vtest_winsys *vdws = virgl_vtest_winsys(vws);
>> @@ -560,9 +560,9 @@ static bool virgl_fence_wait(struct virgl_winsys *vws,
>> return TRUE;
>> }
>>
>> -static void virgl_fence_reference(struct virgl_winsys *vws,
>> - struct pipe_fence_handle **dst,
>> - struct pipe_fence_handle *src)
>> +static void virgl_semaphore_reference(struct virgl_winsys *vws,
>> + struct pipe_semaphore_handle **dst,
>> + struct pipe_semaphore_handle *src)
>> {
>> struct virgl_vtest_winsys *vdws = virgl_vtest_winsys(vws);
>> virgl_vtest_resource_reference(vdws, (struct virgl_hw_res **)dst,
>> @@ -658,7 +658,7 @@ virgl_vtest_winsys_wrap(struct sw_winsys *sws)
>>
>> vtws->base.cs_create_fence = virgl_cs_create_fence;
>> vtws->base.fence_wait = virgl_fence_wait;
>> - vtws->base.fence_reference = virgl_fence_reference;
>> + vtws->base.semaphore_reference = virgl_semaphore_reference;
>>
>> vtws->base.flush_frontbuffer = virgl_vtest_flush_frontbuffer;
>>
>> diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h
>> index 031037b..3fc5494 100644
>> --- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h
>> +++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h
>> @@ -33,7 +33,7 @@
>> #include "virgl/virgl_winsys.h"
>> #include "vtest_protocol.h"
>>
>> -struct pipe_fence_handle;
>> +struct pipe_semaphore_handle;
>> struct sw_winsys;
>> struct sw_displaytarget;
>>
>> @@ -87,7 +87,7 @@ struct virgl_vtest_cmd_buf {
>> };
>>
>> static inline struct virgl_hw_res *
>> -virgl_hw_res(struct pipe_fence_handle *f)
>> +virgl_hw_res(struct pipe_semaphore_handle *f)
>> {
>> return (struct virgl_hw_res *)f;
>> }
>> diff --git a/src/mesa/drivers/dri/i915/intel_syncobj.c b/src/mesa/drivers/dri/i915/intel_syncobj.c
>> index 4839164..224d6b2 100644
>> --- a/src/mesa/drivers/dri/i915/intel_syncobj.c
>> +++ b/src/mesa/drivers/dri/i915/intel_syncobj.c
>> @@ -59,7 +59,7 @@ struct intel_gl_sync_object {
>> };
>>
>> static void
>> -intel_fence_finish(struct intel_fence *fence)
>> +intel_semaphore_finish(struct intel_fence *fence)
>> {
>> if (fence->batch_bo)
>> drm_intel_bo_unreference(fence->batch_bo);
>> @@ -176,7 +176,7 @@ intel_gl_delete_sync_object(struct gl_context *ctx, struct gl_sync_object *s)
>> {
>> struct intel_gl_sync_object *sync = (struct intel_gl_sync_object *)s;
>>
>> - intel_fence_finish(&sync->fence);
>> + intel_semaphore_finish(&sync->fence);
>> free(sync);
>> }
>>
>> @@ -253,7 +253,7 @@ intel_dri_destroy_fence(__DRIscreen *screen, void *driver_fence)
>> {
>> struct intel_fence *fence = driver_fence;
>>
>> - intel_fence_finish(fence);
>> + intel_semaphore_finish(fence);
>> free(fence);
>> }
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_sync.c b/src/mesa/drivers/dri/i965/brw_sync.c
>> index 6391648..443a20c 100644
>> --- a/src/mesa/drivers/dri/i965/brw_sync.c
>> +++ b/src/mesa/drivers/dri/i965/brw_sync.c
>> @@ -91,7 +91,7 @@ brw_fence_init(struct brw_context *brw, struct brw_fence *fence,
>> }
>>
>> static void
>> -brw_fence_finish(struct brw_fence *fence)
>> +brw_semaphore_finish(struct brw_fence *fence)
>> {
>> switch (fence->type) {
>> case BRW_FENCE_TYPE_BO_WAIT:
>> @@ -353,7 +353,7 @@ brw_gl_delete_sync(struct gl_context *ctx, struct gl_sync_object *_sync)
>> {
>> struct brw_gl_sync *sync = (struct brw_gl_sync *) _sync;
>>
>> - brw_fence_finish(&sync->fence);
>> + brw_semaphore_finish(&sync->fence);
>> free(sync);
>> }
>>
>> @@ -430,7 +430,7 @@ brw_dri_create_fence(__DRIcontext *ctx)
>> brw_fence_init(brw, fence, BRW_FENCE_TYPE_BO_WAIT);
>>
>> if (!brw_fence_insert_locked(brw, fence)) {
>> - brw_fence_finish(fence);
>> + brw_semaphore_finish(fence);
>> free(fence);
>> return NULL;
>> }
>> @@ -443,7 +443,7 @@ brw_dri_destroy_fence(__DRIscreen *dri_screen, void *_fence)
>> {
>> struct brw_fence *fence = _fence;
>>
>> - brw_fence_finish(fence);
>> + brw_semaphore_finish(fence);
>> free(fence);
>> }
>>
>> @@ -510,7 +510,7 @@ brw_dri_create_fence_fd(__DRIcontext *dri_ctx, int fd)
>> return fence;
>>
>> fail:
>> - brw_fence_finish(fence);
>> + brw_semaphore_finish(fence);
>> free(fence);
>> return NULL;
>> }
>> diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c
>> index 14bfd5a..97f81ab 100644
>> --- a/src/mesa/state_tracker/st_cb_flush.c
>> +++ b/src/mesa/state_tracker/st_cb_flush.c
>> @@ -47,7 +47,7 @@
>>
>>
>> void st_flush(struct st_context *st,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags)
>> {
>> st_flush_bitmap_cache(st);
>> @@ -61,14 +61,14 @@ void st_flush(struct st_context *st,
>> */
>> void st_finish( struct st_context *st )
>> {
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>>
>> st_flush(st, &fence, PIPE_FLUSH_ASYNC | PIPE_FLUSH_HINT_FINISH);
>>
>> if(fence) {
>> - st->pipe->screen->fence_finish(st->pipe->screen, NULL, fence,
>> + st->pipe->screen->semaphore_finish(st->pipe->screen, NULL, fence,
>> PIPE_TIMEOUT_INFINITE);
>> - st->pipe->screen->fence_reference(st->pipe->screen, &fence, NULL);
>> + st->pipe->screen->semaphore_reference(st->pipe->screen, &fence, NULL);
>> }
>>
>> st_manager_flush_swapbuffers();
>> diff --git a/src/mesa/state_tracker/st_cb_flush.h b/src/mesa/state_tracker/st_cb_flush.h
>> index 5be68c9..2a4ecdf 100644
>> --- a/src/mesa/state_tracker/st_cb_flush.h
>> +++ b/src/mesa/state_tracker/st_cb_flush.h
>> @@ -33,7 +33,7 @@
>> #include "pipe/p_compiler.h"
>>
>> struct dd_function_table;
>> -struct pipe_fence_handle;
>> +struct pipe_semaphore_handle;
>> struct st_context;
>>
>> extern void
>> @@ -42,7 +42,7 @@ st_init_flush_functions(struct pipe_screen *screen,
>>
>> extern void
>> st_flush(struct st_context *st,
>> - struct pipe_fence_handle **fence,
>> + struct pipe_semaphore_handle **fence,
>> unsigned flags);
>>
>> extern void
>> diff --git a/src/mesa/state_tracker/st_cb_syncobj.c b/src/mesa/state_tracker/st_cb_syncobj.c
>> index 44323b4..a1933e6 100644
>> --- a/src/mesa/state_tracker/st_cb_syncobj.c
>> +++ b/src/mesa/state_tracker/st_cb_syncobj.c
>> @@ -40,7 +40,7 @@
>> struct st_sync_object {
>> struct gl_sync_object b;
>>
>> - struct pipe_fence_handle *fence;
>> + struct pipe_semaphore_handle *fence;
>> mtx_t mutex; /**< protects "fence" */
>> };
>>
>> @@ -59,7 +59,7 @@ static void st_delete_sync_object(struct gl_context *ctx,
>> struct pipe_screen *screen = st_context(ctx)->pipe->screen;
>> struct st_sync_object *so = (struct st_sync_object*)obj;
>>
>> - screen->fence_reference(screen, &so->fence, NULL);
>> + screen->semaphore_reference(screen, &so->fence, NULL);
>> mtx_destroy(&so->mutex);
>> free(so->b.Label);
>> free(so);
>> @@ -84,7 +84,7 @@ static void st_client_wait_sync(struct gl_context *ctx,
>> struct pipe_context *pipe = st_context(ctx)->pipe;
>> struct pipe_screen *screen = pipe->screen;
>> struct st_sync_object *so = (struct st_sync_object*)obj;
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>>
>> /* If the fence doesn't exist, assume it's signalled. */
>> mtx_lock(&so->mutex);
>> @@ -95,9 +95,9 @@ static void st_client_wait_sync(struct gl_context *ctx,
>> }
>>
>> /* We need a local copy of the fence pointer, so that we can call
>> - * fence_finish unlocked.
>> + * semaphore_finish unlocked.
>> */
>> - screen->fence_reference(screen, &fence, so->fence);
>> + screen->semaphore_reference(screen, &fence, so->fence);
>> mtx_unlock(&so->mutex);
>>
>> /* Section 4.1.2 of OpenGL 4.5 (Compatibility Profile) says:
>> @@ -112,13 +112,13 @@ static void st_client_wait_sync(struct gl_context *ctx,
>> * Assume GL_SYNC_FLUSH_COMMANDS_BIT is always set, because applications
>> * forget to set it.
>> */
>> - if (screen->fence_finish(screen, pipe, fence, timeout)) {
>> + if (screen->semaphore_finish(screen, pipe, fence, timeout)) {
>> mtx_lock(&so->mutex);
>> - screen->fence_reference(screen, &so->fence, NULL);
>> + screen->semaphore_reference(screen, &so->fence, NULL);
>> mtx_unlock(&so->mutex);
>> so->b.StatusFlag = GL_TRUE;
>> }
>> - screen->fence_reference(screen, &fence, NULL);
>> + screen->semaphore_reference(screen, &fence, NULL);
>> }
>>
>> static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)
>> @@ -133,11 +133,11 @@ static void st_server_wait_sync(struct gl_context *ctx,
>> struct pipe_context *pipe = st_context(ctx)->pipe;
>> struct pipe_screen *screen = pipe->screen;
>> struct st_sync_object *so = (struct st_sync_object*)obj;
>> - struct pipe_fence_handle *fence = NULL;
>> + struct pipe_semaphore_handle *fence = NULL;
>>
>> /* Nothing needs to be done here if the driver does not support async
>> * flushes. */
>> - if (!pipe->fence_server_sync)
>> + if (!pipe->semaphore_server_sync)
>> return;
>>
>> /* If the fence doesn't exist, assume it's signalled. */
>> @@ -149,11 +149,11 @@ static void st_server_wait_sync(struct gl_context *ctx,
>> }
>>
>> /* We need a local copy of the fence pointer. */
>> - screen->fence_reference(screen, &fence, so->fence);
>> + screen->semaphore_reference(screen, &fence, so->fence);
>> mtx_unlock(&so->mutex);
>>
>> - pipe->fence_server_sync(pipe, fence);
>> - screen->fence_reference(screen, &fence, NULL);
>> + pipe->semaphore_server_sync(pipe, fence);
>> + screen->semaphore_reference(screen, &fence, NULL);
>> }
>>
>> void st_init_syncobj_functions(struct dd_function_table *functions)
>> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
>> index 9ef0df1..4dfc3bb 100644
>> --- a/src/mesa/state_tracker/st_extensions.c
>> +++ b/src/mesa/state_tracker/st_extensions.c
>> @@ -1020,7 +1020,7 @@ void st_init_extensions(struct pipe_screen *screen,
>> extensions->OES_geometry_shader = GL_TRUE;
>> }
>>
>> - if (screen->fence_finish) {
>> + if (screen->semaphore_finish) {
>> extensions->ARB_sync = GL_TRUE;
>> }
>>
>> diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
>> index 380b05c..f3838b1 100644
>> --- a/src/mesa/state_tracker/st_manager.c
>> +++ b/src/mesa/state_tracker/st_manager.c
>> @@ -636,7 +636,7 @@ st_framebuffers_purge(struct st_context *st)
>>
>> static void
>> st_context_flush(struct st_context_iface *stctxi, unsigned flags,
>> - struct pipe_fence_handle **fence)
>> + struct pipe_semaphore_handle **fence)
>> {
>> struct st_context *st = (struct st_context *) stctxi;
>> unsigned pipe_flags = 0;
>> @@ -644,16 +644,16 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags,
>> if (flags & ST_FLUSH_END_OF_FRAME)
>> pipe_flags |= PIPE_FLUSH_END_OF_FRAME;
>> if (flags & ST_FLUSH_FENCE_FD)
>> - pipe_flags |= PIPE_FLUSH_FENCE_FD;
>> + pipe_flags |= PIPE_FLUSH_SEMAPHORE_FD;
>>
>> FLUSH_VERTICES(st->ctx, 0);
>> FLUSH_CURRENT(st->ctx, 0);
>> st_flush(st, fence, pipe_flags);
>>
>> if ((flags & ST_FLUSH_WAIT) && fence && *fence) {
>> - st->pipe->screen->fence_finish(st->pipe->screen, NULL, *fence,
>> + st->pipe->screen->semaphore_finish(st->pipe->screen, NULL, *fence,
>> PIPE_TIMEOUT_INFINITE);
>> - st->pipe->screen->fence_reference(st->pipe->screen, fence, NULL);
>> + st->pipe->screen->semaphore_reference(st->pipe->screen, fence, NULL);
>> }
>>
>> if (flags & ST_FLUSH_FRONT)
>> --
>> 2.9.3
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
More information about the mesa-dev
mailing list