platform/upstream/xf86-video-intel.git
10 years agosna: Try to reuse the current cursor if we fail to update
Chris Wilson [Fri, 13 Jun 2014 09:52:47 +0000 (10:52 +0100)]
sna: Try to reuse the current cursor if we fail to update

As a last resort, continue to display the old cursor if we tried and
failed to create a new cursor.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agoxvmc: Refactor mutex locking
Chris Wilson [Fri, 13 Jun 2014 08:31:50 +0000 (09:31 +0100)]
xvmc: Refactor mutex locking

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agoxvmc: Sanitize compile and library flags
Chris Wilson [Fri, 13 Jun 2014 08:14:47 +0000 (09:14 +0100)]
xvmc: Sanitize compile and library flags

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agoconfigure: Fix DRI2 build
Chris Wilson [Fri, 13 Jun 2014 08:15:30 +0000 (09:15 +0100)]
configure: Fix DRI2 build

One s/DRI2/have_dri2/ too far.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Reorder ignore_cpu_damage() to avoid asserts
Chris Wilson [Fri, 13 Jun 2014 07:51:20 +0000 (08:51 +0100)]
sna: Reorder ignore_cpu_damage() to avoid asserts

Tricksy asserts making sure that the correct arguments are passed
around!

Reported-by: Arkadiusz Miskiewicz <arekm@maven.pl
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen8: Allow reads from scanout to be cached
Chris Wilson [Fri, 13 Jun 2014 07:32:34 +0000 (08:32 +0100)]
sna/gen8: Allow reads from scanout to be cached

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen8: Check for WT support before attempting to use the WT mocs
Chris Wilson [Fri, 13 Jun 2014 07:27:05 +0000 (08:27 +0100)]
sna/gen8: Check for WT support before attempting to use the WT mocs

It appears the kernel has a better idea when WT is supported on which
gen8 parts. I assumed it was always supported, but experience suggests
otherwise, so only use WT support when advertised.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79967
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agoconfigure: Allow manual disabling of each DRI level
Chris Wilson [Fri, 13 Jun 2014 06:48:15 +0000 (07:48 +0100)]
configure: Allow manual disabling of each DRI level

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Try to use CPU uploads before BLT uploads
Chris Wilson [Thu, 12 Jun 2014 08:52:50 +0000 (09:52 +0100)]
sna: Try to use CPU uploads before BLT uploads

As the BLT upload implies a sync (and a likely GPU boost), only do so if
we cannot do an immediate upload with the CPU, either directly to
backing memory or through the GTT.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Refactor USE_INPLACE debug macro
Chris Wilson [Thu, 12 Jun 2014 08:26:14 +0000 (09:26 +0100)]
sna: Refactor USE_INPLACE debug macro

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen8: Clear a couple more push constants
Chris Wilson [Wed, 11 Jun 2014 20:14:00 +0000 (21:14 +0100)]
sna/gen8: Clear a couple more push constants

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Remove bogus assertion
Chris Wilson [Wed, 11 Jun 2014 18:10:22 +0000 (19:10 +0100)]
sna: Remove bogus assertion

The sna_pixmap is cleared afterwards, it does not need to be clear on
free.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Fix direction flags for memmove
Chris Wilson [Wed, 11 Jun 2014 17:07:46 +0000 (18:07 +0100)]
sna: Fix direction flags for memmove

Under a compositor, the current deltas may invert the sense of the copy
direction, causing scrolling corruption. Simplify handling those flags
by making them invariant for the function.

Reported-by: Bruno Prémont <bonbons@linux-vserver.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79843
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Use the pixmap header creation routine
Chris Wilson [Wed, 11 Jun 2014 16:43:33 +0000 (17:43 +0100)]
sna: Use the pixmap header creation routine

A few more places could use the common pixmap creator, just remember to
handle the SHMPixmap complication!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen6+: On small GT avoid the intermediate copy for overlaps
Chris Wilson [Wed, 11 Jun 2014 15:41:22 +0000 (16:41 +0100)]
sna/gen6+: On small GT avoid the intermediate copy for overlaps

If the memory bw is constrained on the GPU avoid doing the 2-pass copy
for overlaps on the render ring, and do the single pass slower BLT copy
instead - as since it has to transfer less data it will be faster.

Reported-by: Ildar Nurislamov <absorbb@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77436
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen6+: Overlapping bo by definition have compatible depths
Chris Wilson [Wed, 11 Jun 2014 15:21:13 +0000 (16:21 +0100)]
sna/gen6+: Overlapping bo by definition have compatible depths

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: First copy to overlap temporary must be using GXcopy
Chris Wilson [Wed, 11 Jun 2014 15:12:26 +0000 (16:12 +0100)]
sna: First copy to overlap temporary must be using GXcopy

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Remove debugging hunk
Chris Wilson [Wed, 11 Jun 2014 14:49:43 +0000 (15:49 +0100)]
sna: Remove debugging hunk

Stray hunk in self-copy boxes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Update damage pointer after the implicit reduction
Chris Wilson [Wed, 11 Jun 2014 14:40:25 +0000 (15:40 +0100)]
sna: Update damage pointer after the implicit reduction

sna_damage_contains_box() routine implicitly reduces the damage before
performing its check. This may alter and even destroy the damage entry,
so pass in the handle so that it can be updated correctly.

References: https://bugs.freedesktop.org/show_bug.cgi?id=77436
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Fix scanout creation routine for old kernels <= 3.11
Chris Wilson [Wed, 11 Jun 2014 14:29:59 +0000 (15:29 +0100)]
sna: Fix scanout creation routine for old kernels <= 3.11

With an old kernel, we would fail to actually mark the display as part
of the scanout domain, but proceed to assign it a fb id. This caused our
asserts to report our bookkeeping error.

Reported-by: Pavel Ondračka <pavel.ondracka@email.cz>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79909
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Add some DBG to the memmove path
Chris Wilson [Wed, 11 Jun 2014 13:34:33 +0000 (14:34 +0100)]
sna: Add some DBG to the memmove path

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Tweak self-copy boxes to hit the GPU more often
Chris Wilson [Wed, 11 Jun 2014 13:22:26 +0000 (14:22 +0100)]
sna: Tweak self-copy boxes to hit the GPU more often

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Recheck source bo after migrating dst (in case of src == dst)
Chris Wilson [Wed, 11 Jun 2014 13:08:31 +0000 (14:08 +0100)]
sna: Recheck source bo after migrating dst (in case of src == dst)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Skip redundant clears
Chris Wilson [Wed, 11 Jun 2014 13:00:04 +0000 (14:00 +0100)]
sna: Skip redundant clears

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/glyphs: Always print some DBG when performing fallback
Chris Wilson [Wed, 11 Jun 2014 12:59:46 +0000 (13:59 +0100)]
sna/glyphs: Always print some DBG when performing fallback

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Add some asserts to track redundant damage operations
Chris Wilson [Wed, 11 Jun 2014 12:18:33 +0000 (13:18 +0100)]
sna: Add some asserts to track redundant damage operations

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen8: Check offset alignment before using a userptr for RENDER
Chris Wilson [Fri, 6 Jun 2014 07:30:59 +0000 (08:30 +0100)]
sna/gen8: Check offset alignment before using a userptr for RENDER

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79053
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Support efficient cursor updates for old machines
Chris Wilson [Thu, 17 Apr 2014 20:04:15 +0000 (21:04 +0100)]
sna: Support efficient cursor updates for old machines

Given a kernel patch to fix coherency of physical objects, we can use a
more efficient method for updating cursors.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
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>