All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Manasi Navare <navaremanasi@chromium.org>,
	intel-gfx@lists.freedesktop.org
Cc: Manasi Navare <navaremanasi@chromium.org>,
	Suraj Kandpal <suraj.kandpal@intel.com>,
	Ankit Nautiyal <ankit.k.nautiyal@intel.com>,
	Animesh Manna <animesh.manna@intel.com>,
	Sean Paul <sean@poorly.run>,
	Drew Davenport <ddavenport@chromium.org>
Subject: Re: [PATCH v2] drm/i915/dsc: Fix the macro that calculates DSCC_/DSCA_ PPS reg address
Date: Mon, 05 Feb 2024 14:02:56 +0200	[thread overview]
Message-ID: <878r3zdspb.fsf@intel.com> (raw)
In-Reply-To: <20240202204752.1210687-1-navaremanasi@chromium.org>

On Fri, 02 Feb 2024, Manasi Navare <navaremanasi@chromium.org> wrote:
> Commit bd077259d0a9 ("drm/i915/vdsc: Add function to read any PPS register") defines
> a new macro to calculate the DSC PPS register addresses with PPS number as an
> input. This macro correctly calculates the addresses till PPS 11 since the
> addresses increment by 4. So in that case the following macro works correctly
> to give correct register address:
> _MMIO(_DSCA_PPS_0 + (pps) * 4)
>
> However after PPS 11, the register address for PPS 12 increments by 12 because
> of RC Buffer memory allocation in between. Because of this discontinuity
> in the address space, the macro calculates wrong addresses for PPS 12 - 16
> resulting into incorrect DSC PPS parameter value read/writes causing DSC
> corruption.
>
> This fixes it by correcting this macro to add the offset of 12 for
> PPS >=12.
>
> Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/10172
> Fixes: bd077259d0a9 ("drm/i915/vdsc: Add function to read any PPS register")
> Cc: Suraj Kandpal <suraj.kandpal@intel.com>
> Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> Cc: Animesh Manna <animesh.manna@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Sean Paul <sean@poorly.run>
> Cc: Drew Davenport <ddavenport@chromium.org>
> Signed-off-by: Manasi Navare <navaremanasi@chromium.org>
> ---
>  drivers/gpu/drm/i915/display/intel_vdsc_regs.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_vdsc_regs.h b/drivers/gpu/drm/i915/display/intel_vdsc_regs.h
> index 64f440fdc22b..e676440af369 100644
> --- a/drivers/gpu/drm/i915/display/intel_vdsc_regs.h
> +++ b/drivers/gpu/drm/i915/display/intel_vdsc_regs.h
> @@ -51,8 +51,8 @@
>  #define DSCC_PICTURE_PARAMETER_SET_0		_MMIO(0x6BA00)
>  #define _DSCA_PPS_0				0x6B200
>  #define _DSCC_PPS_0				0x6BA00
> -#define DSCA_PPS(pps)				_MMIO(_DSCA_PPS_0 + (pps) * 4)
> -#define DSCC_PPS(pps)				_MMIO(_DSCC_PPS_0 + (pps) * 4)
> +#define DSCA_PPS(pps)				_MMIO(_DSCA_PPS_0 + ((pps < 12) ? (pps):(pps + 12)) * 4)
> +#define DSCC_PPS(pps)				_MMIO(_DSCC_PPS_0 + ((pps < 12) ? (pps):(pps + 12)) * 4)

pps still needs to be wrapped in parens like I said, to avoid precedence
issues. Also, spaces are needed around ":". They were all there in what
I suggested to be used, and checkpatch also notices both.

BR,
Jani.

>  #define _ICL_DSC0_PICTURE_PARAMETER_SET_0_PB	0x78270
>  #define _ICL_DSC1_PICTURE_PARAMETER_SET_0_PB	0x78370
>  #define _ICL_DSC0_PICTURE_PARAMETER_SET_0_PC	0x78470

-- 
Jani Nikula, Intel

  parent reply	other threads:[~2024-02-05 12:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02 20:47 [PATCH v2] drm/i915/dsc: Fix the macro that calculates DSCC_/DSCA_ PPS reg address Manasi Navare
2024-02-02 21:23 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2024-02-02 21:36 ` ✓ Fi.CI.BAT: success " Patchwork
2024-02-02 23:02 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-02-05 12:02 ` Jani Nikula [this message]
2024-02-05 17:46   ` [PATCH v2] " Manasi Navare

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=878r3zdspb.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=animesh.manna@intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=ddavenport@chromium.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=navaremanasi@chromium.org \
    --cc=sean@poorly.run \
    --cc=suraj.kandpal@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.