Commit Graph

8796 Commits

Author SHA1 Message Date
Chris Wilson 147e190d1e sna: When turning off outputs whilst DPMS off, update the right counters
Whilst the outputs are hidden, if we want to disable a CRTC, we want to
manipulate the hidden counter as opposed to current front_active
counter.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-12 09:51:38 +00:00
Chris Wilson 8348927c37 sna/present: Handle fake RRCrtc
Be sure we don't crash if the user requests presenting on one of our
fake RRCrtcs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-11 22:29:37 +00:00
Chris Wilson 688f5e9bd7 sna/present: Compensate for time elapsed since last swap
When computing the delay for the fake flip, compensate for any time
elapsed since the last frame in order to hit the desired vblank more
accurately. A side-effect of this is that we may now compute 0 delay
timers which require special handling.

Testcase: present-test/accuracy
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-11 22:16:25 +00:00
Chris Wilson 6b6ab54072 sna/dri2: Refactor immediate swap scheduling
Allow a request to swap on the next frame to be considered by the
immediate handling code by refactoring the target msc computation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-11 12:32:53 +00:00
Chris Wilson 7e1671b15e sna/dri2: Queue a flip via a vblank event if we have outstanding flips
If we swap between Clients, or even Windows, then we may have a flip
still pending completion in hardware but no longer tracked in order to
release the freed state. In this scenario, queue the flip via a vblank
event.

Testcase: dri2-race with non-immediate flips
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-11 12:09:22 +00:00
Chris Wilson 8b8b1021f4 test/dri2-race: Mix immediate flips with delayed flips
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-11 12:09:01 +00:00
Chris Wilson fc010846b1 test/dri2-race: Actually queue a number of future WaitMSC
In order to have outstanding WaitMSC when the Client quits or the Window
is destroyed, we need to use the xcb version so as not to immediately
block on the play.

And also print keepalive dots to console as test progresses.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-11 11:06:49 +00:00
Chris Wilson 4f5d7825df test/present: Return the correct error counter from for_each_crtc
When the xserver is fixed and we no longer block for ever inside the
test, we can see that the test itself falsely reports failure!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-11 10:34:47 +00:00
Chris Wilson 7671e5cb7b sna: Handle double failure to flip
During flip failure recovery, we try to queue a second flip in order to
generate the flip completion event. If that fails, we need to abort the
flip entirely.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-11 10:26:13 +00:00
Chris Wilson 426a3afcc6 sna/present: Prevent DoS from exhausting the kernel vblank queue
The kernel caps the number of vblanks per client to 128. There are
already reports from the wild that Present clients are running foul of
that limit, so supplement it with a timer fallback.

Testcase: present-test with future flips
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-11 09:51:43 +00:00
Chris Wilson 0b7a6666f8 sna: Partially unroll conversion of rectangles to boxes for fills
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-11 00:13:26 +00:00
Chris Wilson 8ef3fdacac sna: Reshow cursors after VT switch
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-10 15:00:55 +00:00
Chris Wilson 61e957cb5f Enable support for render-nodes by default with DRI3
DRI3 can use render nodes if provided by the kernel, so enable it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-10 14:03:11 +00:00
Chris Wilson 5568b24a32 dri2: Disable integration with render-nodes
The executive decision has been made to render DRI2 inoperable with
render-nodes, so keep on passing the master device path to clients.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-10 14:01:17 +00:00
Chris Wilson d1ebd27a31 sna: Prefer first active CRTC for offscreen drawables
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-10 13:50:31 +00:00
Chris Wilson d50eb8d57a intel: Fix checking for compatible render node
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-10 12:22:59 +00:00
Chris Wilson 88db217705 tools/dri3info: Match fd against render nodes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-10 12:20:47 +00:00
Chris Wilson 27ededdfc7 tools/dri3info: Query the kernel driver name
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-10 12:10:56 +00:00
Chris Wilson 928ff25430 tools: Add rudimentary dri3info
A simple tool just to check if the target Xserver offers dri3.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-09 17:09:55 +00:00
Chris Wilson f7f68d5079 sna: Convert pixel values into ARGB values for render operations
When converting from a Pixmap into a Solid, we need to remember to
convert from the stored pixel format into the a8r8g8b8 used by the solid
fill.

This was exposed by

commit aef2f99d05
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Feb 3 21:31:16 2015 +0000

    sna: Convert CompositeRectangles ADD white to SRC white

but is a regression from

commit 31a4c7bc13 [2.99.912]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Apr 4 10:46:48 2014 +0100

    sna/gen2+: Replace composite sources with solids where possible

Reported-by: andrew@atomspring.com
Reported-by: Matti Hämäläinen <ccr@tnsp.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89030
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-09 10:38:50 +00:00
Chris Wilson 733a88bda7 sna: Tidy composite operator reduction for CompositeRectangles
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-09 10:36:23 +00:00
Chris Wilson 111847108d sna: Match more classes of opaque composite masks
If we apply the mask clipping first, we can be sure that the samples are
all from an untransformed mask and so we can check the is-clear? hint.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-09 10:36:23 +00:00
Chris Wilson 5b033d638b sna: Avoid accessing past the end of the clip boxes for incremental clipping
During incremental clipping of the trapezoids, we can assign the end
BoxPtr to begin, and so we should be careful not to dereference that
pointer (as it points passed the end of the clip boxes).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-08 22:13:35 +00:00
Chris Wilson 357a798156 sna: Check against last clip box (not past the end of the boxes)
The end BoxPtr actually points to one past the end of the clip boxes, so
in order to inspect whether the line is after the clip region, we want
to look at the last box, i.e. the box before. We also only want to
ignore the clip if we do not intersect at all, otherwise we need to find
the start of the clip row.

Reported-by: Matti Hämäläinen <ccr@tnsp.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-08 22:01:09 +00:00
Chris Wilson 0c2ff5532c sna/present: Fallback to first available CRTC if none overlap Window
In order to handle PRIME offscreen Windows nicely, tie their
presentation into the Primary CRTC (if available).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-08 15:53:56 +00:00
Chris Wilson bc8c161801 sna/present: Always store sna backpointer in vblank event closure
This is primarily defensive paranoia in case we see multiple unflip
requests.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-07 21:08:38 +00:00
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