usage |= SVGA_SURFACE_USAGE_SHARED;
if (key->scanout)
usage |= SVGA_SURFACE_USAGE_SCANOUT;
+ if (key->coherent)
+ usage |= SVGA_SURFACE_USAGE_COHERENT;
handle = sws->surface_create(sws,
key->flags,
uint32_t cachable:1; /* False if this is a shared surface */
uint32_t sampleCount:5;
uint32_t scanout:1;
+ uint32_t coherent:1;
};
#define SVGA_FENCE_FLAG_EXEC (1 << 0)
#define SVGA_FENCE_FLAG_QUERY (1 << 1)
-#define SVGA_SURFACE_USAGE_SHARED (1 << 0)
-#define SVGA_SURFACE_USAGE_SCANOUT (1 << 1)
+#define SVGA_SURFACE_USAGE_SHARED (1 << 0)
+#define SVGA_SURFACE_USAGE_SCANOUT (1 << 1)
+#define SVGA_SURFACE_USAGE_COHERENT (1 << 2)
#define SVGA_QUERY_FLAG_SET (1 << 0)
#define SVGA_QUERY_FLAG_REF (1 << 1)
/** Can we do DMA with guest-backed objects enabled? */
bool have_gb_dma;
+ /** Do we support coherent surface memory? */
+ bool have_coherent;
/**
* Create and define a GB shader.
*/
}
buf->pb_buf = buffer;
- buf->fbuf = debug_flush_buf_create(TRUE, VMW_DEBUG_FLUSH_STACK);
+ buf->fbuf = debug_flush_buf_create(FALSE, VMW_DEBUG_FLUSH_STACK);
return buf;
}
STATIC_ASSERT((unsigned) PB_USAGE_UNSYNCHRONIZED ==
(unsigned) PIPE_TRANSFER_UNSYNCHRONIZED);
- map = pb_map(vmw_pb_buffer(buf), flags, NULL);
+ map = pb_map(vmw_pb_buffer(buf), flags & PB_USAGE_ALL, NULL);
#ifdef DEBUG
if (map != NULL)
if (usage & SVGA_SURFACE_USAGE_SHARED)
req->base.drm_surface_flags |= drm_vmw_surface_flag_shareable;
- if (vws->force_coherent)
+ if ((usage & SVGA_SURFACE_USAGE_COHERENT) || vws->force_coherent)
req->base.drm_surface_flags |= drm_vmw_surface_flag_coherent;
req->base.drm_surface_flags |= drm_vmw_surface_flag_create_buffer;
vws->ioctl.num_cap_3d = SVGA3D_DEVCAP_MAX;
if (have_drm_2_16) {
+ vws->base.have_coherent = TRUE;
getenv_val = getenv("SVGA_FORCE_COHERENT");
if (getenv_val && strcmp(getenv_val, "0") != 0)
vws->force_coherent = TRUE;
struct pb_buffer *pb_buf;
uint32_t pb_flags;
struct vmw_winsys_screen *vws = vsrf->screen;
-
+
*retry = FALSE;
assert((flags & (PIPE_TRANSFER_READ | PIPE_TRANSFER_WRITE)) != 0);
mtx_lock(&vsrf->mutex);
if (vsrf->mapcount) {
- /*
- * Only allow multiple readers to map.
- */
- if ((flags & PIPE_TRANSFER_WRITE) ||
- (vsrf->map_mode & PIPE_TRANSFER_WRITE))
- goto out_unlock;
-
- data = vsrf->data;
- goto out_mapped;
+ /* Other mappers will get confused if we discard. */
+ flags &= ~PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
}
vsrf->rebind = FALSE;
goto out_unlock;
}
- pb_flags = flags & (PIPE_TRANSFER_READ_WRITE | PIPE_TRANSFER_UNSYNCHRONIZED);
+ pb_flags = flags & (PIPE_TRANSFER_READ_WRITE | PIPE_TRANSFER_UNSYNCHRONIZED |
+ PIPE_TRANSFER_PERSISTENT);
if (flags & PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE) {
struct pb_manager *provider;
if (--vsrf->mapcount == 0) {
*rebind = vsrf->rebind;
vsrf->rebind = FALSE;
- vmw_svga_winsys_buffer_unmap(&vsrf->screen->base, vsrf->buf);
} else {
*rebind = FALSE;
}
+ vmw_svga_winsys_buffer_unmap(&vsrf->screen->base, vsrf->buf);
mtx_unlock(&vsrf->mutex);
}