Commit Graph

8770 Commits

Author SHA1 Message Date
Chris Wilson ae05f74e4e sna/present: Try to use async flips for unflip
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>
2015-02-07 21:08:38 +00:00
Chris Wilson 6e3f45e028 sna: Use PrimaryOutput as CRTC source when drawable is offscreen
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-07 21:08:38 +00:00
Chris Wilson 26ba2ba6e7 uxa/present: Fix flip_count for aborting on failed flip request
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-07 00:04:55 +00:00
Chris Wilson c7517c4fe2 sna/present: Restrict pending flip check to enqueueing
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>
2015-02-06 22:18:43 +00:00
Chris Wilson 934733e7c7 sna: Separate per-CRTC client bo from the TearFree cache
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>
2015-02-06 21:08:51 +00:00
Chris Wilson 5ed8368772 sna/trapezoids: Use incremental region clipping for spans
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>
2015-02-06 21:07:50 +00:00
Chris Wilson e0d9953e3b sna: Only do COW creation on read-only migration if forced
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>
2015-02-06 12:27:48 +00:00
Chris Wilson 4c9af31477 uxa/present: Do flip returns 0 on failure
Oops, inverted error handling lead to use-after-free and calamity.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-06 08:05:15 +00:00
Chris Wilson ee42e106fe test: Tighten present checks to catch CRTC interchange bug in a single pass
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-05 13:41:13 +00:00
Chris Wilson ca71ee0685 uxa/present: Do not allow the unflip to fail
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>
2015-02-05 08:50:10 +00:00
Chris Wilson cec34132a7 sna: Add some DBG for why a DoCopy might be skipped
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>
2015-02-05 08:34:39 +00:00
Chris Wilson 7dd16e5684 sna: Clear the resized framebuffer if wedged
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>
2015-02-05 08:34:39 +00:00
Chris Wilson f93aab9bbc sna/present: Queue the unflip if we have flips outstanding
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>
2015-02-05 08:34:39 +00:00
Chris Wilson 6ba3bd9dfd sna: Use local defines for compilation on older distributions
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-04 12:12:13 +00:00
Chris Wilson c6dd23ce11 sna: Always mark the virtual outputs as disconnected until used
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-04 11:13:19 +00:00
Chris Wilson 5fad8d8527 sna: Mark initial output status as unknown
References: https://bugs.freedesktop.org/show_bug.cgi?id=88960
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-04 11:07:19 +00:00
Chris Wilson d7bcb7bcbf sna/trapezoids: Amalgamate adjacent lines
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>
2015-02-04 10:44:33 +00:00
Chris Wilson db629a3834 Allow runtime selection between DRI levels
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>
2015-02-04 09:55:54 +00:00
Chris Wilson aef2f99d05 sna: Convert CompositeRectangles ADD white to SRC white
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-03 21:31:16 +00:00
Chris Wilson 3855a728e5 sna: Always restore the scanout on DPMS on
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>
2015-02-03 20:26:41 +00:00
Chris Wilson 70cb682662 uxa/dri2: Recreate the triple buffer across a mode change
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>
2015-02-02 10:03:33 +00:00
Chris Wilson 6d2754b190 Unify Option "DRI" parsing
Allow Option "DRI" "[23]" to also work with UXA.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-31 21:46:09 +00:00
Chris Wilson dac01d0839 sna: Mark the bo as clean after the kernel reports it idle
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>
2015-01-31 10:55:44 +00:00
Chris Wilson 5edab91b1e intel: Try to load one AccelMethod if the .conf doesn't match
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>
2015-01-31 01:30:09 +00:00
Chris Wilson 6db906ea81 uxa/dri2: Reimplement triple buffer support
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>
2015-01-31 01:27:49 +00:00
Chris Wilson 102a091f5a sna/dri2: Rearrange asserts for greater coverage
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>
2015-01-31 00:21:29 +00:00
Chris Wilson e427bb4e41 test/dri2-race: Race against CloseDisplay and also test WaitMSC
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-30 14:49:02 +00:00
Chris Wilson d909c46074 uxa: Fix error handling for failed pageflips
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>
2015-01-30 13:24:42 +00:00
Chris Wilson c2f30a539c uxa/dri2: Make vblank/flip handlers static
These are no longer called directly from outside intel_dri.c and so we
can make them static.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-30 13:12:20 +00:00
Chris Wilson fa5a8c61d1 uxa/dri2: Reset swap_info->type after a failed flip submission
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>
2015-01-30 13:10:55 +00:00
Chris Wilson c0610c76b7 sna/dri2: Smooth out delivery of triple buffer SwapCompletions
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-29 23:56:06 +00:00
Chris Wilson dc51886c0c sna/dri2: Fix use of stale flip_pending after removing window
Testcase: dri2-race
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-29 23:55:19 +00:00
Chris Wilson 1030705cdc sna/dri2: Fix interoperation between keepalive and fake-triple-buffering
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-29 23:11:49 +00:00
Chris Wilson 58fe408978 sna/dri2: Keep the per-drawable swap cache alive for 50ms
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>
2015-01-29 16:40:15 +00:00
Chris Wilson 2e7ae76038 test/dri2: Use xcb for more accurate timing of SwapBuffers
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>
2015-01-28 11:46:43 +00:00
Chris Wilson 6f6190abcf sna: Clear the per-crtc shadow buffer if they are clipped
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>
2015-01-28 11:24:09 +00:00
Chris Wilson 4bbd102367 sna/dri2: Check for comparable back/front pitches more carefully
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>
2015-01-27 12:01:12 +00:00
Chris Wilson b8d52b0edd sna: Log maximum number of CPU threads
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-26 21:40:20 +00:00
Chris Wilson d2b7d78064 sna/dri2: Use existing busy state if semaphores are disabled
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>
2015-01-26 21:31:44 +00:00
Chris Wilson 64e9c79017 legacy/i810: Expand mask to match unsigned long
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-26 13:18:56 +00:00
Chris Wilson 33f7d5e428 sna: Expand mask to match uintptr_t
Let's make sure we mask all the uintptr_t bits.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-26 13:10:21 +00:00
Patrick Welche 53e825d6cf configure.ac: pwd doesn't take an argument
bash built-in doesn't give an error, but real pwd does, and the
argument is unnecessary.

Signed-off-by: Patrick Welche <prlw1@cam.ac.uk>
2015-01-26 12:47:03 +00:00
Patrick Welche 75fcda8058 uxa: fix XVMC = no build
Signed-off-by: Patrick Welche <prlw1@cam.ac.uk>
2015-01-26 12:46:43 +00:00
Patrick Welche ac90648ec7 backlight.c: test for features
Signed-off-by: Patrick Welche <prlw1@cam.ac.uk>
2015-01-26 12:46:07 +00:00
Chris Wilson 913afaf249 sna: Tweak treatment of DPMS mode to be consistent at all layers
References: https://bugs.freedesktop.org/show_bug.cgi?id=88794
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-26 09:42:11 +00:00
Chris Wilson 6c8d98436a sna/gen6+: Tweak engine placement when considering src/dst combinations
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-25 14:09:07 +00:00
Chris Wilson ed19b16008 sna: Assert that the shadow buffer has a compatible pitch to the front
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-23 11:08:37 +00:00
Chris Wilson b388172076 sna: GETPROPBLOB only works with exact length matches
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>
2015-01-23 10:54:57 +00:00
Chris Wilson 619d165eed sna: Add a fallback DBG for the git version
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>
2015-01-23 08:42:56 +00:00
Chris Wilson 684e921a54 sna/dri2: Only preserve back buffers with the same pitch
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>
2015-01-22 21:03:24 +00:00