Commit Graph

7664 Commits

Author SHA1 Message Date
Chris Wilson b99c8cbefd sna: Cancel the backlight change if set-property(DPMS) fails
If the kernel reports an error from setting the DPMS property, we need
to undo the local changes and propagate back the error to the caller.
Although the latter is prevented by the RandR API, we can at least
restore the backlight.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-28 12:51:00 +00:00
Chris Wilson 47effa1854 sna: Rearrange damage allocation to handle malloc failure more gracefully
If we fail to allocate new damage boxes, first try collescing the
existing boxes to free up memory.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-27 21:48:33 +00:00
Chris Wilson ad7daf9aae sna: Use signal-safe DBG
Otherwise we end up confusing the core Xserver functions when called
from auxilliary threads.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-27 21:48:17 +00:00
Chris Wilson 294180b3bf sna/gen3+: Allow for spill when aligning vertices
We need to flush the batch if we run out of space aligning our vertex
buffer - but the test must anticipate the space required for the new
alignment.

Reported-by: Arkadiusz Miskiewicz
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-24 14:21:44 +00:00
Chris Wilson 4385724dc4 sna/gen2+: Inspect composite flags to discard unneeded CPU damage
We can now check whether the Composite operation will require existing
CPU damage and if not discard it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-24 11:32:43 +00:00
Chris Wilson c9e9c85fc7 sna/gen2,3: Don't set BLT_DST_TILED
This bit only exists for gen4+ so avoid setting it on gen2 and gen3,
whilst setting it doesn't seem to cause any harm, there is no reason to
risk it...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-23 19:14:49 +00:00
Chris Wilson 6914b3af7f sna: Protect against fake CRTCs during initial probe
Reported-by: Nick Bowler <nbowler@draconx.ca>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73981
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-23 17:38:27 +00:00
Chris Wilson e916c922ce sna: Avoid erroneous discarding operations for partial composites
Composite operations were presumed to cover their entire width x height
area. However, a few paths submit boxes that do not cover the clip
region and so the optimisation made during prepare to discard completely
overwritten data is incorrect (and leads to corruption - stale data is
seen which the client expected to have been overdrawn). So along these
more unusual paths, we must add a flag to prevent the overzealous
discard. Notably, xfce4 triggers this as it uses a lot of unantialiased
trapezoids in its theme drawing.

References: https://bugs.freedesktop.org/show_bug.cgi?id=69528
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-23 17:38:27 +00:00
Chris Wilson 59e769e1b1 glamor: Don't require the glamoregl module to be pre-loaded with xserver >= 1.15
Inspired by (ok, copied from):

xf86-video-ati commit f2a0a5cf6c5a21e2a02280e110a4eb8e6609dace
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Jan 22 11:04:42 2014 +0900

    Don't require the glamoregl module to be pre-loaded with xserver >= 1.15

    The issues with loading it on demand have been fixed in xserver 1.15.

    Inspired by Jérôme Glisse on IRC.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-23 17:37:04 +00:00
Chris Wilson 32010ed86b sna: Assert that the fill box is within bounds
References: https://bugs.freedesktop.org/show_bug.cgi?id=73811
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-22 16:31:22 +00:00
Chris Wilson 29e11e2e6f sna: Restore gc->serialNumber correctly after falling back
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73856
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-21 22:40:11 +00:00
Chris Wilson 2c441079cb sna: Initialise the TearFree shadow output from the current front buffer
Otherwise we may end up in a sitation where we show stale contents for a
(sometimes signification) fraction of a second before it is refreshed
with the correct contents.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73842
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-21 10:38:56 +00:00
Chris Wilson ac22dd4292 sna/gen4: Add an ALWAYS_FLUSH debugging option
Still gen4 is cursed. This should restore the plateau we reached with
2.99.907 by forcing a full GPU flush between every operation.

References: https://bugs.freedesktop.org/show_bug.cgi?id=55500
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-21 10:38:56 +00:00
Chris Wilson 720d131963 sna: Drop bogus assert added in recent patches
The intention was to detect if the gc->pCompositeClip still pointed to
the temporary region. However, the assert failed to accomplish that
goal.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-21 10:35:30 +00:00
Chris Wilson 36b743aa8e sna: Reduce zeal of new gc->pCompositeClip
gc->pCompositeClip starts off NULL, just like sna_gc->priv.

Reported-by: Arkadiusz Miskiewicz
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-21 10:00:07 +00:00
Chris Wilson 6a757eaa09 sna: Fix typo in assertion from previous commit
Sigh. It helps to remember to do compile testing with the right
configuration.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-21 09:25:45 +00:00
Chris Wilson b9ebb01683 sna: More assertions for tracking gc->pCompositeClip
Tracking down who leaves it modified...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-21 09:22:21 +00:00
Mark Kettenis f7121bf733 sna: build fix for OpenBSD
Commit 50a45a1cdd introduced the use of
"struct stat" but doesn't include <sys/stat.h>.  Presumably that leaks
in trough some other header on Linux, but on OpenBSD compilation fails
because the struct isn't known.
2014-01-20 22:33:16 +00:00
Chris Wilson 50f6701aa5 sna: Include serial numbers in ValidateGC DBG
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-20 21:36:38 +00:00
Chris Wilson 4c7b183fd2 sna: Short-cut the fallback for XCopyArea with depth < 8
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-20 14:35:55 +00:00
Chris Wilson 671658499b sna: Add some more DBG output around the clipping in sna_do_copy()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-20 14:35:35 +00:00
Chris Wilson 55a933aa29 intel-virtual-output: Tidy some DBG for copying new modes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-20 13:29:22 +00:00
Chris Wilson 04ee452439 sna: Increase limit on number of possible outputs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-20 12:33:47 +00:00
Chris Wilson 637e7c2186 intel-virtual-output: Print error events for debugging
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-20 12:33:47 +00:00
Chris Wilson 92e9bf82b2 intel-virtual-output: Disable remote display if SetCrtcConfig fails
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-20 12:33:47 +00:00
Chris Wilson 3138d06893 intel-virtual-output: Clone modes onto remote display
If the user adds a mode to the VIRTUAL display and then attempts to use
it, add that mode to the remote display.

Reported-by: Christoph Bessei <admin@schwarzwald-falke.de>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73816
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-20 12:03:13 +00:00
Chris Wilson de0797edac sna: Yield the processor if the kernel reports EAGAIN
An artifact of our kernel/userspace interaction is that under certain
circumstances the kernel will report EAGAIN in order for it to have CPU
time to run its own workqueues before it can process the userspace
request. We can be cooperative and yield ourselves rather than busy-spin
waiting for the scheduler to demote us.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-20 09:32:50 +00:00
Chris Wilson 50a45a1cdd sna: Use device minor to narrow search for debugfs files
Also vital in case we ever have two Intel GPUs!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-19 15:59:42 +00:00
Chris Wilson d41bbfc97c sna: Always emit an error message when an execbuffer fails
So that we are not left with a puzzled user with a mysteriously slow
machine.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-19 15:18:44 +00:00
Chris Wilson d7f753ba89 sna: Discard pending wait_for_shadow updates before the TearFree flip
Rather than just assert that we have used the pending update in
wait_for_shadow, discard it first.

Reported-by: Joe Peterson <joe@wildlava.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=70905
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-19 12:52:20 +00:00
Chris Wilson 498fcb0013 sna: Refactor common routines for debugfs file dumping
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-18 22:38:40 +00:00
Chris Wilson b68c35a11d sna: Fix typo in debugfs paths
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-18 22:21:35 +00:00
Chris Wilson 9342bc3dfd sna: Dump fence registers upon starvation
References: https://bugs.freedesktop.org/show_bug.cgi?id=73696
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-18 21:38:59 +00:00
Chris Wilson 35ea7b2dd5 intel: Silence a compiler warning (-Wshadow)
intel_device.c: In function 'intel_entity_get_devid':
intel_device.c:82:32: warning: declaration of 'index' shadows a global declaration [-Wshadow]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-17 12:55:33 +00:00
Rinat f23ab963c4 Provide DRI2DriverVDPAU for future compatibility
Since 2010, DRI2 supports multiple driver names. That was added to ease
selection of appropriate driver by libvdpau. As for today, intel driver
support only DRI2DriverDRI (== 0), but not DRI2DriverVDPAU (== 1).

Although there is no any hardware-specific VDPAU driver for intel video
adapters at the moment, it would be easier to use generic drivers like
libvdpau-va-gl by creating symlink named libvdpau_i965.so.1. That way
appropriate driver will be selected in run time automatically:
libvdpau_i965.so.1 on i965 equipped machines, and libvdpau_nvidia.so.1
on nvidia equipped ones.

[ickle: Whilst I think this is a workaround for a brainfart in libvdpau
that it defaults to libvdpau_nvidia.so rather than first to
libdvpau_${DRI2DriverDRI} and then to a hardcoded libvdpau_backend.so,
I have no better solution, and this does seem in accordance with the
spec.]

Signed-off-by: Rinat <ibragimovrinat@mail.ru>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73507
2014-01-17 10:54:21 +00:00
Chris Wilson 5f3ee21a30 sna: Nullify pixmap->devPrivate.ptr after promoting CPU bo to GPU
When we convert a CPU bo into a GPU bo, we need to remove any dangling
shadow pointers we use for devPrivate.ptr. Whilst the bo remains alive
these are incoherent, but if we ever replace the GPU bo (for example to
change tiling for DRI2) then the dangling pointer becomes invalid and
will explode on next use.

Reported-by: Mike Aury <mike.auty@gmail.com>
Reported-by:  Marti Raudsepp <marti@juffo.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73351
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-17 09:16:38 +00:00
Chris Wilson 34192006c6 sna: Intensify the move-to-cpu pointer paranoia
Rather than just state that the final pixmap->devPrivate.ptr is
non-NULL, we can assert that it matches the shadow value.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-17 09:16:34 +00:00
Chris Wilson cea442c0d0 sna: Cull the DBG spew to stderr
Reduce the logging verbosity of DBG so that it only appears in the
logfile by default - makes debugging much more pleasant.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-17 09:15:37 +00:00
Chris Wilson 6db99169a9 sna: Regularly check that the devPrivate.ptr is valid
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-16 12:18:28 +00:00
Chris Wilson 242d7503dd sna: Avoid allocating temporary storage for TearFree rotations
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-16 12:18:28 +00:00
Chris Wilson 587452a6ad sna: Make the temporary upload pixmap as having a statically allocated pointer
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-16 12:18:28 +00:00
Chris Wilson 40beee995e sna: Add some more paranoia around dangling pointers
References: https://bugs.freedesktop.org/show_bug.cgi?id=73351
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-15 10:15:14 +00:00
Chris Wilson 9a0a132939 sna: Handle release of active stolen scanouts
If the scanout is still active we want to defer our release until the
request is retired.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-10 21:38:44 +00:00
Chris Wilson b351f4a000 sna/dri: Handle TearFree vblanks whilst the pipe is off
As an extra complication for handling TearFree is that if we attempt to
requeue a swap whilst the pipe is off, that fails. As we have recursed
from the pixmap migration path, we have to abort the blit but still send
the event back to the client so that they unblock.

Reported-by: Harald Judt <h.judt@gmx.at>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73469
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-10 12:05:17 +00:00
Chris Wilson b1694c8ea5 sna: Include the deferred hotplug uevent propagation in DBG
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-10 12:05:17 +00:00
Chris Wilson bfabdb7ebf sna: Add regular refcnt checks on pixmap bo
References: https://bugs.freedesktop.org/show_bug.cgi?id=73406
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-09 12:35:51 +00:00
Chris Wilson a2fc9e5f86 Revert "sna: Remove spurious SAMPLER writemask for gen4"
This reverts commit 4966f8374a.

Not so spurious after all!

Reported-by: Michal Suchanek
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-08 11:09:46 +00:00
Chris Wilson b858c28d04 sna/gen4: Tidy URB_FENCE command
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-07 14:42:41 +00:00
Chris Wilson b7565a2640 sna/gen4: Use PIPE_CONTROL for a smaller hammer
Using MI_FLUSH to break up primitive is overkill when a top-of-pipe
PIPE_CONTROL will suffice.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-07 14:05:09 +00:00
Chris Wilson 9d8473c5d9 sna/gen4: Check for available batch space before restoring state after CA pass
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73348
References: https://bugs.freedesktop.org/show_bug.cgi?id=55500
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-07 14:04:18 +00:00