Commit Graph

8136 Commits

Author SHA1 Message Date
Chris Wilson ee7d2e0a8e sna: MST topologies may change on any hotplug event
As the kernel does not send out an explicit DISCOVER event, we have to
reinspect every connector after every hotplug event to detect topology
changes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-11 11:05:27 +01:00
Chris Wilson 782c920b01 sna: Create a stable output name based on MST topology
In order to provide persistent names for MST devices, which may change
topology dynamically, the kernel exports a PATH blob. We can then use
this path to generate the output name, and so reuse existing XID when a
monitor is plugged back in.

Based on the patch for -modesetting by Dave Airlie.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-11 11:05:27 +01:00
Chris Wilson e680e54eab sna: Ignore setting read-only for temporary userptr maps
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-11 11:05:27 +01:00
Chris Wilson d9bf6f3fec sna: Prefer to operate inplace on the GPU rather than stall on the CPU
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-11 11:05:16 +01:00
Chris Wilson 277e6ab84b sna: Discard TearFree damage before checking for an overwriting upload
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-11 11:05:07 +01:00
Chris Wilson eb9de37daa sna: Silence compiler warnings for discarding const Region points
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-11 11:02:05 +01:00
Chris Wilson 085141348c sna: Squelch log messages for fb/pixmap tiling in the default case
The output is confusing, so hide it unless it is modified by the user.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-11 11:02:05 +01:00
Chris Wilson 53c1faa509 sna: Mark the GPU as all damaged when discarding CPU bo during uploads
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-11 08:07:42 +01:00
Chris Wilson e2bfa715a9 sna/dri2: Check that the window covers the whole CRTC before xchg
Fixes TearFre 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

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-10 21:31:05 +01:00
Chris Wilson d0f32a9d3a sna: Cast away compiler warning
sna_display.c: In function 'has_user_backlight_override':
sna_display.c:595:3: warning: return discards 'const' qualifier from pointer target type [enabled by default]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-10 21:31:05 +01:00
Chris Wilson 216beed6df sna: Expand debugging to cover gen8 BLT variations
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-10 21:31:05 +01:00
Chris Wilson f19195f7ea sna: Fix arguments when flipping transformed TearFree outputs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-10 14:39:10 +01:00
Chris Wilson c16b2a1259 sna: Tidy a few asserts on the state of crtc->flip_bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-10 14:39:10 +01:00
Chris Wilson fd6aaec33d sna: Handle the user passing "Backlight" ""
Allow the user to disable the backlight control by passing the empty
string in the xorg.conf.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-10 11:04:33 +01:00
Chris Wilson cb7b27a705 2.99.912 snapshot 2014-06-10 08:54:18 +01:00
Chris Wilson 52e2aa0939 sna: Queue a flip after fixing up a failed flip
After a flip fails, we try to update the CRTC manually to new fb.
However, the caller is still expecting to receive an event though the
drm device to notify when the flips are complete. In order to maintain
that ABI, we need to queue another flip after the fixup (to the
currently bound fb).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-10 08:52:09 +01:00
Chris Wilson 68ac3039e4 sna: Fix the typo in the last commit
Rewording the sentence and reordering the arguments was a mistake!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-09 22:02:06 +01:00
Chris Wilson fdb8f49044 sna: Add an extra error message before disabling a CRTC
One of the error paths to disable a pipe was lacking a log message.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-09 21:47:24 +01:00
Chris Wilson c1154ae107 configure: Allow disabling control over the backlight
Some OS prefer to control the backlight themselves through another
daemon and so do not want X interfering.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-09 21:47:24 +01:00
Chris Wilson bb2d5e3696 sna: Defer the copy back from the shadow CRTC bo until we allocate the target
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-09 16:39:02 +01:00
Chris Wilson b00a60b417 sna: Fix cut'n'paste DBG error
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-09 16:39:02 +01:00
Chris Wilson 8901a99afb sna/dri2: Avoid trying to flip between bo with different pitches
It could happen that we create front/back buffers with different
pitches. The kernel refuses to flip between such buffers, and so we will
hit some fallback paths that try to fix up the failed flips. Circumvent
such by avoiding the flip.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-09 14:57:58 +01:00
Chris Wilson 16574754a9 sna: Fixup normal flips between different pitches
Apply the manual CRTC fixup in case pageflipping fails. This can happen
if the pitches between the front and back differ for example.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-09 14:57:57 +01:00
Chris Wilson 3932e97057 sna/dri2: Allow TearFree flipping to individual CRTC
Baby step. We first take advantage of TearFree to allow us to redirect a
single CRTC to the DRI2 frontbuffer and so allow a fullscreen game
covering a single monitor to avoid expensive blits when running in a
multi-monitor setup.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-09 14:57:57 +01:00
Chris Wilson af3130cbba sna: Do not rely on udev_monitor_receive_device() being non-blocking
The libudev documentation says that is it non-blocking by default, but
experience shows otherwise.

Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-09 13:14:51 +01:00
Chris Wilson 981af18190 uxa: Do not FreePixmap(screen->devPrivate)
Prevent the crash caused by

commit 444a1f7a8802999e27ecf5f6eb598df2206f7277
Author: Brendan King <brendan.king@imgtec.com>
Date:   Thu Apr 24 11:37:45 2014 +0100

    fb: fix screen pixmap leak on server reset

    Call FreePixmap() instead of free() to destroy the screen pixmap in
    fbCloseScreen().

    Signed-off-by: Frank Binns <frank.binns@imgtec.com>
    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Keith Packard <keithp@keithp.com>

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-08 16:56:35 +01:00
Chris Wilson 86f2cae450 sna/dri2: DBG compile fix
Typo in DBG message.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-08 15:32:11 +01:00
Chris Wilson 6153141fa6 sna/dri2: Allow xchg to replace the frontbuffer when all outputs are off
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-08 14:49:15 +01:00
Chris Wilson 9306a148cb sna/dri2: Use xchg for offscreen drawables where applicable
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-08 14:26:35 +01:00
Chris Wilson 22cd7c873e sna/dri2: Explicitly drain the pending event queue before swapping
As there may be some latency between the wakeup and the queue, do a
final check if there is a pending vblank event before we decide whether
to chain up or perform an immediate flip.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-08 08:50:57 +01:00
Chris Wilson 258e0cda1d sna/dri2: Mark frames under construction
As we may recurse into the vblank handler whilst waiting for the
TearFree shadow, we need to be careful that we do not queue the frame
from the vblank handler that we are in the process of constructing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-08 08:22:43 +01:00
Chris Wilson eb8f3a9b34 sna/dri2: Check the xchg against the Pixmap size
As the Window may be resized between the client sending the swap request
and the xchg being processed, we need to validate the swap against the
final target not the buffers supplied originally by the client.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-08 07:47:46 +01:00
Chris Wilson fc64ba8217 sna: Restore backlight when switching to VT
fbcon doesn't adjust the backlight when it takes over. Therefore if X
performs a VT switch whilst its outputs are off, fbcon wakes up with no
backlight and users are unhappy. Make the assumption that whoever takes
over the VT will set the outputs as it desires, and that the failsafe
value is to then turn the backlight to full.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67025
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-07 23:31:25 +01:00
Chris Wilson ecd80a3a99 sna: Fix reporting of TearFree
The switch was moved after we checked whether pageflips are supported,
but the log message was left in the old location.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-07 15:04:15 +01:00
Chris Wilson 035be60f33 sna: Release CRTC on VT switch
In order to free up memory and improve our bookkeeping when the X server
is switched away from the current VT, disable the CRTC.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-07 15:04:15 +01:00
Chris Wilson 717e00facd sna: Allow TearFree to be enabled by default via configure
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-07 09:12:52 +01:00
Chris Wilson dcb64b5509 sna: Fix TearFree for non-compositors
The tearfree code forgot to update the shadow bo, so after the first
flip it would be rendering to the scanout anyway and flip to itself
periodically.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-07 09:12:52 +01:00
Chris Wilson c65fab0740 sna: Fix no relaxed delta path for gen4+
This is for debug purposes only.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-06 22:13:06 +01:00
Chris Wilson a378196fdd sna: Auto-retire upload proxies
This was disabled in

commit 9f4f855ba3
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon May 26 07:06:18 2014 +0100

    sna: Implicit release of upload buffers considered bad

as retiring the buffers during the command setup could free one of the
earlier bo used in the command. But discarding the snooped bo could
still be advantageous. So restore the automatic discard of upload
proxies, but make sure we only do between operations.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matti Hämäläinen <ccr@tnsp.org>
2014-06-06 22:13:06 +01:00
Chris Wilson 23840bd329 sna: Only allow the inplace copy to replace a complete overwritten GPU bo
And double check after recreating the new GPU bo that is still mappable.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-06 16:15:30 +01:00
Chris Wilson 283ff8cbe4 sna: Rearrange scanout_flush checking to avoid potential crash
With a shadow, we may never attach a GPU bo to the frontbuffer, so be
careful when checking the scanout not to dereference that NULL pointer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-06 15:08:59 +01:00
Chris Wilson 694ff54aca sna: Report KMS driver version
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-06 13:39:32 +01:00
Chris Wilson 0ebcef4f2e man: Update notes about TearFree
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-06 11:40:51 +01:00
Chris Wilson 1f943a7d92 sna/dri2: Restore flush on front buffers after swapping bo
Fallout from commit 8369166349
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jun 4 08:29:51 2014 +0100

    sna/dri2: Enable immediate buffer exchanges

We set the flush hint too early, as we may need to swap the GPU bo for a
more appropriate buffer for DRI.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-06 11:40:51 +01:00
Chris Wilson c6cd10f536 sna: Hook up a backlight udev monitor for external changes
Changes to the backlights are notified through uevents. Hooking up a
udev monitor to listen out for external changes to the backlight (e.g.
through ACPI function keys, or by the user writing to
/sys/class/backlight directly) is easier than enabling polling on the
backlight sysfs file using X's select() mechanism.

Since we listen to backlight changes, we have to be careful not to
confuse the side-effects of disabling connectors (which may cause either
ourselves or the kernel to turn off the backlight) with the user value.

Many thanks to Alexander Mezin for the suggestion to use udev for
tracking the notifications for external changes to the backlight.

Reported-by: Alexander Mezin <mezin.alexander@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79699
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-06 08:12:38 +01:00
Chris Wilson b545e10c50 sna: When the output is off, report the cached backlight value
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-05 16:01:27 +01:00
Chris Wilson f0b8720807 sna: Inline calls to save/restore backlight around output DPMS
The intertwined logic was a little confusing to read mixed between the
functions, so inline it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-05 16:01:26 +01:00
Chris Wilson 9f77751583 sna: Set initial output DPMS state from kernel
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-05 16:01:26 +01:00
Chris Wilson 9e02fe269d sna: Make sure we recompute the vblank interval after reconfiguring the CRTC
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-05 16:00:20 +01:00
Chris Wilson 51909f37ed sna: Skip marking the CRTC as damaged for TearFree
As we have reorder the application of damage on a TearFree frontbuffer
to before we attach the CRTC, we do not need to then schedule the update
afterwards (until it gets drawn by the client).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-05 16:00:20 +01:00