Mesa (master): panfrost: Fix invalid conversions
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon May 3 13:30:50 UTC 2021
Module: Mesa
Branch: master
Commit: a67ea63718466053e48fbeeb204c00435c14a736
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a67ea63718466053e48fbeeb204c00435c14a736
Author: Antonio Caggiano <antonio.caggiano at collabora.com>
Date: Mon Apr 26 18:49:14 2021 +0200
panfrost: Fix invalid conversions
When compiling with a C++ compiler, invalid conversions are treated as
errors unless the fpermissive flag is provided. These changes fix all
invalid conversions encountered while including libpanfrost in a C++
project.
Signed-off-by: Antonio Caggiano <antonio.caggiano at collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10468>
---
src/panfrost/lib/gen_pack.py | 20 +++++++++++---------
src/panfrost/lib/pan_device.h | 2 +-
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/panfrost/lib/gen_pack.py b/src/panfrost/lib/gen_pack.py
index 46b76fcadb3..fbb08a4eed5 100644
--- a/src/panfrost/lib/gen_pack.py
+++ b/src/panfrost/lib/gen_pack.py
@@ -105,7 +105,7 @@ __gen_unpack_uint(const uint8_t *restrict cl, uint32_t start, uint32_t end)
const int width = end - start + 1;
const uint64_t mask = (width == 64 ? ~0 : (1ull << width) - 1 );
- for (int byte = start / 8; byte <= end / 8; byte++) {
+ for (uint32_t byte = start / 8; byte <= end / 8; byte++) {
val |= ((uint64_t) cl[byte]) << ((byte - start / 8) * 8);
}
@@ -171,19 +171,19 @@ __gen_unpack_padded(const uint8_t *restrict cl, uint32_t start, uint32_t end)
#define mali_pixel_format_print_v6(fp, format) \\
fprintf(fp, "%*sFormat (v6): %s%s%s %s%s%s%s\\n", indent, "", \\
- mali_format_as_str((format >> 12) & 0xFF), \\
+ mali_format_as_str((enum mali_format)((format >> 12) & 0xFF)), \\
(format & (1 << 20)) ? " sRGB" : "", \\
(format & (1 << 21)) ? " big-endian" : "", \\
- mali_channel_as_str(((format >> 0) & 0x7)), \\
- mali_channel_as_str(((format >> 3) & 0x7)), \\
- mali_channel_as_str(((format >> 6) & 0x7)), \\
- mali_channel_as_str(((format >> 9) & 0x7)));
+ mali_channel_as_str((enum mali_channel)((format >> 0) & 0x7)), \\
+ mali_channel_as_str((enum mali_channel)((format >> 3) & 0x7)), \\
+ mali_channel_as_str((enum mali_channel)((format >> 6) & 0x7)), \\
+ mali_channel_as_str((enum mali_channel)((format >> 9) & 0x7)));
#define mali_pixel_format_print_v7(fp, format) \\
fprintf(fp, "%*sFormat (v7): %s%s %s%s\\n", indent, "", \\
- mali_format_as_str((format >> 12) & 0xFF), \\
+ mali_format_as_str((enum mali_format)((format >> 12) & 0xFF)), \\
(format & (1 << 20)) ? " sRGB" : "", \\
- mali_rgb_component_order_as_str((format & ((1 << 12) - 1))), \\
+ mali_rgb_component_order_as_str((enum mali_rgb_component_order)(format & ((1 << 12) - 1))), \\
(format & (1 << 21)) ? " XXX BAD BIT" : "");
@@ -584,8 +584,10 @@ class Group(object):
args.append(str(fieldref.start))
args.append(str(fieldref.end))
- if field.type in set(["uint", "uint/float", "address", "Pixel Format"]) | self.parser.enums:
+ if field.type in set(["uint", "uint/float", "address", "Pixel Format"]):
convert = "__gen_unpack_uint"
+ elif field.type in self.parser.enums:
+ convert = "(enum %s)__gen_unpack_uint" % enum_name(field.type)
elif field.type == "int":
convert = "__gen_unpack_sint"
elif field.type == "padded":
diff --git a/src/panfrost/lib/pan_device.h b/src/panfrost/lib/pan_device.h
index 976d34ed34a..27f40eedf54 100644
--- a/src/panfrost/lib/pan_device.h
+++ b/src/panfrost/lib/pan_device.h
@@ -250,7 +250,7 @@ panfrost_query_sample_position(
static inline struct panfrost_bo *
pan_lookup_bo(struct panfrost_device *dev, uint32_t gem_handle)
{
- return util_sparse_array_get(&dev->bo_map, gem_handle);
+ return (struct panfrost_bo *)util_sparse_array_get(&dev->bo_map, gem_handle);
}
static inline bool
More information about the mesa-commit
mailing list