Commit Graph

6912 Commits

Author SHA1 Message Date
Chris Wilson 21e29e9526 sna: Simplify validation of active CRTCs
Atter a modeset or KMS takeover, we do a quick readback of the kernel
state in order to verify that it matches our expectations. If we find
that a foreign framebuffer is attached, or no mode if set on the output,
we then turn off that connection and release any resources associated
with that pipe. This patch tries to reduce the number of superfluous
requests to turn off a connection.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-02 15:44:10 +01:00
Chris Wilson 67a6a4bfd9 sna: Hook into crtc_notify rather than ModeSet
ModeSet is called after updating each CRTC, unlike crtc_notify which is
called after applying all changes. The last is what we need as if we are
called too early we detect that the next CRTC doesn't match our
expectations and so we disable it, right before applying the desired
mode.

References: https://bugs.freedesktop.org/show_bug.cgi?id=66494
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-02 14:30:17 +01:00
Chris Wilson c361b449cc sna: Include connector status in the initial probe
We cannot simply rely on connector->encoder->crtc status as with the
introduction of Haswell or SDVO we may have multiple connectors using the
same encoder. So we need to explictly check the connector status first,
before determining if the output is connected to an active encoder and
CRTC.

References: https://bugs.freedesktop.org/show_bug.cgi?id=66488
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-02 10:00:51 +01:00
Chris Wilson 282507af8e intel: Move the validation of the KMS device into the open routine
Currently we leak the fd should we open the device node and decide that
is not a GEM/KMS kernel driver. The simplest way to perform the cleanup
upon failure is to move the checking for GEM/KMS into the device open
routine.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-02 09:38:07 +01:00
Chris Wilson 24a7bec7fa sna: Minor tweaks to make DBG compile again
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 22:51:22 +01:00
Chris Wilson ad0afda3fe sna: Fix checking the dirty boxes
I forgot how insane the data structure for the list of dirty boxes
attached to the damage is. It is neither a simple list, nor does not store
the count of boxes within each chunk.

Fixes regression from
commit 9026bb9546 [2.21.11]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jun 28 15:59:17 2013 +0100

    sna: Inspect the dirty boxes when querying whether damage contains a rectangle

A side effect is that we now make sure that there is an upper bound to
the amount of searching we do for the no-reduce fast path.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66430
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 22:51:22 +01:00
Chris Wilson 1c8a33a72e sna: Allow scanouts to be untiled if need be
Fixes regression from
commit 77fa8ab08b [2.21.11]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Jun 25 22:25:25 2013 +0100

    sna: Free just-allocated bo if we fail to set-tiling on CREATE_EXACT

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 18:11:03 +01:00
Chris Wilson 9cb6756ce1 sna: Always create the clear Picture
As we unconditionally use it irrespective of whether we then call
accelerated code paths or not.

Fixes regression from
commit dc18eaa585 [2.20.10]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Aug 12 10:34:10 2012 +0100

    sna: Make the failure to create render caches non-fatal

in the event we need to start with a hung GPU.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 18:10:07 +01:00
Chris Wilson c6c6ae71be sna: Make sure we are consistent in applying USE_INPLACE debug option
A few new paths were missing the debug check, and clarify a few indirect
uses by performing the explicit check.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 18:07:23 +01:00
Chris Wilson cce2351056 sna: Debug options for forcing mmap syncs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 18:07:23 +01:00
Chris Wilson 7aff6beb37 sna: Improve the message about where to find the hang state
Search the few canonical locations for our hang state so that we can be
more explicit to the user about what to include.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 18:07:23 +01:00
Chris Wilson e0e84e6686 sna: Mark an inplace getimage as preferring the CPU mapping afterwards
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 18:05:17 +01:00
Chris Wilson e648c1f39c sna: Assert that we do not have overlapping damage
Double check that the results of the box query match with the slow
queries.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 18:05:17 +01:00
Chris Wilson 7c6cc0c9ed sna: Check whether the query box is contained within the damage
We can improve our query for whether the rectangle of interest is within
the damage by checking whether the damage extents contains the entire
box rather than just checking for an overlap.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 18:05:17 +01:00
Chris Wilson 64cb923588 sna: Experiment with cpu mappings for migration
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 18:05:17 +01:00
Chris Wilson 12c013d25e sna: Do not use userptr for GetImage on unsupported architectures
If the system cannot blt to a CPU buffer, we should even attempt to do
so for GetImage.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 13:28:57 +01:00
Chris Wilson 7d9163983e 2.21.11 release 2013-06-30 18:24:44 +01:00
Chris Wilson 5005bd2d52 intel: Fix failure code for reporting !drmCheckModesetingSupported
The new function returns the fd, not a Bool, so the error code must now
be -1.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-30 15:02:19 +01:00
Jonathan Gray f8738d7b4c intel: replace direct ioctl use with drm{Set, Drop}Master
Use drmSetMaster/drmDropMaster instead of calling the ioctls
directly.  Fixes compilation on OpenBSD where these ioctls
aren't defined.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
2013-06-30 11:32:24 +01:00
Chris Wilson 40301e6d03 sna: Store the path used to open the device and pass to DRI
Avoid having to search the device tree once again in order to simply
recover the path we used to open the device.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-30 11:32:24 +01:00
Chris Wilson 17da58f904 sna: Replace conflicting drmDropMaster
Calling drmDropMaster twice along the CloseScreen path is not a good
idea.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-30 11:32:24 +01:00
Chris Wilson 3a787da7e8 sna: Allow tiled memcpy on i386
With the split into per-swizzle functions, and with the forced
optimisation levels, it appears that i386 doesn't suffer so badly and
the tiled memcpy are a viable method.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-29 21:57:20 +01:00
Chris Wilson 1d9941a7c0 sna: Add the Ofast option to the critical memcpy routines
Always enable gcc to fully optimize the core memcpy routines (provided
that optimisations are not entirely disabled, for instance for
debugging).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-29 21:56:13 +01:00
Chris Wilson 84c190db33 sna: Fix get_image_inplace to use the pixmap offset
The inplace routine assumed that the region to be read was already in
pixmap coordinates. Making it so makes the code easier, so do it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-29 19:37:51 +01:00
Chris Wilson c7d246ba6f sna: Move the clone discard into free-gpu
Rather than peppering the discard manually before the call to free the
GPU bo, always discard the COW when we actually free the GPU bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-29 16:50:54 +01:00
Chris Wilson 6ab2a3acf7 sna: Improve checks for coherent access through CPU mappings
Refactor the CPU mapping tests to a single function, and remember to
test for a pending GPU write (i.e. bo->exec).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-29 16:08:30 +01:00
Chris Wilson 9026bb9546 sna: Inspect the dirty boxes when querying whether damage contains a rectangle
This helps in the cases where we have subtracted a small number of
rectangles from an all-damage pixmap (such as a number of successive
GetImage, PutImage operations). The danger is that we end up searching a
long list of dirty boxes - maybe just search the first chunk if that
becomes noticeable?

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-29 16:08:30 +01:00
Chris Wilson d635e05c9d sna: Promote assert(!priv->mapped) along migration paths
With the advent of the more permissive mapping schemes and finer damage
tracking, we are more liable to have pixmaps mapped and so can reach the
upload path with the pixmap still mapped.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-29 16:08:30 +01:00
Chris Wilson 2d40500851 sna: Add asserts around applying clears
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-29 16:08:29 +01:00
Chris Wilson e3ad737ef9 sna: Use inplace CPU mapping readback for GetImage on linear buffers
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-29 16:08:25 +01:00
Chris Wilson 626b5e5416 sna: Add debug control for disabling accelerated GetImage
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-28 17:43:46 +01:00
Chris Wilson 2356579cdf sna: Assert that the kernel tiling mode matches our bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-28 13:18:00 +01:00
Chris Wilson e979d32bb7 sna/gen2+: Consider precision in render operation placement
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66297
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-28 11:25:47 +01:00
Chris Wilson 541f816815 sna: Markup when a gradient is opaque
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-28 10:14:16 +01:00
Chris Wilson 34e6366f2a sna/blt: Remove a pair of leftover asserts
As the variable they were inspecting was removed, the asserts are now
breaking the debug build.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-28 10:03:47 +01:00
Chris Wilson 0c93a0cf41 sna: Compensate redirect drawing subrectangle inside an offset pixmap
Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66249
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-28 09:45:47 +01:00
Chris Wilson e33fbd6d7f sna/blt: Refine op placement logic for handling current source location
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-28 08:55:48 +01:00
Chris Wilson 48b5ac11a0 intel: Use fcntl to try and set CLOEXEC if the open(O_CLOEXEC) fails
As suggested by Arkadiusz Miskiewicz.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-27 21:42:13 +01:00
Chris Wilson 9b3e5c2114 intel: #ifdef O_CLOEXEC for compilation on squeeze
If the system doesn't support O_CLOEXEC, then we simply can't use it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-27 21:09:38 +01:00
Chris Wilson caf43fcadb sna: Enable memcpy_from_tiled for the IO paths
Should you ever need to read back from a tiled surface and for whatever
reason do not have a CPU bo to accelerate the operation, maybe we could
use the manual tiling instead (as it is useful elsewhere).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-27 17:16:10 +01:00
Roy.Li b5e85e495e uxa: fix the compilation error with xorg-xserver <= 1.10
struct _Screen has no canDoBGNoneRoot when ABI_VIDEODRV_VERSION is less than 10.0

Signed-off-by: Roy.Li <rongqing.li@windriver.com>
2013-06-27 16:40:41 +01:00
Chris Wilson 41715af4d0 configure: SNA supports the old Xorgs
So allow it to be compiled by default for older Xorgs as well.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-27 16:36:52 +01:00
Chris Wilson 7ce4876174 sna: Trim the large object threshold
Be kinder to smaller machines by lowering the threshold at which treat
an object as huge and worthy of avoiding duplication.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-27 16:12:54 +01:00
Chris Wilson 31467e18d2 sna: Prefer operating inplace with a very large GPU bo
As we strive to only keep one copy when working with very large objects,
so try operating inplace on a mapping for CPU operations with a large
GPU bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-27 16:12:54 +01:00
Chris Wilson b615ce97ec sna: Add a fast path for reading back from tiled X bo
This is lower latency than the double copy incurred for first moving the
bo to the CPU and then copying it back - but due to the less efficient
tiled memcpy, it has lower throughput. So x11perf -shmget500 suffers
(by about 30%) but real world applications improve by about 2x.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-27 15:27:48 +01:00
Chris Wilson 6493c8c65f sna: Implement memcpy_from_tiled functions (for X-tiling only atm)
To provide symmetry with the ability to write into an X-tiled mapping of
a bo, we add the memcpy_from_tiled to be able to read back from the same
bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-27 15:26:41 +01:00
Chris Wilson 60d716b539 sna: Add the probed CRTC mode to the list of output modes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-27 14:11:00 +01:00
Chris Wilson 263e87d5e1 sna: Set the current mode when initialising CRTCs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-27 14:10:30 +01:00
Chris Wilson 2f2f439c9c sna: Fake the output physical width/height from the CRTC size
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-27 12:58:58 +01:00
Chris Wilson 5124f35168 sna: Support operations inplace on CPU mappings of a region
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-27 12:50:59 +01:00