diff options
author | Thomas Hellstrom <[email protected]> | 2019-04-04 10:58:19 +0200 |
---|---|---|
committer | Thomas Hellstrom <[email protected]> | 2019-05-17 08:44:31 +0200 |
commit | 47afc5eed76f12ec38f94f0069c4695c9fe78889 (patch) | |
tree | ba427dc602754176b06038155d21061476fe6776 /src/gallium/winsys | |
parent | 1a66ead1c75246224bf43e82a07b4fdb2891959a (diff) |
svga: Add an environment variable to force coherent surface memory
The vmwgfx driver supports emulated coherent surface memory as of version
2.16. Add en environtment variable to enable this functionality for
texture- and buffer maps: SVGA_FORCE_COHERENT.
This environment variable should be used for testing only.
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_context.c | 1 | ||||
-rw-r--r-- | src/gallium/winsys/svga/drm/vmw_screen.c | 6 | ||||
-rw-r--r-- | src/gallium/winsys/svga/drm/vmw_screen.h | 2 | ||||
-rw-r--r-- | src/gallium/winsys/svga/drm/vmw_screen_ioctl.c | 12 |
4 files changed, 18 insertions, 3 deletions
diff --git a/src/gallium/winsys/svga/drm/vmw_context.c b/src/gallium/winsys/svga/drm/vmw_context.c index d073cd4859f..8b82a9f90d3 100644 --- a/src/gallium/winsys/svga/drm/vmw_context.c +++ b/src/gallium/winsys/svga/drm/vmw_context.c @@ -852,6 +852,7 @@ vmw_svga_winsys_context_create(struct svga_winsys_screen *sws) vswc->fctx = debug_flush_ctx_create(TRUE, VMW_DEBUG_FLUSH_STACK); #endif + vswc->base.force_coherent = vws->force_coherent; return &vswc->base; out_no_hash: diff --git a/src/gallium/winsys/svga/drm/vmw_screen.c b/src/gallium/winsys/svga/drm/vmw_screen.c index 56294fec60e..e3440bfd957 100644 --- a/src/gallium/winsys/svga/drm/vmw_screen.c +++ b/src/gallium/winsys/svga/drm/vmw_screen.c @@ -90,12 +90,12 @@ vmw_winsys_create( int fd ) vws->device = stat_buf.st_rdev; vws->open_count = 1; vws->ioctl.drm_fd = fcntl(fd, F_DUPFD_CLOEXEC, 3); - vws->base.have_gb_dma = TRUE; - vws->base.need_to_rebind_resources = FALSE; - + vws->force_coherent = FALSE; if (!vmw_ioctl_init(vws)) goto out_no_ioctl; + vws->base.have_gb_dma = !vws->force_coherent; + vws->base.need_to_rebind_resources = FALSE; vws->base.have_transfer_from_buffer_cmd = vws->base.have_vgpu10; vws->fence_ops = vmw_fence_ops_create(vws); if (!vws->fence_ops) diff --git a/src/gallium/winsys/svga/drm/vmw_screen.h b/src/gallium/winsys/svga/drm/vmw_screen.h index cb34fec48e7..e0b1bb33bc4 100644 --- a/src/gallium/winsys/svga/drm/vmw_screen.h +++ b/src/gallium/winsys/svga/drm/vmw_screen.h @@ -104,6 +104,8 @@ struct vmw_winsys_screen cnd_t cs_cond; mtx_t cs_mutex; + + boolean force_coherent; }; diff --git a/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c b/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c index 3b14f1d3513..c7310dc7eb4 100644 --- a/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c +++ b/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c @@ -243,6 +243,9 @@ 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) + req->base.drm_surface_flags |= drm_vmw_surface_flag_coherent; + req->base.drm_surface_flags |= drm_vmw_surface_flag_create_buffer; req->base.base_size.width = size.width; req->base.base_size.height = size.height; @@ -969,6 +972,7 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws) drmVersionPtr version; boolean drm_gb_capable; boolean have_drm_2_5; + boolean have_drm_2_16; const char *getenv_val; VMW_FUNC; @@ -985,6 +989,8 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws) (version->version_major == 2 && version->version_minor > 8); vws->ioctl.have_drm_2_15 = version->version_major > 2 || (version->version_major == 2 && version->version_minor > 14); + have_drm_2_16 = version->version_major > 2 || + (version->version_major == 2 && version->version_minor > 15); vws->ioctl.drm_execbuf_version = vws->ioctl.have_drm_2_9 ? 2 : 1; @@ -1108,6 +1114,12 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws) vws->ioctl.num_cap_3d = size / sizeof(uint32_t); else vws->ioctl.num_cap_3d = SVGA3D_DEVCAP_MAX; + + if (have_drm_2_16) { + getenv_val = getenv("SVGA_FORCE_COHERENT"); + if (getenv_val && strcmp(getenv_val, "0") != 0) + vws->force_coherent = TRUE; + } } else { vws->ioctl.num_cap_3d = SVGA3D_DEVCAP_MAX; |