Commit Graph

8250 Commits

Author SHA1 Message Date
Chris Wilson 6848fb235b sna: Fix flushing empty batches
A logic inversion in

commit 1909910fdf
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Jun 22 20:19:22 2014 +0100

    sna: Inject a batch flush before adding a fresh bo

also applied the injection to when the batch was empty.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c48
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-23 11:28:07 +01:00
Chris Wilson 60fd6764eb sna: Handle old busy_ioctl not reporting the active ring
If we have an old kernel, just presume that the bo was last active on the
render ring.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-23 11:26:21 +01:00
Chris Wilson 30348efd57 sna/gen6+: Avoid adjusting copy coordinates until commited to using them
If we need to fallback to the BLT unit, we need to pass it the original
source/dest coordinates and not our transformed render coordinates. So
keep the original values intact until we start emitting the render
operation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-23 11:14:25 +01:00
Chris Wilson e1e853edee sna/gen4+: Add some more asserts around recreating vertex buffers
References: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c46
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-23 10:14:09 +01:00
Chris Wilson 978790dc52 sna: Allow the CPU bo to be created if GPU rendering is forced
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-23 10:01:19 +01:00
Chris Wilson b2206eca00 sna/gen6+: Encourage the compiler to inline a couple of key functions
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-23 10:01:16 +01:00
Chris Wilson bb4c057620 sna: Prefer to render over damage into the GPU bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-23 09:43:10 +01:00
Chris Wilson 416c223861 sna: Do not set CAN_CREATE_GPU flag for untiled allocations
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-23 09:43:10 +01:00
Chris Wilson fb51ec44f4 sna: Rename IGNORE_CPU to IGNORE_DAMAGE to better reflect its purpose
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-23 09:07:13 +01:00
Chris Wilson 96d2749660 sna: Add DBG breadcrumbs to sna_output_discover()
References: https://bugs.freedesktop.org/show_bug.cgi?id=80355
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-23 08:18:23 +01:00
Chris Wilson a33aa554fa sna/gen4+: Add box emitters for the generic vertex paths
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-23 07:51:38 +01:00
Chris Wilson 1909910fdf sna: Inject a batch flush before adding a fresh bo
Fresh bo (those without a reservation already defined, ala
presumed_offset) will cause the kernel to do a full relocation pass. So,
if possible flush the already correct batch in the hope of trimming the
amount of checking the kernel has to perform on this new batch.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-23 07:51:38 +01:00
Chris Wilson 83cbbcd816 sna: Add missing string for DBG
References: https://bugs.freedesktop.org/show_bug.cgi?id=80355#c12
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-23 07:51:38 +01:00
Chris Wilson f22ea4e821 sna: Disable unused CRTC after undock events
If undocking removes output (as the MST topology changes and some
outputs then become unreachable), we may leave dangling CRTC. This
confuses us, so disable any enabled but unconnected CRTC after the
undock event.

Reported-by: Sree Harsha Totakura <freedesktop@h.totakura.in>
References: https://bugs.freedesktop.org/show_bug.cgi?id=80355#c5
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-22 18:46:26 +01:00
Chris Wilson dca0f1c2cc sna: Track CRTC mode changes and discard old flips
If we have a pending flip across a modeset we must be careful to drop
the stale flip_bo after the modeset.

Reported-by: Sree Harsha Totakura <freedesktop@h.totakura.in>
References: https://bugs.freedesktop.org/show_bug.cgi?id=80355#c8
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-22 17:56:43 +01:00
Chris Wilson dae370423a sna: Clean up CRTC on CloseScreen
We need to do this to stop any stray references escaping through kernel
events now that we are passing the CRTC through the event.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-22 11:47:06 +01:00
Chris Wilson 923dc207df sna: Discard write hint from a couple more move-to-gpu
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-21 15:44:38 +01:00
Chris Wilson 2046a49be5 sna: Clear the transform flag on disabling the CRTC
In places, we assume that if the flag is set, we must have an active
CRTC. However, we were not clearing when disabling the CRTC.

Reported-by: Sree Harsha Totakura <freedesktop@h.totakura.in>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80325
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-21 15:45:39 +01:00
Chris Wilson b3d3c0e8e7 sna: Avoid blending with the render engine on snoopable bo
This seems slightly weird, as there is nothing to indicate that this
would generate incorrect results only for snoopable bo. But no many of
flushes make my pnv box happy, so adjust the placement logic to move the
blending operation away from the snoopable target. This is sensible for
reasons of avoiding snoops from the render pipeline anyway.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80253
Reported-and-tested-by: Matti Hämäläinen <ccr@tnsp.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-20 20:06:53 +01:00
Chris Wilson 219f6bd9e8 sna: Be more flexible in converting random subsamples to 8x8 tiles
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-20 20:01:11 +01:00
Chris Wilson 91bc9e42e4 sna: Mark up const boxes to keep the compiler happy
Pass around const to suppress a few compiler warnings.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-20 16:23:18 +01:00
Chris Wilson e5c68b4358 sna: Feed more operations into the 8x8 BLT tiler
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-20 15:08:57 +01:00
Chris Wilson d2b90ac969 sna: Color patterns for BLT are required to be aligned to 256 byte boundaries
This so far appears to be the most restrictive alignment required, so
simply increase the upload alignment to 256 bytes.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80033
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-20 15:08:56 +01:00
Chris Wilson 8d7e7010e3 test: Increase number of tiled sources
Significantly improve the stress impose upon the tiled BLT operations.
Also start dumping pngs of the failures.

References: https://bugs.freedesktop.org/show_bug.cgi?id=80033
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-20 15:08:56 +01:00
Chris Wilson db6dfc3227 sna/dri2: Don't decouple front buffer tracking for invalid SwapBuffer calls
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-20 10:57:22 +01:00
Chris Wilson 113a8b9be9 sna: Mark upload from SHM segment as read-only
As this may be mapped by the Xserver using a read-only SHM segment, we
are forced to treat it always as read-only. And this being X, that it is
using a SHM segment is opaque to the driver. Fantastic middlelayer.

This was incorrectly removed in
commit e680e54eab
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jun 11 10:48:26 2014 +0100

    sna: Ignore setting read-only for temporary userptr maps

Also let's not forget the ShmPutImage -> CopyArea path.

Reported-by: Christoph Haag <haagch.christoph@googlemail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=78411
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-20 10:57:22 +01:00
Chris Wilson df89b49411 sna: Mark upload from SHM segment as read-only
As this may be mapped by the Xserver using a read-only SHM segment, we
are forced to treat it always as read-only. And this being X, that it is
using a SHM segment is opaque to the driver. Fantastic middlelayer.

This was incorrectly removed in
commit e680e54eab
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jun 11 10:48:26 2014 +0100

    sna: Ignore setting read-only for temporary userptr maps

Reported-by: Christoph Haag <haagch.christoph@googlemail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=78411
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-19 20:40:30 +01:00
Chris Wilson 6b32cf3a3c sna: Missed fixing y tile offset in last commit
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-19 12:29:58 +01:00
Chris Wilson edeb2ddd17 sna: Use the right pattern origin for tiled 8x8 extraction
References: https://bugs.freedesktop.org/show_bug.cgi?id=80033
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-19 11:51:00 +01:00
Chris Wilson 1752e2d647 sna: Fix up small extents for 8x8 tile construction
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-19 11:50:54 +01:00
Chris Wilson f866a20c99 sna: Wrap pointer access for 8x8 tile construction
The kernel can quite happily send a SIGBUS whenever we read from an bo
(due to oom), so catch it and handle it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-19 10:49:09 +01:00
Chris Wilson b1aab55d59 sna: Always readback shadow damage after replacing the buffer
Instead track what we explicitly want to discard for the next operation,
so that we don't have to copy back the whole buffer if we have to
replace the shadow and intend to overwrite it all.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-19 09:47:02 +01:00
Chris Wilson f4b930318c sna/dri2: Replace assertion with code to skip updating the back buffer
After a window resize or redirection, the DRI2BufferPtr become stale but
it may take a while for the Client to notice and reconfigure. Just
skip touching stale backbuffers and let the Client catch up.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-19 07:40:16 +01:00
Chris Wilson c257c936b4 sna: Fix modulus for partial conversion of tiles to 8x8 patterns
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-18 22:15:42 +01:00
Chris Wilson 9489cc6c70 sna: Delete the silly typo
Not checking DAMAGE_IS_ALL() correctly leads to an assertion failure.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-18 21:28:11 +01:00
Chris Wilson 51a0559b12 sna: Do not treat both src/dst having no clones as being the same
Fixes regression from
commit 62aaf2ff4f
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jun 18 18:41:15 2014 +0100

    sna: Skip redundant copies when already cloned

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-18 20:55:02 +01:00
Chris Wilson 377b0e8657 sna: Add log breadcrumbs with valgrind
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-18 19:59:14 +01:00
Chris Wilson 273c82a574 sna: Fix DBG compilation
Missed updaing the DBG message in

commit 83c0f03445
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jun 18 16:51:46 2014 +0100

    sna: Pass desired CRTC viewport for completing single CRTC flips

References: https://bugs.freedesktop.org/show_bug.cgi?id=80157
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-18 18:47:40 +01:00
Chris Wilson 62aaf2ff4f sna: Skip redundant copies when already cloned
References: https://bugs.freedesktop.org/show_bug.cgi?id=77436
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-18 18:41:15 +01:00
Chris Wilson 83c0f03445 sna: Pass desired CRTC viewport for completing single CRTC flips
We cannot simply compare against the crtc->shadow_bo for all our needs,
so pass in exactly the setup we want and apply that. In particular this
is required when flipping away from the single CRTC setup on secondary
pipes.

Fixes TearFree multi-monitor regression from
commit 3932e97057 [2.99.912]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Jun 9 08:58:15 2014 +0100

    sna/dri2: Allow TearFree flipping to individual CRTC

Reported-by: Leo Wolf <jclw@ymail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80191
2014-06-18 16:55:04 +01:00
Hans de Goede 7119d394a6 uxa: Mark the output as off before making pipe changes
This is a partial "backport" of commit c6cd10f536, which makes the same
change for sna, to avoid users still using uxa ending up with a blackscreen
after plugging in an external monitor.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1032978
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1103806
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-06-18 15:00:00 +01:00
Hans de Goede 52af321a11 uxa: When the output is off, report the cached backlight value
This is a "backport" of commit b545e10c50 to uxa, so that users who are
still using uxa, don't end up with a black screen after suspend / resume.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1032978
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1103806
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-06-18 14:59:46 +01:00
Chris Wilson 44b5912ffc sna/gen8: Fix cleanup after failing to convert channel
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-18 14:52:45 +01:00
Chris Wilson 21b6e55152 sna/gen8: Fix unaligned() to return true when not aligned
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-18 14:52:45 +01:00
Chris Wilson c5b063b8cc sna: Assert that we do not try to mmap a proxy
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-18 14:52:45 +01:00
Hans de Goede 40bd45fb80 backlight: Fix compiler error
/usr/include/xorg/os.h around line 579 reads:

extern _X_EXPORT char *
strndup(const char *str, size_t n);

However strndup is already defined by glibc, and this redefine causes a
compile error.

This gets triggered because backlight.c does:

Without first doing:

Causing HAVE_STRNDUP to not be defined.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-06-18 14:11:05 +01:00
Chris Wilson e52f917a23 sna: Use nxm tiled blits for small regions of large tiles
If the region we are blitting is either narrow or short, we may be able
to construct a tiling pattern out of a large pixmap.

In the process, spot a regression due to

commit 542aeca6e6
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Jun 17 12:26:30 2014 +0100

    sna: Tweak creation 8x8 tiled patterns

which copied too much from the source line.

References: https://bugs.freedesktop.org/show_bug.cgi?id=79888
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-18 10:54:57 +01:00
Chris Wilson b90f6c5aa7 sna: Simplify sna_pixmap_get_source
kgem_bo_upload_image was open-coded, so replace it with a call to the
common function

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-18 10:43:01 +01:00
Chris Wilson 8ea2dd23ab sna: Add DBG option to disable snoop bo cacheing
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-18 10:32:07 +01:00
Chris Wilson b208134584 sna/dri2: fix invalid DBG string
References: https://bugs.freedesktop.org/show_bug.cgi?id=80157
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-18 07:37:28 +01:00