Commit Graph

4672 Commits

Author SHA1 Message Date
Chris Wilson 35c0ef586b sna/gen3: Use cpu bo if already in use
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-26 13:01:24 +00:00
Chris Wilson b76a6da3fa sna: Search the buckets above the desired size in the bo cache
It is preferrable to reuse a slightly larger bo, than it is to create a
fresh one and map it into the aperture. So search the bucket above us as
well.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-26 13:01:24 +00:00
Chris Wilson e2b8b1c145 sna: Apply any previous transformation when downsampling
In order to handle rotations and fractional offsets produced by the act
of downsampling, we need to compute the full affine transformation and
apply it to the vertices rather than attempt to fudge it with an integer
offset.

References: https://bugs.freedesktop.org/show_bug.cgi?id=45086
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-26 13:01:23 +00:00
Chris Wilson 352828ee59 sna: Tweak aperture thresholds for batch flushing
In order to more easily accommodate operations on large source CPU bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-26 12:55:27 +00:00
Chris Wilson cff6a1a2e4 sna: Use the cpu bo where possible as the source for texture extraction
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-26 12:55:22 +00:00
Chris Wilson e583af9cca sna: Experiment with creating large objects as CPU bo
Even on non-LLC systems if we can prevent the migration of such
objects, we can still benefit immensely from being able to map them into
the GTT as required.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-26 12:48:08 +00:00
Chris Wilson 55569272f7 sna: Apply the same migration flags for the dst alphamap as for the dst pixmap
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-26 12:48:07 +00:00
Chris Wilson 4a132ddbf0 sna: Correct offset for moving drawable regions to the CPU
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-26 12:48:07 +00:00
Chris Wilson 65164d90b7 sna/gen2+: Do not force use of GPU if the target is simply cleared
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-26 12:48:02 +00:00
Chris Wilson 307f493d76 sna: Map freshly created, unbound bo through the CPU
Take advantage that we know we will have to clflush the unbound bo
before use by the GPU and populate it inplace.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-26 12:37:07 +00:00
Chris Wilson d785bb7df0 sna: GetImage is allowed to read a window's border
We need to adjust the clip to include the border pixels when migrating
damage from the backing pixmap. This also requires relaxing the
constraint that a read must be within the drawable.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-25 16:46:58 +00:00
Chris Wilson 36425ba49e sna: Round up buffer allocations when downsampling
The pathological case being nx1 or 1xm resulting in an illegal allocation
request of 0 bytes.

One such example is
  wolframalpha.com: x = (200 + x) / 100
which generates an approximately 8500x1 image and so needs downscaling
to fit in the render pipeline on all but IvyBridge. Bring on Ivy!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-25 13:52:27 +00:00
Chris Wilson a2e83c6dcb sna: Silence compiler warning for a potential uninitialised return on error
sna_accel.c: In function 'sna_copy_plane':
sna_accel.c:5022:21: warning: 'ret' may be used uninitialized in this
function [-Wuninitialized]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-25 11:23:22 +00:00
Chris Wilson 8d22a76506 sna: Run the miHandleExposures for no-op CopyPlane
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-25 09:36:20 +00:00
Chris Wilson 338941eda3 sna: Handle self-copies for CopyPlane
Prepare the source first as this has the dual benefit of letting us
decide how best to proceed with the op (on the CPU or GPU) and prevents
modification of the damage after we have choosen our preferred path.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-25 02:42:25 +00:00
Chris Wilson 2e8b398ca3 sna: Only shrink partial buffers that are being written to
Ignore inactive and mmapped buffers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-25 01:47:06 +00:00
Chris Wilson b79252efaa sna: Apply source clipping to sna_copy_plane()
Ensure that the migration region is within bounds for both the source
and destination pixmaps.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-25 01:36:27 +00:00
Chris Wilson 46252bc7bc sna: Set the source clip for CopyArea fallback correctly
The source window is (src->x, src->y)x(src->width, src->height) in
pixmap space. However, we then need to use this to clip against the
desination region, and so we need to translate from the source
coordinate to the destination coordinate.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-25 01:31:34 +00:00
Chris Wilson ae6d3a3117 sna: Print source and destination regions for CopyArea fallback for DBG
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-25 01:18:11 +00:00
Chris Wilson dd5e90adfc sna: Clip GetImage to drawable so that damage migration is within bounds
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-25 01:17:49 +00:00
Chris Wilson b1fba5e853 sna: Clear GPU damage first when moving a clear pixmap to the CPU
This allows us to discard any busy GPU or CPU bo when we know we are
going to clear the shadow pixmap afterwards.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-25 01:17:34 +00:00
Chris Wilson 5ad95d6666 sna: Reduce number of reads required to inspect timers
By using the information provided by select at wakeup.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 22:11:20 +00:00
Chris Wilson aae19cbc5d sna: Only reset devPrivate.ptr if owned by the CPU bo when freeing
If the pixmap is mapped to the GPU bo, we should continue to use the
current mapping rather than revoke it. Otherwise if we write to the GPU
bo inplace, thereby discarding the CPU bo, we set the pointer we are
about to copy to, to NULL.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 20:01:27 +00:00
Chris Wilson 5312ee90ad sna: mark the pixmap as no longer clear after rendering video
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 19:02:56 +00:00
Chris Wilson 69d3fc91f4 sna: Set up GC for general FillArc to FillSpans callback
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 18:54:08 +00:00
Chris Wilson 855c45c65a sna: Enable clipping for mi FillSpans gpu callback
The mi routines do not ensure that their output is suitably constrained
to the clip extents, so we must run it through the clipper.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 18:54:08 +00:00
Chris Wilson c3fe42cde7 sna: Don't attempt to create pixmaps for dpeths smaller than 8
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 18:54:08 +00:00
Chris Wilson 22bab3cd7d sna: Handle malloc failures when downsampling
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 18:54:07 +00:00
Chris Wilson 4aef9e6f50 sna: Add more damage-is-contained asserts
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 18:54:07 +00:00
Chris Wilson 16462e551d sna: Install CPU handler for PolyLine for miPolySegment callback
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 18:54:07 +00:00
Chris Wilson b8b49ae70b sna: Mutate a temporary copy of the GC->ops so we don't alter new GCs
In order to avoid using the wrong function for a scratch GC created
during the course of a MI function whilst we have a specialised GC in
use, we need to avoid modifying the original function table.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 18:54:07 +00:00
Chris Wilson 1a116a15a5 sna: Reduce the assertion that we would have hinted to operate inplace
As the drawable_gc_flags() operate on lower level information than the
hint, it is able to spot more oportunities to reduce the READ flags and
so the assertion was overly optimistic.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 18:54:07 +00:00
Chris Wilson 3d1bba033b sna/gen3: Apply damage to video pixmap
Reported-by: Paul Neumann <paul104x@yahoo.de>
References: https://bugs.freedesktop.org/show_bug.cgi?id=44504
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-24 18:54:07 +00:00
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