Commit Graph

191 Commits

Author SHA1 Message Date
Chris Wilson 32fc0c896e sna/gen6: Prefer the BLT ring, except for copies on behalf of DRI
As demonstrated by the all-important trap300, using the BLT is 2x faster
than the RENDER ring for the simple case of solid fills. (Though note
that performing the relocations costs 3x as much CPU for 2x GPU
performance.) One case that may regress from this change is copywinpix
which should benefit from the batching in the RENDER commands, and might
warrant revisiting in the future (with realistic and synthetic
benchmarks in hand!)

However, due to the forced stall when switching rings, we still want to
perform RENDER copies on behalf of DRI clients and before page-flips.

Checking against cairo-perf-trace indicated no major impact -- I had
worried that setting the BLT flag for some clears might have had a
knock-on effect causing too many operations that could be pipelined on
the RENDER ring to be sent to the BLT ring instead.

Reported-by: Michael Larabel <Michael@phoronix.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-31 23:58:39 +01:00
Chris Wilson 5586dd729b sna/trapezoids: Refactor to project the trapezoid only once
And doing so means that we can go back to using the common validity
check.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-31 09:55:05 +01:00
Chris Wilson 3507437cdb sna/trapezoids: Reject invalid traps after projecting onto the sample grid
If either of the edges are degenerate on the sample grid, then the trap
has zero height and must be skipped. (Otherwise if just one edge becomes
degenerate than the polygon becomes unbalanced and the rasteriser will
implode.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-30 22:13:37 +01:00
Chris Wilson 150a0612d5 sna/trapezoids: Allocate sufficient space for a8 mask for mono traps
Oops, a silly cut'n'paste from caused us to allocate an A1 pixmap for
mono traps instead of the A8 pixmap that we tried to write to; mayhem
ensued.

Reported-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-30 19:49:47 +01:00
Chris Wilson aafe03d3d1 sna: Retain the GTT space used for an upload buffer
In order to retain the GTT space without keeping hold of the memory used
for the upload buffer, we have to create a new bo and copy the relevant
details across.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-29 16:50:12 +01:00
Chris Wilson 28c8c5ca14 sna: Free the buffers immediately upon release
They do not appear to have been leaked per-se, but we end up
accumulating the unused buffers. A more complicated solution would be to
reallocate the handle for retained buffers so that the GTT region can be
reused.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=39184
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-29 16:49:09 +01:00
Chris Wilson 4f2fc00944 sna: Cleanup up the cache upon close
To help with leak-chasing under valgrind.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-29 15:14:41 +01:00
Chris Wilson 0ac4b974b9 sna/video: Defend against PutImage to a broken screen
Similar to the previous commit, check that the Screen Pixmap is bound to
a bo before proceeding.

[Note that in this case, the absence of the bo would have been picked
up much later after doing all of the setup...]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-29 10:47:45 +01:00
Chris Wilson 8216c92d5c sna/trapezoids: Use the tor scan converter to compute the low precision mask
Take of the advantage of the faster mask computation available using the
imprecise tor scan converter for chipsets non yet supporting spans.
In doing so, limit the ability to full step only for vertical only rows
as the small sample grid reduces the benefits of the computationally
more expensive full-step.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-29 10:32:53 +01:00
Chris Wilson aeee6db798 sna/trapezoids: Reduce imprecise sampling to 4x4
Note this also revealed a subtle bug in the handling of degenerate
trapezoids after shrinking to the raster grid.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-27 11:44:13 +01:00
Chris Wilson ac1b83240e sna/accel: Simplify single pixel read-back
The single pixel case is usually assocated with synchronisation of perf
clients and so we do not want to incur extra complication along that
path. Also the cost of tracking a single pixel of non-damage outweighs
its benefit.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-27 11:44:13 +01:00
Chris Wilson 786a770f52 sna/video: Flush the video state at the end of the operation
Or in the case where a second command is received prior to the batch
being flushed, the vertex data is not flushed and leads to the a
miscompution of the number of vertices emitted.

Reported-by: Elias Probst <mail@eliasprobst.eu>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40332
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-25 19:55:49 +01:00
Chris Wilson bd98001a49 sna: Clear structures across server reset
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-25 14:50:37 +01:00
Chris Wilson 0865acb3ad sna/dri2: Add some debug around the use of the Resource database
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-25 14:50:37 +01:00
Chris Wilson 98b67457ca sna/display: Destroy shadow data
Under certain circumstances the shadow can be destroy after being
allocated but before being created. The pixmap is a NULL pointer at that
time, but we know that its value should be data, so just use the data
pointer instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-25 14:50:33 +01:00
Chris Wilson b9ae4e7e71 sna/gen3: reset blend state after applying CA pass
Otherwise we use the stale value when rendering CA glyphs directly to
the front-buffer and subsequent rendering have a tendency to become
invisible. (Rendering via a temporary glyph mask has a fortunate
side-effect of reseting sufficient state to force the re-emission of the
blend state.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-24 21:38:54 +01:00
Chris Wilson ef52f6c8c3 sna/render: allow CLAMP_TO_EDGE for outside samples of extract regions as well
When clipping the sample region to the edge of the texture we can also
allow the GPU to use CLAMP_TO_EDGE (as well as CLAMP_TO_BORDER) to
emulate the RepeatPad mode of the parent texture. (Only the
RepeatNormal, RepeatReflect need special treatment with regard to tiling
that is not yet handled.)

This fixes the recent performance regression due to a slight change in
the fish benchmark that caused it to sample outside of the texture atlas
for one of its little fish.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-24 11:07:23 +01:00
Chris Wilson ccddff087d sna/trapezoids: Speedup tor rasteriser
Faster sorts for the win.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-11 19:42:42 +01:00
Chris Wilson bfbe36cfea sna/gradient: Use a high-precision ramp for a color step rather than fallback
Slightly less precise, but the difference should not be observable in
practice...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-11 19:42:42 +01:00
Chris Wilson 0e61e235bf sna/damage: Take advantage of marking all-damaged
Return early from adding new damage regions if we know that we have
already marked it as all-damaged.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-11 19:42:42 +01:00
Chris Wilson 2cfb703bbe Fix typos for distcheck
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-30 09:26:23 +01:00
Chris Wilson 6f919264da sna: Mark the stencil as untiled
In reality, Mesa will be treating it as W-tiling, only we have no way of
communicating that requirement to the kernel (as not only does the
kernel not understand W-tiling, but also the GTT is incapable of fencing
a W-tiled region.).

Ported from Chad Versace's 3e55f3e88.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-30 09:06:47 +01:00
Chris Wilson 326a84e832 sna: Port IVB acceleration code (Xrender + Xv)
Based on the superlative work by Kenneth Graunke and Xiang, Haihao.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-30 08:50:19 +01:00
Chris Wilson 1079092157 sna: Include the pixmap size in the debug info for moving to cpu
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-30 08:47:20 +01:00
Chris Wilson 1b9e82b4b5 sna: Revert enabling scan-line wait on SNB
Hanging the machine does indeed prevent video tearing. Just not quite
what the user expected...

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=39497
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-26 08:29:36 +01:00
Chris Wilson 6dbbb74bde sna: Enable gen6 scan-line waiting
The code was ready and waiting, just forgot to turn it on.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-20 22:00:53 +01:00
Chris Wilson 7a695c9f6b sna: Fast-path single span boxes
These are very common when compositing unclipped trapezoids, and the
majority of the overhead is in handling the arbitrary number of boxes
and misses out on the constant folding the compiler can do if it is
known we have just one box.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-13 17:43:13 +01:00
Chris Wilson 0190964906 sna/damage: Avoid testing against a completey damaged region
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-13 17:43:13 +01:00
Chris Wilson b929717c89 sna/gen3: Tune emit_spans_primitive_constant
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-13 17:43:13 +01:00
Chris Wilson fbdbfaf38d sna/glyphs: Discard GLYPH_PICTURE hint if the glyph doesn't fit into the cache
If the glyph is too big to fit into the cache, than ideally we do want
to keep an associated GPU bo around for future use. As it is too large
to fit into the cache, it of reasonable size and there is little wastage
in allocating indiviual GPU bo for each oversized glyph.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-13 17:41:02 +01:00
Chris Wilson 12f52530db sna: Add some extra debugging to the texture upload fallback paths
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-13 17:41:02 +01:00
Chris Wilson a861094c23 sna/dri: Fix a couple of typos
Somehow these were lost in the rebasing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-13 17:41:02 +01:00
Chris Wilson c221d0356d sna/dri: Remove the unused id/type members for Resource tracking
...and reduce it to a simple list.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-13 17:41:02 +01:00
Chris Wilson 644b1a9033 dri: Always initialise resource members of DRI2FrameEvent
As we now attempt to always decouple the lists upon freeing the frame
event, we need to initialise them along all code paths.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-12 11:51:58 +01:00
Chris Wilson 32f4235814 sna/dri: Add some simple debugging
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-11 22:14:15 +01:00
Chris Wilson a46598220e sna/dri: Refactor common code for assigning a pixmap to the DRI2 buffer
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-11 22:14:15 +01:00
Chris Wilson 2608a367ac dri: Prevent abuse of the Resource database
The Resource database is only designed to store a single value for a
particular type associated with an XID. Due to the asynchronous nature
of the vblank/flip requests, we would often associate multiple frame
events with a particular drawable/client. Upon freeing the resource, we
would not necessarily decouple the right value, leaving a stale pointer
behind. Later when the client disappeared, we would write through that
stale pointer upsetting valgrind and causing memory corruption. MDK.

Instead, we need to implement an extra layer for tracking multiple
frames within a single Resource.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37700
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-11 21:46:36 +01:00
Chris Wilson 9f22ea7ca4 sna: Clamp results for computing BoxRec coords from xRectangle
As the width/height in the rectangle is specified as uint16_t, the
result may be larger than is storagable in the int16_t of the box. Of
course it would take a really inane client to do attempt to draw
something much larger than the largest possible surface... Is it strange
that first example I've found to do so is a Java application?

Reported-by: Nicolas Kalkhof <nkalkhof@web.de>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-09 14:58:35 +01:00
Chris Wilson f4c5dc8817 sna/accel: Fix fallback for depth=1 copy
A little carelessness with passing down the offsets caused us to
incorrectly copy depth=1 bitmaps, as exemplified by gkrellm.

Reported-by: Nicolas Kalkhof <nkalkhof@web.de>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-09 14:19:04 +01:00
Chris Wilson 649ebcef09 sna: A buffer only needs a flush if it remains dirty at the end of the batch
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-08 18:59:05 +01:00
Chris Wilson 625e37b317 sna/gen3: So we also need to ensure stippling is cleared...
My theory that we used nothing that invoked polygon stippling proved
baseless.

Fixes regression from 3b5971bd23

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-08 18:58:40 +01:00
Chris Wilson 1e2cae0ab3 sna/gen3: Restore disabling the use of stencil/fog in the invariant
One cleanup too far causing spurious results after rebooting. We also
need to ensure that the writemask is fully enabled (ie not disabled)
as well.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-08 10:00:41 +01:00
Chris Wilson ec3dd64e73 sna/dri: Enable chaining of page-flips
Trade off extra frames of latency for extra frames of anti-jitter
buffering and loss of completion information; compiz users rejoice.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-08 10:00:41 +01:00
Chris Wilson a32694b0f0 sna/dri: Remove redundant NULL check in reference
The buffer has already been dereferenced by this point...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-07 23:11:39 +01:00
Chris Wilson d180c5f5f7 sna: Take advantage of the needs_flush tracking on the front buffer
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-07 11:50:12 +01:00
Chris Wilson 0be47f459b sna: Check against an execbuffer reference before discarding partials
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-06 13:06:17 +01:00
Chris Wilson f6573fe757 sna: Compute aligned tiled heights for gen2 correctly
We were underestimating the height of X-tiled surfaces (and less
harmfully overestimating the height of Y-tiled surfaces.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-06 13:06:14 +01:00
Chris Wilson d6afd66461 sna: Reset unused partial buffers
Whilst searching for available space on the active partial buffer list,
if we discover an unreferenced one, reset its used counter to zero.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-05 23:36:09 +01:00
Chris Wilson 6e7a0c8641 sna: Discard unused partial buffers
If we allocate a partial buffer and then fallback for the operation, the
buffer would remain on the partial list waiting for another user.
Discard any unused partials at the next batch submission or expiration
point.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-05 23:36:09 +01:00
Chris Wilson 3b5971bd23 sna/gen2: Restore invariant ENABLES
One deletion too many, unnoticed until the next reboot. Besides the
failure to disable logic op and enable colour buffer blending which
causes a hang if you subsequently try to enable both, you also need
to request texture caching...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-05 22:22:41 +01:00