From 897f5814ed09eca03e9e158be42e477ccfc3e3c5 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Tue, 27 Jan 2026 04:31:03 -0500 Subject: [PATCH] pan/clear: Stop packing undefined bits in colors The util code doesn't actually fill things with zeros so the high bits are undefined. If we really want things replicated, we need to mask off just the bits we care about. Cc: mesa-stable Reviewed-by: Lars-Ivar Hesselberg Simonsen Acked-by: Boris Brezillon Acked-by: Eric R. Smith (cherry picked from commit 4d8551552ef04daa8774b9d8a250589be04753c7) Part-of: --- .pick_status.json | 2 +- src/panfrost/lib/pan_clear.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index bb8c09c8d27..766fce40954 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1504,7 +1504,7 @@ "description": "pan/clear: Stop packing undefined bits in colors", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/panfrost/lib/pan_clear.c b/src/panfrost/lib/pan_clear.c index 2a1917fd3aa..d7b72eb3d18 100644 --- a/src/panfrost/lib/pan_clear.c +++ b/src/panfrost/lib/pan_clear.c @@ -84,13 +84,15 @@ pan_pack_raw(uint32_t *packed, const union pipe_color_union *color, util_pack_color(color->f, format, &out); if (size == 1) { - unsigned s = out.ui[0] | (out.ui[0] << 8); - pan_pack_color_32(packed, s | (s << 16)); - } else if (size == 2) - pan_pack_color_32(packed, out.ui[0] | (out.ui[0] << 16)); - else if (size <= 4) + unsigned b = out.ui[0] & 0xff; + unsigned w = b | (b << 8); + pan_pack_color_32(packed, w | (w << 16)); + } else if (size == 2) { + unsigned w = out.ui[0] & 0xffff; + pan_pack_color_32(packed, w | (w << 16)); + } else if (size <= 4) { pan_pack_color_32(packed, out.ui[0]); - else if (size <= 8) { + } else if (size <= 8) { memcpy(packed + 0, out.ui, 8); memcpy(packed + 2, out.ui, 8); } else {