Commit Graph

8113 Commits

Author SHA1 Message Date
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
Chris Wilson c7efe88a89 sna: Fix DBG compilation
Update the DBG to reflect the new arguments to sna_damage_reduce_all()

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-05 16:00:20 +01:00
Chris Wilson 9566fc0ccc sna: Curry parameters to sna_damage_all()
It is far easily to pass the PixmapPtr into the function and have it
pluck out the width and height than do so in all callers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-05 13:58:27 +01:00
Chris Wilson 1327918f91 sna: Mark CPU as all damaged when discarding a busy GPU bo
When we discard a GPU bo, we need to make sure that the remaining
content is marked as only accessible via the CPU shadow pointer.

Regression from commit 65301412ec
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sat May 17 20:59:38 2014 +0100

    sna: Discard active GPU buffers before uploading into them

Reported-by: Jan Alexander Steffens <jan.steffens@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79517
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-05 13:58:04 +01:00
Chris Wilson 8369166349 sna/dri2: Enable immediate buffer exchanges
The primary benefit of this is avoid the extra blit when using a
compositor and instead propagate the compositor flip on the frontbuffer
to the scanout, or equivalently allows a fullscreen game to flip onto
the scanout without intervention by TearFree.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-05 12:28:22 +01:00
Chris Wilson 0814889619 configure: XORG_DRIVER_CHECK_EXT does not create CFLAGS/LIBS variables
XORG_DRIVER_CHECK_EXT only adds the package name to the list of
REQUIRED_MODULES (which is later passed to pkg-config). For our optional
dependencies, we must do a later call to pkg-config to verify the
package is available and then remember to include the includes with the
CFLAGS.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-03 15:52:02 +01:00
Chris Wilson 0c81041e9b configure: Remove xf86driproto from REQUIRED_MODULES
We only depend upon the original DRI1 infrastructure when building i810
with DRI support. So unless that is true, do not throw an error if the
legacy protocol is absent.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-03 15:52:02 +01:00
Adam Jackson 689ee76a14 configure: Don't link the driver against libX11
78dc0c0474 added REQUIRED_MODULES to the
driver link line for... some reason.  That pulled in the libs from the
XF86DRI check, which near as I can tell has always been wrong, all of
the other extension checks just look for the protocol module and
xextproto doesn't define dri1 protocol in any case.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-06-03 15:52:02 +01:00
Chris Wilson 8297c969ae sna: Replace the bo for tiled uploads if not suitable and being replaced
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-03 13:48:58 +01:00
Chris Wilson 1c55d0447d sna: Allow replacements to cancel operations between both bo under a Pixmap
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-03 13:48:58 +01:00
Chris Wilson a82bfb0334 sna: Discard unwanted damage when promoting to a full CPU migration
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-03 13:48:58 +01:00
Chris Wilson 4cafd1fbb1 sna: Fix early return in download using the GPU
In commit 961139f587
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri May 30 09:45:15 2014 +0100

    sna: Use manual detiling for downloads

the code for deciding when to use the GPU was refactored into a new
function that also performed the transfer, but failed to notice the
early return.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 16:04:51 +01:00
Chris Wilson d6a412812c sna: Use CPU mmappings for linear uploads
The other half of the commit that accidentally got included with

commit bb49222a51
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Jun 2 08:25:52 2014 +0100

    sna: Add DBG hints for using inplace CPU mmappings

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 10:34:03 +01:00
Chris Wilson 454367f594 Only enable the new Cursor API for the next pre-release of Xorg
Make sure we can compile against the pre-release tarballs at the expense
of an innocuous compile warning if compiled against xserver.git

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 09:26:05 +01:00
Keith Packard ff36e1f754 uxa: Add Present extension support
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>

Conflicts:
	configure.ac
	src/uxa/intel.h
	src/uxa/intel_driver.c
2014-06-02 08:32:11 +01:00
Keith Packard 14ff08c282 uxa: Restructure DRM event handling.
This refactors the drm interrupt handling logic quite a bit, both to
allow for either DRI2 or Present handlers, but also to eliminate
passing pointers through the kernel. Passing pointers left the kernel
holding the only reference to some internal X server data structures.

After a server reset, the X server would end up using stale pointers
stored in those structures. Using simple integers makes it possible to
empty the queue of pending interrupt data and then ignore the stale
kernel data.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-06-02 08:32:11 +01:00
Keith Packard 7f28b1cfa2 uxa: Support 64-bit MSC values. Handle kernel vageries about MSC reporting
The kernel sometimes reports bogus MSC values, especially when
suspending and resuming the machine. Deal with this by tracking an
offset to ensure that the MSC seen by applications increases
monotonically, and at a reasonable pace.

Also, provide a full 64 bits of MSC value by noticing wrapping and
tracking the high 32-bits of MSC separately.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>

Conflicts:
	src/uxa/intel_dri.c
2014-06-02 08:32:11 +01:00
Chris Wilson dd6db82680 uxa: Add DRI3 and miSyncShm support
Based on a patch by Keith Packard.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson 975b9798be sna: Add support for Present
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson d8eb87f84f sna: Add support for DRI3
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson 0fbe8995d5 sna: Relax tiling height restrictions
Only force the even-tile-row alignment if we have an old GPU with an old
kernel that doesn't perform conservative alignment for us (as required).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson 67b37332bd intel-virtual-output: Add DRI3 xfer path
Just as proof-of-principle.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson 9cf6cd9726 Add rudimentary tests for Present
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson 6ab6734369 Add rudimentary tests for DRI3
This is a simple little test to create a pixmap from a local bo, copy it
to a normal pixmap, then read it back by importing it into anther local
bo. It tests the fundamental mechanisms of opening a DRI3 render device,
importing into pixmaps, exporting into /buffers and a read-barrier.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00