Re: [PATCH v2 00/14] Renesas R-Car VSP: Add H3 ES2.0 support

2017-07-18 Thread Hans Verkuil
On 26/06/17 20:12, Laurent Pinchart wrote:
> Hello,
> 
> This patch series implements support for the R-Car H3 ES2.0 SoC in the VSP
> and DU drivers.
>  
> Compared to the H3 ES1.1, the H3 ES2.0 has a new VSP2-DL instance that
> includes two blending units, a BRU and a BRS. The BRS is similar to the BRU
> but has two inputs only, and is used to service a second DU channel from the
> same VSP through a second LIF instances connected to WPF.1.
> 
> The patch series starts with a small fixes and cleanups in patches 01/14 to
> 05/14. Patch 06/14 prepares the VSP driver for multiple DU channels support by
> extending the DU-VSP API with an additional argument. Patches 07/14 to 10/14
> gradually build H3 ES2.0 support on top of that by implementing all needed
> features in the VSP driver.
> 
> So far the VSP driver always used headerless display lists when operating in
> connection with the DU. This mode of operation is only available on WPF.0, so
> support for regular display lists with headers when operating with the DU is
> added in patch 11/14.
> 
> The remaining patches finally implement H3 ES2.0 support in the DU driver,
> with support for VSP sharing implemented in patch 12/14, for H3 ES2.0 PLL in
> patch 13/14 (by restricting the ES1.x workaround to ES1.x SoCs) and for RGB
> output routing in patch 14/14.
> 
> Compared to v1, the series has gone under considerable changes. Testing
> locally on H3 ES2.0 uncovered multiple issues in the previous partially tested
> version, which have been fixed in additional patches. The following changes
> can be noted in particular.
> 
> - New small cleanups in patches 02/14 to 05/14
> - Pass the pipe index to vsp1_du_atomic_update() explicitly
> - Rebase on top of the VSP-DU flicker fixes, resulting in a major rework of
>   "v4l: vsp1: Add support for header display lists in continuous mode"
> - New patches 09/14, 10/14 and 12/14 to support the previously untested VGA
>   output
> 
> The series is based on top of Dave's latest drm-next branch as it depends on
> patches merged by Dave for v4.13. It depends, for testing, on
> 
> - the sh-pfc-for-v4.13 branch from Geert's renesas-drivers tree
> - the "[PATCH v2 0/2] R-Car H3 ES2.0 Salvator-X: Enable DU support in DT"
>   patch series
> 
> For convenience, a branch merging this series with all dependencies is
> available from
> 
>   git://linuxtv.org/pinchartl/media.git drm/next/h3-es2/merged
> 
> with the DT and driver series split in two branches respectively tagged
> drm-h3-es2-dt-20170626 and drm-h3-es2-vsp-du-20170626.
> 
> The patches have been tested on the Lager, Salvator-X H3 ES1.x, Salvator-X
> M3-W and Salvator-XS boards. All outputs have been tested using modetest
> without any noticeable regression.
> 
> Laurent Pinchart (14):
>   v4l: vsp1: Fill display list headers without holding dlm spinlock
>   v4l: vsp1: Don't recycle active list at display start
>   v4l: vsp1: Don't set WPF sink pointer
>   v4l: vsp1: Store source and sink pointers as vsp1_entity
>   v4l: vsp1: Don't create links for DRM pipeline
>   v4l: vsp1: Add pipe index argument to the VSP-DU API
>   v4l: vsp1: Add support for the BRS entity
>   v4l: vsp1: Add support for new VSP2-BS, VSP2-DL and VSP2-D instances
>   v4l: vsp1: Add support for multiple LIF instances
>   v4l: vsp1: Add support for multiple DRM pipelines
>   v4l: vsp1: Add support for header display lists in continuous mode
>   drm: rcar-du: Support multiple sources from the same VSP
>   drm: rcar-du: Restrict DPLL duty cycle workaround to H3 ES1.x
>   drm: rcar-du: Configure DPAD0 routing through last group on Gen3

For this patch series:

Acked-by: Hans Verkuil 

Regards,

Hans

> 
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.c|  39 ++--
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.h|   3 +
>  drivers/gpu/drm/rcar-du/rcar_du_group.c   |  21 ++-
>  drivers/gpu/drm/rcar-du/rcar_du_kms.c |  91 --
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.c |  37 ++--
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.h |  10 +-
>  drivers/media/platform/vsp1/vsp1.h|   7 +-
>  drivers/media/platform/vsp1/vsp1_bru.c|  45 +++--
>  drivers/media/platform/vsp1/vsp1_bru.h|   4 +-
>  drivers/media/platform/vsp1/vsp1_dl.c | 205 +-
>  drivers/media/platform/vsp1/vsp1_dl.h |   1 -
>  drivers/media/platform/vsp1/vsp1_drm.c| 283 
> +++---
>  drivers/media/platform/vsp1/vsp1_drm.h|  38 ++--
>  drivers/media/platform/vsp1/vsp1_drv.c| 115 
>  drivers/media/platform/vsp1/vsp1_entity.c |  40 +++--
>  drivers/media/platform/vsp1/vsp1_entity.h |   5 +-
>  drivers/media/platform/vsp1/vsp1_lif.c|   5 +-
>  drivers/media/platform/vsp1/vsp1_lif.h|   2 +-
>  drivers/media/platform/vsp1/vsp1_pipe.c   |   7 +-
>  drivers/media/platform/vsp1/vsp1_regs.h   |  46 +++--
>  drivers/media/platform/vsp1/vsp1_video.c  |  63 ---
>  drivers/media/platform/vsp1/vsp1_wpf.c|   4 +-
>  include/media/vsp1.h  

Re: [PATCH v2 00/14] Renesas R-Car VSP: Add H3 ES2.0 support

2017-07-13 Thread Laurent Pinchart
Hi Kieran,

On Thursday 13 Jul 2017 13:25:55 Kieran Bingham wrote:
> Hi Laurent,
> 
> Thank you for these patches, bringing life to the outputs of my ES2.0 target
> board.
> 
> I have tested them on my board, and including the VSP unit test suite, and
> kmscube utilities.
> 
> Feel free to add a Tested-by: Kieran Bingham
>  to all of the patches if you
> desire, and I'm working through the individual reviews.
> 
> Oh - except now I've just said that - I did some extra testing with both
> HDMI and VGA output connected and ran
>kmstest --flip --sync
> 
> This was soon followed by a kernel error trace [0] shown below.

:-/

> However replicating this is possibly more complicated than just running
> kmstest --flip --sync ... I've had to do various iterations of running
> with/without {flip, sync} but I have reproduced 'issues' about 3 times now.
> 
> I think the key thing is in the VGA connection or regarding trying to output
> to both.
> 
> Interestingly, I haven't been able to make this happen on the ES1.0 platform
> as yet... though --flip --sync is quicker to fail with 'Flip Commit failed:
> -16" there...
> 
> For reference this was tested on your
> pinchartl-media/drm/next/h3-es2/merged, branch which I don't believe has
> the recent work on not needing to wait for a final vblank on shutdown. So
> it is quite possible that the issue I am seeing is simply a symptom of that
> separately repaired issue.

That's possible, or it could also be related to the vblank race and the 
"[PATCH] drm: rcar-du: Wait for flip completion instead of vblank in commit 
tail" patch that I've just posted.

> On that basis I've left my comment regarding my Tested-by: tag above as I
> suspect that this issue I've hit could likely be separate and already
> resolved.
> 
> I'll try to add those patches to this tree to see if the issue resolves
> itself...

I've updated my drm/next/h3-es2/merged branch, could you please test it ? I've 
included "[PATCH] drm: rcar-du: Wait for flip completion instead of vblank in 
commit tail", you may want to try and revert it if it causes issues.

> Regardless of that, this series conflicts with my current developments,
> therefore I will likely rebase my work on top of this series. I don't need
> an immutable branch, but please do let me know if this series changes :-)

I will.

> [0] : Kernel log snippet posted below:
> 
> [  597.471369] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
> [CRTC:57:crtc-3] flip_done timed out
> [  607.711346] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR*
> [CRTC:57:crtc-3] flip_done timed out
> [  607.711354] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
> [CRTC:57:crtc-3] flip_done timed out
> [  607.749585] vsp1 fea2.vsp: failed to reset wpf.1
> [  617.951311] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
> [CRTC:57:crtc-3] flip_done timed out
> [  618.055358] vsp1 fea2.vsp: failed to reset wpf.1
> [  618.060498] vsp1 fea2.vsp: DRM pipeline stop timeout
> [  628.831762] vsp1 fea2.vsp: failed to reset wpf.1
> [  638.943315] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
> [CRTC:57:crtc-3] flip_done timed out
> [  649.183313] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
> [CRTC:57:crtc-3] flip_done timed out
> [  677.753465] vsp1 fea2.vsp: failed to reset wpf.1
> [  687.839322] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
> [CRTC:57:crtc-3] flip_done timed out
> [  687.935288] vsp1 fea2.vsp: failed to reset wpf.1
> [  687.940360] vsp1 fea2.vsp: DRM pipeline stop timeout
> [  687.945939] Unable to handle kernel NULL pointer dereference at virtual
> address 
> [  687.954206] pgd = ff8009a0a000
> [  687.957680] [] *pgd=00073fffe003, *pud=00073fffe003,
> *pmd=
> [  687.966068] Internal error: Oops: 9606 [#1] PREEMPT SMP
> [  687.971690] Modules linked in:
> [  687.974777] CPU: 0 PID: 10426 Comm: kmstest Not tainted
> 4.12.0-rc5-01343-g1bc824acf27c #5
> [  687.983019] Hardware name: Renesas Salvator-X 2nd version board based on
> r8a7795 ES2.0+ (DT)
> [  687.991525] task: ffc6f97b4080 task.stack: ffc6f51dc000
> [  687.997502] PC is at __media_pipeline_stop+0x24/0xd0
> [  688.002507] LR is at media_pipeline_stop+0x34/0x48
> [  688.007336] pc : [] lr : [] pstate:
> 6145 [  688.014790] sp : ffc6f51df780
> [  688.018129] x29: ffc6f51df780 x28: 
> [  688.023490] x27: 0038 x26: ff8008960088
> [  688.028850] x25: ffc6f98bcb10 x24: ffc6f98b8818
> [  688.034210] x23: 0001 x22: ffc6f9ff1998
> [  688.039570] x21: ffc6f98bc080 x20: 
> [  688.044929] x19: 0008 x18: 0010
> [  688.050288] x17: 007f9bc9e1c8 x16: ff8008165bb8
> [  688.055648] x15: ff80899bb63f x14: 0006
> [  688.061007] x13: ffc6faac6750 x12: ff80087bd078
> [  688.066366] x11:  x10: ff80097bb000
> [  688.071725] x9 : ff8008afd000

Re: [PATCH v2 00/14] Renesas R-Car VSP: Add H3 ES2.0 support

2017-07-13 Thread Kieran Bingham
Hi Laurent,

Thankyou for these patches, bringing life to the outputs of my ES2.0 target 
board.

I have tested them on my board, and including the VSP unit test suite, and
kmscube utilities.

Feel free to add a Tested-by: Kieran Bingham
 to all of the patches if you desire,
and I'm working through the individual reviews.

Oh - except now I've just said that - I did some extra testing with both HDMI
and VGA output connected and ran
   kmstest --flip --sync

This was soon followed by a kernel error trace [0] shown below.

However replicating this is possibly more complicated than just running kmstest
--flip --sync ... I've had to do various iterations of running with/without
{flip, sync} but I have reproduced 'issues' about 3 times now.

I think the key thing is in the VGA connection or regarding trying to output to
both.

Interestingly, I haven't been able to make this happen on the ES1.0 platform as
yet... though --flip --sync is quicker to fail with 'Flip Commit failed: -16"
there...

For reference this was tested on your pinchartl-media/drm/next/h3-es2/merged,
branch which I don't believe has the recent work on not needing to wait for a
final vblank on shutdown. So it is quite possible that the issue I am seeing is
simply a symptom of that separately repaired issue.

On that basis I've left my comment regarding my Tested-by: tag above as I
suspect that this issue I've hit could likely be separate and already resolved.

I'll try to add those patches to this tree to see if the issue resolves 
itself...

Regardless of that, this series conflicts with my current developments,
therefore I will likely rebase my work on top of this series. I don't need an
immutable branch, but please do let me know if this series changes :-)

--
Regards

Kieran.






[0] : Kernel log snippet posted below:

[  597.471369] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
[CRTC:57:crtc-3] flip_done timed out
[  607.711346] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR*
[CRTC:57:crtc-3] flip_done timed out
[  607.711354] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
[CRTC:57:crtc-3] flip_done timed out
[  607.749585] vsp1 fea2.vsp: failed to reset wpf.1
[  617.951311] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
[CRTC:57:crtc-3] flip_done timed out
[  618.055358] vsp1 fea2.vsp: failed to reset wpf.1
[  618.060498] vsp1 fea2.vsp: DRM pipeline stop timeout
[  628.831762] vsp1 fea2.vsp: failed to reset wpf.1
[  638.943315] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
[CRTC:57:crtc-3] flip_done timed out
[  649.183313] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
[CRTC:57:crtc-3] flip_done timed out
[  677.753465] vsp1 fea2.vsp: failed to reset wpf.1
[  687.839322] [drm:drm_atomic_helper_commit_cleanup_done] *ERROR*
[CRTC:57:crtc-3] flip_done timed out
[  687.935288] vsp1 fea2.vsp: failed to reset wpf.1
[  687.940360] vsp1 fea2.vsp: DRM pipeline stop timeout
[  687.945939] Unable to handle kernel NULL pointer dereference at virtual
address 
[  687.954206] pgd = ff8009a0a000
[  687.957680] [] *pgd=00073fffe003, *pud=00073fffe003,
*pmd=
[  687.966068] Internal error: Oops: 9606 [#1] PREEMPT SMP
[  687.971690] Modules linked in:
[  687.974777] CPU: 0 PID: 10426 Comm: kmstest Not tainted
4.12.0-rc5-01343-g1bc824acf27c #5
[  687.983019] Hardware name: Renesas Salvator-X 2nd version board based on
r8a7795 ES2.0+ (DT)
[  687.991525] task: ffc6f97b4080 task.stack: ffc6f51dc000
[  687.997502] PC is at __media_pipeline_stop+0x24/0xd0
[  688.002507] LR is at media_pipeline_stop+0x34/0x48
[  688.007336] pc : [] lr : [] pstate: 
6145
[  688.014790] sp : ffc6f51df780
[  688.018129] x29: ffc6f51df780 x28: 
[  688.023490] x27: 0038 x26: ff8008960088
[  688.028850] x25: ffc6f98bcb10 x24: ffc6f98b8818
[  688.034210] x23: 0001 x22: ffc6f9ff1998
[  688.039570] x21: ffc6f98bc080 x20: 
[  688.044929] x19: 0008 x18: 0010
[  688.050288] x17: 007f9bc9e1c8 x16: ff8008165bb8
[  688.055648] x15: ff80899bb63f x14: 0006
[  688.061007] x13: ffc6faac6750 x12: ff80087bd078
[  688.066366] x11:  x10: ff80097bb000
[  688.071725] x9 : ff8008afd000 x8 : 
[  688.077085] x7 : ff8008583c1c x6 : ff8008da75c8
[  688.082443] x5 : ff8009585d00 x4 : 2d28ca88
[  688.087803] x3 : 89277f76 x2 : 
[  688.093162] x1 : ffc6f97b4080 x0 : ff8008583c24
[  688.098523] Process kmstest (pid: 10426, stack limit = 0xffc6f51dc000)
[  688.105453] Stack: (0xffc6f51df780 to 0xffc6f51e)
[  688.111245] f780: ffc6f51df7b0 ff8008583c24 ffc6f98b8ae8
ffc6f98bc080
[  688.119138] f7a0: ffc6f98bc818 ff8009d18000 ffc6f51df7e0
ff80085aa688
[  688.127031] f7c0: ffc6f9878c18 0001 ffc6f9ff0018

[PATCH v2 00/14] Renesas R-Car VSP: Add H3 ES2.0 support

2017-06-26 Thread Laurent Pinchart
Hello,

This patch series implements support for the R-Car H3 ES2.0 SoC in the VSP
and DU drivers.
 
Compared to the H3 ES1.1, the H3 ES2.0 has a new VSP2-DL instance that
includes two blending units, a BRU and a BRS. The BRS is similar to the BRU
but has two inputs only, and is used to service a second DU channel from the
same VSP through a second LIF instances connected to WPF.1.

The patch series starts with a small fixes and cleanups in patches 01/14 to
05/14. Patch 06/14 prepares the VSP driver for multiple DU channels support by
extending the DU-VSP API with an additional argument. Patches 07/14 to 10/14
gradually build H3 ES2.0 support on top of that by implementing all needed
features in the VSP driver.

So far the VSP driver always used headerless display lists when operating in
connection with the DU. This mode of operation is only available on WPF.0, so
support for regular display lists with headers when operating with the DU is
added in patch 11/14.

The remaining patches finally implement H3 ES2.0 support in the DU driver,
with support for VSP sharing implemented in patch 12/14, for H3 ES2.0 PLL in
patch 13/14 (by restricting the ES1.x workaround to ES1.x SoCs) and for RGB
output routing in patch 14/14.

Compared to v1, the series has gone under considerable changes. Testing
locally on H3 ES2.0 uncovered multiple issues in the previous partially tested
version, which have been fixed in additional patches. The following changes
can be noted in particular.

- New small cleanups in patches 02/14 to 05/14
- Pass the pipe index to vsp1_du_atomic_update() explicitly
- Rebase on top of the VSP-DU flicker fixes, resulting in a major rework of
  "v4l: vsp1: Add support for header display lists in continuous mode"
- New patches 09/14, 10/14 and 12/14 to support the previously untested VGA
  output

The series is based on top of Dave's latest drm-next branch as it depends on
patches merged by Dave for v4.13. It depends, for testing, on

- the sh-pfc-for-v4.13 branch from Geert's renesas-drivers tree
- the "[PATCH v2 0/2] R-Car H3 ES2.0 Salvator-X: Enable DU support in DT"
  patch series

For convenience, a branch merging this series with all dependencies is
available from

git://linuxtv.org/pinchartl/media.git drm/next/h3-es2/merged

with the DT and driver series split in two branches respectively tagged
drm-h3-es2-dt-20170626 and drm-h3-es2-vsp-du-20170626.

The patches have been tested on the Lager, Salvator-X H3 ES1.x, Salvator-X
M3-W and Salvator-XS boards. All outputs have been tested using modetest
without any noticeable regression.

Laurent Pinchart (14):
  v4l: vsp1: Fill display list headers without holding dlm spinlock
  v4l: vsp1: Don't recycle active list at display start
  v4l: vsp1: Don't set WPF sink pointer
  v4l: vsp1: Store source and sink pointers as vsp1_entity
  v4l: vsp1: Don't create links for DRM pipeline
  v4l: vsp1: Add pipe index argument to the VSP-DU API
  v4l: vsp1: Add support for the BRS entity
  v4l: vsp1: Add support for new VSP2-BS, VSP2-DL and VSP2-D instances
  v4l: vsp1: Add support for multiple LIF instances
  v4l: vsp1: Add support for multiple DRM pipelines
  v4l: vsp1: Add support for header display lists in continuous mode
  drm: rcar-du: Support multiple sources from the same VSP
  drm: rcar-du: Restrict DPLL duty cycle workaround to H3 ES1.x
  drm: rcar-du: Configure DPAD0 routing through last group on Gen3

 drivers/gpu/drm/rcar-du/rcar_du_crtc.c|  39 ++--
 drivers/gpu/drm/rcar-du/rcar_du_crtc.h|   3 +
 drivers/gpu/drm/rcar-du/rcar_du_group.c   |  21 ++-
 drivers/gpu/drm/rcar-du/rcar_du_kms.c |  91 --
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c |  37 ++--
 drivers/gpu/drm/rcar-du/rcar_du_vsp.h |  10 +-
 drivers/media/platform/vsp1/vsp1.h|   7 +-
 drivers/media/platform/vsp1/vsp1_bru.c|  45 +++--
 drivers/media/platform/vsp1/vsp1_bru.h|   4 +-
 drivers/media/platform/vsp1/vsp1_dl.c | 205 +-
 drivers/media/platform/vsp1/vsp1_dl.h |   1 -
 drivers/media/platform/vsp1/vsp1_drm.c| 283 +++---
 drivers/media/platform/vsp1/vsp1_drm.h|  38 ++--
 drivers/media/platform/vsp1/vsp1_drv.c| 115 
 drivers/media/platform/vsp1/vsp1_entity.c |  40 +++--
 drivers/media/platform/vsp1/vsp1_entity.h |   5 +-
 drivers/media/platform/vsp1/vsp1_lif.c|   5 +-
 drivers/media/platform/vsp1/vsp1_lif.h|   2 +-
 drivers/media/platform/vsp1/vsp1_pipe.c   |   7 +-
 drivers/media/platform/vsp1/vsp1_regs.h   |  46 +++--
 drivers/media/platform/vsp1/vsp1_video.c  |  63 ---
 drivers/media/platform/vsp1/vsp1_wpf.c|   4 +-
 include/media/vsp1.h  |  10 +-
 23 files changed, 676 insertions(+), 405 deletions(-)

-- 
Regards,

Laurent Pinchart