Commit Graph

6973 Commits

Author SHA1 Message Date
Chris Wilson e386ba86ea sna: Perform an explicit check against the region extents
RegionNotEmpty() is only valid if we only use the Region API, and as we
mix direct operations on the region extents, we need to also do our own
final check.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-19 15:22:08 +01:00
Chris Wilson de472d95af sna: Check for bpp>=8 before attempting to use memcpy_blt fastpath
Fixes regression in
commit 6921abd810
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Jul 18 16:21:27 2013 +0100

    sna: Add a fast path for the most common fallback for CPU-CPU blits

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-19 15:13:50 +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 6921abd810 sna: Add a fast path for the most common fallback for CPU-CPU blits
This path will mostly be upload for individual glyph uploads, for which
the malloc overhead is significant.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-19 14:04:48 +01:00
Chris Wilson 4da8308649 sna: Remove the duplicated pimxap migration for the composite fb path
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-19 14:04:38 +01:00
Chris Wilson 0d56f0eb84 sna: DBG controls to turn off unwinding partial bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-19 14:04:38 +01:00
Chris Wilson 494f4bdcb0 sna: Allow operation inplace when wedged
There are times, such as rendering into the scanout, where continuing to
use the GTT is preferrable even when wedged.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-19 14:04:38 +01:00
Chris Wilson fb058de4e6 sna: Treat a source with a CPU bo as being attached.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-19 14:04:38 +01:00
Chris Wilson 4723a730f4 sna: Discard overwritten operations before doing a BLT composite
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-19 14:04:38 +01:00
Chris Wilson b2f3237381 sna: Tidy a few DBG regarding cached uploads
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-19 14:04:37 +01:00
Chris Wilson 1b37a167d9 sna: Only IGNORE_CPU for blt composite operations if the size is known
Some operations we do not know the true extents and so check the whole
drawable when considering placement. In this case, the drawing may only
partially cover the drawable and so we can not simply ignore existing CPU
damage.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-19 14:04:37 +01:00
Chris Wilson 2d62f7c483 sna: Also do exposure checking after source clipping in sna_do_copy
Hopefully a final regression from:

commit 07926bfe50
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Jul 11 15:28:55 2013 +0100

    sna: Remove the temporary region allocation from sna_do_copy

References: https://bugs.freedesktop.org/show_bug.cgi?id=67055
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-19 14:04:37 +01:00
Chris Wilson 2c8c462690 sna/dri: Return early is the DRI2CopyRegion is not attached to the GPU
This can happen if the DRI client passes in a stale DRI2Drawable - that
is the Drawable now references a new Pixmap which the client has not run
DRI2GetBuffers against.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-19 11:55:09 +01:00
Chris Wilson e5036fb159 sna/dri: Reject invalid DRI2Drawables if STRICT_BLIT is defined
Simply reject any attempts to copy using stale references (i.e. the
DRI2Drawable has changed structure but the client hasn't yet noticed).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-19 11:51:40 +01:00
Chris Wilson a45714c9a5 sna/dri: Rearrange some more DBG to come before its assertion
Again, useful to know what the assertion fails with.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-19 11:21:28 +01:00
Chris Wilson e9831b50b5 sna/dri: Expose the refcnts in DBG before we hit the assertions
Useful to try and explain some failures.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-19 11:04:46 +01:00
Chris Wilson 6c8b15d321 sna: Wrap cpuid.h
More our ifdef out of line from the main code into a header file, where
we can also apply a little bit of synatic sugar.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-17 21:02:02 +01:00
Chris Wilson 08cacc265d sna: Guard cpuid for use only with gcc-4.4 and later
Since __cpuid_count() was only introduced into gcc-4.4, we obviously
cannot use it with earlier versions or with compilers that do not
provide compatible interfaces.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-17 14:22:16 +01:00
Chris Wilson aa5f14b340 sna: Ensure that buffer_size is a power-of-two for use in ALIGN
ALIGN() expects it alignment argument to be a power of two. As buffer
size depended upon cache_size, which is not always a power of two,
issues could arise with unexpected buffer sizes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-17 14:12:29 +01:00
Chris Wilson a764a6e69b sna: Fix typo in computing box intersection
Comparing y2 against y1 for the intersection was a silly typo,
especially as the routine for computing the intersection already
existed.

Fixes regression in commit 34c9b759fb
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Jul 16 19:39:37 2013 +0100

    sna: Note that borderClip region may be more than a singular box

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66991
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-17 10:53:26 +01:00
Chris Wilson 7f76a2bf31 sna: Fall back to /proc/cpuinfo parsing if cpuid cache size probe fails
Older hardware does not support cache size probing via cpuid4, so we
need to implement the older algorithm which requires a table based
lookup. (And in hindsight, why I thought cache probing via cpuid to be
quite hairy.) For the moment, just use the value found in /proc/cpuinfo.

Reported-by: Oscar Dario Trujillo Tejada <oscardt19@gmail.com>
Reported-by: Ferry Toth <ftoth@telfort.nl>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-17 10:30:14 +01:00
Chris Wilson 3f3071c6c9 sna: Set a minimum size for tiled IO
And assert that we never ask for a zero-sized upload.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-17 09:02:19 +01:00
Chris Wilson 0952e7e041 sna: Include linear GTT maps when deciding whether a bo is mappable
If the linear bo is still in the CPU domain, we can map it through the
CPU with no penalty, so treat it as mappable.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-17 08:24:19 +01:00
Chris Wilson 34c9b759fb sna: Note that borderClip region may be more than a singular box
If the child is obscured, then borderClip will contain a list of valid
boxes rather a singular extents. I thought this was covered by the
clipList, but I was wrong.

Reported-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66970
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-16 19:39:37 +01:00
Chris Wilson 1323abcc2e sna: Make the assumption bpp>=8 explicit inside the bo size calculation
Use an assert to document that we have a few rounding issues if bpp < 8.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-16 09:03:52 +01:00
Chris Wilson 4a447c514b sna: Create a pixmap in ordinary system memory for depth=1 uploads
Since we will not sample depth=1 pixmaps from the GPU, we may as well
directly allocate these in system memory and avoid tickling the upload
cache. This then avoids an issue within the size calculation code which
makes the assumption that bpp>=8.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-16 09:01:45 +01:00
Chris Wilson 884dd896e4 sna: Change message context to PROBED for initial configuration
Since we are retreiving the hw values rather than choosing a default for
ourselves, it is more consistent to use PROBED rather than INFO for our
message.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-15 10:59:39 +01:00
Chris Wilson f8677a971b sna/gen4: Allow rendering to Y-tiled surfaces
We no longer seem to be hitting the same random hangs, so presumably
another w/a is taking effect.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-15 10:24:53 +01:00
Chris Wilson e83e7e60f4 2.21.12 release 2013-07-14 09:35:07 +01:00
Chris Wilson 0230ef72cb sna: Skip copying to the intermediate target if we will completely overwrite it
Occasionally when forced to use an intermediate destination surface, we
know that we will completely overwrite the contents of the surface and
so we can forgo the initial copy from the target.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-13 00:01:08 +01:00
Chris Wilson 2b16eaefb3 sna: Avoid integer overflow when computing the tiled extents
When stepping over the tiles, beware that the step may overflow the
int16_t region extents, so use an int for the calculation.

Reported-by: Andrew Woodward
Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1200766
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-12 23:29:10 +01:00
Chris Wilson 835ceccb27 sna/gen5: Add some more DBG
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-12 23:21:27 +01:00
Chris Wilson 39f1954f66 sna: Replace parsing of /proc/cpuinfo with parsing of cpuid
Courtesy of a patch from Chad Versace via Ben Widawsky, actually digging
through CPUID for the cache info looks quite easy in comparison to the
fragile approach of parsing a linux specific file that may or may not be
available.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-11 22:23:30 +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 07926bfe50 sna: Remove the temporary region allocation from sna_do_copy
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-11 15:28:55 +01:00
Chris Wilson 519d0007d4 sna: Remove incorrect asserts for checking CPU mappings (after remapping)
These assertions were checking that the previous state prior to
performing the new mapping was consistent. Given that the checks were
occurring after the update in mapping, the asserts were bogus.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-10 18:24:36 +01:00
Chris Wilson a18f4ba903 sna: Ofast was introduced with gcc-4.6
Thomas Jones reported that the build was failing with gcc-4.5 due to the
memcpy routines requesting an unsupported optimisation mode (-Ofast) and
supplied this patch to only enable Ofast for gcc-4.6+

Reported-by: Thomas Jones <thomas.jones@utoronto.ca>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-10 11:56:50 +01:00
Chris Wilson ccf0fdd56d sna: Only flush after the BLT operation if we have more than 2 distinct bo
In order to preserve the optimisation of discarding incomplete batches,
we don't always want to immediately submit the batch after inserting the
first command. As we currently only cancel a batch if it only touches
the bo being discarded, we can skip the immediate flush if it only
accesses one bo and maybe be able to use the undo optimisation later.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-09 20:41:51 +01:00
Chris Wilson d935912d9c sna: Free the source reference after performing a BLT composite
Fixes regression from
commit 8751c0f5ad
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jul 5 17:55:10 2013 +0100

    sna: Flush blt copies if no operations pending

Reported-by: Andreas Reis <andreas.reis@gmail.com>
Reported-by: Mike Lothian <mike@fireburn.co.uk>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66742
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-09 20:38:32 +01:00
Chris Wilson b202008f8f sna: Experiment with a new ioctl to create buffers from stolen memory
If there is stolen memory reserved by the BIOS, we want to utilize it in
preference to regular system memory. However, given the caveat that it
is not suitable for CPU access, rules out most use cases - but it is a
good match for framebuffers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-07 09:31:27 +01:00
Chris Wilson dbb585b9d2 sna/gen4: Remove custom max flush vertices w/a from video path
This should now be superseded by using the common w/a.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-07 09:17:58 +01:00
Chris Wilson 2a59eadf81 sna/gen4: Remove the glyph mask hack and tune the flush w/a
Remove the hack from the glyph path to force the use of an auxiliary
channel, and reduce the maximum amount of inflight vertices until we can
then render glyphs with no corruption (at least in my test case).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-07 09:13:49 +01:00
Chris Wilson c9c1833c30 sna/gen4: Tighten FORCE_FLUSH w/a to spot amalgamation of primitives
Inspect whether this rectangle will be added to the previous primitive
and so charge it against the current number of inflight rectangles.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-07 08:58:52 +01:00
Chris Wilson 368c909b29 sna/gen4: Restore the flush-every-vertex w/a
This is an abhorrent workaround for some internal GPU brokenness. A
slight refinement since earlier times is the recognition that 16 is a
magic number limiting the maximum number of inflight rectangles through
the GPU.

References: https://bugs.freedesktop.org/show_bug.cgi?id=55500
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-06 22:54:02 +01:00
Chris Wilson 1fbf47ec1b sna: Tune inplace hints for CPU operations with GPU targets
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-06 22:54:02 +01:00
Chris Wilson 5aaab9ea03 sna: Relax assertion that the source of the cloned pixmap cannot be mapped
I was being overzealous at the time of making the COW and trying to be
sure that we would never write through a mapping. Then I started to
allow clones to be mapped (for reads) and missed relaxing this assertion.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-06 16:03:15 +01:00
Chris Wilson 8751c0f5ad sna: Flush blt copies if no operations pending
More work to try and keep the GPU busy.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-06 16:03:15 +01:00
Chris Wilson f5529ea61b sna: Use a stack allocated PixmapRec for the fbcon copy
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-04 21:39:33 +01:00
Chris Wilson ea508c177c sna: Set 1024x768 fb in absence of any connected devices
No actual initial configration magic is required, all we need to do is
set the initial framebuffer size with no connected outputs and leave it
to the core to select CompatOutput() the like.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-04 20:19:20 +01:00
Chris Wilson d36c9542d2 sna: Fix gamma query to not request uninitialized values
Oops, surprising that ebf4517a0b had any positive effect.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-04 10:45:09 +01:00