platform/upstream/xf86-video-intel.git
10 years agosna: MST topologies may change on any hotplug event
Chris Wilson [Fri, 6 Jun 2014 11:00:35 +0000 (12:00 +0100)]
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>
10 years agosna: Create a stable output name based on MST topology
Chris Wilson [Thu, 8 May 2014 07:04:58 +0000 (08:04 +0100)]
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>
10 years agosna: Ignore setting read-only for temporary userptr maps
Chris Wilson [Wed, 11 Jun 2014 09:48:26 +0000 (10:48 +0100)]
sna: Ignore setting read-only for temporary userptr maps

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Prefer to operate inplace on the GPU rather than stall on the CPU
Chris Wilson [Wed, 11 Jun 2014 09:35:50 +0000 (10:35 +0100)]
sna: Prefer to operate inplace on the GPU rather than stall on the CPU

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Discard TearFree damage before checking for an overwriting upload
Chris Wilson [Wed, 11 Jun 2014 09:12:01 +0000 (10:12 +0100)]
sna: Discard TearFree damage before checking for an overwriting upload

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Silence compiler warnings for discarding const Region points
Chris Wilson [Wed, 11 Jun 2014 08:29:50 +0000 (09:29 +0100)]
sna: Silence compiler warnings for discarding const Region points

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Squelch log messages for fb/pixmap tiling in the default case
Chris Wilson [Wed, 11 Jun 2014 07:39:42 +0000 (08:39 +0100)]
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>
10 years agosna: Mark the GPU as all damaged when discarding CPU bo during uploads
Chris Wilson [Wed, 11 Jun 2014 06:59:41 +0000 (07:59 +0100)]
sna: Mark the GPU as all damaged when discarding CPU bo during uploads

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Check that the window covers the whole CRTC before xchg
Chris Wilson [Tue, 10 Jun 2014 20:28:32 +0000 (21:28 +0100)]
sna/dri2: Check that the window covers the whole CRTC before xchg

Fixes TearFre regression from

commit 3932e97057fca16615adaefbc1eb25a0d51a1d8b [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>
10 years agosna: Cast away compiler warning
Chris Wilson [Tue, 10 Jun 2014 15:37:24 +0000 (16:37 +0100)]
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>
10 years agosna: Expand debugging to cover gen8 BLT variations
Chris Wilson [Tue, 10 Jun 2014 08:09:30 +0000 (09:09 +0100)]
sna: Expand debugging to cover gen8 BLT variations

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Fix arguments when flipping transformed TearFree outputs
Chris Wilson [Tue, 10 Jun 2014 13:25:42 +0000 (14:25 +0100)]
sna: Fix arguments when flipping transformed TearFree outputs

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Tidy a few asserts on the state of crtc->flip_bo
Chris Wilson [Tue, 10 Jun 2014 12:25:57 +0000 (13:25 +0100)]
sna: Tidy a few asserts on the state of crtc->flip_bo

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Handle the user passing "Backlight" ""
Chris Wilson [Tue, 10 Jun 2014 10:01:38 +0000 (11:01 +0100)]
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>
10 years ago2.99.912 snapshot 2.99.912
Chris Wilson [Mon, 2 Jun 2014 08:36:13 +0000 (09:36 +0100)]
2.99.912 snapshot

10 years agosna: Queue a flip after fixing up a failed flip
Chris Wilson [Tue, 10 Jun 2014 07:49:41 +0000 (08:49 +0100)]
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>
10 years agosna: Fix the typo in the last commit
Chris Wilson [Mon, 9 Jun 2014 21:01:05 +0000 (22:01 +0100)]
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>
10 years agosna: Add an extra error message before disabling a CRTC
Chris Wilson [Mon, 9 Jun 2014 20:46:37 +0000 (21:46 +0100)]
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>
10 years agoconfigure: Allow disabling control over the backlight
Chris Wilson [Mon, 9 Jun 2014 16:04:47 +0000 (17:04 +0100)]
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>
10 years agosna: Defer the copy back from the shadow CRTC bo until we allocate the target
Chris Wilson [Mon, 9 Jun 2014 15:30:15 +0000 (16:30 +0100)]
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>
10 years agosna: Fix cut'n'paste DBG error
Chris Wilson [Mon, 9 Jun 2014 14:03:23 +0000 (15:03 +0100)]
sna: Fix cut'n'paste DBG error

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Avoid trying to flip between bo with different pitches
Chris Wilson [Mon, 9 Jun 2014 13:56:02 +0000 (14:56 +0100)]
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>
10 years agosna: Fixup normal flips between different pitches
Chris Wilson [Mon, 9 Jun 2014 13:54:26 +0000 (14:54 +0100)]
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>
10 years agosna/dri2: Allow TearFree flipping to individual CRTC
Chris Wilson [Mon, 9 Jun 2014 07:58:15 +0000 (08:58 +0100)]
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>
10 years agosna: Do not rely on udev_monitor_receive_device() being non-blocking
Chris Wilson [Mon, 9 Jun 2014 12:13:25 +0000 (13:13 +0100)]
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>
10 years agouxa: Do not FreePixmap(screen->devPrivate)
Chris Wilson [Sun, 8 Jun 2014 15:55:07 +0000 (16:55 +0100)]
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>
10 years agosna/dri2: DBG compile fix
Chris Wilson [Sun, 8 Jun 2014 14:18:34 +0000 (15:18 +0100)]
sna/dri2: DBG compile fix

Typo in DBG message.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Allow xchg to replace the frontbuffer when all outputs are off
Chris Wilson [Sun, 8 Jun 2014 13:48:20 +0000 (14:48 +0100)]
sna/dri2: Allow xchg to replace the frontbuffer when all outputs are off

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Use xchg for offscreen drawables where applicable
Chris Wilson [Sun, 8 Jun 2014 08:40:19 +0000 (09:40 +0100)]
sna/dri2: Use xchg for offscreen drawables where applicable

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Explicitly drain the pending event queue before swapping
Chris Wilson [Sun, 8 Jun 2014 07:46:27 +0000 (08:46 +0100)]
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>
10 years agosna/dri2: Mark frames under construction
Chris Wilson [Sun, 8 Jun 2014 07:21:38 +0000 (08:21 +0100)]
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>
10 years agosna/dri2: Check the xchg against the Pixmap size
Chris Wilson [Sun, 8 Jun 2014 06:45:52 +0000 (07:45 +0100)]
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>
10 years agosna: Restore backlight when switching to VT
Chris Wilson [Sat, 7 Jun 2014 22:27:49 +0000 (23:27 +0100)]
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>
10 years agosna: Fix reporting of TearFree
Chris Wilson [Sat, 7 Jun 2014 13:57:10 +0000 (14:57 +0100)]
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>
10 years agosna: Release CRTC on VT switch
Chris Wilson [Sat, 7 Jun 2014 12:26:12 +0000 (13:26 +0100)]
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>
10 years agosna: Allow TearFree to be enabled by default via configure
Chris Wilson [Sat, 7 Jun 2014 08:07:16 +0000 (09:07 +0100)]
sna: Allow TearFree to be enabled by default via configure

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Fix TearFree for non-compositors
Chris Wilson [Sat, 7 Jun 2014 07:30:38 +0000 (08:30 +0100)]
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>
10 years agosna: Fix no relaxed delta path for gen4+
Chris Wilson [Fri, 6 Jun 2014 21:07:44 +0000 (22:07 +0100)]
sna: Fix no relaxed delta path for gen4+

This is for debug purposes only.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Auto-retire upload proxies
Chris Wilson [Fri, 6 Jun 2014 15:58:45 +0000 (16:58 +0100)]
sna: Auto-retire upload proxies

This was disabled in

commit 9f4f855ba37966fb91d31e9081d03cf72affb154
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>
10 years agosna: Only allow the inplace copy to replace a complete overwritten GPU bo
Chris Wilson [Fri, 6 Jun 2014 15:10:29 +0000 (16:10 +0100)]
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>
10 years agosna: Rearrange scanout_flush checking to avoid potential crash
Chris Wilson [Fri, 6 Jun 2014 14:04:25 +0000 (15:04 +0100)]
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>
10 years agosna: Report KMS driver version
Chris Wilson [Fri, 6 Jun 2014 12:34:18 +0000 (13:34 +0100)]
sna: Report KMS driver version

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agoman: Update notes about TearFree
Chris Wilson [Fri, 6 Jun 2014 10:39:57 +0000 (11:39 +0100)]
man: Update notes about TearFree

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Restore flush on front buffers after swapping bo
Chris Wilson [Fri, 6 Jun 2014 10:25:47 +0000 (11:25 +0100)]
sna/dri2: Restore flush on front buffers after swapping bo

Fallout from commit 8369166349c92a20d9a2e7d0256e63f66fe2682b
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>
10 years agosna: Hook up a backlight udev monitor for external changes
Chris Wilson [Thu, 5 Jun 2014 21:43:37 +0000 (22:43 +0100)]
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>
10 years agosna: When the output is off, report the cached backlight value
Chris Wilson [Thu, 5 Jun 2014 14:54:32 +0000 (15:54 +0100)]
sna: When the output is off, report the cached backlight value

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Inline calls to save/restore backlight around output DPMS
Chris Wilson [Thu, 5 Jun 2014 14:31:54 +0000 (15:31 +0100)]
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>
10 years agosna: Set initial output DPMS state from kernel
Chris Wilson [Thu, 5 Jun 2014 14:31:27 +0000 (15:31 +0100)]
sna: Set initial output DPMS state from kernel

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Make sure we recompute the vblank interval after reconfiguring the CRTC
Chris Wilson [Thu, 5 Jun 2014 14:49:03 +0000 (15:49 +0100)]
sna: Make sure we recompute the vblank interval after reconfiguring the CRTC

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Skip marking the CRTC as damaged for TearFree
Chris Wilson [Thu, 5 Jun 2014 13:54:55 +0000 (14:54 +0100)]
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>
10 years agosna: Fix DBG compilation
Chris Wilson [Thu, 5 Jun 2014 13:50:04 +0000 (14:50 +0100)]
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>
10 years agosna: Curry parameters to sna_damage_all()
Chris Wilson [Thu, 5 Jun 2014 11:26:23 +0000 (12:26 +0100)]
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>
10 years agosna: Mark CPU as all damaged when discarding a busy GPU bo
Chris Wilson [Thu, 5 Jun 2014 11:04:29 +0000 (12:04 +0100)]
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 65301412ecf2d55ab55a2d7faeaa048d4ee8b1d0
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>
10 years agosna/dri2: Enable immediate buffer exchanges
Chris Wilson [Wed, 4 Jun 2014 07:29:51 +0000 (08:29 +0100)]
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>
10 years agoconfigure: XORG_DRIVER_CHECK_EXT does not create CFLAGS/LIBS variables
Chris Wilson [Tue, 3 Jun 2014 14:48:55 +0000 (15:48 +0100)]
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>
10 years agoconfigure: Remove xf86driproto from REQUIRED_MODULES
Chris Wilson [Tue, 3 Jun 2014 14:39:50 +0000 (15:39 +0100)]
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>
10 years agoconfigure: Don't link the driver against libX11
Adam Jackson [Tue, 3 Jun 2014 14:26:46 +0000 (10:26 -0400)]
configure: Don't link the driver against libX11

78dc0c04745ad4485b994f67833f4a155749f01d 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>
10 years agosna: Replace the bo for tiled uploads if not suitable and being replaced
Chris Wilson [Tue, 3 Jun 2014 08:47:27 +0000 (09:47 +0100)]
sna: Replace the bo for tiled uploads if not suitable and being replaced

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Allow replacements to cancel operations between both bo under a Pixmap
Chris Wilson [Tue, 3 Jun 2014 11:43:51 +0000 (12:43 +0100)]
sna: Allow replacements to cancel operations between both bo under a Pixmap

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Discard unwanted damage when promoting to a full CPU migration
Chris Wilson [Tue, 3 Jun 2014 08:28:24 +0000 (09:28 +0100)]
sna: Discard unwanted damage when promoting to a full CPU migration

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Fix early return in download using the GPU
Chris Wilson [Mon, 2 Jun 2014 15:01:10 +0000 (16:01 +0100)]
sna: Fix early return in download using the GPU

In commit 961139f5878572ebea268a0bbf47caf05af9093f
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>
10 years agosna: Use CPU mmappings for linear uploads
Chris Wilson [Mon, 2 Jun 2014 09:32:11 +0000 (10:32 +0100)]
sna: Use CPU mmappings for linear uploads

The other half of the commit that accidentally got included with

commit bb49222a514b1d6041f3d9530a22f5701377118b
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>
10 years agoOnly enable the new Cursor API for the next pre-release of Xorg
Chris Wilson [Mon, 2 Jun 2014 08:25:01 +0000 (09:25 +0100)]
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>
10 years agouxa: Add Present extension support
Keith Packard [Tue, 19 Nov 2013 23:20:44 +0000 (15:20 -0800)]
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

10 years agouxa: Restructure DRM event handling.
Keith Packard [Wed, 20 Nov 2013 07:20:38 +0000 (23:20 -0800)]
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>
10 years agouxa: Support 64-bit MSC values. Handle kernel vageries about MSC reporting
Keith Packard [Wed, 20 Nov 2013 06:58:33 +0000 (22:58 -0800)]
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

10 years agouxa: Add DRI3 and miSyncShm support
Chris Wilson [Fri, 9 May 2014 19:26:19 +0000 (20:26 +0100)]
uxa: Add DRI3 and miSyncShm support

Based on a patch by Keith Packard.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Add support for Present
Chris Wilson [Wed, 21 May 2014 07:58:24 +0000 (08:58 +0100)]
sna: Add support for Present

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Add support for DRI3
Chris Wilson [Thu, 8 May 2014 15:25:32 +0000 (16:25 +0100)]
sna: Add support for DRI3

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Relax tiling height restrictions
Chris Wilson [Thu, 22 May 2014 10:17:35 +0000 (11:17 +0100)]
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>
10 years agointel-virtual-output: Add DRI3 xfer path
Chris Wilson [Tue, 20 May 2014 14:37:13 +0000 (15:37 +0100)]
intel-virtual-output: Add DRI3 xfer path

Just as proof-of-principle.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agoAdd rudimentary tests for Present
Chris Wilson [Wed, 21 May 2014 11:52:18 +0000 (12:52 +0100)]
Add rudimentary tests for Present

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agoAdd rudimentary tests for DRI3
Chris Wilson [Fri, 9 May 2014 10:08:15 +0000 (11:08 +0100)]
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>
10 years agointel: Clear structs for valgrind
Chris Wilson [Wed, 14 May 2014 06:55:03 +0000 (07:55 +0100)]
intel: Clear structs for valgrind

When probing the module, clear structs passed into unknown ioctls to
keep valgrind quiet.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agointel: Add common routines and configure probing for DRI3
Chris Wilson [Fri, 9 May 2014 12:58:37 +0000 (13:58 +0100)]
intel: Add common routines and configure probing for DRI3

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Use real async flips
Chris Wilson [Fri, 30 May 2014 20:09:34 +0000 (21:09 +0100)]
sna/dri2: Use real async flips

Presuming that we have both kernel support and Xorg support, of course.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Enable kernel support for asynchronous flips
Chris Wilson [Fri, 30 May 2014 20:21:00 +0000 (21:21 +0100)]
sna: Enable kernel support for asynchronous flips

If a flip fails, attempt to restore the previous working configuration
(using a modeset) then disable further flipping.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Hide MSC reported as going backwards
Chris Wilson [Sun, 1 Jun 2014 07:44:13 +0000 (08:44 +0100)]
sna/dri2: Hide MSC reported as going backwards

OML_sync_control mandates that MSC must be monotonic, so if the kernel
reports that they go backwards, lie.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Always force the async blits to be immediate
Chris Wilson [Sat, 31 May 2014 20:58:13 +0000 (21:58 +0100)]
sna/dri2: Always force the async blits to be immediate

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Decouple spent flip
Chris Wilson [Sat, 31 May 2014 20:41:45 +0000 (21:41 +0100)]
sna/dri2: Decouple spent flip

If the flip is already completed before we finish the previous flip, the
drawable has been replaced already and we can unchain the flip queue.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Mark queued flip MSC as the one after next
Chris Wilson [Sat, 31 May 2014 12:21:04 +0000 (13:21 +0100)]
sna/dri2: Mark queued flip MSC as the one after next

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen8: Clear all URB push constant allocations
Chris Wilson [Fri, 30 May 2014 12:27:32 +0000 (13:27 +0100)]
sna/gen8: Clear all URB push constant allocations

A little paranoia to clear the unused portion of the URB and dedicate it
to VS entries.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen8: Set GT level
Chris Wilson [Fri, 30 May 2014 11:14:40 +0000 (12:14 +0100)]
sna/gen8: Set GT level

We use the GT level to decide how favourable it is to use the GPU in
various circumstances, now set it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Add DBG hints for using inplace CPU mmappings
Chris Wilson [Mon, 2 Jun 2014 07:25:52 +0000 (08:25 +0100)]
sna: Add DBG hints for using inplace CPU mmappings

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Silence a DBG compiler warning
Chris Wilson [Mon, 2 Jun 2014 07:30:57 +0000 (08:30 +0100)]
sna: Silence a DBG compiler warning

kgem.c: In function '_kgem_submit':
kgem.c:3243:12: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
       write(fd, kgem->batch, batch_end*sizeof(uint32_t));

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Reuse the first scanout bo
Chris Wilson [Fri, 30 May 2014 17:41:39 +0000 (18:41 +0100)]
sna: Reuse the first scanout bo

The path of last resort is meant to reuse the first scanout bo if they
all busy (since it will be the oldest). It chased a dangling pointer
instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Do not allow imported buffers to be cached
Chris Wilson [Fri, 30 May 2014 17:30:47 +0000 (18:30 +0100)]
sna: Do not allow imported buffers to be cached

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Mark all caches for expiration
Chris Wilson [Fri, 30 May 2014 17:11:16 +0000 (18:11 +0100)]
sna: Mark all caches for expiration

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agotest: Only compute the masked pixel value if depth!=32
Chris Wilson [Fri, 30 May 2014 09:31:37 +0000 (10:31 +0100)]
test: Only compute the masked pixel value if depth!=32

Minor saving for when we use a8r8g8b8.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Use manual detiling for downloads
Chris Wilson [Fri, 30 May 2014 08:45:15 +0000 (09:45 +0100)]
sna: Use manual detiling for downloads

If we can CPU mmap the GPU bo, prefer to do so for migration to the CPU
as this saves an extra serialisation step.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Unexport kgem_get_unique_id()
Chris Wilson [Fri, 30 May 2014 21:49:05 +0000 (22:49 +0100)]
sna: Unexport kgem_get_unique_id()

This should always be set during bo creation

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Reorder declarations to compile on old Xorg
Chris Wilson [Wed, 28 May 2014 13:00:26 +0000 (14:00 +0100)]
sna/dri2: Reorder declarations to compile on old Xorg

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agoSilence CLang (almost)
Chris Wilson [Wed, 28 May 2014 11:51:18 +0000 (12:51 +0100)]
Silence CLang (almost)

Fix up all the warnings about implicit enum conversions. The
container_of() macro remains defunct.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Fix the continuation mode for old style triple buffering
Chris Wilson [Wed, 28 May 2014 09:42:58 +0000 (10:42 +0100)]
sna/dri2: Fix the continuation mode for old style triple buffering

Otherwise we end up sending too many SwapCompletes back to the client
and confusing ourselves.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Fix the depth/format on the temporary shadow Pictures
Chris Wilson [Tue, 27 May 2014 19:16:55 +0000 (20:16 +0100)]
sna: Fix the depth/format on the temporary shadow Pictures

When scaling the output, we re-render onto the scanout using a call to
Composite, for which we create temporary Pictures. In most cases, the
mismatching depth/format goes unnoticed, but along one particular
fallback path, we use those to create a new Picture but the mismatching
format results in a segfault.

Reported-by: Matti Hämäläinen <ccr@tnsp.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79320
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Handle bad picture format/depth mismatches
Chris Wilson [Tue, 27 May 2014 19:14:02 +0000 (20:14 +0100)]
sna: Handle bad picture format/depth mismatches

Scaling the output feed in an invalid picture->format/depth combination
which causes the fallback downsampling function to explode. Whilst this
is a bug in the higher layer, we can handle the error anyway.

References: https://bugs.freedesktop.org/show_bug.cgi?id=79320
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agouxa: Silence the compiler over a couple of unused variables
Chris Wilson [Fri, 23 May 2014 12:16:50 +0000 (13:16 +0100)]
uxa: Silence the compiler over a couple of unused variables

intel_driver.c: In function 'I830LeaveVT':
intel_driver.c:1085:24: warning: unused variable 'intel' [-Wunused-variable]
  intel_screen_private *intel = intel_get_screen_private(scrn);
                        ^
intel_driver.c: In function 'I830EnterVT':
intel_driver.c:1102:24: warning: unused variable 'intel' [-Wunused-variable]
  intel_screen_private *intel = intel_get_screen_private(scrn);

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agouxa: Silence compiler for warnings in Cursor API changes
Chris Wilson [Fri, 23 May 2014 13:29:42 +0000 (14:29 +0100)]
uxa: Silence compiler for warnings in Cursor API changes

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Silence compiler for warnings in Cursor API changes
Chris Wilson [Fri, 23 May 2014 13:29:42 +0000 (14:29 +0100)]
sna: Silence compiler for warnings in Cursor API changes

The API changed again in the RC, so update to keep the compiler quiet.
At the same time, protect against the ARGB_CURSOR struct changes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Move scanout processing from frame event to global
Chris Wilson [Mon, 26 May 2014 07:23:45 +0000 (08:23 +0100)]
sna/dri2: Move scanout processing from frame event to global

The scanout is a global property, track it as so. The primary benefit to
this is it strengthens our assertions that we never hand out an active
scanout for use as a back buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>