From: sashiko-bot@kernel.org
To: "Mike Lothian" <mike@fireburn.co.uk>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 6/13] drm/vino: add the video codec
Date: Wed, 26 Aug 2026 16:56:28 +0000 [thread overview]
Message-ID: <20260826165628.A3ECD1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260826163913.7052-7-mike@fireburn.co.uk>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The Navarro parameter map generation exceeds the maximum record stride cap (4080 bytes) for high-resolution displays like 4K.
- [High] The production entropy VLC encoder `Bits::finish` pads the final byte with zeroes instead of the wire-format-required one-bits.
--
commit 74ff1e1c314d743efc9972c4a877920b6216a374
Author: Mike Lothian <mike@fireburn.co.uk>
Date: Wed Aug 26 16:37:31 2026 +0000
drm/vino: add the video codec
This commit adds a proprietary multilevel Haar codec to encode video frames
for DisplayLink docks. It includes the encoder, transform, strip grammar,
record framing, and a software color pipeline.
> diff --git a/drivers/gpu/drm/vino/video/haar/records.rs b/drivers/gpu/drm/vino/video/haar/records.rs
> new file mode 100644
> index 0000000000000..422ae7d83ae27
> --- /dev/null
> +++ b/drivers/gpu/drm/vino/video/haar/records.rs
[ ... ]
> + let mut band = 0usize;
> + let mut record = 0usize;
> + while band < bands {
> + // The first record takes up to PARAM_TLVS_PER_RECORD sub-records, the second the rest.
> + let take_tlvs = if record == 0 {
> + PARAM_TLVS_PER_RECORD
> + } else {
> + bands.div_ceil(PARAM_BANDS_PER_TLV)
> + };
[Severity: High]
Will this logic exceed the 4080-byte stride cap on high-resolution displays?
When configuring a supported high-resolution mode like 4K (3840x2160), the
display is split into 270 bands (bands = 270). The first parameter map record
consumes 15 TLVs (120 bands). For the second record, navarro_strip_params()
evaluates take_tlvs as 270.div_ceil(8) = 34.
The loop then writes the remaining 19 TLVs into the second record. Since 19
TLVs * 262 bytes equals 4978 bytes, this exceeds the STRIDE_CAP of 4080
bytes, which can cause the dock's USB endpoint to halt and the display to
fail.
[ ... ]
> diff --git a/drivers/gpu/drm/vino/video/haar/transform.rs b/drivers/gpu/drm/vino/video/haar/transform.rs
> new file mode 100644
> index 0000000000000..b009061ce13bc
> --- /dev/null
> +++ b/drivers/gpu/drm/vino/video/haar/transform.rs
[ ... ]
> + /// Flush the accumulator and yield the packed bytes, zero-padding the final byte.
> + pub(crate) fn finish(mut self) -> Result<KVec<u8>> {
> + let nbytes = self.nacc.div_ceil(8) as usize;
> + for k in 0..nbytes {
> + self.out.push((self.acc >> (8 * k)) as u8, GFP_KERNEL)?;
> + }
> + Ok(self.out)
> + }
[Severity: High]
Does padding the final byte with zeros instead of ones violate the expected
wire format and risk image corruption?
In Bits::finish(), the unused high bits of self.acc contain zeros, meaning
the partial byte at the end of an unaligned strip is padded with zeros.
Because zero is a valid symbol in the entropy code, the dock may decode
unintended extra coefficients and desynchronize.
If the byte is padded with 1-bits instead, it forms a truncated all-ones
escape sequence that the decoder safely ignores.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260826163913.7052-1-mike@fireburn.co.uk?part=6
next prev parent reply other threads:[~2026-08-26 16:56 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 16:37 [PATCH v3 0/13] drm/vino: a Rust driver for DisplayLink DL3 docks Mike Lothian
2026-08-26 16:37 ` [PATCH v3 1/13] drm/vino: add the DL3 wire framing Mike Lothian
2026-08-26 16:37 ` [PATCH v3 2/13] drm/vino: add the USB transport Mike Lothian
2026-08-26 16:58 ` sashiko-bot
2026-08-26 16:37 ` [PATCH v3 3/13] drm/vino: add the crypto primitives and the HDCP 2.2 AKE Mike Lothian
2026-08-26 16:37 ` [PATCH v3 4/13] drm/vino: add the encrypted control plane Mike Lothian
2026-08-26 16:37 ` [PATCH v3 5/13] drm/vino: add the dock profiles Mike Lothian
2026-08-26 16:37 ` [PATCH v3 6/13] drm/vino: add the video codec Mike Lothian
2026-08-26 16:56 ` sashiko-bot [this message]
2026-08-26 16:37 ` [PATCH v3 7/13] drm/vino: add control-session bring-up Mike Lothian
2026-08-26 16:57 ` sashiko-bot
2026-08-26 16:37 ` [PATCH v3 8/13] drm/vino: add the KMS device and the atomic path Mike Lothian
2026-08-26 16:59 ` sashiko-bot
2026-08-26 16:37 ` [PATCH v3 9/13] drm/vino: add the dock activation and scanout path Mike Lothian
2026-08-26 16:59 ` sashiko-bot
2026-08-26 16:37 ` [PATCH v3 10/13] drm/vino: read the dock's firmware version, and update it over DFU Mike Lothian
2026-08-26 16:58 ` sashiko-bot
2026-08-26 16:37 ` [PATCH v3 11/13] drm/vino: add the USB driver frontend Mike Lothian
2026-08-26 17:01 ` sashiko-bot
2026-08-26 16:37 ` [PATCH v3 12/13] drm/vino: allow the driver to be built Mike Lothian
2026-08-26 17:04 ` sashiko-bot
2026-08-26 16:37 ` [PATCH v3 13/13] Documentation/gpu: document the Vino driver Mike Lothian
2026-08-26 17:10 ` sashiko-bot
2026-08-26 17:28 ` Randy Dunlap
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=20260826165628.A3ECD1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=mike@fireburn.co.uk \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.