Commit Graph

3747 Commits

Author SHA1 Message Date
Chris Wilson 72ca1fdf2f configure: Introduce --with-builderstring
Julien Cristau disliked my broadcasting of the git tree used to build
his distribution package as it bore little relevance to his users. As it
is only useful for people installing their own drivers (as a means of
sanity checking that they are running the right driver), we introduce
the --with-builderstring idiom borrowed from the xserver. This allows
the builder to override the use of `git describe` and either leave it
blank or to fill it with something useful for their own purposes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-15 18:00:07 +01:00
Chris Wilson 544a4167c1 sna/trapezoids: Amalgamate adjacent mono spans
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-14 18:38:57 +01:00
Chris Wilson 3565c48c4b sna: Yet another s/x/y/ typo
Every time I do a transformation into pixmap space I like to include one
of these copy'n'paste errors.

Reported-by: Paul Neumann <paul104x@yahoo.de>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40850
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-14 17:45:41 +01:00
Chris Wilson 4d4aca21fd sna: assert that the memcpy upload path points to valid regions
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-14 17:44:38 +01:00
Chris Wilson 8396105178 sna/gen3: Reset the shader after playing video
Another piece of state we zap without marking as dirty when playing
video.

Reported-by: Paul Neumann <paul104x@yahoo.de>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40842
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-13 18:37:01 +01:00
Chris Wilson 34c03f2215 sna: Clear the list of buffers upon server regen
Or else we may try to clear the new framebuffer with an invalid batch,
because it will reuse the same bo as last time and that bo may still
think it is part of the old batch.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-13 17:24:14 +01:00
Chris Wilson 831cdb8371 sna/debug: Assert that BLT commands on gen2/3 are properly fenced
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-13 17:09:38 +01:00
Chris Wilson a9242a77f0 sna: Add a couple of debug statements for why we may not flush the scanout
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-13 16:20:40 +01:00
Chris Wilson 0056bfd11e video: Stop advertising unsupported Xv attributes
We have yet to implement a yuv-shader that applies
contrast/brightness/saturation and so should not advertise such
features, potentially allowing the client to fallback and perform the
adjustments itself.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-13 14:44:48 +01:00
Chris Wilson 84a7c11a81 sna/video: Stop advertising unsupported Xv attributes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-13 14:42:33 +01:00
Chris Wilson a0d533ea8d sna/trapezoids: Implement a mono-rasteriser to skip opacity spans
For mono-rasteriser we can simply emit the composite spans without
requiring an opacity shader.

For single trapezoids, it will be more interesting to emit triangles
directly. However, we still need to compute the union of many
trapezoids, and this builds upon existing code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-13 13:21:33 +01:00
Chris Wilson 343b99d2a8 sna: Reuse the smallest bo that fits the request
When scanning the active list, pick the smallest that we can reuse.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-13 12:20:17 +01:00
Chris Wilson 90071454d2 sna: Don't clear the kernel-needs-flush flag if we emit a MI_FLUSH
We need to mirror the kernel active lists in order to predict when it
will stall upon an access to a bo, and so we cannot clear the
needs_flush for our own MI_FLUSH.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-13 11:37:17 +01:00
Chris Wilson 2deafe2d95 sna/accel: Use correct enum for requesting a write-buffer
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-13 11:34:43 +01:00
Chris Wilson 544b1a678d sna/gen5: Fix debug compilation
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-13 11:34:25 +01:00
Chris Wilson 6b1ed58d63 sna/gen5: Avoid bitfields for simple assignments 2011-09-12 19:25:08 +01:00
Chris Wilson 03a7fc16f9 sna: Avoid the call overhead for the trivial clip case
Profile guided micro-optimisation. /o\

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-12 12:20:24 +01:00
Chris Wilson 2540c877d4 sna/gen6: Prefer RENDER for copies as it compacts better
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-12 11:54:46 +01:00
Chris Wilson f2a617dcc5 sna: Use single precision for computing the texcoord scale factor
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-12 11:54:02 +01:00
Chris Wilson c2e19987c3 sna: Provide a direct lookup cache of alpha values
To reflect recent changes in cairo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-12 10:56:29 +01:00
Chris Wilson 04c5a3df02 sna: Fix compilation without timerfd()
Based on the patch by Konstantin Belousov.

Reported-by: Konstantin Belousov <konstantin.belousov@zoral.com.ua>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-12 09:20:58 +01:00
Chris Wilson ae887c9d1c sna/trapezoids: Prevent a memleak if feed lots of degenerate boxes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-11 13:59:08 +01:00
Chris Wilson 72fafdfd37 gitignore: add git_version.h
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-09 23:15:58 +01:00
Chris Wilson ac4d4cdbc1 sna: Mark the bo as reusable after extracting the handle from the buffer
The whole purpose for that little dance was so that we could reuse the
bo. However, we left it marked as non-reusable in order for us not to
tie up memory with too many buffers and so defeated the purpose of
trying to place it into the inactive cache.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-09 23:15:14 +01:00
Chris Wilson b3429cf12d sna/gen3: Use a clear pattern for ill-defined radial gradients
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-09 18:09:55 +01:00
Chris Wilson b6837c21b4 sna/gen5: Prefer BLT for solids
And Ironlake also fails to live up to the promise that its GPU is fast
enough to run simple programs at memory rates.

x11perf -trap300 5x fold improvement. No obvious improvement elsewhere
yet.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-09 15:48:30 +01:00
Chris Wilson 27e42b4e12 sna: Prefer memcpy_blt over fbBlt
We know we have compatible formats since we have a gpu_bo attached to
the pixmap, so we can use the simpler direct memcpy rather than calling
fbPutZImage/fbBlt.

On my i3-330m, this improves putimage500 from 730 to 1100 ops/s.

Reported-by: Michael Larabel <Michael@phoronix.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-09 15:26:04 +01:00
Chris Wilson 2e1bf7e1b4 sna: Record git-tree used for compilation
Hopefully, I have all the dependencies correct for auto-updating and
should continue to work with tarballs...

The next step is to perhaps include it in the usual version number,
perhaps as patch level?

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-09 15:26:04 +01:00
Chris Wilson f73cd955e7 sna/trapezoids: Hook up Imprecise AddTraps in lieu of spans
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-09 11:37:32 +01:00
Chris Wilson adde6eab5d sna/trapezoids: Fast upload path for gpu busy bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-08 23:35:33 +01:00
Chris Wilson e9ca05331d sna/traps: Use the trapezoid path for AddTraps
Usually this will be to CPU-only pixmap, but just on the off-chance that
we are stalling for a GPU pixmap just the faster path developed for
Trapezoids.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-08 22:54:22 +01:00
Chris Wilson afdb8aa89a sna/gen3: Do not assume video updates are always vsync'ed
In case the video is running async, then there may be subsequent
instructions within the batch and so we do need to mark the clobbered
state as dirty when setting up the video frame.

Reported-by: Paul Neumann <paul104x@yahoo.de>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40693
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-07 20:27:36 +01:00
Chris Wilson 6aee152cb8 sna/gen2: Flush the batch when we run out of vertex space
Unlike the later gen, we do not yet use a separate vertex buffer and so
when can no longer fit a rectangle (and its CA ghost) we must flush the
batch. Due to the duplication required for the CA pass, the normal
checks to see whether we had sufficient space to add the new command
were passing as they failed to take into account the need to submit the
whole primitive again.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-04 12:57:17 +01:00
Chris Wilson 48bfe4e6de sna/gen2: Improve batch decoder.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-04 12:46:32 +01:00
Chris Wilson 2cda0aaf39 sna/trapezoids: Check for alignment after projection
If after projection onto the Imprecise fast sample grid, the trapezoid
becomes a pixel-aligned box, treat it as such and send it down the fast
paths.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-04 11:20:07 +01:00
Chris Wilson db0fb368c1 sna: Add missing implementation for Triangles
Feed both into spans and as a mask fallback.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-04 11:19:31 +01:00
Chris Wilson 695e7115ef sna/trapezoids: Edges may lie out of bounds
We cannot assume that the edge lies completely within the target, so we
must make sure that the initial prev_x is truly less than any possible
value whilst sorting intersections.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-01 15:51:31 +01:00
Chris Wilson 9a563ea03b sna: Use the shadow buffer for PutImage
This is optimising for the x11perf putimage benchmark, but nevertheless,
uploading the PutImage directly into the uncached scanout is between
2-20x slower than making a temporary copy in the shaodw buffer and
doing a deferred update. Most of the overhead is in the kernel, and
should be addressed there (rather than worked around) and a portion is
due to the overdraw in the benchmark (which is not likely to be
realistic, but then again neither should PutImage be!).

The argument for uploading inplace when possible is that given that the
buffer already exists on the GPU implies that is likely to be used again
in future by the GPU and so we will be uploading it at some point.
Deferring that upload incurs an extra copy. The putimage benchmark does
not actually use the pixel data and so that extra cost is not being
measured.

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 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 0a74cd77a3 video: check that the pixmap exists before use
Now, the pixmap being used is meant to the Screen pixmap and by rights
that has to exists in a GPU buffer! Evidence contrary to the above
exists and so we had better check that we have a bo before using...

Reported-by: Toralf Förster <toralf.foerster@gmx.de>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40439
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-29 10:41:26 +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