Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ankit Nautiyal" <ankit.k.nautiyal@intel.com>,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915/dsc: Fix QP table index calculation for bpp selection
Date: Fri, 16 Oct 2026 10:47:12 +0000	[thread overview]
Message-ID: <sashiko-outbox-174203@kernel.org> (raw)
In-Reply-To: <20261016101713.230013-2-ankit.k.nautiyal@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/i915/dsc: incomplete fix due to unscaled fractional_bits in QP index calculation
--

commit f16f36523ce6f8e8fca7d8b3376a00ba0a384a25
Author: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Subject: drm/i915/dsc: Fix QP table index calculation for bpp selection

This patch fixes the QP table index calculation for a given bpp by restoring
a missing multiplier of 2 for the integer portion of the calculation. This
aims to ensure proper table layout alignment.

> diff --git a/drivers/gpu/drm/i915/display/intel_vdsc.c b/drivers/gpu/drm/i915/display/intel_vdsc.c
> index 8f06c3a4d56df..7a573c2b6a7dd 100644
> --- a/drivers/gpu/drm/i915/display/intel_vdsc.c
> +++ b/drivers/gpu/drm/i915/display/intel_vdsc.c
[ ... ]
> @@ -261,7 +261,7 @@ calculate_rc_params(struct drm_dsc_config *vdsc_cfg)
>  		 * and so on.
>  		 * 0.5 fractional part with 4 decimal precision becomes 5000
>  		 */
> -		bpp_i  = ((bpp - 6) + (fractional_bits < 5000 ? 0 : 1));
> +		bpp_i  = (2 * (bpp - 6) + (fractional_bits < 5000 ? 0 : 1));

[Severity: Medium]
Does this calculation completely fix the index calculation, or is there a
missing scaling factor for fractional_bits?

Earlier in calculate_rc_params(), fractional_bits is extracted directly from
a Q4 value:
    
    int fractional_bits = fxp_q4_to_frac(vdsc_cfg->bits_per_pixel);

Since fxp_q4_to_frac() returns the raw Q4 fractional bits (which are strictly
in the range 0-15), the condition (fractional_bits < 5000) will always evaluate
to true. 

Because of this, the expression (fractional_bits < 5000 ? 0 : 1) will always
evaluate to 0, which means the 0.5 fractional bpp increment is ignored. Is
fractional_bits missing the 10000 scaling factor expected by this logic?

>  
>  		for (buf_i = 0; buf_i < DSC_NUM_BUF_RANGES; buf_i++) {
>  			u8 range_bpg_offset;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261016101713.230013-1-ankit.k.nautiyal@intel.com?part=1

  reply	other threads:[~2026-10-16 10:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 10:17 [PATCH 0/2] drm/i915/dsc: Fix QP, RC parameters issues Ankit Nautiyal
2026-10-16 10:17 ` [PATCH 1/2] drm/i915/dsc: Fix QP table index calculation for bpp selection Ankit Nautiyal
2026-10-16 10:47   ` sashiko-bot [this message]
2026-10-16 10:17 ` [PATCH 2/2] drm/i915/dsc: Fix the helper range_bpg_offset() Ankit Nautiyal
2026-10-16 10:41 ` ✓ CI.KUnit: success for drm/i915/dsc: Fix QP, RC parameters issues Patchwork
2026-10-16 11:33 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-16 19:23 ` ✓ Xe.CI.FULL: " Patchwork

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=sashiko-outbox-174203@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --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