diff options
author | Thomas Hellstrom <[email protected]> | 2019-04-05 09:09:19 +0200 |
---|---|---|
committer | Thomas Hellstrom <[email protected]> | 2019-06-20 09:30:22 +0200 |
commit | 4f59d51d829098a01a5b0af5525372b401d2c789 (patch) | |
tree | 7677df9dc7d3312659ad077fc96b304bdd0eaa87 /src/gallium/winsys | |
parent | 4412be40ddc8dd0b7cc69c4d77c3c032d87b1a59 (diff) |
winsys/svga: Make it possible to specify coherent resources
Add a flag in the surface cache key and a winsys usage flag to
specify coherent memory.
Signed-off-by: Thomas Hellstrom <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r-- | src/gallium/winsys/svga/drm/vmw_buffer.c | 4 | ||||
-rw-r--r-- | src/gallium/winsys/svga/drm/vmw_screen_ioctl.c | 3 | ||||
-rw-r--r-- | src/gallium/winsys/svga/drm/vmw_surface.c | 18 |
3 files changed, 10 insertions, 15 deletions
diff --git a/src/gallium/winsys/svga/drm/vmw_buffer.c b/src/gallium/winsys/svga/drm/vmw_buffer.c index 91b5b259435..34c5e341782 100644 --- a/src/gallium/winsys/svga/drm/vmw_buffer.c +++ b/src/gallium/winsys/svga/drm/vmw_buffer.c @@ -315,7 +315,7 @@ vmw_svga_winsys_buffer_wrap(struct pb_buffer *buffer) } 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; } @@ -365,7 +365,7 @@ vmw_svga_winsys_buffer_map(struct svga_winsys_screen *sws, 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) diff --git a/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c b/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c index a02d31c2bcb..2e84c811e82 100644 --- a/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c +++ b/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c @@ -246,7 +246,7 @@ vmw_ioctl_gb_surface_create(struct vmw_winsys_screen *vws, 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; @@ -1117,6 +1117,7 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws) 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; diff --git a/src/gallium/winsys/svga/drm/vmw_surface.c b/src/gallium/winsys/svga/drm/vmw_surface.c index 69408ffe9d9..6aa09e11b76 100644 --- a/src/gallium/winsys/svga/drm/vmw_surface.c +++ b/src/gallium/winsys/svga/drm/vmw_surface.c @@ -45,21 +45,14 @@ vmw_svga_winsys_surface_map(struct svga_winsys_context *swc, 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; @@ -89,7 +82,8 @@ vmw_svga_winsys_surface_map(struct svga_winsys_context *swc, 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; @@ -169,10 +163,10 @@ vmw_svga_winsys_surface_unmap(struct svga_winsys_context *swc, 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); } |