Commit Graph

77 Commits

Author SHA1 Message Date
Chris Wilson ca252e5b51 sna: Detect batch overflow and fallback rather an risk an ENOSPC
Having noticed that eog was failing to perform a 8k x 8k copy with
compiz running on a 965gm, it was time the checks for batch overflow
were implemented.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-29 20:12:39 +00:00
Chris Wilson 5c6255ba2f sna: Determine whether to use a partial proxy based on the pitch
On gen4+ devices the maximum render pitch is much larger than is simply
required for the maximum coordinates. This makes it possible to use
proxy textures as a subimage into the oversized texture without having
to blit into a temporary copy for virtually every single bo we use.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-29 14:47:12 +00:00
Chris Wilson adb1320bba sna/gen2+: Include being unattached in the list of source fallbacks
If the source is not attached to a buffer (be it a GPU bo or a CPU bo),
a temporary upload buffer would be required and so it is not worth
forcing the target to the destination in that case (should the target
not be on the GPU already).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-26 16:05:48 +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 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 fc9531fc2d sna: Move the flush to the backends
This allows us to implement backend specific workarounds and use the
more appropriate device specific flushing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-20 00:02:05 +00:00
Chris Wilson a11b22d172 sna/gen[23]: Remark the destination bo as dirty after flushing
One of the side-effects of emitting the composite state is that it
tags the destination surface as dirty as a result of the *forthcoming*
operation. So emitting the flush after emitting the composite state
clears that tag, so we need to restore it for future coherency.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-16 13:37:45 +00:00
Chris Wilson 007da2f978 sna/gen2: Check reused source for validity
Be sure the mask picture has a valid format even though it points to the
same pixels as the valid source. And also be wary if the source was
converted to a solid, but the mask is not.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-15 09:48:52 +00:00
Chris Wilson 5d5da35c9f sna/gen[23]: Check for room in the batch before emitting pipeline flushes
Use a single idiom and reuse the check built into the state emission,
for both spans/boxes paths.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-14 22:07:57 +00:00
Chris Wilson 295a22d270 sna: Ensure that the batch mode is always declared before emitting dwords
Initially, the batch->mode was only set upon an actual mode switch,
batch submission would not reset the mode. However, to facilitate fast
ring switching with semaphores, reseting the mode upon batch submission
is desired which means that if we submit the batch in the middle of an
operation we must redeclare its mode before continuing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-14 18:13:48 +00:00
Chris Wilson fb92818ba4 sna: Pass render operation to flush and avoid the implicit flush-on-batch-end
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-14 18:13:47 +00:00
Chris Wilson 5dbcfc2ee3 sna: Be more lenient in not forcing to the GPU if the sources have CPU damage
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-14 18:13:47 +00:00
Chris Wilson 59b79e5952 sna: Reorder composite-done to destroy mask bo before source bo
Just in the unlikely event that we hit the delete-partial-upload path
which prefers destroying the last bo first.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-12 23:12:39 +00:00
Chris Wilson 87f73b0434 sna/gen[23]: Tile render fill to oversized bo
If we are forced to perform a render operation to a bo too large to fit
in the pipeline, copy to an intermediate and split the operation into
tiles rather than fallback.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-10 17:08:15 +00:00
Chris Wilson b76865fa3d sna/gen2: Try to avoid creating a bo for solid colours
As we try to use the diffuse/specular and only resort to using a texture
operation for convenience in the rare case of a solid mask.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-09 23:24:18 +00:00
Chris Wilson 981aae104a sna/gen2: Eliminate some switching between logic op and blend
If the new mode can be done either using a logic op or with the blend
unit, prefer the currently enabled unit.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-09 23:24:18 +00:00
Chris Wilson 09e54c5536 sna/gen2: Add poor-man's linear gradient support
Convert the linear gradient to a texture ramp and compute the texture
coordinates in the standard manner.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-09 23:24:18 +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 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 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 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 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 90a432431c sna/gen[23]: Try BLT if the source/target do no fit in the 3D pipeline
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-18 10:25:40 +00:00
Chris Wilson dcfcf438a5 sna/gen2+: If we use the BLT to prepare the target, try using BLT for op
If we incurred a context switch to the BLT in order to prepare the
target (uploading damage for instance), we should recheck whether we can
continue the operation on the BLT rather than force a switch back to
RENDER.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-18 09:58:08 +00:00
Chris Wilson 0bbd6a08fe sna/gen2: Tidy checking against too large pixmaps for the 3D pipeline
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-13 01:38:09 +00:00
Chris Wilson 3c22baaba9 sna/gen2: Check for unhandled pitches in the render pipeline
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-13 01:38:09 +00:00
Chris Wilson b5a6bc9e33 sna/gen[23]: Fixup render targets with pitches below hw minimum
gen2/3 have a restriction that the 3D pipeline cannot render to a pixmap
with a pitch less than 8/16 respectively. Rather than mandating all
pixmaps to be created with a stride greater than 16, fixup the bo for
the rare occasions when it is necessary.

Reported-by: Paul Neumann <paul104x@yahoo.de>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43688
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-10 13:18:44 +00:00
Chris Wilson e5bc0c823b sna/gen2: Avoid readbacks for unsupported sources
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-08 12:34:52 +00:00
Chris Wilson 7ad2d3b695 sna/gen2: Wire up NO_COMPOSITE for debugging
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-25 09:44:21 +00:00
Chris Wilson 6fc2928f57 sna: tidy assignment of composite damage
Make sure that the damage is always set, even if only to NULL, so that
we are safe if in future the operation state is not initially cleared.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-14 13:05:00 +00:00
Chris Wilson f0acc6c0f1 sna/composite: Attempt to reduce the damage is the operation is contained
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-13 09:57:10 +00:00
Chris Wilson e309cea3ae sna: Do the supported PictOp check first
There is no point even attempting a BLT operation if we know that it is
an unusual render operation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-05 11:28:06 +00:00
Chris Wilson 567cfa508f sna/gen6: Enable spans interface for boxes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-04 13:43:03 +00:00
Chris Wilson 1eefb75c91 sna: Don't mess with NDEBUG
This is set in configure and redefining it later inside the C files just
leads to trouble and broken compilation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-30 17:17:36 +00:00
Chris Wilson 2d3aba8518 Revert "sna: Don't flush the render caches if in the process of writing again"
This reverts commit 15266e1b95.

KDE relies upon the ability to render into a sampler and then render
upon itself. Not the first sign of madness...

Will have to find another way of winning back the compwinwin
performance.
2011-10-30 11:23:23 +00:00
Chris Wilson d406270517 sna/composite: Fix incorrect operator reduction for RenderFillRectangles
As exemplified by KDE (using Kate) on gen3, it would attempt to render a
large set of boxes using OVER and a transparent colour. As gen3 copied
across some of the BLT assumptions, it was incorrectly reducing that to
a CLEAR and thus rendering incorrectly.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-30 10:45:26 +00:00
Chris Wilson 15266e1b95 sna: Don't flush the render caches if in the process of writing again
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-28 18:00:56 +01:00
Chris Wilson 48eff1676c sna/gen2: Reset BLT registers across 2D/3D context switches
It appears the hardware trashes the BLT registers after a 3D context
switch, so we need to reload.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-27 23:56:34 +01:00
Chris Wilson baf78fcddb sna/gen2: Cache the last solid colour for spans
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-27 10:25:36 +01:00
Chris Wilson 0079579ebd sna: Fix debug compilation, again. 2011-10-27 10:25:36 +01:00
Chris Wilson 0ed3426a81 sna: Convert diagonal zero-width lines into blits
This is slower than falling back to swrast for x11perf (up to 4x slower
on SNB), it is still faster than doing that rasterisation through a
WC-mapping and much faster in ordinary usage due to avoiding the
readback hit.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-26 10:37:31 +01:00
Chris Wilson c2040fb8e6 sna: Remove the memset(0) of the fill op
The backends are all expected to initialise the state required.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-21 16:11:15 +01:00
Chris Wilson 7e7759db4c sna: Pass a BoxRec to the fill op
For many of the core drawing routines, passing a BoxRec for the fill is
more convenient since they already have one generated by the clip
intersection.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-21 15:34:28 +01:00
Chris Wilson b2d842df5e sna/gen2: Precompute floats-per-rect
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-18 10:29:33 +01:00
Chris Wilson 729f1ec786 sna/gen2: Prefer to use the BLT
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-18 10:29:33 +01:00
Chris Wilson 01f41e624b sna/gen2: Eliminate redundant diffuse and rectlist emission
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-16 19:39:24 +01:00
Chris Wilson d9e3dbffcb sna/gen2: Fix fill-one-box
Lets only have one special gen2 value for the source channel pixel
colour and so remove the confusion and misrendering.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-16 19:39:24 +01:00
Chris Wilson d5242565ef sna/gen2: Trim some surplus state commands
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-12 23:28:57 +01:00
Chris Wilson a9b53c4877 sna: Mark the spans render functions as fastcall
This reduces the amount of dancing required to call into the span
functions as we can pass the arguments in both the integer and floating
point registers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-11 10:56:51 +01:00