Commit Graph

7138 Commits

Author SHA1 Message Date
Chris Wilson 7e6472cfcc intel-virtual-output: Rebuild pointers after realloc
If reallocs gives us a new memory block, we need to update everything
that pointed into the old blocks.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-01 16:45:32 +01:00
Chris Wilson a41acee728 intel-virtual-output: Register as a singleton
If the user tries to use multiple commands to combine multiple displays,
reroute those to the first instance.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-01 16:07:03 +01:00
Chris Wilson 3f75e95f26 intel-virtual-output: Fix overun with the record Display connection
When converting to the auto-extending arrays, I forgot to include room
for the extra connection for the recording Display. By using an
explicit variable within the global state it is a little more clear.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-01 11:49:18 +01:00
Chris Wilson 89dc44ae45 intel-virtual-output: Prevent cloning the same output twice
And prevent cloning the localhost! The caveat is that the transport
string (Display name) must match, so it still would be possible to
connect to the same display with different transports (local sockets and
TCP sockets for socket) and so cause confusion.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-01 11:46:26 +01:00
Chris Wilson d1d277db9b intel-virtual-output: Manage multiple destination CRTCs
Don't try to assign all the remote outputs to the same crtc.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-01 11:38:49 +01:00
Chris Wilson 47b7e334c1 intel-virtual-output: Try to hide races with gnome-shell
As we try to create VirtualHeads, gnome-shell tries to enable them.
Leading to a lot of flashing and extraneous modes appearing. Without
being able to grab the screen configuration for the duration of our
pruning, there does not seem much we can do other than try and squelch
the worst of the errors.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-31 22:40:48 +01:00
Chris Wilson 7228bd3910 intel-virtual-output: Clone all outputs on the remote display
Now that we allocate VirtualHeads on the fly, we can query the list of
available outputs on the target display and clone them all, rather than
manually passingthe  list of outputs to clone.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-31 22:10:56 +01:00
Chris Wilson 028412faa7 intel-virtual-output: Third time lucky for computing the correct stride?
Aligning a 16-bpp image to a 32-byte boundary is tricky, apparently. Or
at least I make it look so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-31 20:58:48 +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 57904e8d3d intel-virtual-output: Fix calculation of image stride to include bitmap unit
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-31 18:58:07 +01:00
Chris Wilson 9742ff3ae1 intel-virtual-output: use depth-16 transfers for remote hosts or low bpp targets
Avoid up-converting to a depth-24 image and wasting extra bandwidth if
either end-point is only using depth-16.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-31 18:44:49 +01:00
Chris Wilson 6509e46eca intel-virtual-output: use XRender for format conversion if required
Support rendering between mixed depths by using Render to stage the
transfer into our x8r8g8b8 image. An improvement would be to use the gcd
intermediate depth so we don't waste bw unecessarily.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-31 17:45:24 +01:00
Chris Wilson ead32f4a14 configure; Remember to disable building the tools
If we find that the headers for the tools are not available on the
system, simply disable building them as they are not essential features
of the driver.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-31 16:19:21 +01:00
Chris Wilson 8067255dc9 tools: Add intel-virtual-output to extend the local desktop with remote outputs
Based on the original implementation (hybrid-screenclone) by
Tomáš Janoušek, and Bumblebee integration by Kevin Puetz.

intel-virtual-output utilizes local VirtualHeads to present a contiguous
desktop to the local display manager, but maps the drawing on those
outputs to the remote display, and provides bidirectional RandR proxy so
that you can resize the remote display and configure it within your
desktop. The remote display should also send hotplug events back to the
local desktop, for reconfiguration on the fly.

Ideally the remote display is a discrete GPU on the same host so that we
can use local Shared Memory transport and avoid sending data over the
wire (though it will work in that setup). Ideally you would have userptr
support to provide zero-copy rendering between the GPUs, or have dma-buf
(in which case you would be using PRIME). For remote rendering, no
compression is done so this fares worse than VNC.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-31 15:49:01 +01:00
Chris Wilson dbf5751b5b sna: Open the device non-blocking
This is essential to prevent deadlocks when running with ZaphodHeads.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-31 10:35:36 +01:00
Chris Wilson 82dbe3ff81 sna: Mark fake outputs as disconnected until a user applies a mode
Hide the fake outputs until they are instantiated by a user.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-31 10:35:36 +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 314cfd7353 sna/dri: Correct the target_msc for immediate double-buffering
We also need to correctly offset the current_msc for the normal
pageflip, so rearrange the code flow so that we only do the calculation
of target_msc once.

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 92a43caab9 sna/gen6+: Don't force a ring switch for likely TLB misses if already busy
If the target is already on the render ring, don't force the switch away.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-28 14:52:22 +01:00
Chris Wilson f22d7f68b8 sna/gen6+: Improve ring stickyness for BLT composite ops
Rearrange the tests so that we check both src/dst for which rings they
are currently on.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-28 14:52:22 +01:00
Chris Wilson c451a471fb sna/video: Copy the ClipRegion for the sprite
A cut'n'paste error dropped the clip region copy, resulting in the
port not being set on the window instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-27 19:06:52 +01:00
Chris Wilson feae741b38 sna/video: Update sprite destination colorkey command
The final version that was upstreamed differed from the original version
we implemented. The final version allows for both destination/source
colorkeying, but left the ddx out of date.

Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-27 18:57:54 +01:00
Chris Wilson 6997c4c2bd sna: Promote no COWs assertion to a condition check before operating inplace
We can arrive there with a COW and wanting to a CPU mapping, which is
unfortunate and requires the indirect path instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-26 22:08:56 +01:00
Chris Wilson 3b267e52a0 sna: Fix ordering of assert vs the state it checks
It helps to set the state we want to check before actually checking that
we set it!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-26 21:58:57 +01:00
Chris Wilson e98cc0b1ce sna: Make sure we assert our Master status before copying the fbcon
Being able to read back the fbcon handle as a non-Master process is an
information leak that will be fixed. We should already be Master by
this point by virtue of the sequence in which we obtain the device fd.
However, to be pedagogically correct, call drmSetMaster() before the
fbcon copy.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-25 23:34:15 +01:00
Chris Wilson f62173af1a sna/gen7: Combine a couple of pipe-flushes
Reduce the number of pipe-controls we emit by combining one of the
frequent flushes with a stall.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-25 14:12:15 +01:00
Chris Wilson c1dbbe69ad sna: Make SetScreenPixmap do as it says
Make sna_set_screen_pixmap() a little more complete and remove the
assertion that the caller manages sna->front. This should make the
function easier to reuse.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-25 11:44:10 +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 d7e6e9b83c sna/dri: Prefer the source ring
When copying from the DRI client onto the scanout, we return the source
buffer back to the client afterwards. Therefore if we force the source
to switch rings, we incur a double ring switch from the client to us and
back. If we force the dst to switch rings, it will likely be then
correct for all subsequent copies as well.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-25 00:55:19 +01:00
Chris Wilson d4ca195318 sna: Fix reversed logic and loss of trust in the host
The test for a hosted Xserver was backwards in

commit 306c72cffb
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sat Aug 24 14:02:23 2013 +0100

    sna: Trust the preferred-depth returned by the host

so we failed to load the driver instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-24 15:29:30 +01:00
Chris Wilson 3716345bf4 sna: Don't restrict the frontbuffer to be scanout capable if hosted
Since we won't be binding it to a framebuffer, we don't care if it is
incompatible.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-24 14:04:51 +01:00
Chris Wilson 306c72cffb sna: Trust the preferred-depth returned by the host
As we are not master and will not be binding the fb, it is irrelevant as
to whether our render buffer is actually bindable.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-24 14:02:23 +01:00
Chris Wilson 7690346248 sna: Don't copy fbcon if hosted
When hosted, we have no idea what the right initial contents should be
as we are independent of the CRTC and so the existing fb is irrelevant.
Plus, not actually being master will cause the attempt to read back the
bound framebuffer to fail...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-24 14:00:34 +01:00
Chris Wilson 8b0d69e76c intel: Add experimental rendernode support
Render nodes allow clients full access to off-screen rendering and GPU
offload, without assuming any master responsiblities (for device and
display management). As they have a more limited interface, they can be
used in a more permissive manner.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-23 19:27:23 +01:00
Chris Wilson 846436c1a2 sna/dri: Make async blits async again
Fixes the regression introduced in
commit 6f5fd772c7 [2.21.13]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Jul 25 08:29:55 2013 +0100

    sna/dri: Discard the strict checking for stale bo before performing a blit

which added the sync request flag along the explicit async blit path.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-23 16:26:51 +01:00
Chris Wilson fc4e81726d sna/video: Disable the existing sprite when switching CRTCs
After starting a new video on another CRTC, disable the old one as we
currently only track the single video port. However, showing a video
split across multiple CRTCs would be a useful extension in the future.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-23 02:25:34 +01:00
Chris Wilson 509e7aaf84 sna/gen7: Prefer the render ring for more operations
As we get more well-endowed GPUs with ever more execution units, it
becomes advantageous to do even basic copies through the render ring.
However, the extra performance comes at a cost - higher power usage. To
mitigate this, we apply a heuristic of only allowing a switch over to
the render ring if the render ring is already active with an early
request (in addition to the usual stall avoidance and general
performance heuristics).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-23 02:12:59 +01:00
Chris Wilson f57ce6ef9c 2.21.15 release 2013-08-21 12:20:29 +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 4486ae2d82 sna: Do not force use of the CPU bo if replacing a busy GPU bo
To minimise waiting for the SHM pixmap afterwards.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-18 10:11:49 +01:00
Chris Wilson f1cbf13bb1 sna/video: Initialise the UV offsets to 0 for packed formats
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-17 23:37:57 +01:00
Chris Wilson db41bec0fd sna/video: Return the planar offset calculations to the planar branch
They where accidentally move the packed branch in
commit 85e89f2121
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Aug 16 21:11:33 2013 +0100

    sna/video: YUV420 is not supported by sprites, replace it with a RGB passthrough

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-17 23:34:46 +01:00
Chris Wilson fed9ca236a sna/video: Turn off passthrough if given a zero name
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-16 22:43:26 +01:00
Chris Wilson 18e274425d sna: Make sure that external scanouts are immediately discarded
An issue with passthrough Xv buffers is that they end up in the scanout
cache and potentially reused instead of being immediately discarded.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-16 22:03:25 +01:00
Chris Wilson 6692077aca sna/video: Keep a ref to the passthrough overlay bo
Otherwise we will destroy it at the end of the frame whilst it is still
meant to be shown. Not normally an issue as the next frame is show
before it vanishes, but is if the image is shown for an extended period
of time.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-16 22:03:25 +01:00
Chris Wilson d8c9b2c852 sna/video: Mark the sprite color key as changed when disabling
Otherwise we will forgot to send the command to turn off the colorkey.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-16 22:03:25 +01:00
Chris Wilson 85e89f2121 sna/video: YUV420 is not supported by sprites, replace it with a RGB passthrough
As YUV420 is not supported by any of the current sprite implementations
drop it. Instead implement some RGB passthroughs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-16 21:32:09 +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 7a6bd55da9 sna/video: Don't assert on a client error, return BadAlloc
If the client sends a BO that is too small to satifsy the PutImage, then
reject with BadAlloc rather than die with an assert.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-16 15:39:30 +01:00