public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/rockchip: vop2: Add mode valid callback for crtc
@ 2026-01-17  2:07 Andy Yan
  2026-01-18 23:43 ` Sebastian Reichel
  2026-01-20 10:18 ` Heiko Stuebner
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Yan @ 2026-01-17  2:07 UTC (permalink / raw)
  To: heiko
  Cc: hjc, mripard, maarten.lankhorst, tzimmermann, airlied, simona,
	dri-devel, linux-arm-kernel, linux-rockchip, linux-kernel,
	Andy Yan

From: Andy Yan <andy.yan@rock-chips.com>

The different Video Ports support different maximum resolutions.
Reject resolutions that are not supported by a specific VP.

Only the output width is checked because the hardware itself does
not have a hard output height limit.

Filter the mode that can't output by the VP/crtc.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>

---

Changes in v2:
- Add more detailed commit message

 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index 498df0ce4680..74fba29bfff3 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -1439,6 +1439,17 @@ static void vop2_crtc_disable_vblank(struct drm_crtc *crtc)
 	vop2_crtc_disable_irq(vp, VP_INT_FS_FIELD);
 }
 
+static enum drm_mode_status vop2_crtc_mode_valid(struct drm_crtc *crtc,
+						 const struct drm_display_mode *mode)
+{
+	struct vop2_video_port *vp = to_vop2_video_port(crtc);
+
+	if (mode->hdisplay > vp->data->max_output.width)
+		return MODE_BAD_HVALUE;
+
+	return MODE_OK;
+}
+
 static bool vop2_crtc_mode_fixup(struct drm_crtc *crtc,
 				 const struct drm_display_mode *mode,
 				 struct drm_display_mode *adj_mode)
@@ -1884,6 +1895,7 @@ static void vop2_crtc_atomic_flush(struct drm_crtc *crtc,
 
 static const struct drm_crtc_helper_funcs vop2_crtc_helper_funcs = {
 	.mode_fixup = vop2_crtc_mode_fixup,
+	.mode_valid = vop2_crtc_mode_valid,
 	.atomic_check = vop2_crtc_atomic_check,
 	.atomic_begin = vop2_crtc_atomic_begin,
 	.atomic_flush = vop2_crtc_atomic_flush,
-- 
2.43.0

base-commit: 1613a67b5360d6ff78f62143a1cf123414a1b4d9
branch: rk3576-dp-upstream



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] drm/rockchip: vop2: Add mode valid callback for crtc
  2026-01-17  2:07 [PATCH v2] drm/rockchip: vop2: Add mode valid callback for crtc Andy Yan
@ 2026-01-18 23:43 ` Sebastian Reichel
  2026-01-19  2:42   ` Andy Yan
  2026-01-20 10:18 ` Heiko Stuebner
  1 sibling, 1 reply; 4+ messages in thread
From: Sebastian Reichel @ 2026-01-18 23:43 UTC (permalink / raw)
  To: Andy Yan
  Cc: heiko, hjc, mripard, maarten.lankhorst, tzimmermann, airlied,
	simona, dri-devel, linux-arm-kernel, linux-rockchip, linux-kernel,
	Andy Yan

[-- Attachment #1: Type: text/plain, Size: 2802 bytes --]

Hi,

On Sat, Jan 17, 2026 at 10:07:30AM +0800, Andy Yan wrote:
> From: Andy Yan <andy.yan@rock-chips.com>
> 
> The different Video Ports support different maximum resolutions.
> Reject resolutions that are not supported by a specific VP.
> 
> Only the output width is checked because the hardware itself does
> not have a hard output height limit.
> 
> Filter the mode that can't output by the VP/crtc.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> 
> ---

A common RK3576 setup is VP0 mapped to HDMI and VP1 mapped to USB-C
DP AltMode. Since RK3576 VP1 only supports 2.5K, this can easily
become relevant when connecting a 4K screen via USB-C DP AltMode.
I've tested that this patch properly drops all unsupported modes
based on the resolution.

Further checks will be needed to ensure the bandwidth requirements
are also met (e.g. RK3576 VP1 only supports 2.5K@60Hz, so 2.5K@120Hz
should be marked as BAD). I think the bandwidth check should be a
separate patch, but thought it might be worth mentioning here in
case somebody stumbles over it.

Anyways:

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.com> # Sige5

Greetings,

-- Sebastian

> 
> Changes in v2:
> - Add more detailed commit message
> 
>  drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> index 498df0ce4680..74fba29bfff3 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> @@ -1439,6 +1439,17 @@ static void vop2_crtc_disable_vblank(struct drm_crtc *crtc)
>  	vop2_crtc_disable_irq(vp, VP_INT_FS_FIELD);
>  }
>  
> +static enum drm_mode_status vop2_crtc_mode_valid(struct drm_crtc *crtc,
> +						 const struct drm_display_mode *mode)
> +{
> +	struct vop2_video_port *vp = to_vop2_video_port(crtc);
> +
> +	if (mode->hdisplay > vp->data->max_output.width)
> +		return MODE_BAD_HVALUE;
> +
> +	return MODE_OK;
> +}
> +
>  static bool vop2_crtc_mode_fixup(struct drm_crtc *crtc,
>  				 const struct drm_display_mode *mode,
>  				 struct drm_display_mode *adj_mode)
> @@ -1884,6 +1895,7 @@ static void vop2_crtc_atomic_flush(struct drm_crtc *crtc,
>  
>  static const struct drm_crtc_helper_funcs vop2_crtc_helper_funcs = {
>  	.mode_fixup = vop2_crtc_mode_fixup,
> +	.mode_valid = vop2_crtc_mode_valid,
>  	.atomic_check = vop2_crtc_atomic_check,
>  	.atomic_begin = vop2_crtc_atomic_begin,
>  	.atomic_flush = vop2_crtc_atomic_flush,
> -- 
> 2.43.0
> 
> base-commit: 1613a67b5360d6ff78f62143a1cf123414a1b4d9
> branch: rk3576-dp-upstream
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re:Re: [PATCH v2] drm/rockchip: vop2: Add mode valid callback for crtc
  2026-01-18 23:43 ` Sebastian Reichel
@ 2026-01-19  2:42   ` Andy Yan
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Yan @ 2026-01-19  2:42 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: heiko, hjc, mripard, maarten.lankhorst, tzimmermann, airlied,
	simona, dri-devel, linux-arm-kernel, linux-rockchip, linux-kernel,
	Andy Yan


Hello Sebastian,

At 2026-01-19 07:43:35, "Sebastian Reichel" <sebastian.reichel@collabora.com> wrote:
>Hi,
>
>On Sat, Jan 17, 2026 at 10:07:30AM +0800, Andy Yan wrote:
>> From: Andy Yan <andy.yan@rock-chips.com>
>> 
>> The different Video Ports support different maximum resolutions.
>> Reject resolutions that are not supported by a specific VP.
>> 
>> Only the output width is checked because the hardware itself does
>> not have a hard output height limit.
>> 
>> Filter the mode that can't output by the VP/crtc.
>> 
>> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
>> 
>> ---
>
>A common RK3576 setup is VP0 mapped to HDMI and VP1 mapped to USB-C
>DP AltMode. Since RK3576 VP1 only supports 2.5K, this can easily
>become relevant when connecting a 4K screen via USB-C DP AltMode.
>I've tested that this patch properly drops all unsupported modes
>based on the resolution.
>
>Further checks will be needed to ensure the bandwidth requirements
>are also met (e.g. RK3576 VP1 only supports 2.5K@60Hz, so 2.5K@120Hz
>should be marked as BAD). I think the bandwidth check should be a
>separate patch, but thought it might be worth mentioning here in
>case somebody stumbles over it.

Yes, I also think it's better to do by a separate patch,  because we should add
more detail dclk description for every VP.  I will do it after this patch get merged.

>
>Anyways:
>
>Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
>Tested-by: Sebastian Reichel <sebastian.reichel@collabora.com> # Sige5
>
>Greetings,
>
>-- Sebastian
>
>> 
>> Changes in v2:
>> - Add more detailed commit message
>> 
>>  drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 12 ++++++++++++
>>  1 file changed, 12 insertions(+)
>> 
>> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
>> index 498df0ce4680..74fba29bfff3 100644
>> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
>> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
>> @@ -1439,6 +1439,17 @@ static void vop2_crtc_disable_vblank(struct drm_crtc *crtc)
>>  	vop2_crtc_disable_irq(vp, VP_INT_FS_FIELD);
>>  }
>>  
>> +static enum drm_mode_status vop2_crtc_mode_valid(struct drm_crtc *crtc,
>> +						 const struct drm_display_mode *mode)
>> +{
>> +	struct vop2_video_port *vp = to_vop2_video_port(crtc);
>> +
>> +	if (mode->hdisplay > vp->data->max_output.width)
>> +		return MODE_BAD_HVALUE;
>> +
>> +	return MODE_OK;
>> +}
>> +
>>  static bool vop2_crtc_mode_fixup(struct drm_crtc *crtc,
>>  				 const struct drm_display_mode *mode,
>>  				 struct drm_display_mode *adj_mode)
>> @@ -1884,6 +1895,7 @@ static void vop2_crtc_atomic_flush(struct drm_crtc *crtc,
>>  
>>  static const struct drm_crtc_helper_funcs vop2_crtc_helper_funcs = {
>>  	.mode_fixup = vop2_crtc_mode_fixup,
>> +	.mode_valid = vop2_crtc_mode_valid,
>>  	.atomic_check = vop2_crtc_atomic_check,
>>  	.atomic_begin = vop2_crtc_atomic_begin,
>>  	.atomic_flush = vop2_crtc_atomic_flush,
>> -- 
>> 2.43.0
>> 
>> base-commit: 1613a67b5360d6ff78f62143a1cf123414a1b4d9
>> branch: rk3576-dp-upstream
>> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] drm/rockchip: vop2: Add mode valid callback for crtc
  2026-01-17  2:07 [PATCH v2] drm/rockchip: vop2: Add mode valid callback for crtc Andy Yan
  2026-01-18 23:43 ` Sebastian Reichel
@ 2026-01-20 10:18 ` Heiko Stuebner
  1 sibling, 0 replies; 4+ messages in thread
From: Heiko Stuebner @ 2026-01-20 10:18 UTC (permalink / raw)
  To: Andy Yan
  Cc: Heiko Stuebner, hjc, mripard, maarten.lankhorst, tzimmermann,
	airlied, simona, dri-devel, linux-arm-kernel, linux-rockchip,
	linux-kernel, Andy Yan


On Sat, 17 Jan 2026 10:07:30 +0800, Andy Yan wrote:
> The different Video Ports support different maximum resolutions.
> Reject resolutions that are not supported by a specific VP.
> 
> Only the output width is checked because the hardware itself does
> not have a hard output height limit.
> 
> Filter the mode that can't output by the VP/crtc.
> 
> [...]

Applied, thanks!

[1/1] drm/rockchip: vop2: Add mode valid callback for crtc
      commit: 88b14b9279d824dd84bdda20c7b2fdb4b285dd25

Best regards,
-- 
Heiko Stuebner <heiko@sntech.de>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-01-20 10:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-17  2:07 [PATCH v2] drm/rockchip: vop2: Add mode valid callback for crtc Andy Yan
2026-01-18 23:43 ` Sebastian Reichel
2026-01-19  2:42   ` Andy Yan
2026-01-20 10:18 ` Heiko Stuebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox