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

Author: Rob Clark <[email protected]>
Date:   Wed Sep 14 14:04:38 2022 -0700

freedreno/drm/virtio: Don't prefer upload for mapped buffers

The upload path is intended to avoid stalling on host in order to mmap
recently allocated buffers.  But if we already had to mmap it, no point
in taking the upload path.

Signed-off-by: Rob Clark <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18604>

---

 src/freedreno/drm/virtio/virtio_bo.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/freedreno/drm/virtio/virtio_bo.c 
b/src/freedreno/drm/virtio/virtio_bo.c
index b04733b810e..85ab2504c6e 100644
--- a/src/freedreno/drm/virtio/virtio_bo.c
+++ b/src/freedreno/drm/virtio/virtio_bo.c
@@ -224,6 +224,12 @@ virtio_bo_prefer_upload(struct fd_bo *bo, unsigned len)
 {
    struct virtio_bo *virtio_bo = to_virtio_bo(bo);
 
+   /* If we've already taken the hit of mmap'ing the buffer, then no reason
+    * to take the upload path:
+    */
+   if (bo->map)
+      return false;
+
    if (len > 0x4000)
       return false;
 

Reply via email to