From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org
Subject: Re: [PATCH 08/22] drm: rcar-du: Restart the DU group when a plane source changes
Date: Thu, 17 Dec 2015 07:11:49 +0000 [thread overview]
Message-ID: <2986707.83nd5NsHMZ@avalon> (raw)
In-Reply-To: <20150914072213.GC3383@phenom.ffwll.local>
Hi Daniel,
On Monday 14 September 2015 09:22:13 Daniel Vetter wrote:
> On Mon, Sep 14, 2015 at 01:50:55AM +0300, Laurent Pinchart wrote:
> > Plane sources are configured by the VSPS bit in the PnDDCR4 register.
> > Although the datasheet states that the bit is updated during vertical
> > blanking, it seems that updates only occur when the DU group is held in
> > reset through the DSYSR.DRES bit. Restart the group if the source
> > changes.
> >
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> >
> > drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 4 ++++
> > drivers/gpu/drm/rcar-du/rcar_du_group.c | 2 ++
> > drivers/gpu/drm/rcar-du/rcar_du_group.h | 2 ++
> > drivers/gpu/drm/rcar-du/rcar_du_plane.c | 22 ++++++++++++++++++++--
> > 4 files changed, 28 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> > b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 48cb19949ca3..7e2f5c26d589
> > 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> > @@ -272,6 +272,10 @@ static void rcar_du_crtc_update_planes(struct
> > rcar_du_crtc *rcrtc)
> > rcar_du_group_restart(rcrtc->group);
> > }
> >
> > + /* Restart the group if plane sources have changed. */
> > + if (rcrtc->group->need_restart)
> > + rcar_du_group_restart(rcrtc->group);
> > +
> > mutex_unlock(&rcrtc->group->lock);
> >
> > rcar_du_group_write(rcrtc->group, rcrtc->index % 2 ? DS2PR : DS1PR,
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.c
> > b/drivers/gpu/drm/rcar-du/rcar_du_group.c index
> > 4a44ddd51766..0e2b46dce563 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_group.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_group.c
> > @@ -162,6 +162,8 @@ void rcar_du_group_start_stop(struct rcar_du_group
> > *rgrp, bool start)
> >
> > void rcar_du_group_restart(struct rcar_du_group *rgrp)
> > {
> > + rgrp->need_restart = false;
> > +
> > __rcar_du_group_start_stop(rgrp, false);
> > __rcar_du_group_start_stop(rgrp, true);
> > }
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.h
> > b/drivers/gpu/drm/rcar-du/rcar_du_group.h index
> > 4b1952fd4e7d..5e3adc6b31b5 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_group.h
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_group.h
> > @@ -32,6 +32,7 @@ struct rcar_du_device;
> > * @dptsr_planes: bitmask of planes driven by dot-clock and timing
> > generator 1
> > * @num_planes: number of planes in the group
> > * @planes: planes handled by the group
> > + * @need_restart: the group needs to be restarted due to a configuration
> > change
> > */
> > struct rcar_du_group {
> > struct rcar_du_device *dev;
> > @@ -47,6 +48,7 @@ struct rcar_du_group {
> > unsigned int num_planes;
> > struct rcar_du_plane planes[RCAR_DU_NUM_KMS_PLANES];
> >
> > + bool need_restart;
>
> My recommendation is to keep any of these intermediate values in state
> objects too. The reason is that eventually we want to also support real
> queues of atomic commits,
I like the idea :-)
> and then anything stored globally (well, outside of the state objects) won't
> work. And yes it's ok to push that kind of stuff into helper, this isn't
> really any different than e.g. crtc_state->active_changed and similar
> booleans indicating that something special needs to be done when committing.
I agree with you. There's still a couple of state variables I need to remove
in the driver structures, and that's on my todo list (although not very high
I'm afraid).
The group state is a bit of an oddball. The DU groups CRTCs by two and shares
resources inside a group. Implementing that resource sharing requires storing
group state, which is very difficult without an atomic state object for the
group.
Am I missing an easy way to fix that ? And would it be fine to upstream this
patch as-is in the meantime ? I'd like to get it in v4.6, it's been out for
long enough and is blocking other people.
> > };
> >
> > u32 rcar_du_group_read(struct rcar_du_group *rgrp, u32 reg);
> >
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> > b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index
> > 78ca353bfcf0..c7e0535c0e77 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> > @@ -275,9 +275,27 @@ static void rcar_du_plane_atomic_update(struct
> > drm_plane *plane,
> > struct drm_plane_state *old_state)
> > {
> > struct rcar_du_plane *rplane = to_rcar_plane(plane);
> > + struct rcar_du_plane_state *old_rstate;
> > + struct rcar_du_plane_state *new_rstate;
> >
> > - if (plane->state->crtc)
> > - rcar_du_plane_setup(rplane);
> > + if (!plane->state->crtc)
> > + return;
> > +
> > + rcar_du_plane_setup(rplane);
> > +
> > + /* Check whether the source has changed from memory to live source or
> > + * from live source to memory. The source has been configured by the
> > + * VSPS bit in the PnDDCR4 register. Although the datasheet states
> > that
> > + * the bit is updated during vertical blanking, it seems that updates
> > + * only occur when the DU group is held in reset through the
> > DSYSR.DRES
> > + * bit. We thus need to restart the group if the source changes.
> > + */
> > + old_rstate = to_rcar_plane_state(old_state);
> > + new_rstate = to_rcar_plane_state(plane->state);
> > +
> > + if ((old_rstate->source = RCAR_DU_PLANE_MEMORY) !> > + (new_rstate->source = RCAR_DU_PLANE_MEMORY))
> > + rplane->group->need_restart = true;
> > }
> >
> > static const struct drm_plane_helper_funcs rcar_du_plane_helper_funcs = {
--
Regards,
Laurent Pinchart
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org
Subject: Re: [PATCH 08/22] drm: rcar-du: Restart the DU group when a plane source changes
Date: Thu, 17 Dec 2015 09:11:49 +0200 [thread overview]
Message-ID: <2986707.83nd5NsHMZ@avalon> (raw)
In-Reply-To: <20150914072213.GC3383@phenom.ffwll.local>
Hi Daniel,
On Monday 14 September 2015 09:22:13 Daniel Vetter wrote:
> On Mon, Sep 14, 2015 at 01:50:55AM +0300, Laurent Pinchart wrote:
> > Plane sources are configured by the VSPS bit in the PnDDCR4 register.
> > Although the datasheet states that the bit is updated during vertical
> > blanking, it seems that updates only occur when the DU group is held in
> > reset through the DSYSR.DRES bit. Restart the group if the source
> > changes.
> >
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> >
> > drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 4 ++++
> > drivers/gpu/drm/rcar-du/rcar_du_group.c | 2 ++
> > drivers/gpu/drm/rcar-du/rcar_du_group.h | 2 ++
> > drivers/gpu/drm/rcar-du/rcar_du_plane.c | 22 ++++++++++++++++++++--
> > 4 files changed, 28 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> > b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 48cb19949ca3..7e2f5c26d589
> > 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> > @@ -272,6 +272,10 @@ static void rcar_du_crtc_update_planes(struct
> > rcar_du_crtc *rcrtc)
> > rcar_du_group_restart(rcrtc->group);
> > }
> >
> > + /* Restart the group if plane sources have changed. */
> > + if (rcrtc->group->need_restart)
> > + rcar_du_group_restart(rcrtc->group);
> > +
> > mutex_unlock(&rcrtc->group->lock);
> >
> > rcar_du_group_write(rcrtc->group, rcrtc->index % 2 ? DS2PR : DS1PR,
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.c
> > b/drivers/gpu/drm/rcar-du/rcar_du_group.c index
> > 4a44ddd51766..0e2b46dce563 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_group.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_group.c
> > @@ -162,6 +162,8 @@ void rcar_du_group_start_stop(struct rcar_du_group
> > *rgrp, bool start)
> >
> > void rcar_du_group_restart(struct rcar_du_group *rgrp)
> > {
> > + rgrp->need_restart = false;
> > +
> > __rcar_du_group_start_stop(rgrp, false);
> > __rcar_du_group_start_stop(rgrp, true);
> > }
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.h
> > b/drivers/gpu/drm/rcar-du/rcar_du_group.h index
> > 4b1952fd4e7d..5e3adc6b31b5 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_group.h
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_group.h
> > @@ -32,6 +32,7 @@ struct rcar_du_device;
> > * @dptsr_planes: bitmask of planes driven by dot-clock and timing
> > generator 1
> > * @num_planes: number of planes in the group
> > * @planes: planes handled by the group
> > + * @need_restart: the group needs to be restarted due to a configuration
> > change
> > */
> > struct rcar_du_group {
> > struct rcar_du_device *dev;
> > @@ -47,6 +48,7 @@ struct rcar_du_group {
> > unsigned int num_planes;
> > struct rcar_du_plane planes[RCAR_DU_NUM_KMS_PLANES];
> >
> > + bool need_restart;
>
> My recommendation is to keep any of these intermediate values in state
> objects too. The reason is that eventually we want to also support real
> queues of atomic commits,
I like the idea :-)
> and then anything stored globally (well, outside of the state objects) won't
> work. And yes it's ok to push that kind of stuff into helper, this isn't
> really any different than e.g. crtc_state->active_changed and similar
> booleans indicating that something special needs to be done when committing.
I agree with you. There's still a couple of state variables I need to remove
in the driver structures, and that's on my todo list (although not very high
I'm afraid).
The group state is a bit of an oddball. The DU groups CRTCs by two and shares
resources inside a group. Implementing that resource sharing requires storing
group state, which is very difficult without an atomic state object for the
group.
Am I missing an easy way to fix that ? And would it be fine to upstream this
patch as-is in the meantime ? I'd like to get it in v4.6, it's been out for
long enough and is blocking other people.
> > };
> >
> > u32 rcar_du_group_read(struct rcar_du_group *rgrp, u32 reg);
> >
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> > b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index
> > 78ca353bfcf0..c7e0535c0e77 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> > @@ -275,9 +275,27 @@ static void rcar_du_plane_atomic_update(struct
> > drm_plane *plane,
> > struct drm_plane_state *old_state)
> > {
> > struct rcar_du_plane *rplane = to_rcar_plane(plane);
> > + struct rcar_du_plane_state *old_rstate;
> > + struct rcar_du_plane_state *new_rstate;
> >
> > - if (plane->state->crtc)
> > - rcar_du_plane_setup(rplane);
> > + if (!plane->state->crtc)
> > + return;
> > +
> > + rcar_du_plane_setup(rplane);
> > +
> > + /* Check whether the source has changed from memory to live source or
> > + * from live source to memory. The source has been configured by the
> > + * VSPS bit in the PnDDCR4 register. Although the datasheet states
> > that
> > + * the bit is updated during vertical blanking, it seems that updates
> > + * only occur when the DU group is held in reset through the
> > DSYSR.DRES
> > + * bit. We thus need to restart the group if the source changes.
> > + */
> > + old_rstate = to_rcar_plane_state(old_state);
> > + new_rstate = to_rcar_plane_state(plane->state);
> > +
> > + if ((old_rstate->source == RCAR_DU_PLANE_MEMORY) !=
> > + (new_rstate->source == RCAR_DU_PLANE_MEMORY))
> > + rplane->group->need_restart = true;
> > }
> >
> > static const struct drm_plane_helper_funcs rcar_du_plane_helper_funcs = {
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2015-12-17 7:11 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-13 22:50 [PATCH 00/22] R-Car DU: Add Gen3 support Laurent Pinchart
2015-09-13 22:50 ` Laurent Pinchart
2015-09-13 22:50 ` [PATCH 01/22] drm: rcar-du: Don't update planes on disabled CRTCs Laurent Pinchart
2015-09-13 22:50 ` Laurent Pinchart
2015-09-13 22:50 ` [PATCH 02/22] drm: rcar-du: Add support for the R8A7793 DU Laurent Pinchart
2015-09-13 22:50 ` Laurent Pinchart
2015-09-13 22:50 ` [PATCH 03/22] drm: rcar-du: Add support for the R8A7794 DU Laurent Pinchart
2015-09-13 22:50 ` Laurent Pinchart
2015-09-13 22:50 ` [PATCH 04/22] drm: rcar-du: Compute plane DDCR4 register value directly Laurent Pinchart
2015-09-13 22:50 ` Laurent Pinchart
2015-09-13 22:50 ` [PATCH 05/22] drm: rcar-du: Refactor plane setup Laurent Pinchart
2015-09-13 22:50 ` Laurent Pinchart
2015-09-13 22:50 ` [PATCH 06/22] drm: rcar-du: Add VSP1 support to the planes allocator Laurent Pinchart
2015-09-13 22:50 ` Laurent Pinchart
2015-09-13 22:50 ` [PATCH 07/22] drm: rcar-du: Add VSP1 compositor support Laurent Pinchart
2015-09-13 22:50 ` Laurent Pinchart
2015-09-13 22:50 ` [PATCH 08/22] drm: rcar-du: Restart the DU group when a plane source changes Laurent Pinchart
2015-09-13 22:50 ` Laurent Pinchart
2015-09-14 7:22 ` Daniel Vetter
2015-09-14 7:22 ` Daniel Vetter
2015-12-17 7:11 ` Laurent Pinchart [this message]
2015-12-17 7:11 ` Laurent Pinchart
2015-12-17 9:41 ` Daniel Vetter
2015-12-17 9:41 ` Daniel Vetter
2015-12-27 9:00 ` Laurent Pinchart
2015-12-27 9:00 ` Laurent Pinchart
2015-09-13 22:50 ` [PATCH 09/22] drm: rcar-du: Move plane allocator to rcar_du_plane.c Laurent Pinchart
2015-09-13 22:50 ` Laurent Pinchart
2015-09-13 22:50 ` [PATCH 10/22] drm: rcar-du: Expose the VSP1 compositor through KMS planes Laurent Pinchart
2015-09-13 22:50 ` Laurent Pinchart
2015-09-13 22:50 ` [PATCH 11/22] drm: rcar-du: Use the VSP atomic update API Laurent Pinchart
2015-09-13 22:50 ` Laurent Pinchart
2015-09-13 22:50 ` [PATCH 12/22] drm: rcar-du: Fix compile warning on 64-bit platforms Laurent Pinchart
2015-09-13 22:50 ` Laurent Pinchart
2015-09-13 22:51 ` [PATCH 13/22] drm: rcar-du: Enable compilation on ARM64 Laurent Pinchart
2015-09-13 22:51 ` Laurent Pinchart
2015-09-13 22:51 ` [PATCH 14/22] drm: rcar-du: Drop LVDS double dependency on OF Laurent Pinchart
2015-09-13 22:51 ` Laurent Pinchart
2015-09-13 22:51 ` [PATCH 15/22] drm: rcar-du: Support up to 4 CRTCs Laurent Pinchart
2015-09-13 22:51 ` Laurent Pinchart
2015-09-13 22:51 ` [PATCH 16/22] drm: rcar-du: Output the DISP signal on the DISP pin Laurent Pinchart
2015-09-13 22:51 ` Laurent Pinchart
2015-09-13 22:51 ` [PATCH 17/22] drm: rcar-du: Output the DISP signal on the ODDF pin Laurent Pinchart
2015-09-13 22:51 ` Laurent Pinchart
2015-09-13 22:51 ` [PATCH 18/22] drm: rcar-du: Add R8A7795 device support Laurent Pinchart
2015-09-13 22:51 ` Laurent Pinchart
2015-09-13 22:51 ` [PATCH 19/22] drm: rcar-du: lvds: Avoid duplication of clock clamp code Laurent Pinchart
2015-09-13 22:51 ` Laurent Pinchart
2015-09-13 22:51 ` [PATCH 20/22] drm: rcar-du: lvds: Fix PLL frequency-related configuration Laurent Pinchart
2015-09-13 22:51 ` Laurent Pinchart
2015-09-13 22:51 ` [PATCH 21/22] drm: rcar-du: lvds: Rename PLLEN bit to PLLON Laurent Pinchart
2015-09-13 22:51 ` Laurent Pinchart
2015-09-13 22:51 ` [PATCH 22/22] drm: rcar-du: lvds: Add R-Car Gen3 support Laurent Pinchart
2015-09-13 22:51 ` Laurent Pinchart
2015-09-14 7:52 ` [PATCH 00/22] R-Car DU: Add " Geert Uytterhoeven
2015-09-14 7:52 ` Geert Uytterhoeven
2015-09-14 8:07 ` Geert Uytterhoeven
2015-09-14 8:07 ` Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2986707.83nd5NsHMZ@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-sh@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.