mbox series

[v7,00/24] drm/rockchip: RK356x VOP2 support

Message ID 20220225075150.2729401-1-s.hauer@pengutronix.de (mailing list archive)
Headers show
Series drm/rockchip: RK356x VOP2 support | expand

Message

Sascha Hauer Feb. 25, 2022, 7:51 a.m. UTC
Here is v7 of adding RK356x VOP2 support. The one big notable change this
time is that I moved the of_graph parsing from runtime code into
initialization, see patch 2/24. Other than that there are some smaller
changes due to the review feedback to v6.

Sascha

Changes since v6:
- Move of_graph parsing out of runtime code to initialization

Changes since v5:
- Add new patch to fix dw-hdmi of_graph binding
- Drop "drm/encoder: Add of_graph port to struct drm_encoder" and solve
  issue internally in the driver
- make checkpatch cleaner

Changes since v4:
- Reorder patches in a way that binding/dts/driver patches are closer together
- Drop clk patches already applied by Heiko

Changes since v3:
- added changelog to each patch
- Add 4k support to hdmi driver
- rebase on v5.17-rc1

Changes since v2:
- Add pin names to HDMI supply pin description
- Add hclk support to HDMI driver
- Dual license rockchip-vop2 binding, update binding
- Add HDMI connector to board dts files
- drop unnecessary gamma_lut registers from vop2
- Update dclk_vop[012] clock handling, no longer hacks needed
- Complete regmap conversion

Changes since v1:
- drop all unnecessary waiting for frames within atomic modeset and plane update
- Cluster subwin support removed
- gamma support removed
- unnecessary irq_lock removed
- interrupt handling simplified
- simplified zpos handling
- drop is_alpha_support(), use fb->format->has_alpha instead
- use devm_regulator_get() rather than devm_regulator_get_optional() for hdmi regulators
- Use fixed number of planes per video port
- Drop homegrown regmap code from vop2 driver (not complete yet)
- Add separate include file for vop2 driver to not pollute the vop include

Andy Yan (1):
  drm: rockchip: Add VOP2 driver

Benjamin Gaignard (1):
  dt-bindings: display: rockchip: dw-hdmi: Add compatible for rk3568
    HDMI

Douglas Anderson (2):
  drm/rockchip: dw_hdmi: Use auto-generated tables
  drm/rockchip: dw_hdmi: Set cur_ctr to 0 always

Michael Riesch (1):
  arm64: dts: rockchip: enable vop2 and hdmi tx on quartz64a

Nickey Yang (1):
  drm/rockchip: dw_hdmi: add default 594Mhz clk for 4K@60hz

Sascha Hauer (18):
  drm/rockchip: Embed drm_encoder into rockchip_decoder
  drm/rockchip: Add crtc_endpoint_id to rockchip_encoder
  drm/rockchip: dw_hdmi: rename vpll clock to reference clock
  dt-bindings: display: rockchip: dw-hdmi: use "ref" as clock name
  arm64: dts: rockchip: rk3399: rename HDMI ref clock to 'ref'
  drm/rockchip: dw_hdmi: add rk3568 support
  drm/rockchip: dw_hdmi: add regulator support
  dt-bindings: display: rockchip: dw-hdmi: Add regulator support
  drm/rockchip: dw_hdmi: Add support for hclk
  dt-bindings: display: rockchip: dw-hdmi: Add additional clock
  drm/rockchip: dw_hdmi: drop mode_valid hook
  dt-bindings: display: rockchip: dw-hdmi: Make unwedge pinctrl optional
  arm64: dts: rockchip: rk356x: Add VOP2 nodes
  arm64: dts: rockchip: rk356x: Add HDMI nodes
  arm64: dts: rockchip: rk3568-evb: Enable VOP2 and hdmi
  drm/rockchip: Make VOP driver optional
  dt-bindings: display: rockchip: Add binding for VOP2
  dt-bindings: display: rockchip: dw-hdmi: fix ports description

 .../display/rockchip/rockchip,dw-hdmi.yaml    |   53 +-
 .../display/rockchip/rockchip-vop2.yaml       |  140 +
 arch/arm64/boot/dts/rockchip/rk3399.dtsi      |    2 +-
 .../boot/dts/rockchip/rk3566-quartz64-a.dts   |   47 +
 arch/arm64/boot/dts/rockchip/rk3566.dtsi      |    4 +
 .../boot/dts/rockchip/rk3568-evb1-v10.dts     |   47 +
 arch/arm64/boot/dts/rockchip/rk3568.dtsi      |    4 +
 arch/arm64/boot/dts/rockchip/rk356x.dtsi      |   83 +
 drivers/gpu/drm/rockchip/Kconfig              |   14 +
 drivers/gpu/drm/rockchip/Makefile             |    4 +-
 .../gpu/drm/rockchip/analogix_dp-rockchip.c   |   32 +-
 drivers/gpu/drm/rockchip/cdn-dp-core.c        |   18 +-
 drivers/gpu/drm/rockchip/cdn-dp-core.h        |    2 +-
 .../gpu/drm/rockchip/dw-mipi-dsi-rockchip.c   |   17 +-
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c   |  292 +-
 drivers/gpu/drm/rockchip/inno_hdmi.c          |   32 +-
 drivers/gpu/drm/rockchip/rk3066_hdmi.c        |   34 +-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c   |   36 +-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h   |   20 +-
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c    |    2 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop.h   |   15 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c  | 2686 +++++++++++++++++
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.h  |  477 +++
 drivers/gpu/drm/rockchip/rockchip_lvds.c      |   26 +-
 drivers/gpu/drm/rockchip/rockchip_vop2_reg.c  |  281 ++
 include/dt-bindings/soc/rockchip,vop2.h       |   14 +
 26 files changed, 4186 insertions(+), 196 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_vop2.h
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
 create mode 100644 include/dt-bindings/soc/rockchip,vop2.h

Comments

Frank Wunderlich March 3, 2022, 4:07 p.m. UTC | #1
Tested this Series on my rk3568 Bananapi R2 Pro v00

Tested-by: Frank Wunderlich <frank-w@public-files.de>

regards Frank
Sascha Hauer March 7, 2022, 12:54 p.m. UTC | #2
Hi Andy,

On Mon, Mar 07, 2022 at 08:18:08PM +0800, Andy Yan wrote:
> Hi Sascha:
> 
> On 2/25/22 15:51, Sascha Hauer wrote:
> > From: Andy Yan <andy.yan@rock-chips.com>
> > 
> > The VOP2 unit is found on Rockchip SoCs beginning with rk3566/rk3568.
> > It replaces the VOP unit found in the older Rockchip SoCs.
> > 
> > This driver has been derived from the downstream Rockchip Kernel and
> > heavily modified:
> > 
> > - All nonstandard DRM properties have been removed
> > - dropped struct vop2_plane_state and pass around less data between
> >    functions
> > - Dropped all DRM_FORMAT_* not known on upstream
> > - rework register access to get rid of excessively used macros
> > - Drop all waiting for framesyncs
> > 
> > The driver is tested with HDMI and MIPI-DSI display on a RK3568-EVB
> > board. Overlay support is tested with the modetest utility. AFBC support
> > on the cluster windows is tested with weston-simple-dmabuf-egl on
> > weston using the (yet to be upstreamed) panfrost driver support.
> 
> 
> When run a weston 10.0.0:

I used weston 9.0.90 during testing. I'll try to reproduce the issue
with weston 10.

Could you maybe have a look at the HCLK issue we are discussing? This
thread could use some input from someone who has contact to the hardware
guys.

Regards,
  Sascha
Daniel Stone March 7, 2022, 1:09 p.m. UTC | #3
Hi Andy,

On Mon, 7 Mar 2022 at 12:18, Andy Yan <andy.yan@rock-chips.com> wrote:
> On 2/25/22 15:51, Sascha Hauer wrote:
> > The VOP2 unit is found on Rockchip SoCs beginning with rk3566/rk3568.
> > It replaces the VOP unit found in the older Rockchip SoCs.
> >
> > This driver has been derived from the downstream Rockchip Kernel and
> > heavily modified:
> >
> > - All nonstandard DRM properties have been removed
> > - dropped struct vop2_plane_state and pass around less data between
> >    functions
> > - Dropped all DRM_FORMAT_* not known on upstream
> > - rework register access to get rid of excessively used macros
> > - Drop all waiting for framesyncs
> >
> > The driver is tested with HDMI and MIPI-DSI display on a RK3568-EVB
> > board. Overlay support is tested with the modetest utility. AFBC support
> > on the cluster windows is tested with weston-simple-dmabuf-egl on
> > weston using the (yet to be upstreamed) panfrost driver support.
>
> When run a weston 10.0.0:
>
>   # export XDG_RUNTIME_DIR=/tmp
>   # weston --backend=drm-backend.so --use-pixma --tty=2
> --continue=without-input
>
> I got the following error:
>
> drm_atomic_check_only [PLANE:31:Smart0-win0] CRTC set but no FB

Can you please start Weston with --logger-scopes=log,drm-backend and
attach the output?

Cheers,
Daniel
Andy Yan March 8, 2022, 8:42 a.m. UTC | #4
Hi Daniel:

On 3/7/22 21:09, Daniel Stone wrote:
> Hi Andy,
>
> On Mon, 7 Mar 2022 at 12:18, Andy Yan <andy.yan@rock-chips.com> wrote:
>> On 2/25/22 15:51, Sascha Hauer wrote:
>>> The VOP2 unit is found on Rockchip SoCs beginning with rk3566/rk3568.
>>> It replaces the VOP unit found in the older Rockchip SoCs.
>>>
>>> This driver has been derived from the downstream Rockchip Kernel and
>>> heavily modified:
>>>
>>> - All nonstandard DRM properties have been removed
>>> - dropped struct vop2_plane_state and pass around less data between
>>>     functions
>>> - Dropped all DRM_FORMAT_* not known on upstream
>>> - rework register access to get rid of excessively used macros
>>> - Drop all waiting for framesyncs
>>>
>>> The driver is tested with HDMI and MIPI-DSI display on a RK3568-EVB
>>> board. Overlay support is tested with the modetest utility. AFBC support
>>> on the cluster windows is tested with weston-simple-dmabuf-egl on
>>> weston using the (yet to be upstreamed) panfrost driver support.
>> When run a weston 10.0.0:
>>
>>    # export XDG_RUNTIME_DIR=/tmp
>>    # weston --backend=drm-backend.so --use-pixma --tty=2
>> --continue=without-input
>>
>> I got the following error:
>>
>> drm_atomic_check_only [PLANE:31:Smart0-win0] CRTC set but no FB
> Can you please start Weston with --logger-scopes=log,drm-backend and
> attach the output?

Please see the weston ouput here[0]


This failed is from   drm_atom_plane_check: both CRTC and FB must be set 
or neither.

static int drm_atomic_plane_check(const struct drm_plane_state 
*old_plane_state,
                                   const struct drm_plane_state 
*new_plane_state)
{
         struct drm_plane *plane = new_plane_state->plane;
         struct drm_crtc *crtc = new_plane_state->crtc;
         const struct drm_framebuffer *fb = new_plane_state->fb;
         unsigned int fb_width, fb_height;
         struct drm_mode_rect *clips;
         uint32_t num_clips;
         int ret;

         /* either *both* CRTC and FB must be set, or neither */
         if (crtc && !fb) {
                 drm_dbg_atomic(plane->dev, "[PLANE:%d:%s] CRTC set but 
no FB\n",
                                plane->base.id, plane->name);
                 return -EINVAL;
         } else if (fb && !crtc) {
                 drm_dbg_atomic(plane->dev, "[PLANE:%d:%s] FB set but no 
CRTC\n",
                                plane->base.id, plane->name);
                 return -EINVAL;
         }

[0]https://pastebin.com/mGXKqD2S

> Cheers,
> Daniel
Daniel Stone March 8, 2022, 2:04 p.m. UTC | #5
On Tue, 8 Mar 2022 at 08:42, Andy Yan <andy.yan@rock-chips.com> wrote:
> On 3/7/22 21:09, Daniel Stone wrote:
> > On Mon, 7 Mar 2022 at 12:18, Andy Yan <andy.yan@rock-chips.com> wrote:
> >> When run a weston 10.0.0:
> >>
> >>    # export XDG_RUNTIME_DIR=/tmp
> >>    # weston --backend=drm-backend.so --use-pixma --tty=2
> >> --continue=without-input
> >>
> >> I got the following error:
> >>
> >> drm_atomic_check_only [PLANE:31:Smart0-win0] CRTC set but no FB
> > Can you please start Weston with --logger-scopes=log,drm-backend and
> > attach the output?
>
> Please see the weston ouput here[0]

Are you running with musl perhaps? Either way, please make sure your
libdrm build includes commit 79fa377c8bdc84fde99c6a6ac17e554971c617be.

Cheers,
Daniel
Andy Yan March 9, 2022, 2:03 a.m. UTC | #6
Hi Daniel:

On 3/8/22 22:04, Daniel Stone wrote:
> On Tue, 8 Mar 2022 at 08:42, Andy Yan <andy.yan@rock-chips.com> wrote:
>> On 3/7/22 21:09, Daniel Stone wrote:
>>> On Mon, 7 Mar 2022 at 12:18, Andy Yan <andy.yan@rock-chips.com> wrote:
>>>> When run a weston 10.0.0:
>>>>
>>>>     # export XDG_RUNTIME_DIR=/tmp
>>>>     # weston --backend=drm-backend.so --use-pixma --tty=2
>>>> --continue=without-input
>>>>
>>>> I got the following error:
>>>>
>>>> drm_atomic_check_only [PLANE:31:Smart0-win0] CRTC set but no FB
>>> Can you please start Weston with --logger-scopes=log,drm-backend and
>>> attach the output?
>> Please see the weston ouput here[0]
> Are you running with musl perhaps?
Do you mean the C library? I chose uClib-ng in buildroot, not use musl.
> Either way, please make sure your
> libdrm build includes commit 79fa377c8bdc84fde99c6a6ac17e554971c617be.


The upstream buildroot use libdrm2.4.109, this commit[0] if from 
libdrm2.4.110

I cherry-pick this patch to my local libdrm, but has no effect, still 
has "atomic: couldn't commit new state" error.

I have do a search in libdrm and weston, but find no one call 
drmModeAtomicMerge, is that right?

[0]https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/167

>
> Cheers,
> Daniel
Andy Yan March 9, 2022, 7:37 a.m. UTC | #7
Hi Daniel:

On 3/9/22 10:03, Andy Yan wrote:
> Hi Daniel:
>
> On 3/8/22 22:04, Daniel Stone wrote:
>> On Tue, 8 Mar 2022 at 08:42, Andy Yan <andy.yan@rock-chips.com> wrote:
>>> On 3/7/22 21:09, Daniel Stone wrote:
>>>> On Mon, 7 Mar 2022 at 12:18, Andy Yan <andy.yan@rock-chips.com> wrote:
>>>>> When run a weston 10.0.0:
>>>>>
>>>>>     # export XDG_RUNTIME_DIR=/tmp
>>>>>     # weston --backend=drm-backend.so --use-pixma --tty=2
>>>>> --continue=without-input
>>>>>
>>>>> I got the following error:
>>>>>
>>>>> drm_atomic_check_only [PLANE:31:Smart0-win0] CRTC set but no FB
>>>> Can you please start Weston with --logger-scopes=log,drm-backend and
>>>> attach the output?
>>> Please see the weston ouput here[0]
>> Are you running with musl perhaps?
> Do you mean the C library? I chose uClib-ng in buildroot, not use musl.
>> Either way, please make sure your
>> libdrm build includes commit 79fa377c8bdc84fde99c6a6ac17e554971c617be.
>
>
> The upstream buildroot use libdrm2.4.109, this commit[0] if from 
> libdrm2.4.110
>
> I cherry-pick this patch to my local libdrm, but has no effect, still 
> has "atomic: couldn't commit new state" error.
>
> I have do a search in libdrm and weston, but find no one call 
> drmModeAtomicMerge, is that right?
>
> [0]https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/167
>

With your patch applied from libdrm2.4.110, I do a make clean for 
buidlroot, than build it again,  That's take effect.

I can see only the second value (non-zero FB) of plane 31 commit to the 
kernel. So this is works.

Maybe the buidroot should update libdrm package.

Thank you.

>>
>> Cheers,
>> Daniel
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip
Andy Yan March 14, 2022, 11:02 a.m. UTC | #8
Hi Daniel:

   Remember you said our downstream vop2 driver is very slow on weston.

Would you please share the case you run ? or how can i test frame rate 
on weston?

On 3/9/22 15:37, Andy Yan wrote:
> Hi Daniel:
>
> On 3/9/22 10:03, Andy Yan wrote:
>> Hi Daniel:
>>
>> On 3/8/22 22:04, Daniel Stone wrote:
>>> On Tue, 8 Mar 2022 at 08:42, Andy Yan <andy.yan@rock-chips.com> wrote:
>>>> On 3/7/22 21:09, Daniel Stone wrote:
>>>>> On Mon, 7 Mar 2022 at 12:18, Andy Yan <andy.yan@rock-chips.com> 
>>>>> wrote:
>>>>>> When run a weston 10.0.0:
>>>>>>
>>>>>>     # export XDG_RUNTIME_DIR=/tmp
>>>>>>     # weston --backend=drm-backend.so --use-pixma --tty=2
>>>>>> --continue=without-input
>>>>>>
>>>>>> I got the following error:
>>>>>>
>>>>>> drm_atomic_check_only [PLANE:31:Smart0-win0] CRTC set but no FB
>>>>> Can you please start Weston with --logger-scopes=log,drm-backend and
>>>>> attach the output?
>>>> Please see the weston ouput here[0]
>>> Are you running with musl perhaps?
>> Do you mean the C library? I chose uClib-ng in buildroot, not use musl.
>>> Either way, please make sure your
>>> libdrm build includes commit 79fa377c8bdc84fde99c6a6ac17e554971c617be.
>>
>>
>> The upstream buildroot use libdrm2.4.109, this commit[0] if from 
>> libdrm2.4.110
>>
>> I cherry-pick this patch to my local libdrm, but has no effect, still 
>> has "atomic: couldn't commit new state" error.
>>
>> I have do a search in libdrm and weston, but find no one call 
>> drmModeAtomicMerge, is that right?
>>
>> [0]https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/167
>>
>
> With your patch applied from libdrm2.4.110, I do a make clean for 
> buidlroot, than build it again,  That's take effect.
>
> I can see only the second value (non-zero FB) of plane 31 commit to 
> the kernel. So this is works.
>
> Maybe the buidroot should update libdrm package.
>
> Thank you.
>
>>>
>>> Cheers,
>>> Daniel
>>
>> _______________________________________________
>> Linux-rockchip mailing list
>> Linux-rockchip@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-rockchip
Daniel Stone March 14, 2022, 1:38 p.m. UTC | #9
Hi Andy,

On Mon, 14 Mar 2022 at 11:02, Andy Yan <andy.yan@rock-chips.com> wrote:
>    Remember you said our downstream vop2 driver is very slow on weston.
>
> Would you please share the case you run ? or how can i test frame rate
> on weston?

We were able to observe this by just using either waylandsink (using
dmabuf from the V4L2 rkvdec/rkvpu drivers), or even weston-simple-egl.
I have not been able to do a full review of Sascha's submission, but
from what I've seen of it, it should have fixed those issues. (I don't
have RK3568 hardware to hand anymore.)

Cheers,
Daniel