Commit Graph

9333 Commits

Author SHA1 Message Date
Chris Wilson 4458f1bf8a sna: Restore TearFree operation after switching everything off
We give up on TearFree if we ever see an error whilst page flipping (in
the hope that we can keep displaying via direct use of the scanout).
With the advent of MST, this can happen simply by the user unplugging a
dock causing connectors to disappear and if we flip before we see the
uevent telling us which outputs are disabled, we get an error.

So, lets try and re-enable TearFree on the next opportunity, when all
the outputs are off and we can rebuild the shadow buffer.

Reported-by: Martin Jørgensen <mkj@gotu.dk>
References: https://bugs.freedesktop.org/show_bug.cgi?id=96180
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-28 19:23:38 +01:00
Chris Wilson 46ffdf295d sna/dri2: Avoid chaining swaps across a mode change
If the pixmap on a drawable changes between swap events, just queue a
normal vblank event rather than chaining up.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-22 18:32:54 +01:00
Chris Wilson 2205da0729 sna: Display errno when SETCURSOR fails
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-22 18:20:33 +01:00
Chris Wilson 8477615ae1 sna: Allow disconnected outputs to retain state without EDID checks
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-22 14:18:20 +01:00
Chris Wilson 25d2c2d049 sna: Confirm the EDID is the same after a hotplug before ignoring
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-18 23:26:50 +01:00
Chris Wilson a508b11bde sna: Don't skip migration-to-GPU for TearFree
In 46caee86db ("sna: Fix reporting of errno after setcrtc failure"),
the intention was to avoid reporting a fail to migrate whilst wedged for
a simple copy from the frontbuffer to TearFree's shadow buffer. However,
by skipping the migration, we never flushed any dirt from the CPU buffer
prior to doing the TearFree flip.

References: https://bugs.freedesktop.org/show_bug.cgi?id=95401#c7
References: https://bugs.freedesktop.org/show_bug.cgi?id=95414#c4
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-17 07:55:33 +01:00
Chris Wilson 48569eb18d sna: Track the minimum damage when doing CRTC-local TearFree
We avoid having to redraw the entire CRTC's buffer on every flip as we
know the contents from the previous flip are still available and only
need to invalidate the dirty region.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-17 07:45:46 +01:00
Chris Bainbridge ab3ab412a4 sna: Fix increment of modeset serial after applying CRTC
We track how many mode sets have been made in order to detect stale
flips (i.e. a sequence that crosses a mode change). This was broken by
the logic inversion in setcrc in 46caee86db ("sna: Fix reporting of
errno after setcrtc failure")

References: https://bugs.freedesktop.org/show_bug.cgi?id=95401
Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-17 07:28:23 +01:00
Chris Wilson 34f63f28c8 sna: Ensure we only cache the local CRTC scanout buffer
Double check that we are not about to cache the common, untransformed,
shadow buffer for the per-CRTC transformed buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-16 10:14:04 +01:00
Chris Wilson 3a7d6afd85 sna: Do not cache the current crtc bo after performing the setcrtc
When doing a SETCRTC as a fallack for a failed pageflip, do not use the
then current CRTC bo as the next bo for pageflipping - as then we will
render into it prior to flipping and so cause tearing.

References: https://bugs.freedesktop.org/show_bug.cgi?id=95401
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-16 10:01:09 +01:00
Chris Wilson f71447998c sna/dri2: Refactor open-coded __kgem_bo_is_busy
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-14 16:18:42 +01:00
Chris Wilson 3c95efe5f7 sna/dri2: Force blocking wait if vblank queue fails
Whilst waiting for the previous blit to complete, if we fail to queue
the vblank to wake up on the next frame, block before replying the blit
is complete.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-14 16:18:42 +01:00
Chris Wilson 1486cfdf04 sna/gen6+: Don't force a switch to BLT if the target bo cannot be blitted
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-13 22:53:26 +01:00
Chris Wilson 512284fd47 sna/dri2: Enforce swap-limits on stale buffers
If the client sends an out-of-date swap request, first make sure that we
don't cause an error by chasing a NULL CRTC and secondly force them to
wait for a whole vblank before the next swap.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-09 21:11:13 +01:00
Chris Wilson 88733a7874 sna/dri2: Force consideration of the DRI2CopyRegion source as unclean
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-07 15:58:43 +01:00
Chris Wilson 08865b0af2 sna: Add a special case for fast DRI2CopyRegion and NoAccel
Enable copying onto a scanout buffer using a WC mmap - so long as it is
X-tiled and no swizzling.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-07 15:58:43 +01:00
Chris Wilson b89f203b0d sna: Do not force ping-pong migration for TearFree + NoAccel
If acceleration is disabled, but we are using TearFree, then ideally we
want to flip the shadow buffer onto the scanout. If the shadow buffer is
already on the GPU, e.g. having been swapped in by a compositor, then we
do not want to move it to the CPU domain only to copy it back to a new
buffer and then flipped for a TearFree update.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-07 15:20:32 +01:00
Chris Wilson 47cd7fdd0b test: Exercise XVidMode switching
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-04 12:34:37 +01:00
Chris Wilson e4ef6e9e5b sna/dri2: Free the pending back buffer after use
The pending back buffer is only the pending copy, the actual info->back
stores the client's view of the current back buffer which may be more
recent than the pending copy. So store the current back buffer, swap in
the pending to do the normal swap, then free the resultant back (which
may have been exchanged with the front), before restoring the client's
current back buffer.

References: https://bugs.freedesktop.org/show_bug.cgi?id=95200
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-30 14:10:57 +01:00
Chris Wilson bca4e0e35e sna: Limit generic convolution to smallish kernels
Since the naive implementation uses an 8bit temporary, we can only
support so many passes before the quantization artefacts become
apparent. We have to be extra conservation in order to support
multi-pass convolution algorithms (notable 2-pass separable Gaussian
kernels).

References: https://bugs.freedesktop.org/show_bug.cgi?id=95091
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-23 22:56:08 +01:00
Chris Wilson cac8e1ee74 uxa: Enable Y-tiling BLT support
Mesa wants to pass Y-tiled framebuffers onto scanout. Admittedly, this
isn't quite that but it does prevent them being jumbled up.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-22 22:48:54 +01:00
Chris Wilson 46caee86db sna: Fix reporting of errno after setcrtc failure
As we now do more syscalls after the setcrtc, we cannot rely on errno
storing the pertinent error code. Instead we have to save it immediately
after the drmIoctl() and propagate that back.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-20 21:41:11 +01:00
Chris Wilson c62177ec32 sna: Force the shadow buffer even after we fail to set the crtc for TearFree
As the first choice of orientation and tiling may be invalid, e.g.
left/right rotation on Skylake, we need to force the second pass here to
try and an alternate non-native rotation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-20 21:31:46 +01:00
Chris Wilson 562ae1f29f sna/present: Postpone recursed vblank during TearFree by 1ms
Avoid postponing until the next vblank to avoid continually recursing
every TearFree update, and to minimise the presentation delay.

References: https://bugs.freedesktop.org/show_bug.cgi?id=94982
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-18 20:56:05 +01:00
Chris Wilson 680ae24ea9 sna: Block SIGIO when we are trying to flip
Temporarily stopping the pointer whilst we try to queue the flip should
help keep the output latency down.

Reported-by: Rafael Ristovski <rafael.ristovski@gmail.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=94980
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-17 18:58:09 +01:00
Chris Wilson 81029be073 sna/gen8+: Flush pipecontrols when forcing a pipeline stall
In order to actually stall the pipeline completely and to wait for
earlier flushes to complete, we have to set a flag in the pipecontrol.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-17 16:02:30 +01:00
Chris Wilson f7f5ef714f sna: Tweak flushing before adding a new bo into a batch
Try to reduce the frequency we flush between operations, to only
consider known-idle bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-17 15:06:57 +01:00
Chris Wilson 29b70ccdf6 sna/present: Fix requeuing after interrupting TearFree
Increment the target_msc by one, not the last known msc!

Reported-by: Rafael Ristovski <rafael.ristovski@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-17 15:06:57 +01:00
Chris Wilson f2a46458a2 sna: Fix alignment vs length check when adjusting dst pointer
When doing the misaligned copy from the start of the dst pointer, the
important check is whether there is enough bytes remaining to the next
alignment position, next from the last.

References: https://bugs.freedesktop.org/show_bug.cgi?id=94928
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-16 18:17:31 +01:00
Chris Wilson c3dc831057 sna: Mark the transformed cursor image as dirty
So that when we size from transformed cursors to non-transformed, we
remember to clear the entire area.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-15 19:35:00 +01:00
Chris Wilson d30d276aee sna/blt: Reuse computed partial tile offset in copy_from_tiled
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-15 19:29:47 +01:00
Chris Wilson bb69256b52 sna/gen6: Encourage migration of small BLT operations
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-15 15:16:00 +01:00
Chris Wilson 0d38419cbe sna/gen9: Update mocs selection
Since the choice is now boolean (use PTE or use WB), remove the third
uncached condition.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-15 14:58:57 +01:00
Chris Wilson a7526ea2e0 sna/present: Prevent recursion when handling TearFree waits
When draining the flipqueue for TearFree, we may recurse from the vblank
handlers. Avoid this by delaying the Present vblank until next frame.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-10 16:46:46 +01:00
Chris Wilson b6917eced7 sna: Restict reduction of ADD white when we have compatibile formats
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-09 20:45:29 +01:00
Chris Wilson 6c07f467a3 sna: Apply the precomputed BLT colors for SRC reductions
Eek, after computing what the resultant color should be, we should
endeavour to use it!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-09 20:15:41 +01:00
Chris Wilson d08221edab sna: Replace lost offset when copying from tiled memory
Fixes typo from 28e3bdd758

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-09 19:12:47 +01:00
Chris Wilson de44aaa2dd sna/present: Refuse to queue a vblank on a disabled CRTC
Kick the error back to the upper layer for it to sort out.

Reported-by: Timo Aaltonen <tjaalton@ubuntu.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-08 21:08:08 +01:00
Chris Wilson edcfb3efb8 sna/present: Handle 64bit wraparound in msc comparisons
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-08 20:58:02 +01:00
Chris Wilson e5bbf519bd sna/present: Fixup msc when reporting a fake vblank with 0 delay
If we have to fake a vblank because the CRTC is off and we compute the
delay as being 0, then we would report the event immediately - but with
the earlier msc. Instead, we want to report the completion.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-08 20:49:13 +01:00
Chris Wilson e783ffa497 sna/gen9: Bias GT for pipeline selection
Each GT on Skylake is bigger than previous generations. For reusing the
placement logic, we then want to pretend that Skylake has a higher
GT-equivalence.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-08 15:28:34 +01:00
Chris Wilson 15903e7c68 sna: Avoid rep mov (builtin memcpy) for WC writes
Lesson learnt, rep mov is terrible when applied to WC.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-08 11:00:22 +01:00
Chris Wilson ab041b9b91 sna: Specialise alignment paths for storing
Switch between aligned/unaligned stores for the bulk copy inner loops.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-08 10:01:29 +01:00
Chris Wilson e62010374c sna: Unroll the innermost SSE2 loop one more time
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-08 08:24:44 +01:00
Chris Wilson 27ec7e49da sna: Force inlinement of SSE2 builtins
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-08 08:03:11 +01:00
Chris Wilson 65c72d9871 sna: Invert the function wrapping for sse64xN/sse64
We should be consistent in making the code simpler for the compiler and
so not rely on it eliminating the dead-code for a single loop of
sse64xN!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-08 07:56:07 +01:00
Chris Wilson 59d371a9b2 sna: Don't limit CRTC id
Don't bake in the assumption that the CRTCs will always be allocated in
the low byte of the identifiers range. It is only used in a pair of
other functions (Xv plane updates), so not a big deal.

Reported-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-07 21:57:00 +01:00
Chris Wilson 28e3bdd758 sna: Fixup SSE2 alignment instructions for copying to client memory
Only the tiled surface alignment is known, the client we must assume is
unaligned.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-07 18:41:58 +01:00
Chris Wilson d4818c74b1 sna/present: Clamp to maximum timer delay
Timers can only be set for a maximum of int32_t milliseconds into the
future. Respect that - if we need more, we'll just requeue!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-07 14:17:01 +01:00
Chris Wilson 74b755fe0a sna/present: Clear flags on the vblank event's CRTC early
We store a flag on the vblank's CRTC to indicate whether we have marked
the target CRTC as having an immediately pending vblank. We should clear
this set of flags early so that we don't have to worry about the flag
whilst processing the vblank, and so that we don't get confused if we
have to requeue the vblank.

Reported-by: Christoph Haag <haagch@frickel.club>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94829#c32
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-06 22:55:39 +01:00