Commit Graph

4639 Commits

Author SHA1 Message Date
Chris Wilson ff4b8a03a4 sna: Use RepeatPad to avoid sampling the border color when downsampling
References: https://bugs.freedesktop.org/show_bug.cgi?id=45086
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 18:54:07 +00:00
Chris Wilson 09bddddaf9 sna: handle negative modulus for tiled blits
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 18:54:07 +00:00
Chris Wilson f3b11ebc28 sna: Add more assertions for copy errors
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 18:26:35 +00:00
Chris Wilson b56971986d sna: Trim the clipped Segment to the right length
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 18:26:35 +00:00
Chris Wilson 358a0861e6 sna: Do not discard CPU damage for a partial copy
If we are copying a region that does not fill its extents (i.e. is not
singular) then we must be care not to discard the CPU damage that is not
overwritten by the copy.

Fixes regression from 77ee922485
(sna: Use full usage flags for moving the dst pixmap for a copy).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 13:29:25 +00:00
Chris Wilson 672c6ad817 sna: Silence the compiler with a few DBG format warnings
The size of the integers being printed changed causing warnings on 32/64
bit.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 12:56:59 +00:00
Chris Wilson 238f3d9bc5 sna: A deferred attachment will never have a CPU bo
So we can remove that check in sna_copy_boxes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 12:20:01 +00:00
Chris Wilson c353a8cfde sna: Revise use of the inplace hint to favour small cacheable operations
The goal of the heuristic is to reduce readbacks and damage tracking on
active GPU bo whilst simultaneously offering the best performance for
small operations which would prefer to be performed on the shadow rather
than in place.

This restores ShmPutImage performance.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 11:43:40 +00:00
Chris Wilson 29547421f3 sna: Use the reduced ROP from the fbGC to accurately determine readback
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 11:43:18 +00:00
Chris Wilson ec794f7594 sna: Track a proxy's dirty status upon itself rather than the target
As proxy's are short-lived and are not used outside of the operation for
which they are created, dirtied or flushed, we can safely copy the dirty
status onto the proxy object itself.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 01:29:31 +00:00
Chris Wilson 2574a04c94 sna: Split the active bo cache into per-tiling caches
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 01:29:31 +00:00
Chris Wilson 566cbf1ef5 sna: Abort search for a linear bo if we encounter a purged buffer
Given the rarity of encountering a purged buffer versus the frequency of
scanning the list and the then likely result of allocation a new buffer,
simply abort the search on the first purged bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 01:29:31 +00:00
Chris Wilson b8d3353624 sna: Refactor tests for a solid gc to use the new function
This way all paths can test to see if they might be able to reduce the
tiled fill or the opaque fill into a solid fill.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 01:29:31 +00:00
Chris Wilson 78238b3a37 sna: Prefer mi span filling functions to call through to the GPU
Having removed the double analysis for the fast paths, at least, the
span filling code on the GPU is now faster than doing the same
operations in cache memory for the majority of cases. So allow the
driver to prefer to use those functions when it has a GPU bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 01:29:31 +00:00
Chris Wilson c5c77d04d7 sna: Reduce GC to solid if possible along general spans path
Again, we should no longer be hitting this code if at all possible, but
for completeness...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 01:29:31 +00:00
Chris Wilson 03611f662d sna: Guard against being passed n==0 to FillSpans
Apparently this does happen, notably by miFillPolyArc.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 01:29:31 +00:00
Chris Wilson 7ac13a4d5a sna: Provide a fast path for miZeroLine for PolySegment
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 01:29:31 +00:00
Chris Wilson e7817a2206 sna: Override sna_fill_spans for PolySegment
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 01:29:31 +00:00
Chris Wilson 5b8db54d0f sna: Provide a fast path for miZeroLine for PolyLine
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 01:29:31 +00:00
Chris Wilson 280a9165db sna: Override sna_fill_spans for PolyLine
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 01:29:29 +00:00
Chris Wilson 72fc3122b8 sna: Prefer to always use span generation for PolyArc
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 01:28:52 +00:00
Chris Wilson 98879e3786 sna: Specialise PolyPoint for callback from miZeroPolyArc
miZeroPolyArc may use either FillSpans for PolyPoint to generate its
curves, so also provide custom point filling routines.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 01:12:24 +00:00
Chris Wilson 5b10cb4a5c sna: Override sna_fill_spans for PolyArc
This is the missing like that allows the GPU to outperform fbPolyArc.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 01:12:23 +00:00
Chris Wilson 6390a44a69 sna: Pass the reduce clip region to sna_fill_spans__cpu
Since we compute it for the pixmap migration, we may as well use to
perform the clipping within FillSpans as well.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 00:32:30 +00:00
Chris Wilson 40e3745deb sna: Wrap gc->ops->PolyFillArc
The goal is to avoid the overhead of performing multiple region analysis
when calling sna_fill_spans by doing it once at the top level and then
choose the most appropriate drawing method.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 00:32:30 +00:00
Chris Wilson 55c2211143 sna: Use a streamlined sna_fill_spans for when we know we want to use the gpu
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 00:32:28 +00:00
Chris Wilson b20ae33156 sna: Switch to using spans based on use_wide_spans()
This just gives us a hook with which to conveniently enable or disable
the new code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-23 19:51:00 +00:00
Chris Wilson 41739ff951 sna: Wrap gc->ops->FillPolygon
The goal is to avoid the overhead of performing multiple region analysis
when calling sna_fill_spans by doing it once at the top level and then
choose the most appropriate drawing method.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-23 15:42:18 +00:00
Chris Wilson aef56b194d sna: Mark GPU bo as busy when drawing to an all-damaged pixmap for core
The fast path to decide whether to use the GPU bo for the core drawaing
operations forgot to update the active status of the pixmap. This
included forgetting to clear the is-cleared flag.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-23 15:38:30 +00:00
Chris Wilson c67e6a05ff sna: Align the origin of downsampling subregion to an even pixel
In order for us to produce stable downsampled images across multiple
frames, we need to sample the same pairs of pixels every time. This
requires us to align the origin of the sample region to an even pixel.

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=45086
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-23 11:40:13 +00:00
Chris Wilson 9267da9396 sna: Apply composite offset to copy-clear GPU path
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-23 11:20:12 +00:00
Chris Wilson 803f6558c6 sna: Only subtract the fillrect from the CPU damage if it covers the drawable
The idea behind that optimisation is for the inactive pixmap to be
refreshed and allowed to be transfered back to the GPU when it is
entirely redrawn. As such performing the subtraction when it does not
completely remove it only incurs additional overhead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-23 11:10:28 +00:00
Chris Wilson 267493f391 sna: Assert that the subtract operation does reduce an all-damaged
Somewhere somewhen it appears that I am discarding the all-damaged flag
on the pointer. The only possibility I can see is for a no-op
subtraction, so put an assert there just in case the impossible is
happening.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-23 10:54:13 +00:00
Chris Wilson 2908fe2df7 sna: Remove assertion that all flushing list members are in the GPU domain
This may not be true for external buffers that are put on the flushing
list because they have foreign requests pending.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-22 18:52:07 +00:00
Chris Wilson a0bc17c0fa sna/gen6: stall before blending dirty pixels from the render cache
Another restriction on the render pipeline, it turns out, is that before
the blend unit can read back the dst pixels in a subsequent primitive,
we must stall the pipeline for the completion of that earlier primitive.

This is demonstrated by cacomposite.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-22 18:32:05 +00:00
Chris Wilson 5aa494305e sna: Correct the offsets for performing partial downsampling on the GPU
Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=45086
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-22 16:11:41 +00:00
Chris Wilson a7b24bb434 sna: Correct image buffer size when uploading a downsampled image
Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=45086
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-22 16:11:41 +00:00
Chris Wilson 238fc67aa9 sna: Incude prefer-gpu hint in decision to upload CPU textures
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-22 16:11:41 +00:00
Chris Wilson aeaffb1021 sna: Add some more DBG along the downsampling source extraction path
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-22 16:11:41 +00:00
Chris Wilson 92badc9c9c sna: Avoid a common readback after clearing
It is surprisingly common for a pixmap to be created, cleared and then
used as an upload target or, even worse, as a source for a ShmGetImage.
In order to prevent this folly, we can trivially track when we clear an
entire pixmap and its GPU bo and avoid the readback in such cases.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-22 14:10:24 +00:00
Chris Wilson 67a166d124 sna: Pass inplace hint for sna_copy_boxes fallback
In the unlikely event that this makes a difference, provide the hint as
to when we do not read back from the destination and so a streaming copy
would be preferable.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-22 13:46:05 +00:00
Chris Wilson 77ee922485 sna: Use full usage flags for moving the dst pixmap for a copy
Now that the migration code can decide for itself when to not move
damage, we can pass the hints to the code rather than perform the
optimisation in sna_copy_boxes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-22 13:42:57 +00:00
Chris Wilson dd079dd1f6 sna: Check the blt composite op is within the source bounds
If we attempt to read from a drawable that is partially off its backing
pixmap (such as a partially offscreen composite window) we need to fixup
the read from the out-of-bounds regions to return clear. Since we don't,
the easier answer is to just to switch to the render pipeline for such
an operation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-21 19:42:29 +00:00
Chris Wilson 8a91c7d857 sna: Give kgem_create_buffer_2d a unique id
The gen3, among others, backend uses the unique id of a buffer to track
the currently attached buffer and uses 0 as the invalid value. Linear
buffers as created by kgem_create_buffer_2d were not being assigned a
unique id causing mayhem when they were then being passed to the
backends as render targets and sources. In particular, gen3 did not
notice the switch in render target and did not emit commands to change
the GPU target nor attach the buffer to the batch, causing the
sna_read_boxes to fail and for us to trigger an assertion for an
uncomsumed read buffer.

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42718
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-21 01:23:26 +00:00
Chris Wilson d21e80433f sna/gen3: Add DBG markup for tracking target state
In particular for when we switch to a new destination and mark it dirty.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-21 01:23:26 +00:00
Chris Wilson 20006a9ae7 sna: Cleanup PolyText and ImageText fallback debugging
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-20 22:17:44 +00:00
Chris Wilson 3fbd7cafb4 sna: Copy the glyphs metrics before checking for an empty glyph
The empty glyph still needs the correct advance, and copying it too late
left it as zero and so we were collapsing spaces in PolyText8 and
friends.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-20 22:16:53 +00:00
Chris Wilson f0d8f5d377 sna/gen3: Set bo to NULL for render_fill_one
It had to happen, I missed one! From fc9531fc2d.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-20 14:37:33 +00:00
Chris Wilson 0286ddbd67 sna/gen6: Cleanup non-pipelined w/a
Move the workaround CS stall into the emit drawrect which is the only
non-pipelined op we emit. This removes the split between deciding
whether we will emit a drawrect and actual emission.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-20 11:37:01 +00:00
Chris Wilson a0c4024e32 sna/gen6: Do not enable blending on video sources
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-20 09:42:18 +00:00