From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Brian Starkey <Brian.Starkey@arm.com>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
Liviu Dudau <Liviu.Dudau@arm.com>,
Kieran Bingham <kieran.bingham@ideasonboard.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"james qian wang (Arm Technology China)"
<james.qian.wang@arm.com>, nd <nd@arm.com>
Subject: Re: [PATCH v5 07/19] media: vsp1: dl: Support one-shot entries in the display list
Date: Fri, 22 Feb 2019 16:46:29 +0200 [thread overview]
Message-ID: <20190222144629.GA5020@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20190222143004.cdp2lj4ic3r4ogw4@DESKTOP-E1NTVVP.localdomain>
Hi Brian,
On Fri, Feb 22, 2019 at 02:30:03PM +0000, Brian Starkey wrote:
> On Thu, Feb 21, 2019 at 12:32:00PM +0200, Laurent Pinchart wrote:
> > One-shot entries are used as an alternative to committing a complete new
> > display list when a couple of registers need to be written for one frame
> > and then reset to another value for all subsequent frames. This will be
> > used to implement writeback support that will need to enable writeback
> > for the duration of a single frame.
> >
> > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > drivers/media/platform/vsp1/vsp1_dl.c | 78 +++++++++++++++++++++++++++
> > drivers/media/platform/vsp1/vsp1_dl.h | 3 ++
> > 2 files changed, 81 insertions(+)
> >
> > diff --git a/drivers/media/platform/vsp1/vsp1_dl.c b/drivers/media/platform/vsp1/vsp1_dl.c
> > index 886b3a69d329..7b4d252bfde7 100644
> > --- a/drivers/media/platform/vsp1/vsp1_dl.c
> > +++ b/drivers/media/platform/vsp1/vsp1_dl.c
> > @@ -115,6 +115,12 @@ struct vsp1_dl_body {
> >
> > unsigned int num_entries;
> > unsigned int max_entries;
> > +
> > + unsigned int num_patches;
> > + struct {
> > + struct vsp1_dl_entry *entry;
> > + u32 data;
> > + } patches[2];
> > };
> >
> > /**
> > @@ -361,6 +367,7 @@ void vsp1_dl_body_put(struct vsp1_dl_body *dlb)
> > return;
> >
> > dlb->num_entries = 0;
> > + dlb->num_patches = 0;
> >
> > spin_lock_irqsave(&dlb->pool->lock, flags);
> > list_add_tail(&dlb->free, &dlb->pool->free);
> > @@ -388,6 +395,47 @@ void vsp1_dl_body_write(struct vsp1_dl_body *dlb, u32 reg, u32 data)
> > dlb->num_entries++;
> > }
> >
> > +/**
> > + * vsp1_dl_body_write_oneshot - Write a register to a display list body for a
> > + * single frame
> > + * @dlb: The body
> > + * @reg: The register address
> > + * @value: The register value
> > + * @reset_value: The value to reset the register to at the next vblank
> > + *
> > + * Display lists in continuous mode are re-used by the hardware for successive
> > + * frames until a new display list is committed. Changing the VSP configuration
> > + * normally requires creating and committing a new display list. This function
> > + * offers an alternative race-free way by writing a @value to the @register in
> > + * the display list body for a single frame, specifying in @reset_value the
> > + * value to reset the register to one vblank after the display list is
> > + * committed.
> > + *
> > + * The maximum number of one-shot entries is limited to 2 per display list body,
> > + * and one-shot entries are counted in the total number of entries specified
> > + * when the body is allocated by vsp1_dl_body_alloc().
> > + */
> > +void vsp1_dl_body_write_oneshot(struct vsp1_dl_body *dlb, u32 reg, u32 value,
> > + u32 reset_value)
> > +{
> > + if (WARN_ONCE(dlb->num_entries >= dlb->max_entries,
> > + "DLB size exceeded (max %u)", dlb->max_entries))
> > + return;
> > +
> > + if (WARN_ONCE(dlb->num_patches >= ARRAY_SIZE(dlb->patches),
> > + "DLB patches size exceeded (max %zu)",
> > + ARRAY_SIZE(dlb->patches)))
> > + return;
> > +
> > + dlb->patches[dlb->num_patches].entry = &dlb->entries[dlb->num_entries];
> > + dlb->patches[dlb->num_patches].data = reset_value;
> > + dlb->num_patches++;
> > +
> > + dlb->entries[dlb->num_entries].addr = reg;
> > + dlb->entries[dlb->num_entries].data = value;
> > + dlb->num_entries++;
> > +}
> > +
> > /* -----------------------------------------------------------------------------
> > * Display List Extended Command Management
> > */
> > @@ -652,6 +700,7 @@ static void __vsp1_dl_list_put(struct vsp1_dl_list *dl)
> > * has at least one body, thus we reinitialise the entries list.
> > */
> > dl->body0->num_entries = 0;
> > + dl->body0->num_patches = 0;
> >
> > list_add_tail(&dl->list, &dl->dlm->free);
> > }
> > @@ -930,6 +979,35 @@ void vsp1_dl_list_commit(struct vsp1_dl_list *dl, unsigned int dl_flags)
> > * Display List Manager
> > */
> >
> > +/**
> > + * vsp1_dlm_irq_display_start - Display list handler for the display start
> > + * interrupt
> > + * @dlm: the display list manager
> > + *
> > + * Apply all one-shot patches registered for the active display list.
> > + */
> > +void vsp1_dlm_irq_display_start(struct vsp1_dl_manager *dlm)
> > +{
> > + struct vsp1_dl_body *dlb;
> > + struct vsp1_dl_list *dl;
> > + unsigned int i;
> > +
> > + spin_lock(&dlm->lock);
> > +
> > + dl = dlm->active;
> > + if (!dl)
> > + goto done;
> > +
> > + list_for_each_entry(dlb, &dl->bodies, list) {
> > + for (i = 0; i < dlb->num_patches; ++i)
> > + dlb->patches[i].entry->data = dlb->patches[i].data;
> > + dlb->num_patches = 0;
> > + }
> > +
> > +done:
> > + spin_unlock(&dlm->lock);
> > +}
> > +
>
> We've got some HW which doesn't support one-shot writeback, and use a
> similar trick to try and disable writeback immediately after the flip.
>
> We ran into issues where the "start" interrupt wouldn't run in time to
> make sure the writeback disable was committed before the next frame.
> We have to keep track of whether the disable really happened in time,
> before we release the output buffer.
>
> Might you have a similar problem here?
We may, but there's no provision at the hardware level to check if the
configuration updated happened in time. I could add some safety checks
but I believe they would be racy in the best case :-(
Note that we have the duration of a complete frame to disable writeback,
as we receive an interrupt when the frame starts, and have until vblank
to update the configuration. It's thus slightly better than having to
disable writeback between vblank and the start of the next frame.
> > /**
> > * vsp1_dlm_irq_frame_end - Display list handler for the frame end interrupt
> > * @dlm: the display list manager
> > diff --git a/drivers/media/platform/vsp1/vsp1_dl.h b/drivers/media/platform/vsp1/vsp1_dl.h
> > index e0fdb145e6ed..f845607abc4c 100644
> > --- a/drivers/media/platform/vsp1/vsp1_dl.h
> > +++ b/drivers/media/platform/vsp1/vsp1_dl.h
> > @@ -54,6 +54,7 @@ struct vsp1_dl_manager *vsp1_dlm_create(struct vsp1_device *vsp1,
> > unsigned int prealloc);
> > void vsp1_dlm_destroy(struct vsp1_dl_manager *dlm);
> > void vsp1_dlm_reset(struct vsp1_dl_manager *dlm);
> > +void vsp1_dlm_irq_display_start(struct vsp1_dl_manager *dlm);
> > unsigned int vsp1_dlm_irq_frame_end(struct vsp1_dl_manager *dlm);
> > struct vsp1_dl_body *vsp1_dlm_dl_body_get(struct vsp1_dl_manager *dlm);
> >
> > @@ -71,6 +72,8 @@ struct vsp1_dl_body *vsp1_dl_body_get(struct vsp1_dl_body_pool *pool);
> > void vsp1_dl_body_put(struct vsp1_dl_body *dlb);
> >
> > void vsp1_dl_body_write(struct vsp1_dl_body *dlb, u32 reg, u32 data);
> > +void vsp1_dl_body_write_oneshot(struct vsp1_dl_body *dlb, u32 reg, u32 value,
> > + u32 reset_value);
> > int vsp1_dl_list_add_body(struct vsp1_dl_list *dl, struct vsp1_dl_body *dlb);
> > int vsp1_dl_list_add_chain(struct vsp1_dl_list *head, struct vsp1_dl_list *dl);
> >
--
Regards,
Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-02-22 14:46 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-21 10:31 [PATCH v5 00/19] R-Car DU display writeback support Laurent Pinchart
2019-02-21 10:31 ` [PATCH v5 01/19] Revert "[media] v4l: vsp1: Supply frames to the DU continuously" Laurent Pinchart
2019-02-21 13:16 ` Kieran Bingham
2019-02-21 10:31 ` [PATCH v5 02/19] media: vsp1: wpf: Fix partition configuration for display pipelines Laurent Pinchart
2019-02-21 10:31 ` [PATCH v5 03/19] media: vsp1: Replace leftover occurrence of fragment with body Laurent Pinchart
2019-02-21 10:31 ` [PATCH v5 04/19] media: vsp1: Fix addresses of display-related registers for VSP-DL Laurent Pinchart
2019-02-21 10:31 ` [PATCH v5 05/19] media: vsp1: Refactor vsp1_video_complete_buffer() for later reuse Laurent Pinchart
2019-02-21 10:31 ` [PATCH v5 06/19] media: vsp1: Replace the display list internal flag with a flags field Laurent Pinchart
2019-02-21 10:32 ` [PATCH v5 07/19] media: vsp1: dl: Support one-shot entries in the display list Laurent Pinchart
2019-02-21 13:16 ` Kieran Bingham
2019-02-22 14:30 ` Brian Starkey
2019-02-22 14:46 ` Laurent Pinchart [this message]
2019-02-22 15:06 ` Brian Starkey
2019-03-05 23:14 ` Laurent Pinchart
2019-03-06 11:05 ` Brian Starkey
2019-03-06 18:22 ` Laurent Pinchart
2019-03-07 12:28 ` Brian Starkey
2019-03-08 12:24 ` Laurent Pinchart
2019-03-18 16:59 ` Brian Starkey
2019-03-19 10:00 ` Laurent Pinchart
2019-03-06 14:20 ` Liviu Dudau
2019-03-06 18:01 ` Laurent Pinchart
2019-03-07 11:52 ` Liviu Dudau
2019-03-07 13:48 ` Laurent Pinchart
2019-03-07 16:31 ` Liviu Dudau
2019-03-08 12:46 ` Laurent Pinchart
2019-03-08 15:02 ` Liviu Dudau
2019-03-13 0:56 ` Laurent Pinchart
2019-02-21 10:32 ` [PATCH v5 08/19] media: vsp1: wpf: Add writeback support Laurent Pinchart
2019-02-21 10:32 ` [PATCH v5 09/19] media: vsp1: drm: Split RPF format setting to separate function Laurent Pinchart
2019-02-21 10:32 ` [PATCH v5 10/19] media: vsp1: drm: Extend frame completion API to the DU driver Laurent Pinchart
2019-02-21 10:32 ` [PATCH v5 11/19] media: vsp1: drm: Implement writeback support Laurent Pinchart
2019-02-21 10:32 ` [PATCH v5 12/19] drm: writeback: Cleanup job ownership handling when queuing job Laurent Pinchart
2019-02-21 10:42 ` Laurent Pinchart
2019-02-21 16:02 ` Brian Starkey
2019-02-21 21:56 ` Laurent Pinchart
2019-02-22 13:33 ` Brian Starkey
2019-02-21 16:40 ` Eric Anholt
2019-02-26 18:07 ` Liviu Dudau
2019-02-21 10:32 ` [PATCH v5 13/19] drm: writeback: Fix leak of writeback job Laurent Pinchart
2019-02-21 17:48 ` Brian Starkey
2019-02-26 18:10 ` Liviu Dudau
2019-02-21 10:32 ` [PATCH v5 14/19] drm: writeback: Add job prepare and cleanup operations Laurent Pinchart
2019-02-21 18:12 ` Brian Starkey
2019-02-21 22:12 ` Laurent Pinchart
2019-02-22 13:50 ` Brian Starkey
2019-02-22 14:49 ` Laurent Pinchart
2019-02-22 15:11 ` Brian Starkey
2019-02-26 18:39 ` Liviu Dudau
2019-02-27 12:38 ` Laurent Pinchart
2019-02-21 10:32 ` [PATCH v5 15/19] drm/msm: Remove prototypes for non-existing functions Laurent Pinchart
2019-02-21 10:39 ` Laurent Pinchart
2019-03-13 0:00 ` Laurent Pinchart
2020-12-16 2:54 ` Laurent Pinchart
2019-03-13 9:05 ` Kieran Bingham
2019-02-21 10:32 ` [PATCH v5 16/19] drm: rcar-du: Fix rcar_du_crtc structure documentation Laurent Pinchart
2019-03-11 22:57 ` Kieran Bingham
2019-03-12 15:24 ` Laurent Pinchart
2019-03-12 20:42 ` Kieran Bingham
2019-02-21 10:32 ` [PATCH v5 17/19] drm: rcar-du: Store V4L2 fourcc in rcar_du_format_info structure Laurent Pinchart
2019-03-11 23:20 ` Kieran Bingham
2019-02-21 10:32 ` [PATCH v5 18/19] drm: rcar-du: vsp: Extract framebuffer (un)mapping to separate functions Laurent Pinchart
2019-02-21 10:32 ` [PATCH v5 19/19] drm: rcar-du: Add writeback support for R-Car Gen3 Laurent Pinchart
2019-02-22 14:04 ` [PATCH v5 00/19] R-Car DU display writeback support Brian Starkey
2019-02-22 14:47 ` Laurent Pinchart
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=20190222144629.GA5020@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=Brian.Starkey@arm.com \
--cc=Liviu.Dudau@arm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=james.qian.wang@arm.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=nd@arm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).