From: sashiko-bot@kernel.org
To: "Chaoyi Chen" <kernel@airkyi.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/display/dsc: Add YCbCr 4:2:2 and 4:2:0 computation for DSC 1.2 RC parameters
Date: Wed, 23 Sep 2026 10:34:43 +0000 [thread overview]
Message-ID: <20260923103444.410EA1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260923102616.215-1-kernel@airkyi.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/dsc: incorrect second line BPG offset accumulation
--
commit b83356cde3094c64861089db4359f0b624aad6bd
Author: Chaoyi Chen <kernel@airkyi.com>
drm/display/dsc: Add YCbCr 4:2:2 and 4:2:0 computation for DSC 1.2 RC parameters
This commit updates drm_dsc_compute_rc_parameters() to compute rate control
parameters for DSC 1.2 in native 4:2:0 and 4:2:2 modes. It also introduces
__drm_dsc_compute_buffer_offset() to optimize the calculation of rbsMin
using the DSC 1.2 reference C model.
> diff --git a/drivers/gpu/drm/display/drm_dsc_helper.c b/drivers/gpu/drm/display/drm_dsc_helper.c
> --- a/drivers/gpu/drm/display/drm_dsc_helper.c
> +++ b/drivers/gpu/drm/display/drm_dsc_helper.c
> @@ -1300,6 +1300,59 @@ int drm_dsc_setup_rc_params(struct drm_dsc_config *vdsc_cfg, enum drm_dsc_params
[ ... ]
> +static long
> +__drm_dsc_compute_buffer_offset(const struct drm_dsc_config *vdsc_cfg,
> + unsigned long groups_per_line,
> + unsigned long grpcnt)
> +{
[ ... ]
> + if (vdsc_cfg->native_420) {
> + if (grpcnt <= groups_per_line)
> + offset -= (grpcnt * vdsc_cfg->nsl_bpg_offset) >> 11;
> + else if (grpcnt <= 2 * groups_per_line)
> + offset += (grpcnt - groups_per_line) *
> + vdsc_cfg->second_line_bpg_offset -
> + ((groups_per_line *
> + vdsc_cfg->nsl_bpg_offset) >> 11);
> + else
> + offset += (grpcnt - groups_per_line) *
> + vdsc_cfg->second_line_bpg_offset -
> + (((grpcnt - groups_per_line) *
> + vdsc_cfg->nsl_bpg_offset) >> 11);
[Severity: High]
Does this code inflate the accumulated offset for groups beyond the second
line?
In the branch where grpcnt > 2 * groups_per_line, the calculation multiplies
(grpcnt - groups_per_line) by vdsc_cfg->second_line_bpg_offset. Should this
be capped to groups_per_line * vdsc_cfg->second_line_bpg_offset instead?
When grpcnt_id is large (which is common for narrow slices), this unbounded
linear growth could significantly inflate the rate buffer size minimum
(rbs_min). This might result in invalid rate control parameters (rc_bits,
initial_dec_delay) and cause display configuration failures or corrupted
output when a 4:2:0 DSC-capable sink is connected.
> + }
> +
> + return offset;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260923102616.215-1-kernel@airkyi.com?part=1
prev parent reply other threads:[~2026-09-23 10:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 10:26 [PATCH] drm/display/dsc: Add YCbCr 4:2:2 and 4:2:0 computation for DSC 1.2 RC parameters Chaoyi Chen
2026-09-23 10:34 ` sashiko-bot [this message]
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=20260923103444.410EA1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@airkyi.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox