mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: lyude@redhat.com
To: Mohamed Ahmed <mohamedahmedegypt2001@gmail.com>,
	 linux-kernel@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org,
	Danilo Krummrich <dakr@kernel.org>,
	 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann	 <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>,
	Simona Vetter	 <simona@ffwll.ch>,
	Mary Guillemard <mary@mary.zone>,
		nouveau@lists.freedesktop.org
Subject: Re: [PATCH 6/7] nouveau/dispnv50: program pixel clocks above 2.147GHz on GB20x
Date: Mon, 17 Aug 2026 18:43:35 -0400	[thread overview]
Message-ID: <71b8aaed1153fe1b5562db4dd395bb205f04d0ec.camel@redhat.com> (raw)
In-Reply-To: <20260814235705.59132-7-mohamedahmedegypt2001@gmail.com>

On Sat, 2026-08-15 at 03:57 +0400, Mohamed Ahmed wrote:
> The HEAD_SET_PIXEL_CLOCK_FREQUENCY(_MAX) methods carry only 31 HERTZ
> bits. Starting with C97D the upper bits live in separate
> HEAD_SET_PIXEL_CLOCK_FREQUENCY_HI(_MAX) methods, which nouveau never
> programmed and headca7d_mode() computed m->clock * 1000 into the 31-
> bit
> field. NVVAL's mask then silently truncates anything past 2^31 Hz,
> which
> means that every mode scanned out at pclk modulo 2^31.
> 
> No mode nouveau can currently commit crosses the boundary (an
> uncompressed HDMI FRL mode tops out around 1.78GHz at 8bpc), but this
> is
> a prerequisite for the upcoming DSC work, which makes 2.147GHz+ modes
> reachable.
> 
> Program the full value split across the low and HI methods, exactly
> as OpenRM's EvoSetRasterParams9() does (nvkms-evo4.c, 31-bit low word
> plus the 4 HI HERTZ bits, giving 35 bits of range).
> 
> Signed-off-by: Mohamed Ahmed <mohamedahmedegypt2001@gmail.com>
> ---
>  drivers/gpu/drm/nouveau/dispnv50/headca7d.c   | 21 ++++++++++++++++-
> --
>  .../drm/nouveau/include/nvhw/class/clca7d.h   |  4 ++++
>  2 files changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/dispnv50/headca7d.c
> b/drivers/gpu/drm/nouveau/dispnv50/headca7d.c
> index eeaeb15aa664..2046e38a4d79 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/headca7d.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/headca7d.c
> @@ -219,10 +219,11 @@ headca7d_mode(struct nv50_head *head, struct
> nv50_head_atom *asyh)
>  {
>  	struct nvif_push *push = &head->disp->core->chan.push;
>  	struct nv50_head_mode *m = &asyh->mode;
> +	const u64 hz = (u64)m->clock * 1000;
>  	const int i = head->base.index;
>  	int ret;
>  
> -	ret = PUSH_WAIT(push, 11);
> +	ret = PUSH_WAIT(push, 15);

This can be 14, see below

>  	if (ret)
>  		return ret;
>  
> @@ -245,11 +246,25 @@ headca7d_mode(struct nv50_head *head, struct
> nv50_head_atom *asyh)
>  	PUSH_MTHD(push, NVCA7D, HEAD_SET_CONTROL(i),
>  		  NVDEF(NVCA7D, HEAD_SET_CONTROL, STRUCTURE,
> PROGRESSIVE));
>  
> +	/* The FREQUENCY methods carry only 31 HERTZ bits; the upper
> bits
> +	 * of anything past 2.147GHz live in the HI methods
> +	 * (EvoSetRasterParams9()). Truncation here scans out at
> pclk modulo 2^31.
> +	 */
>  	PUSH_MTHD(push, NVCA7D, HEAD_SET_PIXEL_CLOCK_FREQUENCY(i),
> -		  NVVAL(NVCA7D, HEAD_SET_PIXEL_CLOCK_FREQUENCY,
> HERTZ, m->clock * 1000));
> +		  NVVAL(NVCA7D, HEAD_SET_PIXEL_CLOCK_FREQUENCY,
> HERTZ,
> +			(u32)(hz & 0x7fffffff)));
>  
>  	PUSH_MTHD(push, NVCA7D,
> HEAD_SET_PIXEL_CLOCK_FREQUENCY_MAX(i),
> -		  NVVAL(NVCA7D, HEAD_SET_PIXEL_CLOCK_FREQUENCY_MAX,
> HERTZ, m->clock * 1000));
> +		  NVVAL(NVCA7D, HEAD_SET_PIXEL_CLOCK_FREQUENCY_MAX,
> HERTZ,
> +			(u32)(hz & 0x7fffffff)));
> +
> +	PUSH_MTHD(push, NVCA7D,
> HEAD_SET_PIXEL_CLOCK_FREQUENCY_HI(i),
> +		  NVVAL(NVCA7D, HEAD_SET_PIXEL_CLOCK_FREQUENCY_HI,
> HERTZ,
> +			(u32)(hz >> 31)));
> +
> +	PUSH_MTHD(push, NVCA7D,
> HEAD_SET_PIXEL_CLOCK_FREQUENCY_HI_MAX(i),
> +		  NVVAL(NVCA7D,
> HEAD_SET_PIXEL_CLOCK_FREQUENCY_HI_MAX, HERTZ,
> +			(u32)(hz >> 31)));

These last two PUSH_MTHDs can be combined since each mthd comes one
after the other:

PUSH_MTHD(push, NVCA7D, HEAD_SET_PIXEL_CLOCK_FREQUENCY_HI(i),
	  NVVAL(NVCA7D, HEAD_SET_PIXEL_CLOCK_FREQUENCY_HI, HERTZ,
		(u32)(hz >> 31)),

	  		HEAD_SET_PIXEL_CLOCK_FREQUENCY_HI_MAX(i),
	  NVVAL(NVCA7D, HEAD_SET_PIXEL_CLOCK_FREQUENCY_HI_MAX(i),
		(u32 hz >> 31)));

That also lets you go from 15 to 14 in the PUSH_WAIT above.

>  
>  	return 0;
>  }
> diff --git a/drivers/gpu/drm/nouveau/include/nvhw/class/clca7d.h
> b/drivers/gpu/drm/nouveau/include/nvhw/class/clca7d.h
> index 0fec6fc21d44..1ab12d91c9d9 100644
> --- a/drivers/gpu/drm/nouveau/include/nvhw/class/clca7d.h
> +++ b/drivers/gpu/drm/nouveau/include/nvhw/class/clca7d.h
> @@ -653,6 +653,10 @@
>  #define
> NVCA7D_HEAD_SET_PIXEL_CLOCK_FREQUENCY_MAX_ADJ1000DIV1001             
>    31:31
>  #define
> NVCA7D_HEAD_SET_PIXEL_CLOCK_FREQUENCY_MAX_ADJ1000DIV1001_FALSE       
>    (0x00000000)
>  #define
> NVCA7D_HEAD_SET_PIXEL_CLOCK_FREQUENCY_MAX_ADJ1000DIV1001_TRUE        
>    (0x00000001)
> +#define
> NVCA7D_HEAD_SET_PIXEL_CLOCK_FREQUENCY_HI(a)                          
>    (0x000020C0 + (a)*0x00000800)
> +#define
> NVCA7D_HEAD_SET_PIXEL_CLOCK_FREQUENCY_HI_HERTZ                       
>    3:0
> +#define
> NVCA7D_HEAD_SET_PIXEL_CLOCK_FREQUENCY_HI_MAX(a)                      
>    (0x000020C4 + (a)*0x00000800)
> +#define
> NVCA7D_HEAD_SET_PIXEL_CLOCK_FREQUENCY_HI_MAX_HERTZ                   
>    3:0
>  #define
> NVCA7D_HEAD_SET_HEAD_USAGE_BOUNDS(a)                                 
>    (0x00002030 + (a)*0x00000800)
>  #define
> NVCA7D_HEAD_SET_HEAD_USAGE_BOUNDS_CURSOR                             
>    2:0
>  #define
> NVCA7D_HEAD_SET_HEAD_USAGE_BOUNDS_CURSOR_USAGE_NONE                  
>    (0x00000000)


  reply	other threads:[~2026-08-17 22:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 23:56 [PATCH 0/7] nouveau: assorted display fixes (GB20x, r570 DP_CONFIG_STREAM, HF-EEODB EDIDs) Mohamed Ahmed
2026-08-14 23:56 ` [PATCH 1/7] nouveau/disp: add GB20x HDMI vendor infoframe writer Mohamed Ahmed
2026-08-14 23:57 ` [PATCH 2/7] nouveau/gsp: fix HDMI vendor infoframes on GB20x Mohamed Ahmed
2026-08-17 21:49   ` lyude
2026-08-14 23:57 ` [PATCH 3/7] nouveau/gsp: fix HDMI GCP AVMute register offsets " Mohamed Ahmed
2026-08-14 23:57 ` [PATCH 4/7] nouveau/gsp: use per-version DP_CONFIG_STREAM params on r570 firmware Mohamed Ahmed
2026-08-17 22:05   ` lyude
2026-08-14 23:57 ` [PATCH 5/7] nouveau/gsp: fix vblank interrupts on GB20x Mohamed Ahmed
2026-08-17 22:59   ` lyude
2026-08-18 20:02     ` Mohamed Ahmed
2026-08-18 20:06       ` lyude
2026-08-18 20:09         ` Mohamed Ahmed
2026-08-14 23:57 ` [PATCH 6/7] nouveau/dispnv50: program pixel clocks above 2.147GHz " Mohamed Ahmed
2026-08-17 22:43   ` lyude [this message]
2026-08-14 23:57 ` [PATCH 7/7] nouveau: honor HF-EEODB EDIDs by converting to struct drm_edid Mohamed Ahmed
2026-08-17 23:51   ` lyude

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=71b8aaed1153fe1b5562db4dd395bb205f04d0ec.camel@redhat.com \
    --to=lyude@redhat.com \
    --cc=airlied@gmail.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mary@mary.zone \
    --cc=mohamedahmedegypt2001@gmail.com \
    --cc=mripard@kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /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

all inboxes | Powered by JetHome®