If possible, we want the restoration of the Screen Pixmap to be fast,
and so we want to preferably use the immediate asynchronous flip.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Present checks for a flip-compatible Pixmap prior to deciding whether to
queue the flip after a pending flip, and at that point we do not want to
reject a potential flip due to outstanding flips. That is only of
restriction only applies when we request the kernel to perform the flip,
so more the check to the corresponding position.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Using the same member as both an override and a cache in different
modes leads unsurprisingly to confusion.
Fixes regression from
commit 3cfde9f043
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Tue Jan 13 13:50:08 2015 +0000
sna: Only instantiate the frontbuffer on the GPU if used
Reported-by: Chris Bainbridge <chris.bainbridge@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89007
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Within a span, we have the advantage of knowing that we only need to
intersect one box with the clip region, and that box has monotonically
increasing y. This avoid having to compute RegionIntersect for every
span element which was very slow (e.g. libreoffice).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
For reads, we can use the existing clone -- except if the migration is
required to return a unique GPU handle to the pixmap.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
As we cannot propagate the failure for unflipping back to the caller, we
must ensure that the CRTCs are correctly reset if the attempt to flip
back to normality fails.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This captures a bug in transitioning from gdm to gnome-shell where the
present_unflip copy back onto the Screen Pixmap fails.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
We always try to make sure the scanout is initialised before use, but if
the GPU is wedged we need to fallback to use the CPU to do the clears.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Rather than synchronously wait in the unflip for the pageflips to complete
by forcing the modeset, try to queue the unflip to happen after the pending
flip completes.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
If we have two scanlines with identical extents and coverage, we can
amalgamate them into a set of multi-row boxes. For simplicity, we only
compare with the last box (assuming that the majority of such cases are
"rounded-rectangles" where we have a large vertical area with no
variation and can coalesce into a single box). This operates as a second
pass to the scanline converter itself coalescing pure-vertical regions.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Rather than imposing a maximum DRI level at compile time by compiling
out unwanted protocol handlers, default to limiting it at runtime so
that we can switch between any level.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
As we may exchange the frontbuffer whilst the outputs are hidden (DPMS
off), when we turn them back on, unless we force the CRTCs to be
updated, we may end up simply showing a stale scanout buffer not the
current frontbuffer. If the two are same, it will just be a kernel
no-op.
Reported-by: Jiri Slaby <jirislaby@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88826
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
If the mode changes whilst we have a pending flip, we may reinstall the
previous scanout buffer as our next back buffer despite it no longer
matching.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
After querying for an idle bo and retiring the associated requests, we
must be careful not to confuse ourselves with exported bo becoming busy
again.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c83
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
If you mistype or make the wrong selection in the AccelMethod override,
you can end up with a non-booting system, so lets always try to start
something!
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Since xorg-server-1.12.0, Xorg has supported adjusting the client swap
limits allowing us the implemention of triple buffered flipping with
accurate event timestamps. Given that the current implemention has an
issue tracking the right GEM name across composite unredirection, it is
an approximate juncture to tackle both bugs.
Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=742911#c1
Testcase: dri2-race + gnome-shell
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Always check that the reused DRI2Buffer matches the associated name, and
not just for back buffers of a window.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Lots of issues found when trying dri2-race, mostly resulting from
queueing too many flips at one - which itself is buggy. However, we
crashed whilst trying to recover from the kernel reporting the error.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
As we set the type prior to attempting to queue a flip, we need to then
reset the type if that attempt fails and we need to fall back to a
vblank handler.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
The purpose is to keep the recent history of buffers for a DRI client
for tracking the relevant age.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
To do SwapBuffers correctly requires a Swap/Get buffers combination, and
this is easiest using xcb rather than xlib.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Before we present a buffer on the CRTC, we try to make sure it is
initialised with the current contents. However, if it is larger than the
screen then not all the buffer may be initialised and so we need to
clear it first.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Suppose for a moment that we don't have a DRI2Buffer associated with the
Drawable just yet... This could happen after a Composite redirect as the
front buffer may created (and so associated with the new Pixmap) after
the back buffer is recreated.
Reported-by: Tomas Pruzina <pruzinat@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88814
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Undo d16ac1f30b (sna/dri2: Prefer to use normal selection criteria for
CopyRegion on small GT) to keep on the current ring as the external bo
if semaphores are disabled.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
If the blob is smaller than the space we offer for the read, it skips
the read. So make sure we repeat the read in this case as well.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
In case the version numbering is disabled, like on Arch, include it
anyway in the full debug log.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
We can only pageflip if we don't change the pitch, otherwise we
simulate the pageflip with modeset. The idea is that once we have
exchanged the buffers, we will quickly settle down to a steady state
scenario where each buffer has the same pitch. We can encourage this
further by only keeping those buffers around that do have the same pitch
as the current front.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>