Commit Graph

4334 Commits

Author SHA1 Message Date
Chris Wilson 655a96cd5f sna: Mark the glyph cache as being unpageable
In order to prevent it falling foul of the inactive pixmap reaper, we
need to mark the pixmap as pinned.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-26 14:37:37 +00:00
Chris Wilson 2934e778f0 sna: Increase the minimum alignment constraint for g33
Still not getting the single-stream mode that I am aiming for!

Reported-by: Matti Hamalainen <ccr@tnsp.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44150
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-26 11:30:39 +00:00
Chris Wilson f7593a995a sna: Move the is-mappable check into the callers of region_inplace()
As they slightly differ in their requirements.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-25 11:20:40 +00:00
Chris Wilson aff32e3e08 sna: Tweak damage not to reduce if it will not affect the outcome of reducing to all
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-25 00:36:33 +00:00
Chris Wilson be21a09fef sna: Only call move-to-gpu on scanout flush if we have cpu damage to move
Reduce the number of redundant calls.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-25 00:28:55 +00:00
Chris Wilson 7b69dc8809 sna: Inline the common portion of sna_get_pixel_from_rgba()
The function overhead completely dominates for the common case.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-25 00:21:21 +00:00
Chris Wilson b117f65520 sna: Jump straight to the fallback copy routines if the dst is not attached
Marginally simplify the convoluted logic for choosing the most
appropriate path and help prevent further errors.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-24 21:31:06 +00:00
Chris Wilson 72217790ee sna: Use shadow if the GPU is busy or not immediately mappable
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-24 21:31:06 +00:00
Chris Wilson 0be136c21f sna: use indirect uploads if the bo was last known to be unmappable
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-24 21:31:06 +00:00
Chris Wilson e764a52ee8 sna: Encourage large operations to be migrated to the GPU
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-24 21:31:06 +00:00
Chris Wilson f9f8535db6 sna: Fix damage reduction by adding new boxes to the tail of the box list
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-24 21:31:06 +00:00
Chris Wilson f8c91f229a sna: We can always compare the box to be subtracted against the dirty extents
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-24 12:17:53 +00:00
Chris Wilson cc21d3fa04 sna/damage: Fix the is-contained test
It was a non-overlapping test which is almost the reverse of what was
intended.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-24 12:14:33 +00:00
Chris Wilson b86e4f5929 sna: Check that the copy dst is attached before replacing damage
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-24 11:45:27 +00:00
Chris Wilson 3bcc9f08e1 sna: Create a GPU for a streaming write
If we are about to do a write-only drawing operation that will exceed
our cache, allocate a GPU bo and perform the operation inplace.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-24 10:08:06 +00:00
Chris Wilson efc8d04fc1 sna: Promote an unattached pixmap to the GPU for inplace copies
If we would prefer to perform the copy on the GPU and if the pixmap is
virgin, create a GPU bo for the operation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-24 09:47:37 +00:00
Chris Wilson 8c0e7ff5ac sna: Clear the CPU damage for other overwriting rectangular blits as well
And make the accessing of the sna_pixmap safe -- it may not even exist!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-24 09:47:36 +00:00
Chris Wilson 7f9ed3ca56 sna: reset the pixmap on the initial clear after being swapped out
Pixmaps are swapped out into the CPU after a period of inactivity. This
then prevents the core rendering routines from migrating the pixmap back
to the GPU until it gets used again on a Render path. However, we can
clear that CPU damage and enable migration before a number of key steps
in the expose process.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-24 09:15:08 +00:00
Chris Wilson 8c987b6ccf sna: Cheaply reduce damage when subtracting and removing the entire damage
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-24 09:15:08 +00:00
Chris Wilson 098592ca5d sna: Remove the independent tracking of elts from boxes
Following the switch to a global mode for damage, the elts array became
redundant and all that is required is the list of boxes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-24 02:59:21 +00:00
Chris Wilson 73df0c7ab7 sna: Tune region upload inplace threshold
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-24 02:50:47 +00:00
Chris Wilson ef66c5b5ad sna: Search the inactive VMA cache first for a linear mapping
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-24 01:09:56 +00:00
Chris Wilson 1cc07fa2d2 sna: Avoid forced creation of GPU bo for tiny operations and dirty pixmaps
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-23 22:11:19 +00:00
Chris Wilson e5bfea5826 sna: Discard any GPU damage when overwriting with trapezoids
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-23 22:11:19 +00:00
Chris Wilson 819dc93e52 sna/glyphs: Create GPU bo for large enough destination surfaces with glyphs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-23 22:11:19 +00:00
Chris Wilson 9580ae8490 sna: Pass usage-hint to move-to-gpu
When simply creating a source GPU bo it is preferrable not to mark it as
all-damaged.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-23 22:11:19 +00:00
Chris Wilson 98f15fc613 sna: Don't align pwrite to cachelines for doing discontiguous copies
The batch compaction breaks the 1:1 mapping between the cpu buffer and
the bo, so we can no longer safely align the transfer to whole
cachelines.

References: https://bugs.freedesktop.org/show_bug.cgi?id=44091
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-23 17:28:14 +00:00
Chris Wilson 3850f4ad48 sna: Silence unsigned comparison against 0
The good news is if this ever failed, the kernel is far too broken...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-23 12:42:02 +00:00
Chris Wilson d9ca113a83 sna: Trim the unused pages from the batch between the last command and surface
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-23 11:18:21 +00:00
Chris Wilson 013eda17e9 sna: Free the additional bindings on proxies 2011-12-23 10:41:22 +00:00
Chris Wilson 84d97bdba0 sna/gen2+: Reuse source channel for mask where possible
GTK+ has a clever trick for premultiplying its images by loading the
same pixel data into both the source and mask, and then performing the
composite. This causes us to upload the same pixel data twice!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-23 00:28:12 +00:00
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