Commit Graph

7340 Commits

Author SHA1 Message Date
Chris Wilson a6613a8fe3 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>
2014-05-23 07:32:22 +01:00
Chris Wilson 24443c6c89 sna/dri2: Tidy computation of target sequence
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-23 07:32:22 +01:00
Chris Wilson a767ad2e50 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>
2014-05-22 22:00:28 +01:00
Chris Wilson 5d80af3066 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>
2014-05-22 22:00:28 +01:00
Chris Wilson 0f0cd87c66 sna/dri2: DBG fixes
Update the DBG statements to match current code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-22 10:05:20 +01:00
Chris Wilson 80dfbaa3c3 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>
2014-05-22 08:27:54 +01:00
Chris Wilson 9b21237a1c 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>
2014-05-22 00:44:08 +01:00
Chris Wilson c548f231c1 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>
2014-05-22 00:44:08 +01:00
Chris Wilson 1f237bb6db 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>
2014-05-21 23:07:36 +01:00
Chris Wilson 00d9396f6b sna: Fix attachment of the default monitor to the first output
Broke during code motion in

commit add84cd8a8
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>
2014-05-21 21:07:46 +01:00
Chris Wilson 5168a160a1 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>
2014-05-21 20:12:24 +01:00
Chris Wilson 66e14c96d0 sna/dri2: Limit pending swaps to 1 when queueing a future blit
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-21 18:56:13 +01:00
Chris Wilson bf4475d29d sna/dri2: Tidy conditional use of XORG_CAN_TRIPLE_BUFFER
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-21 11:52:33 +01:00
Chris Wilson 0b3ea29727 sna/dri2: Tidy recording of the last swap sequence number and time
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-21 09:15:48 +01:00
Dave Airlie 183a0728ba 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>
2014-05-21 07:47:57 +01:00
Chris Wilson 2dbe76c492 sna/dri2: Tidy computation of 64bit ust
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-21 07:40:02 +01:00
Chris Wilson a82f6a7594 sna/dri2: Client cannot be NULL, so drop the checks
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-20 22:19:35 +01:00
Chris Wilson c548427e6d sna: Only mark the scanout as being busy for writes (not solitary reads)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-20 22:19:35 +01:00
Chris Wilson 61df0ffc0b 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>
2014-05-20 22:19:35 +01:00
Dave Airlie 197ab0cda0 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]
2014-05-20 07:46:48 +01:00
Chris Wilson bfd0e41d5c 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>
2014-05-19 12:34:49 +01:00
Chris Wilson 1a84875c21 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>
2014-05-18 08:41:30 +01:00
Chris Wilson 65301412ec sna: Discard active GPU buffers before uploading into them
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-18 08:40:11 +01:00
Chris Wilson f5e4305846 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>
2014-05-18 08:37:13 +01:00
Chris Wilson df297e9faf sna: Userptr lands upstream, enable.
No longer an optional feature of an experimental kernel!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-16 18:22:13 +01:00
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 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 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