All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Suraj Kandpal <suraj.kandpal@intel.com>, intel-gfx@lists.freedesktop.org
Cc: juha-pekka.heikkila@intel.com, william.tseng@intel.com
Subject: Re: [Intel-gfx] [PATCH] drm/i915/vdsc: Fix first_line_bpg_offset calculation
Date: Mon, 14 Aug 2023 14:30:36 +0300	[thread overview]
Message-ID: <87edk5zwrn.fsf@intel.com> (raw)
In-Reply-To: <20230804083737.3844575-1-suraj.kandpal@intel.com>

On Fri, 04 Aug 2023, Suraj Kandpal <suraj.kandpal@intel.com> wrote:
> On checking DSC1.1 Errata and DSC 1.2 spec the current formula
> we were using was incorrect to calculate first_line_bpg_offset.
> The new fixed formula is derived from C model.
>
> --v2
> -Use clamp function in linux/minmax.h [Ankit]
>
> --v3
> -remove linux/minmax.h header
>
> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>

Should this be:

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/9102

> ---
>  drivers/gpu/drm/i915/display/intel_vdsc.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_vdsc.c b/drivers/gpu/drm/i915/display/intel_vdsc.c
> index 9d76c2756784..e4c395b4dc46 100644
> --- a/drivers/gpu/drm/i915/display/intel_vdsc.c
> +++ b/drivers/gpu/drm/i915/display/intel_vdsc.c
> @@ -80,13 +80,19 @@ calculate_rc_params(struct drm_dsc_config *vdsc_cfg)
>  	int bpc = vdsc_cfg->bits_per_component;
>  	int bpp = vdsc_cfg->bits_per_pixel >> 4;
>  	int qp_bpc_modifier = (bpc - 8) * 2;
> +	int uncompressed_bpg_rate;
> +	int first_line_bpg_offset;
>  	u32 res, buf_i, bpp_i;
>  
>  	if (vdsc_cfg->slice_height >= 8)
> -		vdsc_cfg->first_line_bpg_offset =
> -			12 + DIV_ROUND_UP((9 * min(34, vdsc_cfg->slice_height - 8)), 100);
> +		first_line_bpg_offset =
> +			12 + (9 * min(34, vdsc_cfg->slice_height - 8)) / 100;
>  	else
> -		vdsc_cfg->first_line_bpg_offset = 2 * (vdsc_cfg->slice_height - 1);
> +		first_line_bpg_offset = 2 * (vdsc_cfg->slice_height - 1);
> +
> +	uncompressed_bpg_rate = (3 * bpc + (vdsc_cfg->convert_rgb ? 0 : 2)) * 3;
> +	vdsc_cfg->first_line_bpg_offset = clamp(first_line_bpg_offset, 0,
> +						uncompressed_bpg_rate - 3 * bpp);
>  
>  	/*
>  	 * According to DSC 1.2 spec in Section 4.1 if native_420 is set:

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2023-08-14 11:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-03 16:02 [Intel-gfx] [PATCH] drm/i915/vdsc: Fix first_line_bpg_offset calculation Suraj Kandpal
2023-08-03 18:31 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2023-08-03 18:31 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-08-03 18:47 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-08-04  2:12 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2023-08-04  7:55 ` [Intel-gfx] [PATCH] " Nautiyal, Ankit K
2023-08-07  2:45   ` Tseng, William
2023-08-04  8:28 ` Suraj Kandpal
2023-08-04  8:37   ` Suraj Kandpal
2023-08-14 11:30     ` Jani Nikula [this message]
2023-08-14 12:55       ` Kandpal, Suraj
2023-08-04 10:30 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/vdsc: Fix first_line_bpg_offset calculation (rev3) Patchwork
2023-08-04 10:30 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-08-04 10:44 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-08-04 15:28 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=87edk5zwrn.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=juha-pekka.heikkila@intel.com \
    --cc=suraj.kandpal@intel.com \
    --cc=william.tseng@intel.com \
    /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.