Commit Graph

6709 Commits

Author SHA1 Message Date
Chris Wilson 27ad2fc1dc sna: Start splitting the trapezoids megafile into parseable blocks
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-04 21:57:26 +01:00
Chris Wilson 898087014c sna: Fix FillRectangles intersection with complex clip
Lesson 2: Use the right variables.

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70137
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-04 16:28:29 +01:00
Chris Wilson 20afd7263f sna: Tidy up FillRectangles intersection with complex clip
Lesson 1: do not accidentally overwrite the loop count inside the loop.

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70137
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-04 16:15:04 +01:00
Chris Wilson 22557b88d3 sna/dri: Only move the scanout to the flip cache if destroyed
Under certain circumstances, we can retire the pageflip before the
client has updated its back buffers. This leads us to pre-emptively
moving the scanout to the cache, when all we need to do (and will do) is
report the same back buffer back to the client.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-04 14:15:53 +01:00
Chris Wilson 394b2ce51d sna: Add a few more DBG to track refcnts
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-04 14:13:50 +01:00
Chris Wilson dbf98d8963 sna/gen5: Replace pipe-control with full MI_FLUSH for required CS stall
It appears that we need top-of-pipe synchronisation for changing of
certain state, and that the gen5 pipecontrol instruction is
insufficient. So we have to fall back on the good old MI_FLUSH in order
to make sure that the GPU invalidates its state correctly.

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51422
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-04 09:36:49 +01:00
Chris Wilson aa439ffee4 sna: The device fd is marked as non-blocking so beware the busy-wait
During redisplay we wait for the pageflip result. If the fd is marked as
non-blocking this results in a busy-wait, so insert a poll first to
remove the busy-wait.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-04 09:07:30 +01:00
Chris Wilson a0476ee6d0 intel: Allow opening the device only through platform information
Only fail to open the device based on the PCI address, if and only if we
do not have sufficient platform information to find the correct system
device.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03 16:15:22 +01:00
Chris Wilson a47f8683fe intel: Handle fallback probing without match_data
One extreme fallback path through the xf86PlatformProbe results in a
call without any match data. As we have a device by this point, we can
simply do a reverse match.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03 16:15:22 +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 4685e79d11 intel: And restore PlatformProbe to working order
In the saga of the untested WIP patches for hosted device probing, was
the failure in logic to detect a valid device during probing. Yikes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03 14:42:45 +01:00
Chris Wilson 58b26055f4 intel: Querying device attributes must be non-NULL
Check first for a NULL platform device before querying the attributes or
else suffer a segfault during PCI probing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03 14:09:26 +01:00
Chris Wilson b7d5292e01 intel: Fix fallout from accident push of ODEV_ATTRIB_FD
This is WIP for passing along a hosted fd. It wasn't meant to be pushed
along with the bug fix this morning.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03 13:38:06 +01:00
Chris Wilson adbf01306a sna: Restart timer evaluations if the BlockHandler takes too long
Rather than passing a negative timeout to select, if we detect that we
expired our timeout during the processing of the BlockHandler, restart.

More worrying is that something in the BlockHandler took longer than 3ms
to process.

Reported-by: Felipe Contreras <felipe.contreras@gmail.com>
Link: http://article.gmane.org/gmane.comp.freedesktop.xorg.devel/37388
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03 08:30:48 +01:00
Chris Wilson 3b3a5ca603 intel: Query platform fd
Under a compositor, we wish to use the pre-authorized fd passed to us by
the host, stashed away in the platform device.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-02 18:29:38 +01:00
Chris Wilson 7978592048 intel: Pass the platform device along to the open routines
This allows us to pass along more metadata along with the platform
device in future. Currently we pass the device path, but in a hosted
environment we should be passing along the authorized fd from the host.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-02 18:24:47 +01:00
Chris Wilson a048f436a0 sna: Only delete unused io buffers
Before deleting the io buffer, we need to check that it is not active.
Currently we check that it is not pending use in the current batch, but
we also need to double check that it does not have outstanding use by
the GPU. Failing to do so could mean overwriting the data prior to it
being read by the GPU, a very small race but often hit!

Reported-by: Vedran Rodic <vrodic@gmail.com> # and many others
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66990
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-02 15:04:20 +01:00
Chris Wilson 660e9e14bd sna: Add a few more asserts around handling of buffers
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-02 15:04:19 +01:00
Chris Wilson c724098f22 sna/trapezoids: Fix clipping on the far left
Edges that extend past the left hand side of the clip box cannot simply
be ignored (since they contribute to the scanline to their right, our
region of interest) but they need to calculated separately rather than
merged into the first cell.

Reported-by: Pavel Ondračka <pavel.ondracka@email.cz>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69469
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-01 10:56:31 +01:00
Chris Wilson 1cf8d5134d sna: Honour Option "AccelMethod" "none"
If the user requests that acceleration be disabled either through
AccelMethod or NoAccel, do so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-30 15:40:35 +01:00
Chris Wilson 1d6a9d4a42 sna: Only reduce Over to Src if the rects do not overlap
Similar to the previous commit, we have to allow overlapping OVER
rectangles to be drawn one after another.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-30 13:27:19 +01:00
Chris Wilson b9bce2303e sna: Do not reduce overdrawn rectangles for XRenderCompositeRects
The specification is that each is drawn in sequence (so over top of
earlier rectangles), so do not cheat by using the computed region.

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66313
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-30 12:39:51 +01:00
Chris Wilson 0532b3cc3c sna: Unmap cow bo when recreating the source bo
When we destroy the original source and copy it to a new bo, we also
need to make sure that any mappings of the original bo in the clones are
undone.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-30 12:38:39 +01:00
Chris Wilson aad53e37a7 sna/gen3: Tidy up fallback handling from fill-boxes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-30 12:38:19 +01:00
Chris Wilson 2c06e9576a sna: Use the bo allocation cache for converting buffers
Since we have a malloc cache for the bo, we may as well use it when
converting from an upload buffer to a bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-29 23:34:18 +01:00
Chris Wilson 57c799deb0 sna: Whitespace fixes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-29 23:33:11 +01:00
Chris Wilson 81d00c5101 sna: Apply the non-relaxed fencing partial paranoia everywhere
This is required to ensure that the tiled offsets are tile-row aligned.

Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1232546
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-29 14:39:56 +01:00
Chris Wilson a0bb41d16f sna/video: The sprite framebuffer also encodes its format
So we need to check whether the cached framebuffer matches the requested
format, or else recreate.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-29 13:33:26 +01:00
Chris Wilson 0dd2038136 sna: Resize an existing framebuffer if possible
Sometimes we may have a compatible scanout cached, but of the wrong
size. Instead of throwing away the memory and creating a new scanout
from scratch, allow us to just resize the old scanout by destroying and
recreating its associated framebuffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-29 11:22:37 +01:00
Chris Wilson 902ce98df1 sna/video: Don't allow caching of yuv scanouts
We only want scanouts capable of being used for the front buffer in our
cache, so make sure that YUV formatted fb are destroyed upon release.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-29 11:22:37 +01:00
Chris Wilson 4a7587ca1c sna/video: Discard old video buffers when the frame size changes
Back in the good old days of the overlay, we only needed to care about
having a frame buffer large enough to hold the data. This changed with
the sprite interface which encodes the width x height into the
framebuffer and so we need to be careful when handing back a cached
buffer that it does indeed match the required dimensions.

Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-29 11:21:41 +01:00
Chris Wilson 2c67e9da5f sna: Avoid reads from a GTT mmapped upload buffer
We now allow LLC machines to also use GTT upload buffers, so we need to
be cache when scanning the cache to look for suitable buffers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-28 10:15:03 +01:00
Chris Wilson 5a5f9b2812 sna: OsSigHandler expects 0 on handled
Returning 0 from sigtrap_handler() when we wish to fallback to the core
OsSigHandler was precisely the wrong thing to do.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-28 08:12:22 +01:00
Chris Wilson 2893d2b516 sna: Fix regression in picture extraction
This is a little helper function, that just returns a bool, not the
error code used by the render backends. Instead the caller tries an
alternative method of extraction before giving up.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-27 19:52:30 +01:00
Chris Wilson 4c9265ebff sna: Only flush the scanout if we successfully upload it to the GPU
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-27 10:47:18 +01:00
Chris Wilson 47ac44159c sna: Make sure we do not try to upload indirectly if the GPU is wedged
Otherwise we trigger assertions and may end up with corruption.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-27 10:47:18 +01:00
Chris Wilson 7206d0bb91 sna: Disable the promotion of large bo as flush
We can rely on our aperture and idleness tracking to appropriate flush
batches. Marking the large bo as flush interferes with the treatment of
flush for externally named bo, such as DRI/PRIME.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-27 10:47:18 +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 7025956558 sna: Mark all large cached buffers as purgeable
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-27 10:47:18 +01:00
Chris Wilson 455754ca8d sna: Make sure the transformed CRTC box is clipped correctly.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-27 10:47:18 +01:00
Chris Wilson ec9ffc9e41 sna: Trigger fallback after intermediate pixmap allocation failure
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-27 10:47:17 +01:00
Chris Wilson bbfbe22954 sna/gen4+: Handle very large copies more gracefully
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-27 10:47:17 +01:00
Chris Wilson 4d2840919f sna: In desperation, query the actual available aperture space
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-27 10:47:17 +01:00
Chris Wilson bf1268838a sna: Drop the REPLACES hint for a pinned target bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-26 14:48:31 +01:00
Chris Wilson 50bd37cf7f sna: Simplify the clearing of a transformed frontbuffer
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-26 14:24:45 +01:00
Chris Wilson c9445af34a sna: Remove a bogus assert
We keep active/inactive scanouts in the same cache, so drop the assert
that they are all inactive - as it is handled a couple of lines later!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-26 11:43:14 +01:00
Chris Wilson 17f47afcbc sna: Eliminate a DBG compile warn for 32-bit builds
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-26 11:42:05 +01:00
Chris Wilson 8ef851b223 sna: Promote self-copies to the GPU
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-25 15:07:48 +01:00
Chris Wilson 1c7df83ca7 sna: Micro-optimise copies
Defer the read of the fExpose bit until we need it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-25 15:07:24 +01:00
Chris Wilson d7eb40efa7 sna: Check that the bo exists before attempting to undo it
Fixes a NULL dereference from sna_blt_composite().

Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1228677
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-25 13:54:43 +01:00