mbox series

[v5,0/4] drm/rockchip: dw_hdmi: Add 4k@30 support

Message ID 20230208090816.3810589-1-s.hauer@pengutronix.de (mailing list archive)
Headers show
Series drm/rockchip: dw_hdmi: Add 4k@30 support | expand

Message

Sascha Hauer Feb. 8, 2023, 9:08 a.m. UTC
Some more small changes to this series, see changelog.

Sascha

Changes since v4:
- Use struct vop_reg to store resolutions
- Only check for valid clock rates when clock != NULL

Changes since v3
- Add patch to limit VOP resolutions to hardware capabilitie

Changes since v2:
- Use correct register values for mpll_cfg
- Add patch to discard modes we cannot achieve

Changes since v1:
- Allow non standard clock rates only on Synopsys phy as suggested by
  Robin Murphy

Sascha Hauer (4):
  drm/rockchip: vop: limit maximium resolution to hardware capabilities
  drm/rockchip: dw_hdmi: relax mode_valid hook
  drm/rockchip: dw_hdmi: Add support for 4k@30 resolution
  drm/rockchip: dw_hdmi: discard modes with unachievable pixelclocks

 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c  | 41 ++++++++++++++++----
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c  | 15 +++++++
 drivers/gpu/drm/rockchip/rockchip_drm_vop.h  |  6 +++
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.h |  5 ---
 drivers/gpu/drm/rockchip/rockchip_vop_reg.c  | 18 +++++++++
 5 files changed, 73 insertions(+), 12 deletions(-)

Comments

FUKAUMI Naoki Feb. 13, 2023, 7:11 a.m. UTC | #1
hi,

on my rk3399 boards(ROCK Pi 4B+ and ROCK 4C+), fb0 is configured as 
1920x1080, and nothing is displayed... "no signal" on display.

--
FUKAUMI Naoki

On 2/8/23 18:08, Sascha Hauer wrote:
> Some more small changes to this series, see changelog.
> 
> Sascha
> 
> Changes since v4:
> - Use struct vop_reg to store resolutions
> - Only check for valid clock rates when clock != NULL
> 
> Changes since v3
> - Add patch to limit VOP resolutions to hardware capabilitie
> 
> Changes since v2:
> - Use correct register values for mpll_cfg
> - Add patch to discard modes we cannot achieve
> 
> Changes since v1:
> - Allow non standard clock rates only on Synopsys phy as suggested by
>    Robin Murphy
> 
> Sascha Hauer (4):
>    drm/rockchip: vop: limit maximium resolution to hardware capabilities
>    drm/rockchip: dw_hdmi: relax mode_valid hook
>    drm/rockchip: dw_hdmi: Add support for 4k@30 resolution
>    drm/rockchip: dw_hdmi: discard modes with unachievable pixelclocks
> 
>   drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c  | 41 ++++++++++++++++----
>   drivers/gpu/drm/rockchip/rockchip_drm_vop.c  | 15 +++++++
>   drivers/gpu/drm/rockchip/rockchip_drm_vop.h  |  6 +++
>   drivers/gpu/drm/rockchip/rockchip_drm_vop2.h |  5 ---
>   drivers/gpu/drm/rockchip/rockchip_vop_reg.c  | 18 +++++++++
>   5 files changed, 73 insertions(+), 12 deletions(-)
>
Sascha Hauer Feb. 14, 2023, 3:43 p.m. UTC | #2
On Mon, Feb 13, 2023 at 04:11:46PM +0900, FUKAUMI Naoki wrote:
> hi,
> 
> on my rk3399 boards(ROCK Pi 4B+ and ROCK 4C+), fb0 is configured as
> 1920x1080, and nothing is displayed... "no signal" on display.

I can confirm this.

First of all there is a stupid bug in my patch:

> +       if (vop->data->max_output.width && mode->hdisplay > vop->data->max_output.height)
> +               return MODE_BAD_HVALUE;

The comparison should be against the width here of course, not against
the height. Fixing this should at least allow you to display something
when a 1080p display is connected.

The other problem comes with the legacy fbdev emulation. I think failure
is pretty much expected here. The fbdev emulation happens to use the
VOPL to display a 4k picture, but the VOPL can only do up to 2560x1600
and so the mode is denied in vop_crtc_mode_valid(). Quoting Daniel Stone
on this topic:

> You've done the right thing. Userspace should detect this and try with
> alternative CRTC routing. The kernel shouldn't be trying to solve this
> problem.

Trying an alternative CRTC routing is exactly what the fbdev emulation
doesn't do. Now my "userspace" is in kernel and the kernel shouldn't try
to solve this problem. We're trapped :-/

Sascha

> 
> --
> FUKAUMI Naoki
> 
> On 2/8/23 18:08, Sascha Hauer wrote:
> > Some more small changes to this series, see changelog.
> > 
> > Sascha
> > 
> > Changes since v4:
> > - Use struct vop_reg to store resolutions
> > - Only check for valid clock rates when clock != NULL
> > 
> > Changes since v3
> > - Add patch to limit VOP resolutions to hardware capabilitie
> > 
> > Changes since v2:
> > - Use correct register values for mpll_cfg
> > - Add patch to discard modes we cannot achieve
> > 
> > Changes since v1:
> > - Allow non standard clock rates only on Synopsys phy as suggested by
> >    Robin Murphy
> > 
> > Sascha Hauer (4):
> >    drm/rockchip: vop: limit maximium resolution to hardware capabilities
> >    drm/rockchip: dw_hdmi: relax mode_valid hook
> >    drm/rockchip: dw_hdmi: Add support for 4k@30 resolution
> >    drm/rockchip: dw_hdmi: discard modes with unachievable pixelclocks
> > 
> >   drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c  | 41 ++++++++++++++++----
> >   drivers/gpu/drm/rockchip/rockchip_drm_vop.c  | 15 +++++++
> >   drivers/gpu/drm/rockchip/rockchip_drm_vop.h  |  6 +++
> >   drivers/gpu/drm/rockchip/rockchip_drm_vop2.h |  5 ---
> >   drivers/gpu/drm/rockchip/rockchip_vop_reg.c  | 18 +++++++++
> >   5 files changed, 73 insertions(+), 12 deletions(-)
> > 
>
FUKAUMI Naoki Feb. 15, 2023, 9:22 a.m. UTC | #3
hi,

On 2/15/23 00:43, Sascha Hauer wrote:
> On Mon, Feb 13, 2023 at 04:11:46PM +0900, FUKAUMI Naoki wrote:
>> hi,
>>
>> on my rk3399 boards(ROCK Pi 4B+ and ROCK 4C+), fb0 is configured as
>> 1920x1080, and nothing is displayed... "no signal" on display.
> 
> I can confirm this.
> 
> First of all there is a stupid bug in my patch:
> 
>> +       if (vop->data->max_output.width && mode->hdisplay > vop->data->max_output.height)
>> +               return MODE_BAD_HVALUE;
> 
> The comparison should be against the width here of course, not against
> the height. Fixing this should at least allow you to display something
> when a 1080p display is connected.

with above fix, and modified dts either VOPL or VOPB enabled, I could 
get expected resolution on the display.

thank you so much for your nice work :)

--
FUKAUMI Naoki

> The other problem comes with the legacy fbdev emulation. I think failure
> is pretty much expected here. The fbdev emulation happens to use the
> VOPL to display a 4k picture, but the VOPL can only do up to 2560x1600
> and so the mode is denied in vop_crtc_mode_valid(). Quoting Daniel Stone
> on this topic:
> 
>> You've done the right thing. Userspace should detect this and try with
>> alternative CRTC routing. The kernel shouldn't be trying to solve this
>> problem.
> 
> Trying an alternative CRTC routing is exactly what the fbdev emulation
> doesn't do. Now my "userspace" is in kernel and the kernel shouldn't try
> to solve this problem. We're trapped :-/
> 
> Sascha
> 
>>
>> --
>> FUKAUMI Naoki
>>
>> On 2/8/23 18:08, Sascha Hauer wrote:
>>> Some more small changes to this series, see changelog.
>>>
>>> Sascha
>>>
>>> Changes since v4:
>>> - Use struct vop_reg to store resolutions
>>> - Only check for valid clock rates when clock != NULL
>>>
>>> Changes since v3
>>> - Add patch to limit VOP resolutions to hardware capabilitie
>>>
>>> Changes since v2:
>>> - Use correct register values for mpll_cfg
>>> - Add patch to discard modes we cannot achieve
>>>
>>> Changes since v1:
>>> - Allow non standard clock rates only on Synopsys phy as suggested by
>>>     Robin Murphy
>>>
>>> Sascha Hauer (4):
>>>     drm/rockchip: vop: limit maximium resolution to hardware capabilities
>>>     drm/rockchip: dw_hdmi: relax mode_valid hook
>>>     drm/rockchip: dw_hdmi: Add support for 4k@30 resolution
>>>     drm/rockchip: dw_hdmi: discard modes with unachievable pixelclocks
>>>
>>>    drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c  | 41 ++++++++++++++++----
>>>    drivers/gpu/drm/rockchip/rockchip_drm_vop.c  | 15 +++++++
>>>    drivers/gpu/drm/rockchip/rockchip_drm_vop.h  |  6 +++
>>>    drivers/gpu/drm/rockchip/rockchip_drm_vop2.h |  5 ---
>>>    drivers/gpu/drm/rockchip/rockchip_vop_reg.c  | 18 +++++++++
>>>    5 files changed, 73 insertions(+), 12 deletions(-)
>>>
>>
>