Commit Graph

9119 Commits

Author SHA1 Message Date
Chris Wilson 6027bfc461 sna/dri2: Also track the front bo as an active buffer
This so that we permanently exclude the active front buffer from the set
of triple buffer replacements.

References: https://bugs.freedesktop.org/show_bug.cgi?id=91658
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19 17:03:02 +01:00
Chris Wilson 8a59e85801 sna/dri2: Initialise scratch.pScreen for copying
Down one particular patch (overlapping render copies) the
scratch.pScreen is dereferenced (to create a temporary Pixmap). Ensure
that we populate it before hand.

References: https://bugs.freedesktop.org/show_bug.cgi?id=91658
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19 16:48:58 +01:00
Chris Wilson 8c59c5ba4e sna/dri2: Remove unused local variable in normal builds
The local was only used in debug builds, so remove it to squash the
compiler warning.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19 15:21:09 +01:00
Chris Wilson dab1c0f159 sna/dri2: Move the pending swap from the buffer to the event
To ease tracking of the next swap, stash it on the event (which is then
reused) rather than the back buffer (which changes frequently).

In addition, add debug flags and assertions to track event stages (such
as making sure we do not decouple/free an event that we have sent a
signal back to the client).

References: https://bugs.freedesktop.org/show_bug.cgi?id=91658
References: https://bugs.freedesktop.org/show_bug.cgi?id=70461
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19 15:18:24 +01:00
Chris Wilson 18e4845027 sna/dri2: Transfer the pending back to the new back following the xchg
Third time lucky at getting the pending copy swap with the real back
correct?

References: https://bugs.freedesktop.org/show_bug.cgi?id=70461
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-18 13:37:09 +01:00
Chris Wilson b86974ffd4 sna/dri2: Do full exchanges of back/pending around deferred swaps
References: https://bugs.freedesktop.org/show_bug.cgi?id=91658
References: https://bugs.freedesktop.org/show_bug.cgi?id=70461
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-18 11:58:21 +01:00
Chris Wilson 79fc9a923c sna/dri2: Immediately complete a stale swap if any are queued
If we don't control the vblank for the window, we cannot use the vblank
signal as it ends up being queued as well.

References: https://bugs.freedesktop.org/show_bug.cgi?id=91658
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-18 09:21:20 +01:00
Chris Wilson 07eee812b2 sna/dri2: Avoid pushing the triple buffer into the cache list twice
A side effect of commit 4cea803798
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sat Aug 8 22:10:20 2015 +0100

    sna/dri2: Restore caching of fullscreen triple buffers

was that we discovered that we had been inserting the buffer into the
cache list multiple times.

Reported-by: Dan Doel <dan.doel@gmail.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=91658#c5
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-17 20:57:54 +01:00
Chris Wilson 1b3cf1efe3 sna/dri2: Check that the copy succeeds before associating the request
If the DRI2 copy ends up on the CPU, then we will not have a GPU
request for the operation.

Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-17 12:45:24 +01:00
Chris Wilson 9b0ed16385 sna/dri2: Flush the pending flip when a client disappears
If a client dies with a pending flip, we have to complete it so that the
scanout matches the frontbuffer again. This requires one last flip
following the client disapparance.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-16 13:31:16 +01:00
Chris Wilson 521b2c5a3b sna/dri2: Use the primary CRTC for swap completion for offscreen Windows
Letting GL clients run amok when offscreen (or when hidden) has
unexpected UX behaviour. Instead we can elect to throttle them to the
nearest CRTC and keep the desktop running smoothly.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-14 19:39:22 +01:00
Chris Wilson 2c03599166 sna: Fixup conversion of rotation into reflection
Similarly to the fix for reflection into rotation, make sure we only set
one Rotation bit afterwards.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-14 10:47:30 +01:00
Chris Wilson eea91b8e23 sna: Only handle a rotation natively if all bits are supported
Since we can combine Reflections and Rotations, we have to check all
bits.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-14 10:31:33 +01:00
Bob Paauwe f75a5689c3 sna: Fix the reduction of xy reflection onto rotations.
When reducing a xy reflection to a 180 degree rotation, make sure
only one rotation bit is set.  Also by rotating the bit left, we
can support cases where xy reflection happens with 90/270 degree
rotation.

Signed-off-by: Bob Paauwe <bob.j.paauwe@intel.com>
[ickle: Interleave comments]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-14 09:15:57 +01:00
Chris Wilson 656c0a6946 list: Add missing ';' for the compatiblity macro for intermediate xorg
Reported-by: Joakim Tjernlund <joakim.tjernlund@transmode.se>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-12 12:31:27 +01:00
Chris Wilson 5a9a3e73a9 sna/dri2: Keep the most-recent back buffer cache when reaping on idle
When the client misses a swap, we consider it idle and unlikely to swap
again for a while. We try to take advantage of that and remove the old
back buffers. But it is likely to swap again and so having some of that
cache around would be advantageous.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-11 10:48:48 +01:00
Chris Wilson 4cea803798 sna/dri2: Restore caching of fullscreen triple buffers
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-08 22:10:58 +01:00
Chris Wilson fd5f44f4d2 sna: A couple more asserts for valid flip data and handling
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-08 22:10:57 +01:00
Chris Wilson cadea260de sna/dri2: Add the old buffer from a chain swap to the swap cache
Rather than just discarding the old buffer, we want to add it to the swap
cache and so hand it back to the client in the near future.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-08 15:39:05 +01:00
Chris Wilson 611ec7d7d4 sna: Remove incorrect assertion
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 17:19:25 +01:00
Chris Wilson f324506f7d sna: Prefer direct writes if the target is LLC
If we can use WB CPU writes into the target, prefer to do so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 16:45:38 +01:00
Chris Wilson 095528e6c3 sna: Tweak the semantics for small uploads into Damage tracked pixmaps
Based on further study of behaviour under a compositing manager, always
prefer to upload directly into the flushed bo, with a couple of
exceptions.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 16:38:32 +01:00
Chris Wilson 07bcd3f0c7 sna: Use direct uploads into a Damage tracked for v.small operations
If the batch is being frequently flushed due to Damage+Composite
tracking, we cannot amalgamate the small copies into the destination and
so end up sending thousands and thousands of tiny batches with tiny
render copies hogging the GPU.

References: https://bugs.freedesktop.org/show_bug.cgi?id=91577
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 15:26:30 +01:00
Chris Wilson 3f128867d9 sna: Skip a no-op copy
If the source has no contents, the destination is equally undefined.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 15:21:33 +01:00
Chris Wilson a3ac461a30 sna: Add a handle=%d to a DBG for consistency
Helps with grepping if the DBG are consistent.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 15:18:49 +01:00
Chris Wilson 5ef9d68043 sna: More simple DBG tracing around cleanup/retire handling
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 14:04:31 +01:00
Chris Wilson fd0236bb8e sna: Release the reference on the rq->bo during forced cleanup
Since the switch to preallocating the batch buffer, the request owns its
reference to the rq->bo. However, dropping that reference was missed
during the cleanup.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 13:48:38 +01:00
Chris Wilson 6bab82b91d sna: Always prefer a fresh allocation for the batch if !llc
An unwanted subtle change in preference from

commit 8c465d0fbf
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Aug 7 10:15:42 2015 +0100

    sna: Fallback after a bo allocation failure for the batch

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 13:25:52 +01:00
Chris Wilson a00fdce1fd sna: Add a little more DBG information to kgem_retire()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 13:24:13 +01:00
Chris Wilson d78685787a sna: Fix sync'ing to the most recent request on forced cache cleanup
We picked the oldest, not most recent and so were not recovering as much
memory as desired.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 12:59:57 +01:00
Chris Wilson 862c0d3cc9 sna/dri2: Make event chaining DBG clearer
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 12:57:31 +01:00
Chris Wilson f1b1baa7ff sna: Add a DBG for when we discard an invalid old mmapping
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 12:45:26 +01:00
Chris Wilson 672436efd5 sna: Treat being wedged as unlikely during rendering with HW
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 12:03:34 +01:00
Chris Wilson ccc553ff03 sna: Stop allocating requests once wedged
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 12:01:38 +01:00
Chris Wilson b0f125495c sna: Tweak DBG traces for cache cleanup
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 11:57:27 +01:00
Chris Wilson 90b6cba066 sna: Add DBG trace when doing a forced cache cleanup
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 11:07:09 +01:00
Chris Wilson ca71199679 sna: Harden batch allocation against resource starvation
If the batch allocation fails, retire the oldest request and try again.

References: https://bugs.freedesktop.org/show_bug.cgi?id=91577
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 10:48:20 +01:00
Chris Wilson 8c465d0fbf sna: Fallback after a bo allocation failure for the batch
If we fail to allocate the next bo to use for the next_request, we can
just fallback to the delayed allocation used by !llc.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91577
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 10:16:56 +01:00
Chris Wilson 69d8edc111 sna: Handle batch allocation failure
Whilst we currently do not try and submit a failed batch buffer
allocation, we still treat it as a valid request. This explodes much
later when we inspect the NULL rq->bo.

References: https://bugs.freedesktop.org/show_bug.cgi?id=91577
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 10:08:17 +01:00
Chris Wilson bc063c9f4a sna: Undo a CRTC flip that results in a pageflip failure
If the pageflip following the CRTC fixup fails, we can be left with the
flip-to bo being left as the CRTC scanout. If that is so, reset the
desired mode (and original scanout bo).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-31 17:17:26 +01:00
Chris Wilson 9451976a5b sna: Assert that flip handler/data exists before invoking
Just an explanatory assert in case we ever jump off into a NULL function
pointer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-31 17:14:12 +01:00
Chris Wilson 6a2dcb388e intel: Refactor i915.ko loading support
Different OS name the i915 KMS module differently, so make it convenient
for us to be able to feed in the right name, or even just try them all
and pick the first one that exists!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-31 10:47:24 +01:00
Chris Wilson 4246c63347 sna: Fix off by one in constructing XCopyPlane on bdw
Broadwell expanded all the relocations and we needed to adjust our
command construction to match. I missed offsetting the XY_SRC_COPY_IMM
used for XCopyPlane resulting in garbage for small copies on Broadwell.

Reported-by: Omar Sandoval
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91499
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-29 09:45:50 +01:00
Chris Wilson 66e16d97ee test: Exercise copyplane
Reported-by: Omar Sandoval
References: https://bugs.freedesktop.org/show_bug.cgi?id=91499
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-29 09:45:47 +01:00
Chris Wilson 4f0a58c9db sna: Batch process hotplug events
Read all available HOTPLUG uevents and batch them into a single topology
probe. Like waiting for a bus, when one hotplug uevent arrives expect a
few more.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-28 13:51:49 +01:00
Chris Wilson 6be2bea5f0 sna: Double check for Present takeover before TearFree flips
References: https://bugs.freedesktop.org/show_bug.cgi?id=91467#c17
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-26 19:58:53 +01:00
Chris Wilson d11dc75fb5 sna: Only check non-NULL Pixmaps
check_pixmap() can be called very early in the Window setup proceeding,
before a pixmap is even assigned to a Window. There we expect the Window
to be NULL, so be more careful in our check_pixmap.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91467#c16
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-26 19:08:39 +01:00
Chris Wilson e5f8f90f68 sna: Stall for outstanding TearFree flips when taking over with Present
When juggling Present and TearFree, we have to hide the extra flips from
Present as it cannot account for them. Preferrably we want to schedule
the Present flip following completion of the TearFree flip, but for the
moment simply block and wait until TearFree completes before starting
Present.

Reported-by: Andreas Reis <andreas.reis@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91467
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-26 19:03:46 +01:00
Chris Wilson 7e5e006be4 sna: Add a few more DBG and assertions around Present/TearFree interactions
References: https://bugs.freedesktop.org/show_bug.cgi?id=91467#c12
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-26 18:41:03 +01:00
Chris Wilson 50f3e9c41c sna: Add a small pixmap sanity check
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-26 18:22:16 +01:00