[PATCH 3/5] present: Add mode for pixmap flips per window

Roman Gilg subdiff at gmail.com
Wed Aug 30 09:14:51 UTC 2017


On Wed, Aug 30, 2017 at 4:35 AM, Michel Dänzer <michel at daenzer.net> wrote:

> On 30/08/17 12:24 AM, Roman Gilg wrote:
> > This patch adds a new mode to the internal flip mode API, that
> > enables per window flips on capable hardware platforms.
> >
> > Pixmap flips are possible for every window with a parent window and
> > without redirection.
>
> This sentence is a bit confusing. In rootless mode, a toplevel window
> has no parent, but may use flips, right?


The restriction to only allow a window W with a parent to flip is there, so
that we can use the parent window's window pixmap on unflip to restore W's
window pixmap. It was somewhat a late addition to the code because I had
problems with "saving" W's original pixmap. Basically I increased the saved
pixmap's refcnt when doing that, but on restore this pixmap often was
already unreffed by the original creator. So I had to add a condition to
only unref in Present for recnt > 1 (otherwise the pixmap would have been
freed afterwards and could not act as the window pixmap after unflip).

To remove this condition I opted for only allowing window flips for windows
with parent. In this case it's clear what to restore: The parent window's
window pixmap. I did this because in my test applications (only tested with
KWin though) a window requesting pixmap flips never was the toplevel
window, so I assumed in this case the restriction is not limiting.

What could be added in the future is a condition to save the original
window's pixmap in the case of windows without parent and otherwise restore
from the parent window's window pixmap.

> Besides the per window flips the new mode diverges from the old
> > screen flipping by holding back the PresentIdleNotify event for a
> > flipped pixmaps of a preceding frame until present_winmode_event_notify
> > is called once more.
>
> As discussed before, this should be kept separate from the flip mode, as
> it would also be useful with per-screen flips.
>
> My suggestion was to add a PresentCapability* flag for this. If the
> driver sets this flag, it will call present_event_notify separately when
> the flip completes for the target CRTC and when the previous buffer can
> be re-used.


With the new flip mode API it is easy to add this functionality to screen
flip mode later on - and share the code with the window flip mode if
applicable. I just did it not yet with this patch set to leave the screen
flip mode functionality completely unchanged. Instead, if wished for, this
could go in a separate patch.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.x.org/archives/xorg-devel/attachments/20170830/4d89db5a/attachment.html>


More information about the xorg-devel mailing list