Mesa (main): intel/tools: fix int-to-pointer/pointer-to-int cast warnings on 32-bit
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jun 28 09:43:53 UTC 2021
Module: Mesa
Branch: main
Commit: f2a3c9de677ab8f55b15f7d201f484a084c98b27
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f2a3c9de677ab8f55b15f7d201f484a084c98b27
Author: Marcin Ślusarz <marcin.slusarz at intel.com>
Date: Thu Jun 24 13:18:35 2021 +0200
intel/tools: fix int-to-pointer/pointer-to-int cast warnings on 32-bit
gcc complains:
../src/intel/tools/aub_write.c: In function ‘populate_ppgtt_table’:
../src/intel/tools/aub_write.c:254:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
254 | (void *)(aub->phys_addrs_allocator++ << 12);
| ^
../src/intel/tools/aub_write.c:258:27: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
258 | i, (uint64_t)table->subtables[i]);
| ^
../src/intel/tools/aub_write.c:273:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
273 | (level == 1 ? (uint64_t)table->subtables[i] :
| ^
../src/intel/tools/aub_write.c: In function ‘ppgtt_lookup’:
../src/intel/tools/aub_write.c:346:11: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
346 | return (uint64_t)L1_table(ppgtt_addr)->subtables[L1_index(ppgtt_addr)];
| ^
../src/intel/tools/intel_sanitize_gpu.c: In function ‘bo_size’:
../src/intel/tools/intel_sanitize_gpu.c:99:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
99 | return e ? (uint64_t)e->data : UINT64_MAX;
| ^
Signed-off-by: Marcin Ślusarz <marcin.slusarz at intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11574>
---
src/intel/tools/aub_write.c | 8 ++++----
src/intel/tools/intel_sanitize_gpu.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/intel/tools/aub_write.c b/src/intel/tools/aub_write.c
index e9443c5b82d..e0703a75e52 100644
--- a/src/intel/tools/aub_write.c
+++ b/src/intel/tools/aub_write.c
@@ -251,11 +251,11 @@ populate_ppgtt_table(struct aub_file *aub, struct aub_ppgtt_table *table,
dirty_end = max(dirty_end, i);
if (level == 1) {
table->subtables[i] =
- (void *)(aub->phys_addrs_allocator++ << 12);
+ (void *)(uintptr_t)(aub->phys_addrs_allocator++ << 12);
if (aub->verbose_log_file) {
fprintf(aub->verbose_log_file,
" Adding entry: %x, phys_addr: 0x%016" PRIx64 "\n",
- i, (uint64_t)table->subtables[i]);
+ i, (uint64_t)(uintptr_t)table->subtables[i]);
}
} else {
table->subtables[i] =
@@ -270,7 +270,7 @@ populate_ppgtt_table(struct aub_file *aub, struct aub_ppgtt_table *table,
}
}
entries[i] = 3 /* read/write | present */ |
- (level == 1 ? (uint64_t)table->subtables[i] :
+ (level == 1 ? (uint64_t)(uintptr_t)table->subtables[i] :
table->subtables[i]->phys_addr);
}
@@ -343,7 +343,7 @@ aub_map_ppgtt(struct aub_file *aub, uint64_t start, uint64_t size)
static uint64_t
ppgtt_lookup(struct aub_file *aub, uint64_t ppgtt_addr)
{
- return (uint64_t)L1_table(ppgtt_addr)->subtables[L1_index(ppgtt_addr)];
+ return (uint64_t)(uintptr_t)L1_table(ppgtt_addr)->subtables[L1_index(ppgtt_addr)];
}
static const struct engine {
diff --git a/src/intel/tools/intel_sanitize_gpu.c b/src/intel/tools/intel_sanitize_gpu.c
index 492d1b6162a..74d0b78a8c8 100644
--- a/src/intel/tools/intel_sanitize_gpu.c
+++ b/src/intel/tools/intel_sanitize_gpu.c
@@ -96,7 +96,7 @@ bo_size(int fd, uint32_t handle)
if (!t)
return UINT64_MAX;
struct hash_entry *e = _mesa_hash_table_search(t, (void*)(uintptr_t)handle);
- return e ? (uint64_t)e->data : UINT64_MAX;
+ return e ? (uint64_t)(uintptr_t)e->data : UINT64_MAX;
}
static inline bool
More information about the mesa-commit
mailing list