platform/upstream/xf86-video-intel.git
10 years agouxa: Add some explanation to why bo were rejected
Chris Wilson [Mon, 16 Jun 2014 09:27:16 +0000 (10:27 +0100)]
uxa: Add some explanation to why bo were rejected

References: https://bugs.freedesktop.org/show_bug.cgi?id=80088
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Fix logic inversion for final placement in is_gpu_dst()
Chris Wilson [Mon, 16 Jun 2014 09:13:09 +0000 (10:13 +0100)]
sna: Fix logic inversion for final placement in is_gpu_dst()

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Promote better active buffer reuse
Chris Wilson [Mon, 16 Jun 2014 08:46:54 +0000 (09:46 +0100)]
sna: Promote better active buffer reuse

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/glyphs: Show number of glyphs in DBG
Chris Wilson [Mon, 16 Jun 2014 08:24:45 +0000 (09:24 +0100)]
sna/glyphs: Show number of glyphs in DBG

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Fix some batch DBG
Chris Wilson [Mon, 16 Jun 2014 07:03:21 +0000 (08:03 +0100)]
sna: Fix some batch DBG

Helps to check for a successful read when we want to show the batch
after execution.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Clear our private hints about front rendering exported bo
Chris Wilson [Sun, 15 Jun 2014 20:42:10 +0000 (21:42 +0100)]
sna: Clear our private hints about front rendering exported bo

Unlike GLXWindows, GLXPixmaps are rendered directly into, without a
staging copy. Therefore we must treat those carefully when exported and
clear our hints everytime control passes back to the Client.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79999
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Add more DBG to track transitions between CRTC and its shadow or flip bo
Chris Wilson [Sun, 15 Jun 2014 19:55:30 +0000 (20:55 +0100)]
sna: Add more DBG to track transitions between CRTC and its shadow or flip bo

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agotest: Add a simple SHM test skeleton
Chris Wilson [Sun, 15 Jun 2014 13:04:50 +0000 (14:04 +0100)]
test: Add a simple SHM test skeleton

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Enable TearFree by default for systems with PSR
Chris Wilson [Fri, 13 Jun 2014 20:41:36 +0000 (21:41 +0100)]
sna: Enable TearFree by default for systems with PSR

Panel Self-Refresh requires us to avoid frontbuffer rendering in order
to be power efficient. This is a job for TearFree!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Fix assertions for discarding upload caches
Chris Wilson [Sat, 14 Jun 2014 05:51:34 +0000 (06:51 +0100)]
sna: Fix assertions for discarding upload caches

The upload caches are special, along with having a bo->proxy, they also
claim to be completely damaged on both the GPU and CPU. Allow that to
pass through when discarding the proxy.

Reported-by: Nick Bowler <nbowler@draconx.ca>
Bugzilla; https://bugs.freedesktop.org/show_bug.cgi?id=79992
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Use the right is-clipped hint
Chris Wilson [Fri, 13 Jun 2014 19:30:25 +0000 (20:30 +0100)]
sna: Use the right is-clipped hint

The region here has yet to be clipped, and so the only valid is-clipped
hint is from the flags computed from the PolyRect extents. Make sure we
use those when determining whether it is valid to discard damage.

Fixes regression from
commit ad0390068832ad4727371902fe41a85a53de1894 [2.99.903]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Sep 24 10:00:03 2013 +0100

sna: Separate out copy preferrence from operating in place decision

Reported-by: Nick Bowler <nbowler@draconx.ca>
Tested-by: Nick Bowler <nbowler@draconx.ca>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79992
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Only discard the CPU bo if we have a GPU bo to transfer the damage to
Chris Wilson [Fri, 13 Jun 2014 17:56:57 +0000 (18:56 +0100)]
sna: Only discard the CPU bo if we have a GPU bo to transfer the damage to

References: https://bugs.freedesktop.org/show_bug.cgi?id=79992
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agointel-virtual-output: Compile fixes
Chris Wilson [Fri, 13 Jun 2014 20:41:16 +0000 (21:41 +0100)]
intel-virtual-output: Compile fixes

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agointel-virtual-output: Disable outputs on remote displays upon shutdown
Chris Wilson [Fri, 13 Jun 2014 18:59:16 +0000 (19:59 +0100)]
intel-virtual-output: Disable outputs on remote displays upon shutdown

References: https://bugs.freedesktop.org/show_bug.cgi?id=79994
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agointel-virtual-output: Initialise image after clone
Chris Wilson [Fri, 13 Jun 2014 18:29:41 +0000 (19:29 +0100)]
intel-virtual-output: Initialise image after clone

As the image inherits its width/height from the clone, we need to set
those first on the clone.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79994
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agointel-virtual-output: Only call XShmDetach on a valid SHM segment
Chris Wilson [Fri, 13 Jun 2014 18:15:08 +0000 (19:15 +0100)]
intel-virtual-output: Only call XShmDetach on a valid SHM segment

Saves a couple of extraneous XErrors.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agointel-virtual-output: Check for an error creating the DRI3 fd
Chris Wilson [Fri, 13 Jun 2014 17:37:15 +0000 (18:37 +0100)]
intel-virtual-output: Check for an error creating the DRI3 fd

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79994
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Refine decision whether to use the GPU or render inplace
Chris Wilson [Fri, 13 Jun 2014 15:14:43 +0000 (16:14 +0100)]
sna: Refine decision whether to use the GPU or render inplace

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Track the pageflip bo's busyness
Chris Wilson [Fri, 13 Jun 2014 14:06:13 +0000 (15:06 +0100)]
sna: Track the pageflip bo's busyness

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agointel: Check that the fd points to i915 after authorising
Chris Wilson [Fri, 13 Jun 2014 12:50:34 +0000 (13:50 +0100)]
intel: Check that the fd points to i915 after authorising

The call to GETPARAM requires either a rendernode or authorisation.
Therefore we can only assert that the fd is a valid i915 handle after
authorise() and not before.

Reported-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen6+: Prefer the BLT for large overlapping copies
Chris Wilson [Fri, 13 Jun 2014 11:32:12 +0000 (12:32 +0100)]
sna/gen6+: Prefer the BLT for large overlapping copies

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