From: Jocelyn Falempe <jfalempe@redhat.com>
To: peder.bergan@gmail.com, Javier Martinez Canillas <javierm@redhat.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
dri-devel@lists.freedesktop.org, rust-for-linux@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] drm/panic: Check QR alignment centers one axis at a time
Date: Fri, 27 Nov 2026 13:41:16 +0100 [thread overview]
Message-ID: <ba9b59dc-1e4e-4a59-8354-e4ec0de4ef1d@redhat.com> (raw)
In-Reply-To: <20261126-perf-drm-panic-qr-v1-1-51856937dc4d@gmail.com>
On 11/26/26 17:53, Peder Bergan via B4 Relay wrote:
> From: Peder Bergan <peder.bergan@gmail.com>
>
> is_alignment() scans pairs of alignment centers each time it tests
> whether a module is reserved. At version 40 there are seven centers
> per axis, so a lookup can visit 49 pairs.
>
> Each center covers a five-module span, and adjacent centers are at
> least 12 modules apart. Find the unique matching center on each axis
> and apply the existing finder-pattern exclusion to that pair. The
> lookup now needs at most 14 center tests.
Thanks for your contribution.
This code is executed only once when a panic occurs, so optimizations
are clearly not a priority.
But this series looks good, and keeps the code simple.
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
>
> Signed-off-by: Peder Bergan <peder.bergan@gmail.com>
> ---
> drivers/gpu/drm/drm_panic_helper_qr.rs | 19 ++++++++-----------
> 1 file changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_panic_helper_qr.rs b/drivers/gpu/drm/drm_panic_helper_qr.rs
> index 4941731fb60fa..c6ed395c05bd2 100644
> --- a/drivers/gpu/drm/drm_panic_helper_qr.rs
> +++ b/drivers/gpu/drm/drm_panic_helper_qr.rs
> @@ -746,17 +746,14 @@ fn draw_alignments(&mut self) {
>
> fn is_alignment(&self, x: u8, y: u8) -> bool {
> let positions = self.version.alignment_pattern();
> - for &ax in positions.iter() {
> - for &ay in positions.iter() {
> - if self.is_finder(ax, ay) {
> - continue;
> - }
> - if x >= ax - 2 && x <= ax + 2 && y >= ay - 2 && y <= ay + 2 {
> - return true;
> - }
> - }
> - }
> - false
> + // Centers are at least 12 modules apart, so their five-module spans are disjoint.
> + let Some(&ax) = positions.iter().find(|&¢er| x.abs_diff(center) <= 2) else {
> + return false;
> + };
> + let Some(&ay) = positions.iter().find(|&¢er| y.abs_diff(center) <= 2) else {
> + return false;
> + };
> + !self.is_finder(ax, ay)
> }
>
> // Timing pattern: 2 dotted line between the finder patterns.
>
next prev parent reply other threads:[~2026-11-27 12:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 16:53 [PATCH 0/3] drm/panic: Speed up QR code encoding Peder Bergan via B4 Relay
2026-11-26 16:53 ` [PATCH 1/3] drm/panic: Check QR alignment centers one axis at a time Peder Bergan via B4 Relay
2026-11-27 12:41 ` Jocelyn Falempe [this message]
2026-11-26 16:53 ` [PATCH 2/3] drm/panic: Apply the QR mask while drawing data modules Peder Bergan via B4 Relay
2026-11-27 12:42 ` Jocelyn Falempe
2026-11-26 16:53 ` [PATCH 3/3] drm/panic: Simplify QR error correction exponent reduction Peder Bergan via B4 Relay
2026-11-27 12:42 ` Jocelyn Falempe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ba9b59dc-1e4e-4a59-8354-e4ec0de4ef1d@redhat.com \
--to=jfalempe@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=peder.bergan@gmail.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox