Commit Graph

7304 Commits

Author SHA1 Message Date
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 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 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 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
Chris Wilson 81608b4da5 sna: Do not discard damage when using the CPU to perform BLT spans
The BLT paths are only taken when we know we are overwriting the target
contents, and so we do not have to worry about reads along those paths.
However, in terms of migrating the damage for a pixmap, we have to be
careful in case we do not write to the full area of the composite
rectangle, in which case we have to treat it as a read to that area and
migrate the damage.

Regression from
commit a13781d19d [2.20.10]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Aug 19 09:45:12 2012 +0100

    sna: Enable BLT composite functions to target CPU buffers

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

Reported-by: Matti Hämäläinen
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-01 13:18:51 +01:00
Chris Wilson 150458c402 sna: Refactor migration DBG code
And add a new DBG option to disable partial-cpu migrations.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-01 09:43:23 +01:00
Chris Wilson ca57ee7234 sna: Add some DBG for tracing vblanks across modeset/resume
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-01 09:18:45 +01:00
Chris Wilson bcbb2f222c sna/dri: Tidy call to vblank ioctl for MSC waiting
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-01 09:18:45 +01:00
Chris Wilson 4430703619 sna: Be more lenient and allow tiled uploads to replace CPU buffers
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-30 12:37:46 +01:00
Chris Wilson 2fd1a05ac5 sna/video: Initialise pitch before query
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-29 13:56:34 +01:00
Chris Wilson 41a573c15c sna: Discard TearFree damage on partial migration
If we are overwriting part of the framebuffer, we know we do not need to
read that portion back from the scanout.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-29 13:56:34 +01:00
Chris Wilson d75501572a sna: Preserve cpu hint for compatible mmapping of the GPU bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-29 13:56:33 +01:00
Chris Wilson 94e3932377 sna: Recycle physical cursors
A side-effect of the workaround for incoherent physical cursors is that
we never reused a cursor after disabling. As such moving the cursor off
the pipe and back on would eventually consume all the preallocated
structs leading to a segfault.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78002
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-29 09:16:51 +01:00
Chris Wilson 0b23011c27 sna: Tweaks to cursor DBG logging
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-28 15:59:42 +01:00
Chris Wilson d4bd452caa sna: Assert against underflows in BLT command lengths
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-28 15:59:42 +01:00
Chris Wilson 2a993c8aa9 sna: Initialise pointer before use
commit 534a0e6433
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Apr 28 07:53:13 2014 +0100

    sna: Factor in destination sizes for choosing intermediate tiling bo size

assumed that the target bo was being initialisation for the tiling
composite; it was not.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-28 12:54:23 +01:00
Chris Wilson f004285049 sna: Rearrange final aperture check
If we cross the high water mark, first flush the batch, then check the
remaining pages to see if they fit into the aperture.

Reported-by: Bruno Prémont
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-28 08:38:58 +01:00
Chris Wilson 7a685d1d7b sna: Add a minor DBG for tiled copies
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-28 08:38:58 +01:00
Chris Wilson 3e330f3980 sna: Refine fence packing estimates
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-28 08:38:58 +01:00
Chris Wilson 534a0e6433 sna: Factor in destination sizes for choosing intermediate tiling bo size
When tiling, factor in the destination usage of the aperture in case
that reduces the available aperture for the intermediate bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-28 08:38:58 +01:00
Chris Wilson 11cc397cb1 sna: Preallocate cursors
We need to avoid all allocations within the signal handlers, so
preallocate the cursor structs.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77975
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-27 08:35:40 +01:00
Chris Wilson 9417f13cc4 sna: Preallocate pwrite scratch buffer for old fashioned cursor updates
We need to avoid all allocations within the signal handlers, so
preallocate the transfer buffer.

References: https://bugs.freedesktop.org/show_bug.cgi?id=77975
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-27 08:35:40 +01:00
Chris Wilson 795cebf053 sna: Replace cursor gen test with feature flag
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-27 08:35:40 +01:00
Chris Wilson 1b76a1f6fb sna: Initialise cursors after checking for KMS
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-27 08:35:40 +01:00
Chris Wilson b3c5a52496 sna: Tweak use inplace CPU maps for writing
Allow us to write into a GPU bo without any pending CPU damage.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-24 13:54:30 +01:00