platform/upstream/xf86-video-intel.git
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>
10 years agosna/dri2: Defer reallocation of backbuffer until request
Chris Wilson [Sun, 25 May 2014 06:14:53 +0000 (07:14 +0100)]
sna/dri2: Defer reallocation of backbuffer until request

If we defer the reallocation of the backbuffer until the client requests
the set of current buffers (with GetBuffers), then we can often avoid
allocating the fresh backbuffer as the flip often retires before the
client is ready.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Make the swap-limit transitions more obvious
Chris Wilson [Fri, 23 May 2014 14:52:20 +0000 (15:52 +0100)]
sna/dri2: Make the swap-limit transitions more obvious

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Implicit release of upload buffers considered bad
Chris Wilson [Mon, 26 May 2014 06:06:18 +0000 (07:06 +0100)]
sna: Implicit release of upload buffers considered bad

Currently upload buffers are automatically decoupled when the buffer is
retired. As retiring can happen during command setup after we have
selected which bo to render with, this can free the bo we plan to use.
Which is bad.

Instead of making the release of upload buffers automatic, we manually
check whether the buffer is idle before use as a source to consider
scrapping it and replacing it with a real GPU bo. This is likely to keep
upload buffers alive for longer (limiting reuse between Pixmaps but
making reuse of the buffer within a Pixmap more likely) which is both
good and bad. (Good - may improve the content cache, bad - may increase
the amount of memory used by upload buffers for arbitrary long periods.)

Reported-by: Matti Hämäläinen <ccr@tnsp.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79238
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Assert that we do not replace active IO buffers
Chris Wilson [Mon, 26 May 2014 05:54:03 +0000 (06:54 +0100)]
sna: Assert that we do not replace active IO buffers

References: https://bugs.freedesktop.org/show_bug.cgi?id=79238
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Handle allocation failure adding frame events gracefully
Chris Wilson [Fri, 23 May 2014 12:34:38 +0000 (13:34 +0100)]
sna/dri2: Handle allocation failure adding frame events gracefully

Now that we do not preallocate the storage for the chain in the Window
devPrivates, we need to check for an allocation failure.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Tidy add/remove chain to use the common DRI2 private
Chris Wilson [Fri, 23 May 2014 11:48:10 +0000 (12:48 +0100)]
sna/dri2: Tidy add/remove chain to use the common DRI2 private

The code is more readable directly updating the private rather than
hiding the pointer chasing through the opaque lookups.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Handle offscreen Window and Pixmap with CRTC tracking
Chris Wilson [Fri, 23 May 2014 11:40:10 +0000 (12:40 +0100)]
sna/dri2: Handle offscreen Window and Pixmap with CRTC tracking

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agotest/dri2: Restore original configuration after testing
Chris Wilson [Fri, 23 May 2014 10:16:56 +0000 (11:16 +0100)]
test/dri2: Restore original configuration after testing

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Combine the DRI2 Window privates together into a single struct
Chris Wilson [Fri, 23 May 2014 09:11:10 +0000 (10:11 +0100)]
sna/dri2: Combine the DRI2 Window privates together into a single struct

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Free the private CRTC tracker on each window
Chris Wilson [Fri, 23 May 2014 09:03:39 +0000 (10:03 +0100)]
sna/dri2: Free the private CRTC tracker on each window

Remember to clean up our privates when the window is destroyed.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Adjust current msc / target seq between CRTCs
Chris Wilson [Fri, 23 May 2014 08:03:17 +0000 (09:03 +0100)]
sna/dri2: Adjust current msc / target seq between CRTCs

The target_msc supplied by the client is required to be monotonic. Since
the client does not know which CRTC the window is on, they do not
control from which pipe we derive the MSC, and so we need to adjust the
hardware values such that the client only ever sees a monotonic value.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agotest/dri2: Check validity of MSC across CRTC
Chris Wilson [Fri, 23 May 2014 08:13:31 +0000 (09:13 +0100)]
test/dri2: Check validity of MSC across CRTC

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Queue the flip immediately for the next frame
Chris Wilson [Thu, 22 May 2014 22:48:20 +0000 (23:48 +0100)]
sna/dri2: Queue the flip immediately for the next frame

If we compute that we want to flip on the next frame, queue it
immediately rather than take a round trip through the kernel and risk
missing the vblank.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Tidy computation of target sequence
Chris Wilson [Thu, 22 May 2014 21:47:35 +0000 (22:47 +0100)]
sna/dri2: Tidy computation of target sequence

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Use the timestamps stored on the CRTC
Chris Wilson [Thu, 22 May 2014 20:18:10 +0000 (21:18 +0100)]
sna/dri2: Use the timestamps stored on the CRTC

Now that we store the information for the swap completion on the CRTC,
we don't need to pass it around inside the frame event.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Tweak flip continuation
Chris Wilson [Thu, 22 May 2014 12:04:31 +0000 (13:04 +0100)]
sna/dri2: Tweak flip continuation

Minor tidying to the returned target_msc and a useful assertion.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agointel-virtual-output: Probe after claiming virtual output
Chris Wilson [Thu, 22 May 2014 11:34:05 +0000 (12:34 +0100)]
intel-virtual-output: Probe after claiming virtual output

Rerun a detection cycle after claiming the virtual output so that it is
hidden again.

References: https://bugs.freedesktop.org/show_bug.cgi?id=78293
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: DBG fixes
Chris Wilson [Thu, 22 May 2014 09:04:09 +0000 (10:04 +0100)]
sna/dri2: DBG fixes

Update the DBG statements to match current code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Move fixed array allocations to per-crtc
Chris Wilson [Wed, 21 May 2014 23:24:07 +0000 (00:24 +0100)]
sna/dri2: Move fixed array allocations to per-crtc

Replace the fixed size MAX_PIPES array by moving the vblank handling to
per-crtc.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Maintain sequence calculation in 64bits
Chris Wilson [Wed, 21 May 2014 22:40:36 +0000 (23:40 +0100)]
sna/dri2: Maintain sequence calculation in 64bits

Avoid casting down to 32bits at the begining of the calculation to only
then compare against the full 64bit values later.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Fix WaitMSC to maintain the vblank counters
Chris Wilson [Wed, 21 May 2014 22:35:19 +0000 (23:35 +0100)]
sna/dri2: Fix WaitMSC to maintain the vblank counters

Fix WaitMSC to also use 64 bit counters and maintain the last vblank
notifications.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Apply a margin of error to the sequence wrap detection
Chris Wilson [Wed, 21 May 2014 22:02:52 +0000 (23:02 +0100)]
sna/dri2: Apply a margin of error to the sequence wrap detection

If we have a queue of events, we may set the msc from a recent vblank
query only to then process an older vblank event and declare the counter
wrapped.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Fix attachment of the default monitor to the first output
Chris Wilson [Wed, 21 May 2014 19:00:56 +0000 (20:00 +0100)]
sna: Fix attachment of the default monitor to the first output

Broke during code motion in

commit add84cd8a8dc6d285912d0ea3a3a3e7faa9e0942
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri May 2 13:21:02 2014 +0100

    sna: Perform dynamic connector discovery

Reported-and-tested-by: Jay Little <jaylittle@jaylittle.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79015
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Decouple queued events
Chris Wilson [Wed, 21 May 2014 18:16:32 +0000 (19:16 +0100)]
sna/dri2: Decouple queued events

Becareful when reaping a chain on a destroyed window as some events may
be queued ahead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Limit pending swaps to 1 when queueing a future blit
Chris Wilson [Wed, 21 May 2014 17:38:36 +0000 (18:38 +0100)]
sna/dri2: Limit pending swaps to 1 when queueing a future blit

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Tidy conditional use of XORG_CAN_TRIPLE_BUFFER
Chris Wilson [Wed, 21 May 2014 10:31:29 +0000 (11:31 +0100)]
sna/dri2: Tidy conditional use of XORG_CAN_TRIPLE_BUFFER

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Tidy recording of the last swap sequence number and time
Chris Wilson [Wed, 21 May 2014 07:26:21 +0000 (08:26 +0100)]
sna/dri2: Tidy recording of the last swap sequence number and time

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agouxa: fix getmsc to not fail hard
Dave Airlie [Wed, 21 May 2014 02:41:58 +0000 (12:41 +1000)]
uxa: fix getmsc to not fail hard

If some outputs go away we race with this call and apps
get X errors and fall over. Do what SNA does and don't
bother trying.

Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agosna/dri2: Tidy computation of 64bit ust
Chris Wilson [Wed, 21 May 2014 06:38:35 +0000 (07:38 +0100)]
sna/dri2: Tidy computation of 64bit ust

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Client cannot be NULL, so drop the checks
Chris Wilson [Tue, 20 May 2014 11:20:38 +0000 (12:20 +0100)]
sna/dri2: Client cannot be NULL, so drop the checks

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Only mark the scanout as being busy for writes (not solitary reads)
Chris Wilson [Tue, 20 May 2014 15:36:31 +0000 (16:36 +0100)]
sna: Only mark the scanout as being busy for writes (not solitary reads)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/dri2: Verify that the reference pipe is still active for flipping
Chris Wilson [Tue, 20 May 2014 11:07:50 +0000 (12:07 +0100)]
sna/dri2: Verify that the reference pipe is still active for flipping

We rely on the reference pipe to drive the event wake up. If we issue a
deferred flip, there is a chance that the user could rearrange the
screen on another crtc whilst otherwise preserving the screen geometry.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agouxa: fix pageflips on 3 head scenarios
Dave Airlie [Tue, 20 May 2014 06:45:14 +0000 (07:45 +0100)]
uxa: fix pageflips on 3 head scenarios

While fixing up UXA for MST I eventually fell over this bug.

Signed-off-by: Dave Airlie <airlied@redhat.com>
[ickle: replace constant with macro to track pipe-dependent code]

10 years agosna: Fix assertions for combining shadow transforms and TearFree
Chris Wilson [Mon, 19 May 2014 11:31:49 +0000 (12:31 +0100)]
sna: Fix assertions for combining shadow transforms and TearFree

When the RandR shadow buffer is enabled we set the sna_crtc->transform
flag. We set the crtc->transform_in_use only when coordinate transforms
are required - i.e. we may enable the shadow buffer if a CRTC is out of
bounds, but otherwise has no transformation. That confused the asserts.

Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Switch iterators over to real CRTCs only
Chris Wilson [Fri, 16 May 2014 14:05:31 +0000 (15:05 +0100)]
sna: Switch iterators over to real CRTCs only

Many loops only want to walk the real CRTCs, so update the loop bounds
to be explicit and assert that they are the real ones.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Discard active GPU buffers before uploading into them
Chris Wilson [Sat, 17 May 2014 19:59:38 +0000 (20:59 +0100)]
sna: Discard active GPU buffers before uploading into them

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Do not mark an upload as a potential replace if the dst is pinned
Chris Wilson [Fri, 16 May 2014 21:45:45 +0000 (22:45 +0100)]
sna: Do not mark an upload as a potential replace if the dst is pinned

This saves us from trying to optimise for an operation that cannot
happen as we cannot replace the destination buffer.

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