Commit Graph

7676 Commits

Author SHA1 Message Date
Chris Wilson 76e430e92c sna: Constify GCFunc to quieten the compiler.
We keep a pointer to the old funcs when wrapping, this now needs to be const.

sna_accel.c: In function 'sna_gc_move_to_cpu':
sna_accel.c:4008:17: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
  sgc->old_funcs = gc->funcs;

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-30 12:24:47 +00:00
Chris Wilson 57445e57d4 sna: Fix format specifier typo ('%D') in DBG
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-29 16:48:21 +00:00
Chris Wilson 139fc76260 sna: Always clear the domain even only a potential sync
It helps to keep the domain-tracking bookkeeping consistent.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-29 13:42:50 +00:00
Chris Wilson d70620d978 sna: We can only retire a bo if is not referenced by the current batch
Fixes regression from
commit 8b0ebebcab
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Jan 28 16:30:47 2014 +0000

    sna: Be a little more assertive in retiring after set-domain

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74176
Reported-by: Jan Alexander Steffens <jan.steffens@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-29 13:40:08 +00:00
Chris Wilson 971a5e64f5 sna: Add assertions for set/get binding
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-29 13:15:43 +00:00
Chris Wilson 7df3da10e7 sna/gen4+: Assert that the cached binding location is valid
We can at least check that it is in the right region (i.e. not past
where the current surface has been allocated from).

References: https://bugs.freedesktop.org/show_bug.cgi?id=74176
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-29 13:06:08 +00:00
Chris Wilson 001dd080e1 sna: Do not use color corrected pixel values for comparing against gc
Dashed zero-width lines devolve into two passes (first to draw the
foreground dashes, and then to draw the gaps). The code was using the
pixel value to decide which phase was being drawn -- however the color
on the gc is not always bit exact (e.g. alpha channel) with the pixel
value. As a result, we would oft miss drawing anything when rendering
into the scanout.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1059152
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-29 11:23:41 +00:00
Chris Wilson 872468a059 sna/gen6+: Encourage inplace uploads for Composite
First try using the blt path for a potential inplace upload for a
simple composite operation copying from a ShmPixmap.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-29 05:40:00 +00:00
Chris Wilson 4b73a0ea22 sna: Skip undamaged TearFree redisplays
If we have not had cause to flush the wait_for_shadow buffer during the
course of the rendering, then we never wrote to the backbuffer and its
contents are still identical to the current frontbuffer. So if the
wait_for_shadow is still flagged as required on the scanout, we know we
can safely discard the redisplay request.

References: https://bugs.freedesktop.org/show_bug.cgi?id=70905
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-29 05:32:25 +00:00
Chris Wilson 9f3fc9ec49 Allow selection of glamor as the default acceleration method
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74162
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-28 21:56:23 +00:00
Chris Wilson 2425f03432 sna: Check for a hang after a spurious error return from set-domain-ioctl
set-domain-ioctl should only ever fail for invalid user input, beyond
the normal signal handling. As such if we do find a spurious error
return from the kernel, check for a GPU hang.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-28 19:22:55 +00:00
Chris Wilson 8b0ebebcab sna: Be a little more assertive in retiring after set-domain
After a successful set-domain for writing with the CPU, we know that the
buffer is idle so remove it from our request tracking. (External clients
complicate matters in that they may keep the bo active even after our
set-domain.) On the contrary, because of read-read optimisations a bo
may still be active after a set-domain for reading by the CPU, in which
we need to remain conservative in retiring the bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-28 16:40:45 +00:00
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