Commit Graph

4303 Commits

Author SHA1 Message Date
Chris Wilson 281f620573 sna: Age active wholly damaged GPU buffers more slowly
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-22 23:36:33 +00:00
Chris Wilson f8575b8bd1 sna: Cancel the immediate batch submit once handled in the block handler
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-22 23:36:33 +00:00
Chris Wilson 609e1d9da2 sna: Bump the inactivity timeout
With the goal of removing inactive pixmap froms the GPU after 5 minutes
of idleness.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-22 15:54:39 +00:00
Chris Wilson 62602209e5 sna: discard damage-all even for width|height==0 operations
Even if we don't know the extents of the render operation, if the entire
pixmap is damaged we can still reduce the damage tracking.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-22 15:52:37 +00:00
Chris Wilson f68a99a55e sna: Mark fresh GPU only bo as being all damaged
Presume that we will not fallback and so treat a GPU only bo (one that
is initially created on the GPU) as being all-damaged. This makes future
operations cheaper as the damage tracking overhead is much reduced, and
the cost of the first readback will mainly be in the synchronisation
overhead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-22 15:09:40 +00:00
Chris Wilson 1f2cd536bc sna: Reduce damage after complete solid fills
RenderFillRectangles is often used to initially clear a pixmap after
creation by flooding it with a solid colour, as is PolyRect. We can
reduce further damage operations by checking for this condition.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-22 14:34:43 +00:00
Chris Wilson 7a6a2c5d4c sna: Setup the pixmap correctly in order to attach our private
During creation of sna_pixmap we validate that we can use a GPU bo with
the target pixmap. This fails if we pass in a raw pixmap header, so
make sure the scratch pixmap is fully initialised first.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-22 14:13:00 +00:00
Chris Wilson f621b3de84 sna: flatten source alphamaps
Replace the source picture+alpha with a bo that contains the RGB
channels from source and A from the alpha map.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-22 14:11:39 +00:00
Chris Wilson 6c08eb4d6f sna/gen2+: Prefer to use the CPU if we have a source alphamap and CPU pictures
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-22 11:51:59 +00:00
Chris Wilson 354dc3c65b sna: Avoid fallbacks for convolutions by rendering the convolved texture
If we have no shader support for generic convolutions, we currently
create the convolved texture using pixman. A multipass accumulation
algorithm can be implemented on top of CompositePicture, so try it!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-22 11:51:58 +00:00
Chris Wilson 34cfa15e52 sna: Drop suggested tiling parameter when creating bo
The only place where we did anything other than use the default was when
creating a new bo for CopyArea. In that case, basing the choice on the
src GPU bo was not only wrong but a potential segfault.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-21 00:47:47 +00:00
Chris Wilson 4d34842559 sna: Intiialise pixmap size before use
After 0c12f7cb0 we were setting the width/height of the pixmap *after*
trying to use them to determine if the pixmap could be created on the
GPU. Normally this would be corrected when we attempt to render, except
for the core drawing protocol.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-20 22:40:25 +00:00
Chris Wilson e71058c9c8 sna: Always readback untiled bo in place
We are going to gain no advantage from the kernel detiling the busy
buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-20 22:40:25 +00:00
Chris Wilson 6690ff51ec sna: Treat all exported bo as potentially active
Don't assume that a read/write will clear the active flag if the bo has
been exported to another DRI client.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-20 22:40:25 +00:00
Chris Wilson 743084bbc4 sna: Only upload tiny pixmaps on the second use
Most small pixmaps appear to be single shot, so amalgamate them into one
buffer and trim our memory usage.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-20 20:42:08 +00:00
Chris Wilson ca24ffe8b9 sna: Improve a debug message
Give the units when saying the pixmap is too small to bother tiling.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-20 20:11:12 +00:00
Chris Wilson f837b9bcc7 sna/render: If the pixmap already has a GPU bo, use it for the source
The usage hint not to create a GPU bo is obviously superceded if we
already have a GPU bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-20 20:06:25 +00:00
Chris Wilson dfafe76a57 sna: Do not use Y-tiling for composite back pixmaps
These are treated by the core drawing routines as replacements for the
front-buffer attached to Windows, and so expect the usual BLT
accelerations are available, for example overlapping blits to handle
scrolling. If we create these pixmaps with Y-tiling and then they are
pinned by the external compositor we are forced to perform a double copy
through the 3D pipeline as it does not handle overlapping blits and the
BLT does not handle Y-tiling.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-20 18:46:47 +00:00
Chris Wilson 0cda7b4fa8 sna: Implement extended fallback handling for src == dst copies
Only marginally better than falling all the way back to using the CPU,
is to perform a double copy to workaround the overlapping copy.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-20 18:46:47 +00:00
Chris Wilson d257a96739 sna: Explicitly handle depth==1 scratch pixmaps
Short-cut the determination of whether it can be tiled and accelerated
-- we know it can't! This is mainly to cleanup the debug logs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-20 12:55:01 +00:00
Chris Wilson 0c12f7cb01 sna: Tidy up some recent valgrind complaints with reuse of scratch pixmaps
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-20 12:48:28 +00:00
Chris Wilson d3a4f5db14 sna: Fixup the refcnt to avoid an assert
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-20 12:17:27 +00:00
Chris Wilson ac52a1fcd1 sna: Don't immediately check for region intersection after subtract
In the READ==0 case we know that the region does not intersect damage
because we have just subtracted, and checking the intersection causes us
to immediately apply the subtraction operation defeating the
optimisation and forcing the expensive operation each time.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-20 08:44:14 +00:00
Chris Wilson 4071dca0ef sna: Don't mark mapping as synchronous by default
Only those that point into scratch memory need to synchronized before
control is handed back to the client.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-20 00:25:29 +00:00
Chris Wilson 4c2a97e9d2 sna: Always pass the damage to sna_drawable_use_gpu_bo()
As it now assumes that the damage is always writable.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-19 23:10:45 +00:00
Chris Wilson 06a1792f91 sna: Avoid the GPU readback with READ==0 move_to_cpu
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-19 21:04:02 +00:00
Chris Wilson 0b5fec3f80 sna: Drop the is-mapped flag after operating via the GPU
Mark the end of a sequence of CPU operations and force the decision to
map again to be based on the current upload operation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-19 20:13:05 +00:00
Chris Wilson 351c8f1633 sna: Discard all damage when replacing pixmap contents
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-19 20:11:08 +00:00
Chris Wilson addf66dda7 sna: Tweak the rendering priorities
If the last operation was on the GPU, continue on the GPU if this
operation overlaps any GPU damage or does not overlap CPU damage.
Otherwise, if the last operation was on the CPU only switch to the GPU
if we do not overlap any CPU damage and overlap existing GPU damage.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-19 20:11:08 +00:00
Chris Wilson 9b6ade1234 sna: Create a GPU bo for accelerated core drawing
As we now can accelerate most of the common core drawing operations, we
can create GPU bo for accelerated drawing on first use without undue
fear of readbacks. This benefits Qt especially which heavily uses core
the drawing operations.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-19 20:11:08 +00:00
Chris Wilson eeb81dd6b4 sna: Remove the forced inplace upload
Make the decision per-operation, with a tendency to remain mapped.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-19 20:10:57 +00:00
Chris Wilson c3a8d77a2b sna: Tune the inplace cross-over point to be half-cache size
The theory being that we will also require cache space to copy from when
uploading into the shadow.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-19 20:10:47 +00:00
Chris Wilson d53b1b2895 configure: Bump the required pixman version
UXA now also uses pixman_triangle_t in order for its fallback, so we
need to bump the required pixman version for UXA as well as SNA.

Reported-by: Fabio Pedretti <fabio.ped@libero.it>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43946
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-19 15:39:06 +00:00
Chris Wilson 1fa5721f06 sna: Reset the GTT mapping flag when freeing the shadow pointers
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-19 00:37:43 +00:00
Chris Wilson 7326d30986 sna: Restore CPU shadow after a GTT memory
When mixing operations and switching between GTT and CPU mappings we
need to restore the original CPU shadow rather than accidentally
overwrite.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-19 00:37:43 +00:00
Chris Wilson ae32aaf4b2 sna/gen[23]: We need to check the batch before doing an inline flush
A missing check before emitting a dword into the batch opened up the
possibility of overflowing the batch and corrupting our state.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-19 00:37:43 +00:00
Chris Wilson e32ad64676 sna: Continue searching the linear lists for CPU mappings
Prefer to reuse an available CPU mapping which are considered precious
and reaped if we keep too many unused entries availabled.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-18 23:42:07 +00:00
Chris Wilson 15a769a66f sna: Distinguish between GTT and CPU maps when searching for VMA
Similarly try to avoid borrowing any vma when all we intend to do is
pwrite.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-18 23:00:46 +00:00
Chris Wilson d0ee695ef0 sna: the active cache is not marked as purgeable, so skip checking it
Otherwise we do a lot of list walking for no-ops.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-18 20:28:18 +00:00
Chris Wilson 8df9653135 sna: clear the request list when reusing a flushing bo
That the rq is NULL when on the flushing list is no longer true, but
now it points to the static request instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-18 20:08:19 +00:00
Chris Wilson b51e3de662 sna: When freeing vma, first see if the kernel evicted any
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-18 19:51:17 +00:00
Chris Wilson fed8d145c1 sna: Use a safe iterator whilst searching for inactive linear bo
As we may free a purged bo whilst iterating, we need to keep the next bo
as a local member.

Include the debugging that led to this find.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-18 19:46:08 +00:00
Chris Wilson 2a98dabcab sna: Purge all evicted bo
After we find a single bo that has been evicted from our cache, the
kernel is likely to have evicted many more so check our caches for any
more bo to reap.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-18 19:23:10 +00:00
Chris Wilson 8ae105b2c7 sna: Only retire for the VMA search if there are cached VMA
If there are no VMA that might become inactive, there is no point
scanning the inactive lists if we are searching for VMA.

This prevents the regression in firefox-fishbowl whilst maintaining most
of the improvement with PutComposite.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-18 18:29:33 +00:00
Chris Wilson a0c0a3765c sna: Retire if the inactive vma list is empty
Try to recycle vma by first trying to populate the inactive list before
scanning for a vma bo to harvest.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-18 17:38:05 +00:00
Chris Wilson 34efb73146 sna: Hint likely usage of CPU bo
If we are going to transfer GPU damage back to the CPU bo, then we can
reuse an active buffer and so improve the recycling.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-18 17:00:22 +00:00
Chris Wilson 3018967438 sna: Only upload to the source GPU bo if we need tiling to avoid TLB misses
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-18 16:25:49 +00:00
Chris Wilson b7f5d75aa5 Silence uxa-only compilation
Kill the stray warning for the undeclared extern used by the module
loader.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-18 16:25:28 +00:00
Chris Wilson a73cc4bf1e sna/gen5: Tidy checking against hardcoded maximum 3D size
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-18 14:55:23 +00:00
Chris Wilson b43548af39 sna: Explicitly handle errors from madv
In order to avoid conflating whether a bo was marked purgeable with its
retained state, we need to carefully handle the errors from madv.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-18 13:19:26 +00:00