Mesa (main): freedreno/drm: Fix bos_on_stack calculation
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun May 1 16:22:08 UTC 2022
Module: Mesa
Branch: main
Commit: 69edfcaa20294d0d4dbbeac8867885519d794a8a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=69edfcaa20294d0d4dbbeac8867885519d794a8a
Author: Rob Clark <robdclark at chromium.org>
Date: Sat Apr 30 10:24:08 2022 -0700
freedreno/drm: Fix bos_on_stack calculation
Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16263>
---
src/freedreno/drm/msm/msm_ringbuffer_sp.c | 2 +-
src/freedreno/drm/virtio/virtio_ringbuffer.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/freedreno/drm/msm/msm_ringbuffer_sp.c b/src/freedreno/drm/msm/msm_ringbuffer_sp.c
index 5fd0dfeac54..96e7462df62 100644
--- a/src/freedreno/drm/msm/msm_ringbuffer_sp.c
+++ b/src/freedreno/drm/msm/msm_ringbuffer_sp.c
@@ -120,7 +120,7 @@ flush_submit_list(struct list_head *submit_list)
* NOTE allocate on-stack in the common case, but with an upper-
* bound to limit on-stack allocation to 4k:
*/
- const unsigned bo_limit = sizeof(struct drm_msm_gem_submit_bo) / 4096;
+ const unsigned bo_limit = 4096 / sizeof(struct drm_msm_gem_submit_bo);
bool bos_on_stack = fd_submit->nr_bos < bo_limit;
struct drm_msm_gem_submit_bo
_submit_bos[bos_on_stack ? fd_submit->nr_bos : 0];
diff --git a/src/freedreno/drm/virtio/virtio_ringbuffer.c b/src/freedreno/drm/virtio/virtio_ringbuffer.c
index 8744be3a49a..ccae5da1d9c 100644
--- a/src/freedreno/drm/virtio/virtio_ringbuffer.c
+++ b/src/freedreno/drm/virtio/virtio_ringbuffer.c
@@ -121,7 +121,7 @@ flush_submit_list(struct list_head *submit_list)
* NOTE allocate on-stack in the common case, but with an upper-
* bound to limit on-stack allocation to 4k:
*/
- const unsigned bo_limit = sizeof(struct drm_msm_gem_submit_bo) / 4096;
+ const unsigned bo_limit = 4096 / sizeof(struct drm_msm_gem_submit_bo);
bool bos_on_stack = fd_submit->nr_bos < bo_limit;
struct drm_msm_gem_submit_bo
_submit_bos[bos_on_stack ? fd_submit->nr_bos : 0];
More information about the mesa-commit
mailing list