Mesa (master): nvc0/cl: hande 64 bit pointers in nvc0_set_global_handle

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Sep 1 19:05:30 UTC 2020


Module: Mesa
Branch: master
Commit: 6e52c6dfcc93aa801d1ac86796492fc325d997d2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6e52c6dfcc93aa801d1ac86796492fc325d997d2

Author: Karol Herbst <kherbst at redhat.com>
Date:   Mon Aug 31 13:32:55 2020 +0200

nvc0/cl: hande 64 bit pointers in nvc0_set_global_handle

clover gives us a uint32_t pointer into the kernel input bufffer, but also
for actual 64 bit pointers, so we can just use memcpy instead.

Signed-off-by: Karol Herbst <kherbst at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6433>

---

 src/gallium/drivers/nouveau/nvc0/nvc0_state.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
index 90c2a5e1c6e..2f00bd1c937 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
@@ -1357,14 +1357,9 @@ nvc0_set_global_handle(uint32_t *phandle, struct pipe_resource *res)
 {
    struct nv04_resource *buf = nv04_resource(res);
    if (buf) {
-      uint64_t limit = (buf->address + buf->base.width0) - 1;
-      if (limit < (1ULL << 32)) {
-         *phandle = (uint32_t)buf->address;
-      } else {
-         NOUVEAU_ERR("Cannot map into TGSI_RESOURCE_GLOBAL: "
-                     "resource not contained within 32-bit address space !\n");
-         *phandle = 0;
-      }
+      uint64_t address = buf->address + *phandle;
+      /* even though it's a pointer to uint32_t that's fine */
+      memcpy(phandle, &address, 8);
    } else {
       *phandle = 0;
    }



More information about the mesa-commit mailing list