* [PATCH] drm/rockchip: vop2: Add mode valid callback for crtc
@ 2026-01-09 0:58 Andy Yan
2026-01-20 11:03 ` Daniel Stone
0 siblings, 1 reply; 6+ messages in thread
From: Andy Yan @ 2026-01-09 0:58 UTC (permalink / raw)
To: heiko
Cc: hjc, dri-devel, linux-arm-kernel, linux-kernel, linux-rockchip,
airlied, maarten.lankhorst, mripard, simona, Andy Yan
From: Andy Yan <andy.yan@rock-chips.com>
Filter the mode that can't output by the crtc.
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---
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: 84f1d42065381b7c3fbdeefe917e5e24ec0c6d87
branch: rk3576-dp-upstream
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] drm/rockchip: vop2: Add mode valid callback for crtc
@ 2026-01-16 0:59 Andy Yan
2026-01-16 16:49 ` Heiko Stübner
0 siblings, 1 reply; 6+ messages in thread
From: Andy Yan @ 2026-01-16 0:59 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>
Filter the mode that can't output by the crtc.
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/rockchip: vop2: Add mode valid callback for crtc
2026-01-16 0:59 [PATCH] drm/rockchip: vop2: Add mode valid callback for crtc Andy Yan
@ 2026-01-16 16:49 ` Heiko Stübner
2026-01-17 2:09 ` Andy Yan
0 siblings, 1 reply; 6+ messages in thread
From: Heiko Stübner @ 2026-01-16 16:49 UTC (permalink / raw)
To: Andy Yan
Cc: hjc, mripard, maarten.lankhorst, tzimmermann, airlied, simona,
dri-devel, linux-arm-kernel, linux-rockchip, linux-kernel,
Andy Yan
Hi Andy,
Am Freitag, 16. Januar 2026, 01:59:49 Mitteleuropäische Normalzeit schrieb Andy Yan:
> From: Andy Yan <andy.yan@rock-chips.com>
when resending an unmodified patch, please mark the subject as
[PATCH RESEND] ....
> Filter the mode that can't output by the crtc.
In commit 8e140cb60270 ("drm/rockchip: vop: limit maximum resolution to
hardware capabilities") which introduced the similar check on VOP(1), we
had additional information, in that the VOP1 hardware does not have
an output height limit. Is the same true for VOP2 ?
Because then I'd like to extend the commit description to something like:
======= 8< =======
The different VOP variants support different maximum resolutions. Reject
resolutions that are not supported by a specific variant.
Only the output width is checked because the hardware itself does not
have a hard output height limit.
======= 8< =======
Because when someone sees the code later they might ask why the height
is not checked, so having that in the commit description allows us all to
remember why the check is this specific way :-)
Thanks
Heiko
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> ---
> 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,
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re:Re: [PATCH] drm/rockchip: vop2: Add mode valid callback for crtc
2026-01-16 16:49 ` Heiko Stübner
@ 2026-01-17 2:09 ` Andy Yan
0 siblings, 0 replies; 6+ messages in thread
From: Andy Yan @ 2026-01-17 2:09 UTC (permalink / raw)
To: Heiko Stübner
Cc: hjc, mripard, maarten.lankhorst, tzimmermann, airlied, simona,
dri-devel, linux-arm-kernel, linux-rockchip, linux-kernel,
Andy Yan
Hello Heiko,
在 2026-01-17 00:49:23,"Heiko Stübner" <heiko@sntech.de> 写道:
>Hi Andy,
>
>Am Freitag, 16. Januar 2026, 01:59:49 Mitteleuropäische Normalzeit schrieb Andy Yan:
>> From: Andy Yan <andy.yan@rock-chips.com>
>
>when resending an unmodified patch, please mark the subject as
>[PATCH RESEND] ....
>
Sorry, I forgot that this patch had already been sent out once before
>> Filter the mode that can't output by the crtc.
>
>In commit 8e140cb60270 ("drm/rockchip: vop: limit maximum resolution to
>hardware capabilities") which introduced the similar check on VOP(1), we
>had additional information, in that the VOP1 hardware does not have
>an output height limit. Is the same true for VOP2 ?
>
>Because then I'd like to extend the commit description to something like:
>======= 8< =======
>The different VOP variants support different maximum resolutions. Reject
>resolutions that are not supported by a specific variant.
>
>Only the output width is checked because the hardware itself does not
>have a hard output height limit.
>======= 8< =======
>
>Because when someone sees the code later they might ask why the height
>is not checked, so having that in the commit description allows us all to
>remember why the check is this specific way :-)
Done in V2
>
>Thanks
>Heiko
>
>> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
>> ---
>> 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,
>>
>
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/rockchip: vop2: Add mode valid callback for crtc
2026-01-09 0:58 Andy Yan
@ 2026-01-20 11:03 ` Daniel Stone
2026-01-20 11:24 ` Daniel Stone
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Stone @ 2026-01-20 11:03 UTC (permalink / raw)
To: Andy Yan
Cc: heiko, hjc, dri-devel, linux-arm-kernel, linux-kernel,
linux-rockchip, airlied, maarten.lankhorst, mripard, simona,
Andy Yan
Hi Andy,
On Fri, 9 Jan 2026 at 00:59, Andy Yan <andyshrk@163.com> wrote:
> Filter the mode that can't output by the crtc.
>
> [...]
>
> +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;
Why not test height as well?
Cheers,
Daniel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/rockchip: vop2: Add mode valid callback for crtc
2026-01-20 11:03 ` Daniel Stone
@ 2026-01-20 11:24 ` Daniel Stone
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Stone @ 2026-01-20 11:24 UTC (permalink / raw)
To: Andy Yan
Cc: heiko, hjc, dri-devel, linux-arm-kernel, linux-kernel,
linux-rockchip, airlied, maarten.lankhorst, mripard, simona,
Andy Yan
Hi Andy,
On Tue, 20 Jan 2026 at 11:03, Daniel Stone <daniel@fooishbar.org> wrote:
> On Fri, 9 Jan 2026 at 00:59, Andy Yan <andyshrk@163.com> wrote:
> > Filter the mode that can't output by the crtc.
> >
> > [...]
> >
> > +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;
>
> Why not test height as well?
I see the question was answered about 45 minutes ago ... anyway, why
not as a follow-up, change struct vop_rect max_output to just a single
max_width value?
Cheers,
Daniel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-01-20 11:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-16 0:59 [PATCH] drm/rockchip: vop2: Add mode valid callback for crtc Andy Yan
2026-01-16 16:49 ` Heiko Stübner
2026-01-17 2:09 ` Andy Yan
-- strict thread matches above, loose matches on Subject: below --
2026-01-09 0:58 Andy Yan
2026-01-20 11:03 ` Daniel Stone
2026-01-20 11:24 ` Daniel Stone
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox