dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Liviu Dudau <Liviu.Dudau@arm.com>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.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, 8 Mar 2019 14:46:08 +0200	[thread overview]
Message-ID: <20190308124608.GH4802@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20190307163140.GZ25147@e110455-lin.cambridge.arm.com>

Hi Liviu,

On Thu, Mar 07, 2019 at 04:31:40PM +0000, Liviu Dudau wrote:
> On Thu, Mar 07, 2019 at 03:48:23PM +0200, Laurent Pinchart wrote:
> > On Thu, Mar 07, 2019 at 11:52:18AM +0000, Liviu Dudau wrote:
> >> On Wed, Mar 06, 2019 at 08:01:53PM +0200, Laurent Pinchart wrote:
> >>> On Wed, Mar 06, 2019 at 02:20:51PM +0000, Liviu Dudau wrote:
> >>>> On Wed, Mar 06, 2019 at 01:14:40AM +0200, Laurent Pinchart wrote:

[snip]

> >>>>> We thus have three states for an atomic commit:
> >>>>> 
> >>>>> - active, where the corresponding registers list address has been
> >>>>>   written to the hardware, and processed
> >>>>> 
> >>>>> - queued, where the corresponding registers list address has been
> >>>>>   written to the hardware but not processed yet
> >>>>> 
> >>>>> - pending, where the corresponding registers list address hasn't been
> >>>>>   written to the hardware yet
> >>>>> 
> >>>>> The status bit mentioned above allows us to tell if a list exists in the
> >>>>> queued state.
> >>>>> 
> >>>>> At frame end time, if the status bit is set, we have potentially lost
> >>>>> the race between writing the new registers list and the frame end
> >>>>> interrupt, so we wait for one more vblank. Otherwise, if a list was
> >>>>> queued, we move it to the active state, and retire the active list. If a
> >>>>> list was pending, we write its address to the hardware, and move it to
> >>>>> the queued state.
> >> 
> >> It looks to me like the moving of the pending state into queued state is your
> >> opportunity to also in-place modify the writeback registers if the state does
> >> not have its own writeback request.
> > 
> > Moving from pending to queued means the pointer has been given to the
> > hardware, but not processed yet. I need to wait until the commit that
> > enables writeback is fully processed before modifying it in-place to
> > disable writeback, and that's at the frame start following the move from
> > the queued state to the active state.
> 
> I'm not attempting to (re)write your driver, only to explain my thinking process in
> a way that is easiest for me:

I wouldn't mind if you attempted to rewrite the driver if it ended up in
a better state :-)

> 1. driver prepares a new commit that might have a writeback and sets the
> pointer register to the new address. It then marks the commit as queued.
> 
> (optional) 2. driver receives a new commit that is marked as pending
> 
> 3. end-of-frame interrupt arrives
>      a. HW reads the new address and programs a DMA transfer to update registers.
>      b. driver reads the status bit and waits until status == 0.

Step b is not needed as the status bit is set to 0 as soon as the
hardware starts the DMA.

>      c. driver marks queued commit as active and looks if it has any pending commits
>           - if yes, it looks at the pending commit if it has a writeback request
> 	        - if no, it updates the pending commit to write the register(s) that disable writeback
> 		- moves pending commit to queued
> 	  - if no, then it copies active commit and disables writeback. (*)

Pending commits are very rare. Userspace will usually queue the next
commit when it receives notification of completion of the previous
commit, so the next commit will arrive after vblank, with a single
commit per frame interval. At that point there will be an active commit,
and no queued commit, and the new commit will become the queued commit.
The "no" case will thus be hit in the vast majority of cases, preventing
the next userspace commit to be queued for the same frame, delaying it
by one frame, and thus halving the frame rate :-(

>      d. driver signals vblank and any previous writebacks that might have been programmed
>         by the previously active commit
> 
> 4. ....
> 5. profit!
> 
> 
> (*) depending on how the HW behaves, it might be enough to create a stub
>     commit that only disables the writeback, with no other update.

A stub is enough, there's no need to reprogram everything.

> This way writeback commits will always be followed by another commit,
> even if it is a dummy one that only disables writeback.

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-03-08 12: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
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 [this message]
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=20190308124608.GH4802@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.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