Commit Graph

235 Commits

Author SHA1 Message Date
Chris Wilson f0da01aa90 sna: Remove stale mappings when replacing GPU bo
References: https://bugs.freedesktop.org/show_bug.cgi?id=70527
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-25 14:22:05 +01:00
Chris Wilson 51c87f9aca sna/io: Propagate failure to XOR uploads
Similar to the handling required for the normal upload paths.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-25 11:26:40 +01:00
Chris Wilson fa2687bdd5 sna: Eliminate the synchronous wait from inside TearFree
Defer the actual wait until the next use of the screen pixmap, and then
if needed replace the GPU bo with an alternative back buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-21 23:44:16 +01:00
Chris Wilson dd280a69b5 sna: Tighten pixmap map assertions
We need to also take account of upload buffers which include an offset
to the base map. To do so, we also need to stop conflating the cpu hint
with the current mapping flag.

References: https://bugs.freedesktop.org/show_bug.cgi?id=70461
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-18 12:35:21 +01:00
Chris Wilson 621eaba0d5 sna: Assert mapped state
When mapped, assert that we point to the expected mapping of the GPU bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-17 12:09:52 +01:00
Chris Wilson ec0866e86d sna/glyphs: Fix computation of extents for long strings
And make sure we consider such overflowing strings for correct clipping
against Windows.

To offset the cost of doing a full extents check (~10% on aa10text), we
introduce an approximate extents query (~1% on aa10text). The disparity
should be rare, and should be an overestimate to force redundant
clipping.

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70541
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-16 22:54:09 +01:00
Chris Wilson 8bd9d63a86 sna/gen6+: Share the common routines for ring preferrence
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-10 13:24:46 +01:00
Chris Wilson 6c157a925f intel: Remove dependence upon having PciInfo
After some probing mechanisms, we may end up with a valid device without
knowing its PCI address a priori. Having a valid device, we can just
query it for the correct device id, and can safely abort any path that
requires PCI information that we don't have. (Those paths are not valid
under such hosting anyway - if it may be required, we could reconstruct
the address.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03 16:13:38 +01:00
Chris Wilson 6ac1ac98c2 sna: Catch SIGBUS to prevent X death
We know that when we access either a CPU or GTT mmap we are vulernable
to receiving a SIGBUS. In fact, we can catch these and abort the
operation preventing X and all of its clients from randomly dieing.

This helps for instance if you try and use a 1GiB frontbuffer on a 2GiB
machine...

For complete protection, we also need to catch signals for all GTT maps,
such as VBO and staging buffers. (TBD)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-27 10:47:18 +01:00
Chris Wilson 63a070a31a sna: Do not change DPMS mode on unconnected outputs
The operation is in theory redundant, and in the case of Haswell where
we have multiple outputs aliasing to the same encoder, actually harmful.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68030
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-19 15:35:34 +01:00
Chris Wilson dcf9b5ae18 intel: Compile fixes for base install of SLED11.sp3
Highlights of that distribution include xorg-xserver-1.6.5, kernel
3.0.76 and gcc-4.3.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-18 12:49:41 +01:00
Chris Wilson f99e49f764 intel: Make the option to control VSync and PageFlip explict
Too often our implementation of vsync or pageflip is buggy, or for some
other reason it is desired by the user to disable those code paths. Make
it possible once again by restoring the Options for the user to control.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-17 09:29:42 +01:00
Chris Wilson 9a66d77efa sna: Disable use of Y-tiling for gen4
This problematic GPU still seems to like to fallover when faced with
Y-tiling. It was reserved only for use with glyphs, but even that
occasionally runs into trouble, so disable all selection of Y-tiling for
our own use.

Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1222203
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-10 12:29:24 +01:00
Chris Wilson 7ee7e373f2 sna: Split get_drawable_deltas()
In some cases we know we only have a window, and so may skip a
conditional.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-07 17:28:33 +01:00
Chris Wilson 0c697aee9b Revert "sna: Add XMir support"
This reverts commit 42d94356f6.

Ordered-by: The Management.
2013-09-07 08:42:26 +01:00
Chris Wilson f2ed1ac7b9 sna: Listen to ACPI events for power state notifications
When on-battery, we would prefer to use more power efficient operations.
For example, the BCS is far more economical to more data around with, but
it doesn't have quite the same throughput as the hungry RCS. (Not that
there is any reason why, the BCS is supposed to run at full memory
speed, unfortunately that is main memory speed and not the caches...)

Note: that X already listens to acpid for video switch notifications, it
would be useful if we could extend that interface to emit power
notifications as well.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-06 16:06:06 +01:00
Chris Wilson 42d94356f6 sna: Add XMir support
With lots of updates by Christopher James Halse Rogers as he updated the
XMir API - but now supposedly frozen!

"<RAOF> ickle: I think the xmir api should be pretty much stable now,
barring people coming up with more awesome ways of doing things."

Signed-off-by: Christopher James Halse Rogers <raof@ubuntu.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-04 15:18:29 +01:00
Chris Wilson ecb3c303f8 sna: Fix sna_pixmap_move_area_to_gpu() to return the sna_pixmap
Like it's sibling sna_pixmap_move_to_gpu(), it helps to know the private
sna_pixmap after the operation rather than just a boolean success/fail
result, and make it more robust in the process.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-04 12:25:47 +01:00
Chris Wilson 8ecb758697 sna: Expand the array of fake outputs if the last is used
Always maintain one spare so that we can reconfigure for any number of
desired outputs on the fly.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-31 20:48:24 +01:00
Chris Wilson 6d99249c58 sna: Protect against unattached pixmaps when peeking inside for a GPU bo
Prevent a NULL dereference for the small system pixmaps. Introduced with

commit f22d7f68b8
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Aug 28 14:24:33 2013 +0100

    sna/gen6+: Improve ring stickyness for BLT composite ops

Reported-by: Sami Farin <hvtaifwkbgefbaei@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68728
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-30 08:57:25 +01:00
Chris Wilson 68d139388a sna: Allow user specification of number of VirtualHeads
Previously, we instantiated a fake output in case we had a machine with
no output. (For certain server-class products.) The Bumblee project were
also doing something very similar in order to fake an extended desktop
on the Intel igfx and copy portions onto a discrete GPU. (The preferred
method for doing this upstream is through the use of PRIME). As the code
is very similar, we can support both use-cases simultaneously.

This adds the option:

Section "Device"
  Driver "intel"
  Option "VirtualHeads" "<count>"
EndSection

to allow the user to specify an additional set of fake outputs, which
can then be controlled using xrandr.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-30 08:57:25 +01:00
Chris Wilson 097c256793 sna: Add a few more checks for a hosted Xserver before walking CRTC lists
If we are hosted, we do not own the CRTC configuration, and deferencing
the private data structures believing them to be ours, only leads to
disaster.

Based on patches by Christopher James Halse Rogers.

Reported-by: Christopher James Halse Rogers <raof@ubuntu.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-25 11:00:32 +01:00
Chris Wilson ed40a7c3de sna/gen6+: Tweak semaphore avoidance for composite operations
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-18 14:45:39 +01:00
Chris Wilson c610d37dae sna/video: Expose an attribute to keep the overlay always on top
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-16 18:22:45 +01:00
Chris Wilson a0f90a4c79 sna: Rename sna_pixmap_get_bo()
Mark how dangerous this function is by giving it a __ prefix.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-14 18:12:15 +01:00
Chris Wilson 021c59f624 sna/glyphs: Micro-optimise glyph drawing
When you don't have many cycles to play with, every one counts.

Here we make sure we cache negative lookups for large glyphs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-10 13:35:10 +00:00
Chris Wilson b6b5c3f009 intel: Disable incompatible features whilst hosted
Start adding the infrastructure to disable direct hardware access if X
is being run under a system compositor (aka "hosted").

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-09 11:46:24 +01:00
Raul Fernandes c6add09791 Micro-optimise box intersections
We can shave a few instructions off the routine by incrementally
performing the "is-empty" check as soon as we compute the intersection
in each dimension.
2013-08-08 09:28:20 +01:00
Chris Wilson 3f04b6f33f sna/dri: Disable TripleBuffering by default for compositors
Ideally, the method of swapping is something that the applications have
control over, along with how to synchronise to the vertical refresh.
Whilst triple buffering is good to reduce jitter for games (at the cost of
an extra frame of latency, usually considered a good tradeoff), it
prevents the applications from accurately controlling the presentation
of animations. One vocal critique is Owen Taylor, who demands accurate
swap control for smooth animations in gnome-shell. For example,

http://blog.fishsoup.net/2012/11/28/avoiding-jitter-in-composited-frame-display/

In lieu of application control, just apply a quirk for the compositor.
Everyone else will just have to wait for DRI3.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-01 15:21:04 +01:00
Chris Wilson 4aa0288f16 sna: Return true from get_drawable_deltas() if the pixmap is offset
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-19 14:21:45 +01:00
Chris Wilson c604d1426c sna: Remove the duplicated open-coding of SetScreenPixmap
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-11 22:23:29 +01:00
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 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 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 62e42de300 sna: Determine swizzling once during initialisation and choose memcpy_to_tiled_x
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-21 21:00:23 +01:00
Chris Wilson b9439a5617 sna: Move the GTT dirty tracking from the pixmap to the bo
This allows us to more accurately track when the GTT is dirty. However,
the only danger is that we may prematurely flush the scanout and clear
the dirty bit and not preserve the flush timer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-10 22:56:20 +01:00
Chris Wilson 7151e437df sna: Track when we write directly to bo through the GTT
In the future, we may need to explicitly flush GTT writes to the
scanout, so add the infrastructure to do so now.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-07 16:11:46 +01:00
Chris Wilson 195a51353c sna/video: Convert to a pure Xv backend
This is to enable feature work which requires access to Client state.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-05-21 11:14:52 +01:00
Chris Wilson ef9dc6fae5 sna: Undo a few more overwritten operations upon a bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-05-21 09:31:55 +01:00
Chris Wilson ee166ca856 sna: Undo the clone when replacing the DRI pixmap
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-05-17 11:30:46 +01:00
Chris Wilson 5d9315873e sna: Avoid replacing pinned bo when undoing a clone
Otherwise we end up cloning the scanout only to leave it dangling if the
client copies the from the front-buffer and then writes to it.

Reported-by: Nick Bowler <nbowler@draconx.ca>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64675
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-05-17 11:06:10 +01:00
Chris Wilson 16a64649e9 sna: Basic copy-on-write support for cloning pixmaps
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-05-14 14:29:32 +01:00
Chris Wilson 6668f68054 Revert "xgvevent"
This reverts commit ddd75d6539.

This is a WIP patch, not ready for upstream. The danger of mixing topic
branches.
2013-04-17 15:32:58 +01:00
Chris Wilson ddd75d6539 xgvevent 2013-04-16 11:56:17 +01:00
Chris Wilson caf3118f90 sna: Align uploads to start on page boundaries
This reduces the number of loops and restarts required in the kernel.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-04-10 13:46:45 +01:00
Chris Wilson 540802595f sna: Suppress hotplug events whilst VT switched away
Whilst we are not DRM master, not only is another server in control of
the outputs and responding to the udev event, we ourselves cannot
change modes and just cause contention upon the DRM device. Instead
inform userspace of the change as soon as we are DRM master again and
back in control.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-04-10 10:38:30 +01:00
Chris Wilson 28371a34fa sna: Skip processing an all-clipped-out glyph
Along the slow path, skip all processing of glyphs that are not visible.
This is important as the slow path handles the per-glyph redirection
case, which is much more expensive.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-18 15:11:24 +00:00
Chris Wilson cd1c14b172 sna: Remove the unused output and crtc lists
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-07 10:16:19 +00:00
Chris Wilson 5f1c2b3b8b sna: Supply a fake pipe to run completely headless
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-07 10:03:46 +00:00
Chris Wilson e05d2e4814 sna: Track number of pixmaps allocated whilst counting bo leaks
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-01 09:08:19 +00:00