2019-05-31 09:50:03

by Brian Masney

[permalink] [raw]
Subject: [PATCH v3 0/6] ARM: qcom: working Nexus 5 display support

This patch series adds working display support to the LG Nexus 5
(hammerhead) phone.

Changes since v2:
- Dropped two drm/msm bug fix patches that have been merged separately.
- New patch: 'add support for per-CRTC max_vblank_count on mdp5'.
Special thanks to Jeffrey Hugo for helping to track down this issue.
- Add panel_pin to msm8974-hammerhead device tree. Dropped Linus
Walleij's reviewed-by on this patch due to this change.

Changes since v1:
- Shortened problem description above. I'll reply to this email and send
a full dmesg with the boot log with debugging turned on.
- Dropped patch 'fix null pointer dereference in
msm_atomic_prepare_fb()'
- New patch: Remove resv fields from msm_gem_object struct that was
incorrectly being referenced by the prepare_fb callbacks.
- Add drm_plane_enable_fb_damage_clips() to plane init for mdp4, mdp5,
and dpu1.
- Add Linus Walleij's reviewed-by to patches 3-6

My status page at https://masneyb.github.io/nexus-5-upstream/
describes what is working so far with the upstream kernel on the Nexus
5.

Brian Masney (6):
drm/msm: add dirty framebuffer helper
drm/msm: add support for per-CRTC max_vblank_count on mdp5
ARM: qcom_defconfig: add display-related options
ARM: dts: qcom: msm8974-hammerhead: add support for backlight
ARM: dts: msm8974: add display support
ARM: dts: qcom: msm8974-hammerhead: add support for display

.../qcom-msm8974-lge-nexus5-hammerhead.dts | 92 ++++++++++++
arch/arm/boot/dts/qcom-msm8974.dtsi | 132 ++++++++++++++++++
arch/arm/configs/qcom_defconfig | 5 +
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 3 +
drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c | 3 +
drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 16 ++-
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 2 +-
drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 3 +
drivers/gpu/drm/msm/msm_fb.c | 2 +
9 files changed, 256 insertions(+), 2 deletions(-)

--
2.20.1


2019-05-31 09:50:18

by Brian Masney

[permalink] [raw]
Subject: [PATCH v3 2/6] drm/msm: add support for per-CRTC max_vblank_count on mdp5

The mdp5 drm/kms driver currently does not work on command-mode DSI
panels due to 'vblank wait timed out' errors. This causes a latency
of seconds, or tens of seconds in some cases, before content is shown
on the panel. This hardware does not have the something that we can use
as a frame counter available when running in command mode, so we need to
fall back to using timestamps by setting the max_vblank_count to zero.
This can be done on a per-CRTC basis, so the convert mdp5 to use
drm_crtc_set_max_vblank_count().

This change was tested on a LG Nexus 5 (hammerhead) phone.

Signed-off-by: Brian Masney <[email protected]>
Suggested-by: Jeffrey Hugo <[email protected]>
---
drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 16 +++++++++++++++-
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 2 +-
2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
index c3751c95b452..6fde1097844f 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
@@ -450,6 +450,18 @@ static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
mdp5_crtc->enabled = false;
}

+static void mdp5_crtc_vblank_on(struct drm_crtc *crtc)
+{
+ struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state);
+ struct mdp5_interface *intf = mdp5_cstate->pipeline.intf;
+ u32 count;
+
+ count = intf->mode == MDP5_INTF_DSI_MODE_COMMAND ? 0 : 0xffffffff;
+ drm_crtc_set_max_vblank_count(crtc, count);
+
+ drm_crtc_vblank_on(crtc);
+}
+
static void mdp5_crtc_atomic_enable(struct drm_crtc *crtc,
struct drm_crtc_state *old_state)
{
@@ -486,7 +498,7 @@ static void mdp5_crtc_atomic_enable(struct drm_crtc *crtc,
}

/* Restore vblank irq handling after power is enabled */
- drm_crtc_vblank_on(crtc);
+ mdp5_crtc_vblank_on(crtc);

mdp5_crtc_mode_set_nofb(crtc);

@@ -1039,6 +1051,8 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc)
mdp5_crtc_destroy_state(crtc, crtc->state);

__drm_atomic_helper_crtc_reset(crtc, &mdp5_cstate->base);
+
+ drm_crtc_vblank_reset(crtc);
}

static const struct drm_crtc_funcs mdp5_crtc_funcs = {
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 97179bec8902..fcb0b0455abe 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -750,7 +750,7 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos;
dev->driver->get_scanout_position = mdp5_get_scanoutpos;
dev->driver->get_vblank_counter = mdp5_get_vblank_counter;
- dev->max_vblank_count = 0xffffffff;
+ dev->max_vblank_count = 0; /* max_vblank_count is set on each CRTC */
dev->vblank_disable_immediate = true;

return kms;
--
2.20.1

2019-06-03 14:57:51

by Jeffrey Hugo

[permalink] [raw]
Subject: Re: [PATCH v3 2/6] drm/msm: add support for per-CRTC max_vblank_count on mdp5

On Fri, May 31, 2019 at 3:46 AM Brian Masney <[email protected]> wrote:
>
> The mdp5 drm/kms driver currently does not work on command-mode DSI
> panels due to 'vblank wait timed out' errors. This causes a latency
> of seconds, or tens of seconds in some cases, before content is shown
> on the panel. This hardware does not have the something that we can use
> as a frame counter available when running in command mode, so we need to
> fall back to using timestamps by setting the max_vblank_count to zero.
> This can be done on a per-CRTC basis, so the convert mdp5 to use
> drm_crtc_set_max_vblank_count().
>
> This change was tested on a LG Nexus 5 (hammerhead) phone.
>
> Signed-off-by: Brian Masney <[email protected]>
> Suggested-by: Jeffrey Hugo <[email protected]>

Reviewed-by: Jeffrey Hugo <[email protected]>

> ---
> drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 16 +++++++++++++++-
> drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 2 +-
> 2 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
> index c3751c95b452..6fde1097844f 100644
> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
> @@ -450,6 +450,18 @@ static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc,
> mdp5_crtc->enabled = false;
> }
>
> +static void mdp5_crtc_vblank_on(struct drm_crtc *crtc)
> +{
> + struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state);
> + struct mdp5_interface *intf = mdp5_cstate->pipeline.intf;
> + u32 count;
> +
> + count = intf->mode == MDP5_INTF_DSI_MODE_COMMAND ? 0 : 0xffffffff;
> + drm_crtc_set_max_vblank_count(crtc, count);
> +
> + drm_crtc_vblank_on(crtc);
> +}
> +
> static void mdp5_crtc_atomic_enable(struct drm_crtc *crtc,
> struct drm_crtc_state *old_state)
> {
> @@ -486,7 +498,7 @@ static void mdp5_crtc_atomic_enable(struct drm_crtc *crtc,
> }
>
> /* Restore vblank irq handling after power is enabled */
> - drm_crtc_vblank_on(crtc);
> + mdp5_crtc_vblank_on(crtc);
>
> mdp5_crtc_mode_set_nofb(crtc);
>
> @@ -1039,6 +1051,8 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc)
> mdp5_crtc_destroy_state(crtc, crtc->state);
>
> __drm_atomic_helper_crtc_reset(crtc, &mdp5_cstate->base);
> +
> + drm_crtc_vblank_reset(crtc);
> }
>
> static const struct drm_crtc_funcs mdp5_crtc_funcs = {
> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> index 97179bec8902..fcb0b0455abe 100644
> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> @@ -750,7 +750,7 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
> dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos;
> dev->driver->get_scanout_position = mdp5_get_scanoutpos;
> dev->driver->get_vblank_counter = mdp5_get_vblank_counter;
> - dev->max_vblank_count = 0xffffffff;
> + dev->max_vblank_count = 0; /* max_vblank_count is set on each CRTC */
> dev->vblank_disable_immediate = true;
>
> return kms;
> --
> 2.20.1
>

2019-06-16 18:43:20

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH v3 0/6] ARM: qcom: working Nexus 5 display support

On Fri 31 May 02:46 PDT 2019, Brian Masney wrote:

> This patch series adds working display support to the LG Nexus 5
> (hammerhead) phone.
>
> Changes since v2:
> - Dropped two drm/msm bug fix patches that have been merged separately.
> - New patch: 'add support for per-CRTC max_vblank_count on mdp5'.
> Special thanks to Jeffrey Hugo for helping to track down this issue.
> - Add panel_pin to msm8974-hammerhead device tree. Dropped Linus
> Walleij's reviewed-by on this patch due to this change.
>
> Changes since v1:
> - Shortened problem description above. I'll reply to this email and send
> a full dmesg with the boot log with debugging turned on.
> - Dropped patch 'fix null pointer dereference in
> msm_atomic_prepare_fb()'
> - New patch: Remove resv fields from msm_gem_object struct that was
> incorrectly being referenced by the prepare_fb callbacks.
> - Add drm_plane_enable_fb_damage_clips() to plane init for mdp4, mdp5,
> and dpu1.
> - Add Linus Walleij's reviewed-by to patches 3-6
>
> My status page at https://masneyb.github.io/nexus-5-upstream/
> describes what is working so far with the upstream kernel on the Nexus
> 5.
>

Assuming that patches 1 and 2 won't affect the dts and applied patches 3
through 6 for v5.3.

Regards,
Bjorn

> Brian Masney (6):
> drm/msm: add dirty framebuffer helper
> drm/msm: add support for per-CRTC max_vblank_count on mdp5
> ARM: qcom_defconfig: add display-related options
> ARM: dts: qcom: msm8974-hammerhead: add support for backlight
> ARM: dts: msm8974: add display support
> ARM: dts: qcom: msm8974-hammerhead: add support for display
>
> .../qcom-msm8974-lge-nexus5-hammerhead.dts | 92 ++++++++++++
> arch/arm/boot/dts/qcom-msm8974.dtsi | 132 ++++++++++++++++++
> arch/arm/configs/qcom_defconfig | 5 +
> drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 3 +
> drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c | 3 +
> drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 16 ++-
> drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 2 +-
> drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 3 +
> drivers/gpu/drm/msm/msm_fb.c | 2 +
> 9 files changed, 256 insertions(+), 2 deletions(-)
>
> --
> 2.20.1
>