Mesa (main): svga: Use direct maps when GB objects are present

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 26 01:14:04 UTC 2022


Module: Mesa
Branch: main
Commit: e5306d190a22afeb592f41dea678b1d57a0513c5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e5306d190a22afeb592f41dea678b1d57a0513c5

Author: Zack Rusin <zackr at vmware.com>
Date:   Tue Feb  8 16:03:21 2022 -0500

svga: Use direct maps when GB objects are present

SVGA device always supports direct maps which are preferable in all cases
because they avoid temporary surfaces and extra transfers. Furthermore
DMA transfers on devices with GB objects have undefined timing semantics.

Also the DMA transfers can not work on SVGAv3 because the device lacks
VRAM to be able to perform them.

Fix the last paths still using DMA transfers to make sure they're never
used on GB enabled configs. This fixes gnome-shell startup on SVGAv3.

Signed-off-by: Zack Rusin <zackr at vmware.com>
Reviewed-by: Charmaine Lee <charmainel at vmware.com>
Reviewed-by: Martin Krastev <krastevm at vmware.com>
Reviewed-by: Michael Banack <banackm at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16061>

---

 src/gallium/drivers/svga/svga_cmd.c              | 2 ++
 src/gallium/drivers/svga/svga_resource_texture.c | 9 +++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_cmd.c b/src/gallium/drivers/svga/svga_cmd.c
index 6577c839cf0..8347dc17545 100644
--- a/src/gallium/drivers/svga/svga_cmd.c
+++ b/src/gallium/drivers/svga/svga_cmd.c
@@ -439,6 +439,8 @@ SVGA3D_SurfaceDMA(struct svga_winsys_context *swc,
    unsigned region_flags;
    unsigned surface_flags;
 
+   assert(!swc->have_gb_objects);
+
    if (transfer == SVGA3D_WRITE_HOST_VRAM) {
       region_flags = SVGA_RELOC_READ;
       surface_flags = SVGA_RELOC_WRITE;
diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c
index ff2c500dbb4..f2ab20edba7 100644
--- a/src/gallium/drivers/svga/svga_resource_texture.c
+++ b/src/gallium/drivers/svga/svga_resource_texture.c
@@ -535,10 +535,11 @@ svga_texture_transfer_map(struct pipe_context *pipe,
       break;
    }
 
-   /* Force direct map for multisample surface */
-   if (texture->nr_samples > 1) {
-      assert(svga_have_gb_objects(svga));
-      assert(sws->have_sm4_1);
+   /* We never want to use DMA transfers on systems with GBObjects because
+    * it causes serialization issues and in SVGAv3 vram is gone which
+    * makes it impossible to support both at the same time.
+    */
+   if (svga_have_gb_objects(svga)) {
       use_direct_map = TRUE;
    }
 



More information about the mesa-commit mailing list