Compilers are free to make the assumption that pointers don't violate
strict aliasing. If that assumption is incorrect, as it is with the
framebuffer pointer packing code here, the job can fail.
This depends heavily on the compiler and optimization levels, so it's
hard to reproduce, but it did happen for at least two users running with
-O2 on gcc.
Fixes:
67cbbf941751 ("panfrost: Use framebuffer pointer XML")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8627
Signed-off-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21991>
batch->tls = batch->framebuffer;
#if PAN_ARCH == 5
- pan_pack(&batch->tls.gpu, FRAMEBUFFER_POINTER, cfg) {
+ struct mali_framebuffer_pointer_packed ptr;
+
+ pan_pack(ptr.opaque, FRAMEBUFFER_POINTER, cfg) {
cfg.pointer = batch->framebuffer.gpu;
cfg.render_target_count = 1; /* a necessary lie */
}
+
+ batch->tls.gpu = ptr.opaque[0];
#endif
#endif
}
#include "util/macros.h"
+#include "genxml/gen_macros.h"
+
#include "pan_cs.h"
#include "pan_encoder.h"
#include "pan_texture.h"
*(fb->rts[i].crc_valid) = false;
}
- uint64_t tag = 0;
- pan_pack(&tag, FRAMEBUFFER_POINTER, cfg) {
+ struct mali_framebuffer_pointer_packed tag;
+ pan_pack(tag.opaque, FRAMEBUFFER_POINTER, cfg) {
cfg.zs_crc_extension_present = has_zs_crc_ext;
cfg.render_target_count = MAX2(fb->rt_count, 1);
}
- return tag;
+ return tag.opaque[0];
}
#else /* PAN_ARCH == 4 */
unsigned