summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/winsys/svga
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2017-08-14 09:45:54 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2017-08-14 09:45:54 +0000
commit4c58069f5013f0a621503525f7d5193bfe9976b3 (patch)
treebd8f8a08b889e9a8b99c9de01ae12459d527ea6d /lib/mesa/src/gallium/winsys/svga
parent5caa025e6b62d0456faad86c89f239a14d1eaadb (diff)
Import Mesa 17.1.6
Diffstat (limited to 'lib/mesa/src/gallium/winsys/svga')
-rw-r--r--lib/mesa/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c52
-rw-r--r--lib/mesa/src/gallium/winsys/svga/drm/vmw_context.c41
-rw-r--r--lib/mesa/src/gallium/winsys/svga/drm/vmw_fence.c20
-rw-r--r--lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.c5
-rw-r--r--lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.h5
-rw-r--r--lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_dri.c32
-rw-r--r--lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_svga.c15
-rw-r--r--lib/mesa/src/gallium/winsys/svga/drm/vmw_surface.c23
-rw-r--r--lib/mesa/src/gallium/winsys/svga/drm/vmw_surface.h5
9 files changed, 103 insertions, 95 deletions
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c b/lib/mesa/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c
index d049d1dbc..f7211c29a 100644
--- a/lib/mesa/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c
+++ b/lib/mesa/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c
@@ -70,7 +70,7 @@ struct fenced_manager
/**
* Following members are mutable and protected by this mutex.
*/
- pipe_mutex mutex;
+ mtx_t mutex;
/**
* Fenced buffer list.
@@ -311,11 +311,11 @@ fenced_buffer_finish_locked(struct fenced_manager *fenced_mgr,
ops->fence_reference(ops, &fence, fenced_buf->fence);
- pipe_mutex_unlock(fenced_mgr->mutex);
+ mtx_unlock(&fenced_mgr->mutex);
finished = ops->fence_finish(ops, fenced_buf->fence, 0);
- pipe_mutex_lock(fenced_mgr->mutex);
+ mtx_lock(&fenced_mgr->mutex);
assert(pipe_is_referenced(&fenced_buf->base.reference));
@@ -508,11 +508,11 @@ fenced_buffer_destroy(struct pb_buffer *buf)
assert(!pipe_is_referenced(&fenced_buf->base.reference));
- pipe_mutex_lock(fenced_mgr->mutex);
+ mtx_lock(&fenced_mgr->mutex);
fenced_buffer_destroy_locked(fenced_mgr, fenced_buf);
- pipe_mutex_unlock(fenced_mgr->mutex);
+ mtx_unlock(&fenced_mgr->mutex);
}
@@ -525,7 +525,7 @@ fenced_buffer_map(struct pb_buffer *buf,
struct pb_fence_ops *ops = fenced_mgr->ops;
void *map = NULL;
- pipe_mutex_lock(fenced_mgr->mutex);
+ mtx_lock(&fenced_mgr->mutex);
assert(!(flags & PB_USAGE_GPU_READ_WRITE));
@@ -564,7 +564,7 @@ fenced_buffer_map(struct pb_buffer *buf,
}
done:
- pipe_mutex_unlock(fenced_mgr->mutex);
+ mtx_unlock(&fenced_mgr->mutex);
return map;
}
@@ -576,7 +576,7 @@ fenced_buffer_unmap(struct pb_buffer *buf)
struct fenced_buffer *fenced_buf = fenced_buffer(buf);
struct fenced_manager *fenced_mgr = fenced_buf->mgr;
- pipe_mutex_lock(fenced_mgr->mutex);
+ mtx_lock(&fenced_mgr->mutex);
assert(fenced_buf->mapcount);
if(fenced_buf->mapcount) {
@@ -587,7 +587,7 @@ fenced_buffer_unmap(struct pb_buffer *buf)
fenced_buf->flags &= ~PB_USAGE_CPU_READ_WRITE;
}
- pipe_mutex_unlock(fenced_mgr->mutex);
+ mtx_unlock(&fenced_mgr->mutex);
}
@@ -600,7 +600,7 @@ fenced_buffer_validate(struct pb_buffer *buf,
struct fenced_manager *fenced_mgr = fenced_buf->mgr;
enum pipe_error ret;
- pipe_mutex_lock(fenced_mgr->mutex);
+ mtx_lock(&fenced_mgr->mutex);
if(!vl) {
/* invalidate */
@@ -635,7 +635,7 @@ fenced_buffer_validate(struct pb_buffer *buf,
fenced_buf->validation_flags |= flags;
done:
- pipe_mutex_unlock(fenced_mgr->mutex);
+ mtx_unlock(&fenced_mgr->mutex);
return ret;
}
@@ -649,7 +649,7 @@ fenced_buffer_fence(struct pb_buffer *buf,
struct fenced_manager *fenced_mgr = fenced_buf->mgr;
struct pb_fence_ops *ops = fenced_mgr->ops;
- pipe_mutex_lock(fenced_mgr->mutex);
+ mtx_lock(&fenced_mgr->mutex);
assert(pipe_is_referenced(&fenced_buf->base.reference));
assert(fenced_buf->buffer);
@@ -676,7 +676,7 @@ fenced_buffer_fence(struct pb_buffer *buf,
fenced_buf->validation_flags = 0;
}
- pipe_mutex_unlock(fenced_mgr->mutex);
+ mtx_unlock(&fenced_mgr->mutex);
}
@@ -688,7 +688,7 @@ fenced_buffer_get_base_buffer(struct pb_buffer *buf,
struct fenced_buffer *fenced_buf = fenced_buffer(buf);
struct fenced_manager *fenced_mgr = fenced_buf->mgr;
- pipe_mutex_lock(fenced_mgr->mutex);
+ mtx_lock(&fenced_mgr->mutex);
assert(fenced_buf->buffer);
@@ -699,7 +699,7 @@ fenced_buffer_get_base_buffer(struct pb_buffer *buf,
*offset = 0;
}
- pipe_mutex_unlock(fenced_mgr->mutex);
+ mtx_unlock(&fenced_mgr->mutex);
}
@@ -739,7 +739,7 @@ fenced_bufmgr_create_buffer(struct pb_manager *mgr,
fenced_buf->base.vtbl = &fenced_buffer_vtbl;
fenced_buf->mgr = fenced_mgr;
- pipe_mutex_lock(fenced_mgr->mutex);
+ mtx_lock(&fenced_mgr->mutex);
/*
* Try to create GPU storage without stalling,
@@ -758,12 +758,12 @@ fenced_bufmgr_create_buffer(struct pb_manager *mgr,
LIST_ADDTAIL(&fenced_buf->head, &fenced_mgr->unfenced);
++fenced_mgr->num_unfenced;
- pipe_mutex_unlock(fenced_mgr->mutex);
+ mtx_unlock(&fenced_mgr->mutex);
return &fenced_buf->base;
no_storage:
- pipe_mutex_unlock(fenced_mgr->mutex);
+ mtx_unlock(&fenced_mgr->mutex);
FREE(fenced_buf);
no_buffer:
return NULL;
@@ -775,10 +775,10 @@ fenced_bufmgr_flush(struct pb_manager *mgr)
{
struct fenced_manager *fenced_mgr = fenced_manager(mgr);
- pipe_mutex_lock(fenced_mgr->mutex);
+ mtx_lock(&fenced_mgr->mutex);
while(fenced_manager_check_signalled_locked(fenced_mgr, TRUE))
;
- pipe_mutex_unlock(fenced_mgr->mutex);
+ mtx_unlock(&fenced_mgr->mutex);
assert(fenced_mgr->provider->flush);
if(fenced_mgr->provider->flush)
@@ -791,15 +791,15 @@ fenced_bufmgr_destroy(struct pb_manager *mgr)
{
struct fenced_manager *fenced_mgr = fenced_manager(mgr);
- pipe_mutex_lock(fenced_mgr->mutex);
+ mtx_lock(&fenced_mgr->mutex);
/* Wait on outstanding fences */
while (fenced_mgr->num_fenced) {
- pipe_mutex_unlock(fenced_mgr->mutex);
+ mtx_unlock(&fenced_mgr->mutex);
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
sched_yield();
#endif
- pipe_mutex_lock(fenced_mgr->mutex);
+ mtx_lock(&fenced_mgr->mutex);
while(fenced_manager_check_signalled_locked(fenced_mgr, TRUE))
;
}
@@ -808,8 +808,8 @@ fenced_bufmgr_destroy(struct pb_manager *mgr)
/*assert(!fenced_mgr->num_unfenced);*/
#endif
- pipe_mutex_unlock(fenced_mgr->mutex);
- pipe_mutex_destroy(fenced_mgr->mutex);
+ mtx_unlock(&fenced_mgr->mutex);
+ mtx_destroy(&fenced_mgr->mutex);
FREE(fenced_mgr);
}
@@ -841,7 +841,7 @@ simple_fenced_bufmgr_create(struct pb_manager *provider,
LIST_INITHEAD(&fenced_mgr->unfenced);
fenced_mgr->num_unfenced = 0;
- pipe_mutex_init(fenced_mgr->mutex);
+ (void) mtx_init(&fenced_mgr->mutex, mtx_plain);
return &fenced_mgr->base;
}
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_context.c b/lib/mesa/src/gallium/winsys/svga/drm/vmw_context.c
index 8d23bff5d..c306d988e 100644
--- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_context.c
+++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_context.c
@@ -179,11 +179,36 @@ vmw_swc_flush(struct svga_winsys_context *swc,
struct pipe_fence_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;
unsigned i;
enum pipe_error ret;
+ /*
+ * If we hit a retry, lock the mutex and retry immediately.
+ * If we then still hit a retry, sleep until another thread
+ * wakes us up after it has released its buffers from the
+ * validate list.
+ *
+ * If we hit another error condition, we still need to broadcast since
+ * pb_validate_validate releases validated buffers in its error path.
+ */
+
ret = pb_validate_validate(vswc->validate);
+ if (ret != PIPE_OK) {
+ mtx_lock(&vws->cs_mutex);
+ while (ret == PIPE_ERROR_RETRY) {
+ ret = pb_validate_validate(vswc->validate);
+ if (ret == PIPE_ERROR_RETRY) {
+ cnd_wait(&vws->cs_cond, &vws->cs_mutex);
+ }
+ }
+ if (ret != PIPE_OK) {
+ cnd_broadcast(&vws->cs_cond);
+ }
+ mtx_unlock(&vws->cs_mutex);
+ }
+
assert(ret == PIPE_OK);
if(ret == PIPE_OK) {
@@ -210,7 +235,7 @@ vmw_swc_flush(struct svga_winsys_context *swc,
}
if (vswc->command.used || pfence != NULL)
- vmw_ioctl_command(vswc->vws,
+ vmw_ioctl_command(vws,
vswc->base.cid,
0,
vswc->command.buffer,
@@ -218,6 +243,9 @@ vmw_swc_flush(struct svga_winsys_context *swc,
&fence);
pb_validate_fence(vswc->validate, fence);
+ mtx_lock(&vws->cs_mutex);
+ cnd_broadcast(&vws->cs_cond);
+ mtx_unlock(&vws->cs_mutex);
}
vswc->command.used = 0;
@@ -528,12 +556,12 @@ vmw_swc_surface_relocation(struct svga_winsys_context *swc,
* Make sure backup buffer ends up fenced.
*/
- pipe_mutex_lock(vsurf->mutex);
+ mtx_lock(&vsurf->mutex);
assert(vsurf->buf != NULL);
vmw_swc_mob_relocation(swc, mobid, NULL, (struct svga_winsys_buffer *)
vsurf->buf, 0, flags);
- pipe_mutex_unlock(vsurf->mutex);
+ mtx_unlock(&vsurf->mutex);
}
}
@@ -780,11 +808,12 @@ vmw_svga_winsys_context_create(struct svga_winsys_screen *sws)
vswc->base.flush = vmw_swc_flush;
vswc->base.surface_map = vmw_svga_winsys_surface_map;
vswc->base.surface_unmap = vmw_svga_winsys_surface_unmap;
+ vswc->base.surface_invalidate = vmw_svga_winsys_surface_invalidate;
- vswc->base.shader_create = vmw_svga_winsys_vgpu10_shader_create;
- vswc->base.shader_destroy = vmw_svga_winsys_vgpu10_shader_destroy;
+ vswc->base.shader_create = vmw_svga_winsys_vgpu10_shader_create;
+ vswc->base.shader_destroy = vmw_svga_winsys_vgpu10_shader_destroy;
- vswc->base.resource_rebind = vmw_svga_winsys_resource_rebind;
+ vswc->base.resource_rebind = vmw_svga_winsys_resource_rebind;
if (sws->have_vgpu10)
vswc->base.cid = vmw_ioctl_extended_context_create(vws, sws->have_vgpu10);
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_fence.c b/lib/mesa/src/gallium/winsys/svga/drm/vmw_fence.c
index bcf473a93..edf205e62 100644
--- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_fence.c
+++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_fence.c
@@ -40,7 +40,7 @@ struct vmw_fence_ops
struct pb_fence_ops base;
struct vmw_winsys_screen *vws;
- pipe_mutex mutex;
+ mtx_t mutex;
/*
* Protected by mutex;
@@ -101,10 +101,10 @@ vmw_fences_release(struct vmw_fence_ops *ops)
{
struct vmw_fence *fence, *n;
- pipe_mutex_lock(ops->mutex);
+ mtx_lock(&ops->mutex);
LIST_FOR_EACH_ENTRY_SAFE(fence, n, &ops->not_signaled, ops_list)
LIST_DELINIT(&fence->ops_list);
- pipe_mutex_unlock(ops->mutex);
+ mtx_unlock(&ops->mutex);
}
/**
@@ -130,7 +130,7 @@ vmw_fences_signal(struct pb_fence_ops *fence_ops,
return;
ops = vmw_fence_ops(fence_ops);
- pipe_mutex_lock(ops->mutex);
+ mtx_lock(&ops->mutex);
if (!has_emitted) {
emitted = ops->last_emitted;
@@ -152,7 +152,7 @@ vmw_fences_signal(struct pb_fence_ops *fence_ops,
ops->last_emitted = emitted;
out_unlock:
- pipe_mutex_unlock(ops->mutex);
+ mtx_unlock(&ops->mutex);
}
@@ -193,7 +193,7 @@ vmw_fence_create(struct pb_fence_ops *fence_ops, uint32_t handle,
fence->mask = mask;
fence->seqno = seqno;
p_atomic_set(&fence->signalled, 0);
- pipe_mutex_lock(ops->mutex);
+ mtx_lock(&ops->mutex);
if (vmw_fence_seq_is_signaled(seqno, ops->last_signaled, seqno)) {
p_atomic_set(&fence->signalled, 1);
@@ -203,7 +203,7 @@ vmw_fence_create(struct pb_fence_ops *fence_ops, uint32_t handle,
LIST_ADDTAIL(&fence->ops_list, &ops->not_signaled);
}
- pipe_mutex_unlock(ops->mutex);
+ mtx_unlock(&ops->mutex);
return (struct pipe_fence_handle *) fence;
}
@@ -229,9 +229,9 @@ vmw_fence_reference(struct vmw_winsys_screen *vws,
vmw_ioctl_fence_unref(vws, vfence->handle);
- pipe_mutex_lock(ops->mutex);
+ mtx_lock(&ops->mutex);
LIST_DELINIT(&vfence->ops_list);
- pipe_mutex_unlock(ops->mutex);
+ mtx_unlock(&ops->mutex);
FREE(vfence);
}
@@ -421,7 +421,7 @@ vmw_fence_ops_create(struct vmw_winsys_screen *vws)
if(!ops)
return NULL;
- pipe_mutex_init(ops->mutex);
+ (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;
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.c b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.c
index d0bfcd728..e122e0c99 100644
--- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.c
+++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.c
@@ -109,6 +109,9 @@ vmw_winsys_create( int fd )
if (util_hash_table_set(dev_hash, &vws->device, vws) != PIPE_OK)
goto out_no_hash_insert;
+ cnd_init(&vws->cs_cond);
+ mtx_init(&vws->cs_mutex, mtx_plain);
+
return vws;
out_no_hash_insert:
out_no_svga:
@@ -133,6 +136,8 @@ vmw_winsys_destroy(struct vmw_winsys_screen *vws)
vws->fence_ops->destroy(vws->fence_ops);
vmw_ioctl_cleanup(vws);
close(vws->ioctl.drm_fd);
+ mtx_destroy(&vws->cs_mutex);
+ cnd_destroy(&vws->cs_cond);
FREE(vws);
}
}
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.h b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.h
index 79d0949e9..0ef8e8415 100644
--- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.h
+++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen.h
@@ -40,7 +40,7 @@
#include "svga_winsys.h"
#include "pipebuffer/pb_buffer_fenced.h"
-
+#include <os/os_thread.h>
#define VMW_GMR_POOL_SIZE (16*1024*1024)
#define VMW_QUERY_POOL_SIZE (8192)
@@ -99,6 +99,9 @@ struct vmw_winsys_screen
*/
dev_t device;
int open_count;
+
+ cnd_t cs_cond;
+ mtx_t cs_mutex;
};
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_dri.c b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_dri.c
index eae678a63..2a0ac7b33 100644
--- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_dri.c
+++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_dri.c
@@ -126,38 +126,6 @@ out_no_vws:
return NULL;
}
-static inline boolean
-vmw_dri1_intersect_src_bbox(struct drm_clip_rect *dst,
- int dst_x,
- int dst_y,
- const struct drm_clip_rect *src,
- const struct drm_clip_rect *bbox)
-{
- int xy1;
- int xy2;
-
- xy1 = ((int)src->x1 > (int)bbox->x1 + dst_x) ? src->x1 :
- (int)bbox->x1 + dst_x;
- xy2 = ((int)src->x2 < (int)bbox->x2 + dst_x) ? src->x2 :
- (int)bbox->x2 + dst_x;
- if (xy1 >= xy2 || xy1 < 0)
- return FALSE;
-
- dst->x1 = xy1;
- dst->x2 = xy2;
-
- xy1 = ((int)src->y1 > (int)bbox->y1 + dst_y) ? src->y1 :
- (int)bbox->y1 + dst_y;
- xy2 = ((int)src->y2 < (int)bbox->y2 + dst_y) ? src->y2 :
- (int)bbox->y2 + dst_y;
- if (xy1 >= xy2 || xy1 < 0)
- return FALSE;
-
- dst->y1 = xy1;
- dst->y2 = xy2;
- return TRUE;
-}
-
/**
* vmw_drm_gb_surface_from_handle - Create a shared surface
*
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_svga.c b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_svga.c
index 3a936e7e6..31cbda9af 100644
--- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_svga.c
+++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_screen_svga.c
@@ -156,7 +156,7 @@ vmw_svga_winsys_surface_create(struct svga_winsys_screen *sws,
pipe_reference_init(&surface->refcnt, 1);
p_atomic_set(&surface->validated, 0);
surface->screen = vws;
- pipe_mutex_init(surface->mutex);
+ (void) mtx_init(&surface->mutex, mtx_plain);
surface->shared = !!(usage & SVGA_SURFACE_USAGE_SHARED);
provider = (surface->shared) ? vws->pools.gmr : vws->pools.mob_fenced;
@@ -280,18 +280,6 @@ vmw_svga_winsys_surface_can_create(struct svga_winsys_screen *sws,
}
-static void
-vmw_svga_winsys_surface_invalidate(struct svga_winsys_screen *sws,
- struct svga_winsys_surface *surf)
-{
- /* this is a noop since surface invalidation is not needed for DMA path.
- * DMA is enabled when guest-backed surface is not enabled or
- * guest-backed dma is enabled. Since guest-backed dma is enabled
- * when guest-backed surface is enabled, that implies DMA is always enabled;
- * hence, surface invalidation is not needed.
- */
-}
-
static boolean
vmw_svga_winsys_surface_is_flushed(struct svga_winsys_screen *sws,
struct svga_winsys_surface *surface)
@@ -434,7 +422,6 @@ vmw_winsys_screen_init_svga(struct vmw_winsys_screen *vws)
vws->base.surface_is_flushed = vmw_svga_winsys_surface_is_flushed;
vws->base.surface_reference = vmw_svga_winsys_surface_ref;
vws->base.surface_can_create = vmw_svga_winsys_surface_can_create;
- vws->base.surface_invalidate = vmw_svga_winsys_surface_invalidate;
vws->base.buffer_create = vmw_svga_winsys_buffer_create;
vws->base.buffer_map = vmw_svga_winsys_buffer_map;
vws->base.buffer_unmap = vmw_svga_winsys_buffer_unmap;
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_surface.c b/lib/mesa/src/gallium/winsys/svga/drm/vmw_surface.c
index a438b1a7c..04aa93278 100644
--- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_surface.c
+++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_surface.c
@@ -48,7 +48,7 @@ vmw_svga_winsys_surface_map(struct svga_winsys_context *swc,
*retry = FALSE;
assert((flags & (PIPE_TRANSFER_READ | PIPE_TRANSFER_WRITE)) != 0);
- pipe_mutex_lock(vsrf->mutex);
+ mtx_lock(&vsrf->mutex);
if (vsrf->mapcount) {
/*
@@ -154,7 +154,7 @@ out_mapped:
vsrf->data = data;
vsrf->map_mode = flags & (PIPE_TRANSFER_READ | PIPE_TRANSFER_WRITE);
out_unlock:
- pipe_mutex_unlock(vsrf->mutex);
+ mtx_unlock(&vsrf->mutex);
return data;
}
@@ -165,7 +165,7 @@ vmw_svga_winsys_surface_unmap(struct svga_winsys_context *swc,
boolean *rebind)
{
struct vmw_svga_winsys_surface *vsrf = vmw_svga_winsys_surface(srf);
- pipe_mutex_lock(vsrf->mutex);
+ mtx_lock(&vsrf->mutex);
if (--vsrf->mapcount == 0) {
*rebind = vsrf->rebind;
vsrf->rebind = FALSE;
@@ -173,7 +173,20 @@ vmw_svga_winsys_surface_unmap(struct svga_winsys_context *swc,
} else {
*rebind = FALSE;
}
- pipe_mutex_unlock(vsrf->mutex);
+ mtx_unlock(&vsrf->mutex);
+}
+
+enum pipe_error
+vmw_svga_winsys_surface_invalidate(struct svga_winsys_context *swc,
+ struct svga_winsys_surface *surf)
+{
+ /* this is a noop since surface invalidation is not needed for DMA path.
+ * DMA is enabled when guest-backed surface is not enabled or
+ * guest-backed dma is enabled. Since guest-backed dma is enabled
+ * when guest-backed surface is enabled, that implies DMA is always enabled;
+ * hence, surface invalidation is not needed.
+ */
+ return PIPE_OK;
}
void
@@ -201,7 +214,7 @@ vmw_svga_winsys_surface_reference(struct vmw_svga_winsys_surface **pdst,
assert(p_atomic_read(&dst->validated) == 0);
dst->sid = SVGA3D_INVALID_ID;
#endif
- pipe_mutex_destroy(dst->mutex);
+ mtx_destroy(&dst->mutex);
FREE(dst);
}
diff --git a/lib/mesa/src/gallium/winsys/svga/drm/vmw_surface.h b/lib/mesa/src/gallium/winsys/svga/drm/vmw_surface.h
index f8b582d2c..0fdc8de1d 100644
--- a/lib/mesa/src/gallium/winsys/svga/drm/vmw_surface.h
+++ b/lib/mesa/src/gallium/winsys/svga/drm/vmw_surface.h
@@ -57,7 +57,7 @@ struct vmw_svga_winsys_surface
unsigned next_present_no;
uint32_t present_fences[VMW_MAX_PRESENTS];
- pipe_mutex mutex;
+ mtx_t mutex;
struct svga_winsys_buffer *buf; /* Current backing guest buffer */
uint32_t mapcount; /* Number of mappers */
uint32_t map_mode; /* PIPE_TRANSFER_[READ|WRITE] */
@@ -94,5 +94,8 @@ void
vmw_svga_winsys_surface_unmap(struct svga_winsys_context *swc,
struct svga_winsys_surface *srf,
boolean *rebind);
+enum pipe_error
+vmw_svga_winsys_surface_invalidate(struct svga_winsys_context *swc,
+ struct svga_winsys_surface *srf);
#endif /* VMW_SURFACE_H_ */