Bug#1024762: mesa 22.2.4 & 22.3.0-rc3 break OpenGL applications on panfrost
Source: mesa
Version: 22.2.4-1
Severity: important
Tags: patch upstream
X-Debbugs-Cc: aferraris@debian.org
Control: found -1 mesa/22.3.0~rc3-1
Dear Maintainer,
The latest mesa updates, affecting both 22.2.4-1 and 22.3.0~rc3-1, breaks (at
least) GTK4 and Qt apps on arm64 devices using the panfrost driver (tested to
affect the PinePhone Pro which includes a Mali-T860, but not the PinePhone
which has a Mali-400 GPU handled by the lima driver)
[3022204.252] -> zwp_linux_dmabuf_v1@30.create_params(new id
zwp_linux_buffer_params_v1@39)
[3022204.322] -> zwp_linux_buffer_params_v1@39.add(fd 12, 0, 0, 2880,
134217728, 81)
[3022204.347] -> zwp_linux_buffer_params_v1@39.create_immed(new id
wl_buffer@40, 720, 1296, 875713089, 0)
[3022204.366] -> zwp_linux_buffer_params_v1@39.destroy()
[3022204.378] -> wl_surface@27.attach(wl_buffer@40, 0, 0)
[3022204.394] -> wl_surface@27.damage_buffer(0, 0, 720, 1296)
[3022204.658] -> wl_surface@27.commit()
[3022214.101] wl_display@1.delete_id(37)
[3022214.152] wl_display@1.error(nil, 7, "importing the supplied dmabufs
failed")
Gdk-Message: 11:16:51.477: Error 71 (Protocol error) dispatching to Wayland
display.
This seems to be an occurrence of
https://gitlab.freedesktop.org/mesa/mesa/-/issues/7731, and I can confirm
reverting the offending commit fixes it.
Thanks,
Arnaud
-- System Information:
Debian Release: bookworm/sid
APT prefers testing
APT policy: (500, 'testing'), (200, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 6.0.0-4-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
>From 813c0147d2fe169bcce69abea58656f38933f41a Mon Sep 17 00:00:00 2001
From: Arnaud Ferraris <aferraris@debian.org>
Date: Thu, 24 Nov 2022 11:48:01 +0100
Subject: d/patches: fix breaking change in panfrost
---
...Require-64-byte-alignment-on-imports.patch | 154 ++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 155 insertions(+)
create mode 100644 debian/patches/Revert-panfrost-Require-64-byte-alignment-on-imports.patch
diff --git a/debian/patches/Revert-panfrost-Require-64-byte-alignment-on-imports.patch b/debian/patches/Revert-panfrost-Require-64-byte-alignment-on-imports.patch
new file mode 100644
index 00000000000..cb16591dd3b
--- /dev/null
+++ b/debian/patches/Revert-panfrost-Require-64-byte-alignment-on-imports.patch
@@ -0,0 +1,154 @@
+From: Arnaud Ferraris <aferraris@debian.org>
+Date: Thu, 24 Nov 2022 11:46:01 +0100
+Subject: Revert "panfrost: Require 64-byte alignment on imports"
+
+This reverts commit e1fe4a64d3f319731152bb48e6cb15e899452b15.
+---
+ .pick_status.json | 2 +-
+ src/panfrost/lib/pan_layout.c | 54 +++---------------------------------------
+ src/panfrost/lib/pan_texture.c | 8 -------
+ src/panfrost/lib/pan_texture.h | 6 -----
+ 4 files changed, 4 insertions(+), 66 deletions(-)
+
+diff --git a/.pick_status.json b/.pick_status.json
+index c17161c..bedb90f 100644
+--- a/.pick_status.json
++++ b/.pick_status.json
+@@ -2479,7 +2479,7 @@
+ "description": "panfrost: Require 64-byte alignment on imports",
+ "nominated": true,
+ "nomination_type": 0,
+- "resolution": 1,
++ "resolution": 0,
+ "main_sha": null,
+ "because_sha": null
+ },
+diff --git a/src/panfrost/lib/pan_layout.c b/src/panfrost/lib/pan_layout.c
+index 51b511a..127ad6c 100644
+--- a/src/panfrost/lib/pan_layout.c
++++ b/src/panfrost/lib/pan_layout.c
+@@ -275,34 +275,6 @@ panfrost_texture_offset(const struct pan_image_layout *layout,
+ (surface_idx * layout->slices[level].surface_stride);
+ }
+
+-/*
+- * Return the minimum stride alignment in bytes for a given texture format.
+- *
+- * There is no format on any supported Mali with a minimum alignment greater
+- * than 64 bytes, but 64 bytes is the required alignment of all regular formats
+- * in v7 and newer. If this alignment is not met, imprecise faults may be
+- * raised.
+- *
+- * This may not be necessary on older hardware but we enforce it there too for
+- * uniformity. If this poses a problem there, we'll need a solution that can
+- * handle v7 as well.
+- *
+- * Certain non-regular formats require smaller power-of-two alignments.
+- * This requirement could be loosened in the future if there is a compelling
+- * reason, by making this query more precise.
+- */
+-uint32_t
+-pan_stride_align_B(UNUSED enum pipe_format format)
+-{
+- return 64;
+-}
+-
+-bool
+-pan_is_stride_aligned(enum pipe_format format, uint32_t stride_B)
+-{
+- return (stride_B % pan_stride_align_B(format)) == 0;
+-}
+-
+ bool
+ pan_image_layout_init(struct pan_image_layout *layout,
+ const struct pan_image_explicit_layout *explicit_layout)
+@@ -316,15 +288,8 @@ pan_image_layout_init(struct pan_image_layout *layout,
+ layout->nr_slices > 1 || layout->crc_mode == PAN_IMAGE_CRC_INBAND))
+ return false;
+
+- /* Require both offsets and strides to be aligned to the hardware
+- * requirement. Panfrost allocates offsets and strides like this, so
+- * this requirement is satisfied by any image that was exported from
+- * another process with Panfrost. However, it does restrict imports of
+- * EGL external images.
+- */
+- if (explicit_layout &&
+- !(pan_is_stride_aligned(layout->format, explicit_layout->offset) &&
+- pan_is_stride_aligned(layout->format, explicit_layout->row_stride)))
++ /* Mandate 64 byte alignement */
++ if (explicit_layout && (explicit_layout->offset & 63))
+ return false;
+
+ unsigned fmt_blocksize = util_format_get_blocksize(layout->format);
+@@ -378,19 +343,10 @@ pan_image_layout_init(struct pan_image_layout *layout,
+
+ row_stride = explicit_layout->row_stride;
+ } else if (linear) {
+- /* Keep lines alignment on 64 byte for performance.
+- *
+- * Note that this is a multiple of the minimum
+- * stride alignment, so the hardware requirement is
+- * satisfied as a result.
+- */
++ /* Keep lines alignment on 64 byte for performance */
+ row_stride = ALIGN_POT(row_stride, 64);
+ }
+
+-
+- assert(pan_is_stride_aligned(layout->format, row_stride) &&
+- "alignment gauranteed in both code paths");
+-
+ unsigned slice_one_size = row_stride * (effective_height / block_size.height);
+
+ /* Compute AFBC sizes if necessary */
+@@ -430,10 +386,6 @@ pan_image_layout_init(struct pan_image_layout *layout,
+
+ slice->surface_stride = slice_one_size;
+
+- assert(pan_is_stride_aligned(layout->format, slice->surface_stride) &&
+- "integer multiple of aligned is still aligned, "
+- "and AFBC header is at least 64 byte aligned");
+-
+ /* Compute AFBC sizes if necessary */
+
+ offset += slice_full_size;
+diff --git a/src/panfrost/lib/pan_texture.c b/src/panfrost/lib/pan_texture.c
+index 9fa8c44..446fffe 100644
+--- a/src/panfrost/lib/pan_texture.c
++++ b/src/panfrost/lib/pan_texture.c
+@@ -247,18 +247,10 @@ panfrost_get_surface_strides(const struct pan_image_layout *layout,
+ * repurposed as a Y offset which we don't use */
+ *row_stride = PAN_ARCH < 7 ? 0 : slice->row_stride;
+ *surf_stride = slice->afbc.surface_stride;
+-
+- /* Row stride alignment requirement does not apply to AFBC */
+ } else {
+ *row_stride = slice->row_stride;
+ *surf_stride = slice->surface_stride;
+-
+- /* Particular for linear, the row stride must be aligned */
+- assert(pan_is_stride_aligned(layout->format, *row_stride));
+ }
+-
+- /* All surface strides are aligned, required for linear */
+- assert(pan_is_stride_aligned(layout->format, *surf_stride));
+ }
+
+ static mali_ptr
+diff --git a/src/panfrost/lib/pan_texture.h b/src/panfrost/lib/pan_texture.h
+index 875f008..bd773fa 100644
+--- a/src/panfrost/lib/pan_texture.h
++++ b/src/panfrost/lib/pan_texture.h
+@@ -248,12 +248,6 @@ panfrost_from_legacy_stride(unsigned legacy_stride,
+ enum pipe_format format,
+ uint64_t modifier);
+
+-uint32_t
+-pan_stride_align_B(enum pipe_format format);
+-
+-bool
+-pan_is_stride_aligned(enum pipe_format format, unsigned stride_B);
+-
+ struct pan_surface {
+ union {
+ mali_ptr data;
diff --git a/debian/patches/series b/debian/patches/series
index 00f74717aad..7ddf1930f72 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
07_gallium-fix-build-failure-on-powerpcspe.diff
path_max.diff
src_glx_dri_common.h.diff
+Revert-panfrost-Require-64-byte-alignment-on-imports.patch
--
2.35.1
Reply to: