Mesa (staging/19.2): winsys/svga: Limit the maximum DMA hardware buffer size
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Oct 25 17:02:20 UTC 2019
Module: Mesa
Branch: staging/19.2
Commit: 5f6f349bcfeee93432b44913bf8064ab144f8975
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5f6f349bcfeee93432b44913bf8064ab144f8975
Author: Thomas Hellstrom <thellstrom at vmware.com>
Date: Thu Oct 3 12:44:42 2019 +0200
winsys/svga: Limit the maximum DMA hardware buffer size
The kernel total GMR/DMA size is limited, but it's definitely possible for the
kernel to allow a larger buffer allocation to succeed, but command
submission using that buffer as a GMR would fail typically causing an
application crash.
So have the winsys limit the size of GMR/DMA buffers. The pipe driver will
then resort to allocating smaller buffers and perform the DMA transfer in
multiple bands, also allowing for the pre-flush mechanism to kick in.
This avoids the related application crashes.
Fixes: e7843273fae ("winsys/svga: Update to vmwgfx kernel module 2.1")
Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Charmaine Lee <charmainel at vmware.com>
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
(cherry picked from commit 91146c07967b1d531a38f724ad91e7a0fc0769ef)
---
src/gallium/winsys/svga/drm/vmw_screen_svga.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/gallium/winsys/svga/drm/vmw_screen_svga.c b/src/gallium/winsys/svga/drm/vmw_screen_svga.c
index cd3f21f6033..fb0bee77822 100644
--- a/src/gallium/winsys/svga/drm/vmw_screen_svga.c
+++ b/src/gallium/winsys/svga/drm/vmw_screen_svga.c
@@ -80,8 +80,11 @@ vmw_svga_winsys_buffer_create(struct svga_winsys_screen *sws,
provider = vws->pools.query_fenced;
} else if (usage == SVGA_BUFFER_USAGE_SHADER) {
provider = vws->pools.mob_shader_slab_fenced;
- } else
+ } else {
+ if (size > VMW_GMR_POOL_SIZE)
+ return NULL;
provider = vws->pools.gmr_fenced;
+ }
assert(provider);
buffer = provider->create_buffer(provider, size, &desc.pb_desc);
More information about the mesa-commit
mailing list