Commit Graph

6627 Commits

Author SHA1 Message Date
Chris Wilson bf4be323e3 sna: Fix declaration of write intent for can_map__cpu in PutImage
We always are going to write to the image, despite the flag set in

commit fa961ec99a
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Jul 21 18:00:22 2013 +0100

    sna: Allow linear inplace uploads along the tiled X PutImage blt paths

which was accidentally conditional on the image not being too large.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-12 13:58:32 +01:00
Chris Wilson 815caa9fc6 sna/gen4+: Rebalance creation of vbo during batch flushing
We need to be careful not to copy too much data during the vertex flush
or else that becomes the rate-limiting step. The goal here is to do the
early flush to warm up the GPU, then transition to larger batches.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-11 10:20:30 +01:00
Chris Wilson 0d05a69bd7 sna/gen4: Always try the BLT composite routines first
Given how fragile the render operations are, taking the hit from
transitioning from the slow render operations to the comparatively fast
BLT (when possible) is always worth it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-11 10:20:28 +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 8ff8eb2b38 sna/hsw: Scanline waits require both DERRMR and forcewake
Oh my, bspec is missing a few details on how to perform a scanline wait
on Haswell. But by using the extra steps required for Ivybridge, we can
successfully send events from the scanout to the BCS ring. Sadly this
again means that to use vsync on Haswell requires preventing the GPU
from sleeping whilst it waits for the scanout to advance.

Reported-by: Dan Doel <dan.doel@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69119
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-09 16:23:04 +01:00
Chris Wilson dbe7598245 sna/hsw: Fix the event selection for scanline waits on pipe A
Hmm, this should have meant that we never actually waited for a
scan-line on pipe A. I wonder if it even works...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-09 15:42:06 +01:00
Chris Wilson 144d970461 sna/gen6+: Only apply the BLT copy w/a for self-copies
A missing check along the copy_boxes() path to bring the w/a into line
with the other paths.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-09 15:42:06 +01:00
Chris Wilson af4215dd7f sna: Call the new __offset functions in the last commit
Sigh. I added the new functions for the asserts, updated the parameters,
but forgot to change the actual function themselves.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-09 15:03:30 +01:00
Chris Wilson 6d5df67b3e sna: Remember to offset the box before asserting damage
When using sna_copy_boxes__inplace(), we need to remember that the
region is in destination space, so we need to offset the boxes when
comparing against the source. The assertion forgot to do so, and so
failed as soon as it met a little complexity.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-09 11:19:19 +01:00
Chris Wilson 634748486f sna/gen4+: Flush batch if idle on filling vbo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-08 23:02:29 +01:00
Chris Wilson 77d74ec777 sna/gen6: Prefer the RCS on large GT systems
For SNB, the different between RCS and BCS is more marginal but it is
slightly in favour of using rendercopy on GT2.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-08 22:34:09 +01:00
Chris Wilson 287727ee22 sna/gen7: Prefer the BLT for gt1 systems
On gt1, the BCS is faster than the RCS for all equivalent operations,
unlike gt2+ where the RCS is faster (but at greater power draw).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-08 22:34:03 +01:00
Chris Wilson 6a6517c748 sna: Only update the CRTCs after a resize if master
It appears possible to race the framebuffer resize with a VT switch and
so end up attempting to update the CRTCs whilst master. The code
complains, but in reality we can just ignore the requested change until
we VT switch back and then apply the updates upon restoration of master.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-07 22:07:04 +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 9fdaeec8f2 sna: Search /sys/class/power_state for the AC adapter
The adapter names are not uniform, so we need to scan the directory and
find the entry that corresponds to the Mains power supply. However, the
acpid does continue to report generic ac_adapter events.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-06 23:55:56 +01:00
Chris Wilson 0485cdfb6d sna/dri: Only the BackLeft merits special allocation flags
As the BackLeft is the only that couled be flipped, it is the only one
that may end up as the scanout and so is the only one that should be
allocated from the scanout cache.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-06 23:55:55 +01:00
Chris Wilson 489a93e4cc sna/gen6+: Switch to using the BLT more often when off AC
The BLT is more power-efficient for the operations it can handle, so use
it when possible (following the usual caveats) if we know we only have
battery power.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-06 16:06:06 +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 56f532db2c sna: Prefer to reuse CPU bo if it was last active rather than inplace uploads
This helps short-circuit writes followed by immediate reads.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-06 13:06:48 +01:00
Chris Wilson 7656755c9d sna: Keep the CPU bo around if it was recently active
Rather than always switching over to using the GPU bo and immediately
discarding the CPU bo, keep it around as we may want to reuse the cached
data.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-06 13:06:48 +01:00
Chris Wilson 9a1f2ab84c sna: Try an inplace CopyArea fallback first
This applies the copy-from-tiled-X GetImage optimistion to the
ShmGetImage paths - when we don't have userptr available.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-06 13:06:48 +01:00
Chris Wilson 0b2e11ab3c sna: Rechain up SetWindowPixmap upon ScreenPixmap change
Fixes regression from
commit d2f19d5a1f [2.99.901]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Sep 3 19:05:41 2013 +0100

    sna: Tidy walking the window tree for updating our pixmaps

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-06 11:12:28 +01:00
Chris Wilson 1b1ac5193e sna: Include some DBG for the virtual output detection
So we can see it in the logs along with the regular outputs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-06 11:11:47 +01:00
Chris Wilson 0baac6bba7 sna/gen6+: Don't request extra caching for use-once upload buffers
As we only use these buffers once, we should not benefit from requesting
them to be moved into L3/LLC cache - over and above the default
recommendations we make when creating the buffer. Indeed, this may even
lead to artefacts if we fail to invalidate those other caches when
reusing the buffers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-05 23:08:40 +01:00
Chris Wilson e6bb553b74 sna: Add a DBG to track calls to SetScreenPixmap
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-05 14:42:18 +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 f906a4de62 sna: WriteThrough support is now upstream
Now that the WriteThrough ABI is upstream, we can rely on runtime
detection of the current interface.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-04 15:18:29 +01:00
Chris Wilson 6f49a413aa configure: Check for required UMS headers before enabling
Prevents the build failing with i810 if we can not find vgaHW.h

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-04 15:18:28 +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 ad774cf3a2 sna/dri: Refine proposed async swap interface
The latest proposal for passing swap_interval==0 is through the normal
ScheduleSwap() call, so we can remove the specialised function.

Link: http://lists.x.org/archives/xorg-devel/2013-September/037661.html
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-04 11:39:08 +01:00
Chris Wilson d2f19d5a1f sna: Tidy walking the window tree for updating our pixmaps
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-03 19:37:29 +01:00
Chris Wilson 47e718bf32 sna/dri: Handle failure to move the pixmap into the GPU for CopyRegion
It should not fail, except in extreme cicumstances, and even then we shall
not crash.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-03 18:06:07 +01:00
Chris Wilson 5c51cd4e91 sna: Mark imported PRIME fd as starting in DOMAIN_NONE
Or rather, do not assume anything about the initial domains.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-03 18:06:07 +01:00
Chris Wilson 92b7500668 sna: Add some more DBG
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-03 17:02:12 +01:00
Chris Wilson 529db4d5ed sna: Check for output->randr_output before dereferencing
As we may call the ->detect() routines during the fallback initial
probing, we need to handle the case where the output callbacks are
called before RandR is setup.

Regresion from
commit 8ecb758697
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sat Aug 31 19:44:50 2013 +0100

    sna: Expand the array of fake outputs if the last is used

Reported-by: Andreas Reis <andreas.reis@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68843
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-02 13:06:54 +01:00
Chris Wilson 9ac895fccb sna: Process winSize region
Sometimes the window size is not a simple box, but a full region. In
which case we do need to process it and not just assert that it is a
box!

Reported-by: Jiri Slaby <jirislaby@gmai.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=47597
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-02 13:03:33 +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 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