Mesa (master): nouveau: pacify gcc on ILP32
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Jan 10 21:34:07 UTC 2021
Module: Mesa
Branch: master
Commit: 1a8dcfc74c964858d10d193d7d880a5b87dfb91d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1a8dcfc74c964858d10d193d7d880a5b87dfb91d
Author: Adam Jackson <ajax at redhat.com>
Date: Fri Jan 8 11:59:12 2021 -0500
nouveau: pacify gcc on ILP32
The gcc we're using (and quite possibly newer ones) throws a really
stupid error:
../src/gallium/drivers/nouveau/nouveau_buffer.c:765:22: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
buffer->address = (uint64_t)user_ptr;
Which... address is a uint64_t, and user_ptr is a void *, so this is
completely unambiguously safe to do. Apparently casting to uintptr_t
squelches this, so do that instead.
Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8394>
---
src/gallium/drivers/nouveau/nouveau_buffer.c | 2 +-
src/gallium/drivers/nouveau/nouveau_screen.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c
index beef87de0d6..5e289bd88c7 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.c
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
@@ -762,7 +762,7 @@ nouveau_buffer_create_from_user(struct pipe_screen *pscreen,
* existing code. It's correct nonetheless as the same pointer is equally
* valid on the CPU and the GPU.
*/
- buffer->address = (uint64_t)user_ptr;
+ buffer->address = (uintptr_t)user_ptr;
buffer->data = user_ptr;
buffer->status = NOUVEAU_BUFFER_STATUS_USER_PTR;
buffer->base.screen = pscreen;
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c
index ef5b13396dd..04d8e6f30d2 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -262,7 +262,7 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
}
struct drm_nouveau_svm_init svm_args = {
- .unmanaged_addr = (uint64_t)screen->svm_cutout,
+ .unmanaged_addr = (uintptr_t)screen->svm_cutout,
.unmanaged_size = screen->svm_cutout_size,
};
More information about the mesa-commit
mailing list