Commit Graph

8831 Commits

Author SHA1 Message Date
Chris Wilson 41e559f57e sna: Update the active_scanout flags on async flips
In order to keep our sanity checks and buffers in order, we need to
remember to mark the new frontbuffer as the active scanout after an
asynchronous pageflip.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-25 09:01:25 +00:00
Chris Wilson 1ae0dc460d sna: Clamp aperture size to 32bits
Internally we only use 32bits for limiting the maximum object size
(both for CPU and GPU allocations) so to prevent overflow limit the
reported aperture size.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-24 22:58:51 +00:00
Chris Wilson 98245a5cff sna: Improve DBG messages for MST probing
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-24 22:58:51 +00:00
Chris Wilson 88e84320a3 sna/dri2: Flush triple buffer swap on [un]redirection
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-24 15:50:25 +00:00
Chris Wilson 12af8a575d sna: udev integration depends on fstat and sys/stat.h
src/sna/sna_driver.c: In function 'sna_handle_uevents':
src/sna/sna_driver.c:759:2: error: implicit declaration of function 'fstat' [-Werror=implicit-function-declaration]

Also take the opportunity to include udev support in the configure
summary.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-24 15:30:56 +00:00
Chris Wilson 872a296850 sna: Discard addition of drawable offset if 0
Missing trim of "add 0" from

commit 0b7a6666f8
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Jan 5 14:00:44 2015 +0000

    sna: Partially unroll conversion of rectangles to boxes for fills

not all redundant +(dx,dy) were dropped.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-24 09:07:04 +00:00
Chris Wilson fef0f3dc0c sna: Add missing 'break' from last patch
Converting from

switch(value)
{
case 1: return 1;
...
default: return -1;
}

you must remember to insert the breaks!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-21 17:08:06 +00:00
Chris Wilson b6d4f49176 sna: Cache the output status and modes for 15s
As the output configuration rarely changes, and is normally accompanied
by a hotplug event, we can cache the last probe for a small number of
seconds. If a hotplug event does fire, in the worst case by the 30s
output polling thread, then we reset the cache and force the probe. This
should improve application (and desktop) startup times as they often
seem to do many full xrandr probes (rather than query current status).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-21 16:50:50 +00:00
Chris Wilson 09b0ab9b43 uxa/dri: Drop dependency on stdbool
Copying the bool is_level() without including stdbool.h causes it to not
compile on some machines. Just convert back to the old faithful Bool.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-18 19:16:29 +00:00
Chris Wilson 996736af71 sna: Rename 'sna_output_panel_edid' to 'sna_output_add_default_modes'
The criteria for adding the modes is not associated with panels and
edids, so the name is quite misleading. We add any missing default modes
if we have a panel fitter and the output itself has not declared them
(via its EDID).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-18 16:13:33 +00:00
Chris Wilson 50f911b19f sna/present: Fixup a few DBG
event_id is now an array - but the misprint was hidden on 64bit systems,
the warning only apparent because of the pointer mismatch on 32bit
systems.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-18 14:19:52 +00:00
Chris Wilson e293991f40 sna: Reuse the old cursor on the current CRTC
We only want to prevent sharing of physical handles across CRTC (on old
kernels). If we already have one assigned to a CRTC we know that it is
unshared and can keep using it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-18 10:01:02 +00:00
Chris Wilson 127aae5a72 tools/intel-virtual-output: Check for DRI3 more carefully
Using xcb, we cannot simply call xcb_dri3_query_version() without it
terminating the connection if DRI3 is not enabled on the target display.
Oops.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89172
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-16 21:48:41 +00:00
Chris Wilson 53c435c6cd sna/present: Only share vblanks on the same CRTC
Remember vblanks are private to a CRTC, the same MSC on another CRTC may
fire at completely different times...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-16 16:01:48 +00:00
Chris Wilson 10e40489e2 sna/present: Try exchanging the Pixmap with a scanout-ready bo
Try to avoid more clflushing on the current Pixmap if we have a
scanout-ready bo in the cache. We also note that since we unflip before
any other drawing takes place, we do not need to mark the flipped Pixmap
as being pinned to the scanout.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-16 16:01:48 +00:00
Chris Wilson 1877c8f508 test/present: Compact flip queue checks
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-16 12:00:20 +00:00
Chris Wilson 1c16a91aaf sna: Skip an async flip request to the same bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-16 12:00:20 +00:00
Chris Wilson 93b94b96c6 sna/present: Append duplicates onto queued vblanks
If we have multiple events for the same vblank, append the notification
to an existing vblank. This is particularly useful as we it ensures that
we then report notifications in the same order as queued.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-16 12:00:20 +00:00
Chris Wilson b9eeb9dd84 test/present: Tighten MSC modulus computation
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-16 09:45:17 +00:00
Chris Wilson 3382bd78d9 test/present: Test notifier accuracy
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-15 19:21:01 +00:00
Chris Wilson 5fc2628e80 sna: Use shadow_enabled to prevent TearFree recursion
At times, we want to clear pending flips from inside TearFree, and thus
need to disable recursion. Currently we dance with shadow_damage, but
now we can just migrate over to using the shadow_enabled flag.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-15 19:21:01 +00:00
Chris Wilson 3fc942b374 sna/present: Avoid tricks with the TearFree flag
Modifying the flag may cause havoc if we need to modeset whilst Present
is in control as the CRTC will be setup without reference to TearFree, but
then when Present unflips, we restore the stale configuration. So let's
have a separate flag just to disable TearFree flips when a Present flip
chain is active.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-15 09:50:38 +00:00
Chris Wilson 74553bf4d2 sna/present: Integrate into TearFree, take 2
Following on from the previous attempt is the realisation that we can
simply disable TearFree during a Present flip queue, and re-enable
TearFree upon unflip.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-14 22:43:14 +00:00
Chris Wilson c30af937f8 sna/present: Disable hardware async flips with TearFree
These two don't mix, so remove the claim that we do support async flips
when TearFree is enabled.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-14 22:43:13 +00:00
Chris Wilson 9a311f9da6 sna: Throw away the TearFree damage if it grows too big
The Damage layer is slow, so reduce the amount of work it has to do by
explicitly throwing away any information other than the bbox.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-13 16:41:52 +00:00
Chris Wilson adaf0a2c61 sna/present: Hook into TearFree
For the duration of the Present flip chain, replace our frontbuffer with
the Client's Pixmap. Before any attempt to draw into the real
frontbuffer, Present will unflip back to the TearFree front+shadow.
However, it does give the Client direct access to the scanout through
their Pixmap (effectively disabling TearFree on behalf of the Client).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-13 16:41:52 +00:00
Chris Wilson 42ebe2ef96 uxa: Remove the filtering of bogus Present MSC values
If the intention was to filter the return values from the kernel, the
filtering would have been applied to the kernel values and not to the
incoming values from Present. This filtering introduces crazy integer
promotion and truncation bugs all because Present feeds garbage into its
vblank requests.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-13 08:10:24 +00:00
Chris Wilson 35ab0afd04 test/present: Automatically disable DPMS
DPMS plays havoc with Present timings, make sure the screen doesn't turn
off.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-12 21:10:25 +00:00
Chris Wilson 9eb0ab15b1 test/present: Look for MSC wraparound
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-12 17:10:13 +00:00
Chris Wilson 254f2f2f4b test/present: Check a simple double-buffer sequence
Just check that we can do a present roundtrip in time to submit a new
frame on the next vblank.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-12 17:10:13 +00:00
Chris Wilson 92f74186b0 test/present: Include test for timing accuracy
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-12 17:10:13 +00:00
Chris Wilson 9d4df75edb test/present: Check modulus computation
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-12 14:47:30 +00:00
Chris Wilson 51f184edfb test/present: Tighten the accuracy requirements
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-12 13:51:04 +00:00
Chris Wilson ac1eb7f7c9 test/present: Test accuracy of long pauses
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-12 13:51:04 +00:00
Chris Wilson 818b596a6a sna/present: Store target_msc for DBG output in flip handler
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-12 13:51:04 +00:00
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