Mesa (main): lima: Take offset in account when checking BO size

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 13 21:36:20 UTC 2021


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

Author: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
Date:   Fri May 28 23:06:49 2021 +0200

lima: Take offset in account when checking BO size

BO resources imported from a handle may have an offset provided, which
reduces the available size within the BO. Take this in account when
checking that the size is sufficient in lima.

Reviewed-by: Vasily Khoruzhick <anarsoul at gmail.com>
Reviewed-by: Erico Nunes <nunes.erico at gmail.com>
Reviewed-by: Andreas Baierl <ichgeh at imkreisrum.de>
Signed-off-by: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11076>

---

 src/gallium/drivers/lima/lima_resource.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/lima/lima_resource.c b/src/gallium/drivers/lima/lima_resource.c
index ae757973d31..a783595411a 100644
--- a/src/gallium/drivers/lima/lima_resource.c
+++ b/src/gallium/drivers/lima/lima_resource.c
@@ -370,9 +370,9 @@ lima_resource_from_handle(struct pipe_screen *pscreen,
          goto err_out;
       }
 
-      if (res->bo->size < size) {
+      if ((res->bo->size - res->levels[0].offset) < size) {
          fprintf(stderr, "imported bo size is smaller than expected: %d (BO) < %d (expected)\n",
-                 res->bo->size, size);
+                 (res->bo->size - res->levels[0].offset), size);
          goto err_out;
       }
 



More information about the mesa-commit mailing list