Commit Graph

7998 Commits

Author SHA1 Message Date
Chris Wilson 89e8f2b35b sna/dri2: Update the swap type for chained flips
We stash the pending flip mode into the closure, but failed to copy that
over to the right field when continuing with a chain of flips. The
impact was that we would fail to issue the required SwapComplete to
unblock the clients.

Fixes regression from
commit 96ce362ba4
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue May 13 09:46:45 2014 +0100

    sna/dri2: Do not rate-limit vblank=0 swaps

Reported-by: francisbrwn
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-16 10:20:17 +01:00
Chris Wilson e73d51247b sna/video: Only migrate the destination window
By using move-area-to-gpu and specifying that we overwrite the target
area, we can optimize away any needless damage migration.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-16 10:02:16 +01:00
Chris Wilson 10c18b1a46 intel-virtual-output: Mark the source SHMPixmap as writeable
This is fortunately a no-op, as it gets initialized to zero already
(that is the pixmap is writeable). However, we may as well do the right
thing...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-16 10:02:16 +01:00
Chris Wilson b21fc65b23 intel: Update PCI IDs for Cherryview
Copied from kernel commit 7d87a7f709650bde4d7d63117f25ee1c095da5dd
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date:   Wed Apr 9 18:19:04 2014 +0300

    srm/i915/chv: Add Cherryview PCI IDs

and also includes non-functional changes from

commit fd3c269f8ff940cc0fbb3b7f7e84c0572f6f759a
Author: Zhao Yakui <yakui.zhao@intel.com>
Date:   Thu Apr 17 10:37:35 2014 +0800

    drm/i915: Split the BDW device definition to prepare for dual BSD rings on BDW GT3

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-16 10:02:16 +01:00
Chris Wilson 2afeef0c3f sna: Mark the CHV vsync method as unknown
Similar to the story with Baytrail, vsync is a lost art.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-16 10:02:16 +01:00
Chris Wilson d33e77d58a sna: Handle driver failures more gracefully
Avoid busy-spinning waiting for the cache to expire after a failure. Try
to free up any overdue expiration, then if we still fail, we free the
entire cache. Currently, it would spin over the expiration until all
items were overdue and then freed.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-16 10:02:15 +01:00
Chris Wilson 0625185f47 intel-virtual-output: Make it possible to disable building via configure
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-14 17:29:21 +01:00
Chris Wilson c179003b10 sna/dri2: Ensure new immediate blits are queued behind outstanding swaps
OML_sync_control:
    If there are multiple outstanding swaps for the same window, at most
    one such swap can be satisfied per increment of MSC.  The order of
    satisfying outstanding swaps of a window must be the order they were
    issued.

The only challenge is to keep both this behaviour and vblank_mode=0
benchmarking.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-14 17:27:09 +01:00
Chris Wilson 84d0790453 sna: After disabling the TearFree shadow, flush any pending flips
If we complete a flip after resizing and recreating the TearFree shadow,
we may process the flip completion events whilst the output is only
partially reconfigured.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-14 17:27:09 +01:00
Chris Wilson 68181f0b53 sna/dri2: Carefully check for a completed swap
We have to open-code kgem_bo_is_busy() in order to avoid prematurely
retiring the rq->bo. The unfortunate outcome here is that the bo may be
recycled for a new batch before it is finally released from the request.

Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-14 12:14:47 +01:00
Chris Wilson 9f76133e71 sna/dri2: Tighten reporting of faked flip events
GetDrawableMSC is specified as returning the frame counter and timestamp
of the last flip event associated with the drawable, not the current
hardware timestamp.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-14 12:14:47 +01:00
Chris Wilson 96ce362ba4 sna/dri2: Do not rate-limit vblank=0 swaps
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-14 11:12:36 +01:00
Chris Wilson b7316feeda sna: Add some DBG to track rogue requests
In particular allow the pointer cache to be disabled for valgrind.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-14 11:12:36 +01:00
Chris Wilson 692555cc03 sna: Rename DRI2 files, functions and variables
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-14 11:12:36 +01:00
Chris Wilson 09e26d38e9 sna: Avoid promoting SHM Pixmaps for DRI
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-14 11:01:29 +01:00
Chris Wilson 7303c6c75d sna: Check for PRIME scanouts
Query the cache level on imported dma-bufs to see if they need special
handling.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-13 10:58:58 +01:00
Chris Wilson ad01e1c870 sna: Fix another assignment inside an assert
Another recent introduction, spotted by Rinat Ibragimov.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-08 13:48:43 +01:00
Chris Wilson e78a00c5da sna: Add an xorg.conf option for removing unused outputs
Clients are not yet ready for outputs that disappear at runtime, often
unexpectedly dieing with asynchronous BadOutput errors. A simple
workaround is to not remove any output just yet - but allow users to opt
in via xorg.conf, i.e.

Section "Device"
  Option "DeleteUnusedDP12Displays" "true"
EndSection

The name chosen is to be consistent with the nvidia driver, which did
MST first and encountered all of these issues first, and has also been
adopted for -modesetting. If this is combined with persistent output
naming (i.e. based on DisplayPort branch topology), the number of
outputs presented to the user should be static.

Instead of removing the outputs, we have to mark them detached instead
to avoid throwing errors from the kernel.

Based on the patch for -modesetting by Dave Airlie.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-08 13:48:43 +01:00
Chris Wilson a93157587a sna: Tidy thread handling under valgrind
If valgrind is running, keep it simple and avoid using unknown
instructions (causing valgrind to die with SIGILL).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-07 21:53:46 +01:00
Chris Wilson efd9e9c3ee sna/dri: Use move-area-to-gpu to handle clipped regions more efficiently
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-07 21:53:46 +01:00
Chris Wilson 1385ca9eeb sna: Initialize value read through ioctl to please valgrind
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-07 21:53:46 +01:00
Chris Wilson 7d516589ba sna/dri: Implement TripleBuffering using DRI2SwapLimit
An addition to DRI2 that was overlooked at the time, was the support
added for having multiple outstanding swap requests in the core. The
importance of this is that we can then send the SwapComplete reply after
the pageflip is completed and not before as we currently do to fake
triple buffering - in clear violation of OML_sync_control.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-07 21:53:46 +01:00
Chris Wilson 18416b5162 sna: Don't assign in an assert
That just nullifies the point of the assert in the first place.

Spotted-by: Joakim Tjernlund
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-07 13:50:18 +01:00
Chris Wilson 0250a4f4ba sna: Fix bogus assertion about conn->encoder_id
The connector's encoder_id is only set if the output is active.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-07 12:40:49 +01:00
Chris Wilson c410f0cd98 sna: Set desired mode after rediscover during VT switch
When switching back to the VT, rerun the output discovery (if such an
event was pending) before we attempt to set the desired modes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-07 12:36:59 +01:00
Chris Wilson c38512e12e sna: Run output discovery before modes query
If we keep the separate discovery uevent, we need to run it first in the
cases where we get combined discovery+hotplug events.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-07 12:36:59 +01:00
Chris Wilson 7aefd003bb sna: Fix unattached outputs for ZaphodHeads
We need to preserve possible_crtcs for the later check that we can use
the output with the particular ZaphodHead (which owns a CRTC).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-07 10:17:34 +01:00
Chris Wilson c5bad6daaa intel-virtual-output: Disable remote CRTC using the remote Display!
Reported-by: Kirill Müller <mail@kirill-mueller.de>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78293
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-07 07:56:14 +01:00
Chris Wilson 632d3dfe21 sna: Treat encoder id array as invariant
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-06 12:28:24 +01:00
Chris Wilson f62dfd8f51 sna: Allow connectors without an associated encoder
In the future, we may see a setup where connectors are created without
being attached to a specific encoder, instead associated with multiple
generic encoders - such as DP MST sink devices. To handle this, we need
to recheck their active encoder at runtime after branch configuration
events (or possibly hotplug).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-06 11:25:10 +01:00
Chris Wilson ea602f7e10 sna: Discard the TearFree damage when doing a full CPU migration
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-06 06:59:20 +01:00
Chris Wilson b8d71e029c sna: Tidy computation of clone/crtcs for fake outputs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-06 06:59:20 +01:00
Chris Wilson 77507909a1 intel-virtual-output: Grab the server whilst cleanging up the local output
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-06 06:59:20 +01:00
Chris Wilson 56126d0050 sna: Refine hints to allow inplace writes whilst compositing aligned traps
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-06 06:59:19 +01:00
Chris Wilson 464ef44ab1 intel-virtual-output: Copy existing CRTC information
If we fail to disable the remote output during initialisation, copy the
current configuration in order to try and keep the bookkeeping in order.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-05 14:50:44 +01:00
Chris Wilson 194f9332d3 intel-virtual-output: Try disabling Panning after disabling CRTC
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-05 14:34:12 +01:00
Chris Wilson 5279ebf564 intel-virtual-output: Mark ShmPixmap destinations as writeable
In order to prevent a subsequent BadAccess when we try to use it as a
ShmPixmap, we need to mark the segment as writeable.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
References: https://bugs.freedesktop.org/show_bug.cgi?id=78293
2014-05-05 13:07:31 +01:00
Chris Wilson a93d2d4f91 intel-virtual-output: Check for errors whilst creating ShmPixmaps
Creating a ShmPixmap may cause an asynchronous BadAccess error, so wrap
the construction with XSync and check for an error before proceeding.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
References: https://bugs.freedesktop.org/show_bug.cgi?id=78293
2014-05-05 13:07:31 +01:00
Chris Wilson 45892b3a63 intel-virtual-output: Record shm/randr/xinerama queries in DBG log
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-05 12:42:56 +01:00
Chris Wilson 6c9f216d7c intel-virtual-output: Check error state when disabling CRTC
Only mark an output as disabled if we do successfully disable it. This
will require a little more work to make sure that such errors are
cleanly propagated back to the host...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-05 12:42:56 +01:00
Chris Wilson ef178f7d69 sna: Fix loop iteration whilst deleting connectors
If we remove a connector/output, we need to not advance the iterator or
else we skip over an output (as the array is reduces inside the loop).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-05 09:39:02 +01:00
Chris Wilson 8fd13a5207 sna: Reorder connector initialisation to avoid leak
If the output was ignored, we would leak the allocations. However, we
can check the output name after the first GETCONNECTOR/GETENCODER
request before any allocations.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-05 09:34:22 +01:00
Chris Wilson 55f567f9d8 sna/dri: Report the last known MSC whilst the pipe is off
From OML_sync_control:
"The graphics MSC value is incremented once for each screen refresh.
For a non-interlaced display, this means that the graphics MSC value
is incremented for each frame."

When the pipe is disabled, return the last known MSC such that the
reported value is always monotonic and consistent with the pipe when it
is active again. That also is consistent with OML_sync_control which
says that the MSC is a vertical refresh counter, and by implication does
not increase whilst the pipe is off.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-04 16:27:34 +01:00
Chris Wilson 080e9f9985 sna: Prefer PrimaryOutput for timing signals
If the drawable is even partially on the PrimaryOutput, use that pipe
for determining synchronisation counters and synchronised updates.

OML_sync_control:
	"For a multi-monitor system, the monitor used to
	 determine MSC is screen 0 of <display>."

The PrimaryOutput is the nearest approximation we have to "screen 0". We
also deviate in handling what hapens when that screen is off, which is
not mentioned at all in OML_sync_control.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-04 16:26:43 +01:00
Chris Wilson 828bd9e250 sna: Reorder cursor initialisation
It helps to initialise the cursors after we setup one of the values we
depend on.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-02 17:14:45 +01:00
Chris Wilson 38f82655e0 sna: Remove incorrect cursor assertion
Ideally, we want to assert that we have sufficient stashed cursors to
allocate for the unused CRTCS, so something like
assert(num_stash + num_active_cursors >= 0);

Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-02 17:14:45 +01:00
Chris Wilson 430152da82 compat: Add missing wrapper for RegionSubtract
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-02 17:14:45 +01:00
Chris Wilson add84cd8a8 sna: Perform dynamic connector discovery
One of the side-effects of MST is that we need to support dynamic
attachment and removal of displays as the branch hierachy changes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-02 17:14:45 +01:00
Chris Wilson 3123dec3df sna: Do not stash drmModeResPtr
In the near future we will be dealing with dynamic discovery of
connectors, and so we cannot assume that the mode resources will be
static for our lifetime. The first step is to not keep that struct
around, but pull out the useful information and discard it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-02 11:20:41 +01:00
Chris Wilson 7b072074aa sna: Refactor hints for GPU promotion of composite fills
The major change here is not do a full promotion if we are filling
through a clip region. The original intention was to catch doing the
initial clear of the background, but it was also triggering for drawing
rectangular outlines etc.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-02 11:20:41 +01:00