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

Michel Dänzer michel at daenzer.net
Thu Aug 31 02:02:33 UTC 2017


On 30/08/17 06:14 PM, Roman Gilg wrote:
> On Wed, Aug 30, 2017 at 4:35 AM, Michel Dänzer <michel at daenzer.net
> <mailto: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. 

A per-window flip must set the presented pixmap as the window pixmap of
all windows from the destination window up to and including the toplevel
window. Otherwise there's the same issue as in patch 5 with later X11
requests using the toplevel window.

On the other hand, it may not be necessary to restore the original
window pixmap after per-window flips. Not sure though, I might be
missing a reason why it's necessary. But if it's not, that might make it
easier to handle the above correctly.


>     > 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.

I suspect e.g. the separate present_winmode_event_notify function
wouldn't be necessary though if this was separated, so that wouldn't
need to be added to Xorg's video driver ABI.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the xorg-devel mailing list