Commit Graph

151 Commits

Author SHA1 Message Date
Chris Wilson 18d08e49d2 uxa/glyphs: Fallback instead of crashing on large strings
Not ideal, but being slow is a major improvement over losing data.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=36860
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-28 20:26:48 +01:00
Chris Wilson 855ced5a4e uxa: Remove the attempt to use the 3D pipeline for core rendering
The attempt was still ridden with bugs, such as

http://bugs.freedesktop.org/show_bug.cgi?id=28768
http://bugs.freedesktop.org/show_bug.cgi?id=28798
http://bugs.freedesktop.org/show_bug.cgi?id=28908
http://bugs.freedesktop.org/show_bug.cgi?id=29401

A fresh approach was taken with SNA, but in the mean time before that
can be enabled downstream, restore correct behaviour.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-16 13:36:26 +01:00
Eric Anholt 91424d4937 uxa: Simplify uxa_poly_fill_rect by only clipping once.
Reviewed-by: Keith Packard <keithp@keithp.com>
2011-06-05 21:13:49 -07:00
Eric Anholt e0066e77e0 uxa: Simplify Composite solid acceleration for spans by only clipping once.
Unlike the previous commit removing this style of code, the code in
this one was originally wrong, and would fail to clip in the second
pass of clipping when y was > pbox->y2.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37233
Reviewed-by: Keith Packard <keithp@keithp.com>
2011-06-05 21:13:36 -07:00
Eric Anholt ace324e4aa uxa: Simplify BLT solid acceleration for spans filling by only clipping once.
We were clipping each span against the bounds of the clip, throwing
out the span early if it was all clipped, and then walked the clip box
clipping against each of the cliprects.  We would expect spans to
typically be clipped against one box, and not thrown out, so we were
not saving any work there.  For multiple cliprects, we were adding
work.  Only for many spans clipped entirely out of a complicated clip
region would it have saved work, and it clearly didn't save bugs as
evidenced by the many fix attempts here.

Reviewed-by: Keith Packard <keithp@keithp.com>
2011-06-05 21:13:32 -07:00
Chris Wilson 4c66b28870 uxa: Fallback if the temporary is too large
If the render operation requires a temporary source Picture and the
operation is large, larger than the maximum permitted bo, then we will
fail to allocate the bo. In this case, we need to fallback and perform
the operation on the CPU rather than dereference a NULL bo.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34399
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-02-17 16:52:58 +00:00
Bryce Harrington 6e721e098b Check return value of uxa_acquire_solid() since it can return NULL
uxa_acquire_solid returns NULL under OOM.  Thus the value of solid
must be checked before dereferencing it in the uxa_get_offscreen()
call.

Signed-off-by: Bryce Harrington <bryce@canonical.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-02-04 08:57:11 +00:00
Chris Wilson da990536ec uxa: Undo damage translation before appending
The region is used to paint onto the backing pixmap (and thus
translated) prior to being passed to the damage layer (wrt to the
drawable). So the local translation needs to be undone first.

Identified by Christopher James Halse Rogers.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33650
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-02-03 09:41:48 +00:00
Chris Wilson c6dc27562a uxa: Only recreate the glyph cache on *generational* updates
The screen resources are recreated when the screen is rotated as well,
without being finalized. In this case, we do not need to reconstuct the
cache (or if we did, we would need to tear it down first).

Reported-by: Till Matthiesen <entropy@everymail.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33412
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-01-24 20:29:57 +00:00
Chris Wilson 1ba983034b uxa: Emit the damage after the render for the workaround in uxa_solid_rects
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-12-07 12:27:29 +00:00
Chris Wilson 81d355a8dc uxa: Fix crash after allocation failure
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=31487
Reported-by: Thomas Fjellstrom <tfjellstrom@shaw.ca>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-11-09 09:30:12 +00:00
Chris Wilson 23ee926bcd uxa: Skip a pixmap lookup if there is no driver finish access function
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-10-06 12:17:14 +01:00
Chris Wilson 7c7294ec00 shadow+dri2: Allow dri2 to be independently enabled with shadow
To enable DRI we create GEM buffers for the client to render into with
hardware acceleration. In order to maintain coherency between any 2D
render operations with the independent 3D clients (this includes the
reading of 2D rasterisation by the direct rendering client, e.g.
compiz using texture_from_pixmap) we need to replace the shadow pixmap
with the GTT mapping. Therefore 2D rendering to a DRI buffer will be to
uncached memory and thus penalised -- but the direct rendering clients
will have full hardware acceleration.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-10-04 20:24:36 +01:00
Matthias Hopf b84925b9c0 Make driver compile for 1.6 Xserver series again.
Signed-off-by: Matthias Hopf <mhopf@suse.de>
2010-09-22 17:45:06 +02:00
Chris Wilson 2b96c18165 Enable a shadow buffer and disable GPU acceleration.
An attempt to workaround the incoherency in gen2 chipsets, we avoid
using dynamic reallocation as much as possible.

The first step is to disable allocation of pixmaps using GEM and simply
create them in system memory without a backing buffer object. This
forces all rendering to use S/W fallbacks.

The second step is to allocate a shadow front buffer and assign that to
the Screen pixmap. This ensure that the front buffer remains in the GTT
and pinned for scanout. The shadow buffer will be rendered to in the
normal fashion via the Screen pixmap, and be marked dirty. In the block
handler, the dirty shadow buffer is then blitted (using the GPU) over
the front buffer. This should completely avoid having to move pages
around in the GTT and avoid incurring the wrath of those early chipsets.
Secondly, performance should be reasonable as we avoid the ping-pong
caused by the small aperture and weak GPU forcing software fallbacks.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-08 13:33:37 +01:00
Chris Wilson 68a5ad497b uxa: Fallback if faced with large A1 glyphs.
Rather than assert, we should fixup the use of large A1 glyphs. However,
the simplest approach is to simply fallback to s/w.

Fixes:

  Bug 29430 - [UXA] Crash due assert (uxa_pixmap_is_offscreen(src_pixmap));
  https://bugs.freedesktop.org/show_bug.cgi?id=29430

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-08-25 15:01:50 +01:00
Chris Wilson c57840b272 uxa: Check for failed pixmap allocation
Fixes:

  Bug 29187 - crash in intel_drv
  https://bugs.freedesktop.org/show_bug.cgi?id=29187

Backtrace:
0: /usr/bin/X (xorg_backtrace+0x28) [0x466808]
1: /usr/bin/X (0x400000+0x67c79) [0x467c79]
2: /lib/libpthread.so.0 (0x7ff19b297000+0xef60) [0x7ff19b2a5f60]
3: /usr/lib/xorg/modules/drivers/intel_drv.so (0x7ff197986000+0x34684) => uxa/uxa-render.c:841

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-07-21 09:08:28 +01:00
Keith Packard e30f0338fb Destroy screen pixmap on screen close.
This avoids a memory leak on server reset.

Signed-off-by: Keith Packard <keithp@keithp.com>
[ickle: Added comments from Keith that explain the necessity of
destroying the pixmap ourselves and why chaining up in this instance is
not the correct approach.]
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-07-12 17:40:55 +01:00
Fernando Carrijo 6e08b0f48f Purge macro NEED_EVENTS
Signed-off-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
Acked-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-07-09 20:49:13 -07:00
Dave Airlie a2aa4c23f6 uxa: oops typo in previous commit 2010-07-05 14:02:42 +10:00
Dave Airlie feff2ec80e uxa: don't compare planemask with FB_ALLONES.
planemask is an unsigned long initialised to ~0, on 64-bit this is not equal
to an (unsigned int)-1.

Use the macro provided to do this.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-05 09:07:08 +10:00
Chris Wilson b58a6a39c1 uxa: Fallback to pixman if source is out-of-bounds
If the source is outside the drawable, then CopyArea will fail to
initialise the source correctly. The simplest fix in this case is to
fallback to pixman to generate the source texture.

Fixes:

  Bug 28497 - Graphics corruption after opening a specific website
  https://bugs.freedesktop.org/show_bug.cgi?id=28497

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-23 23:56:44 +01:00
Chris Wilson e8783869ad uxa: Apply the source offsets to the pixmap source, not target.
A slight confusion in computing the correction image location resulted
in the application of the source offsets to the pixel location in the
target and not in the source as intended.

Fixes the visual corruption of the scrollbar in Chromium, and hopefully
the crash reported by Robert Hooker when starting gdm after plymouth.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-20 00:10:43 +01:00
Chris Wilson 4b7142baa0 uxa: Enable SHM pixmaps
Now with streaming uploads and downloads for composite operations in
place, shared memory pixmaps are no longer that dire performance wise.
With careful use these can in fact be the most efficient means of
transfer between a wholly software renderer in the client and a backing
store. For instance, Chromium renders internally to an ARGB32 image
buffer and uses a shared pixmap to composite dirty regions into the
backing store. Thereby using the GPU to either perform the blit or the
format conversion. Enabling shared pixmaps, reduces our CPU overhead
whilst scrolling by a factor of 5 or so.

And this is achieved simply by deleting obsolete code!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-19 13:39:48 +01:00
Chris Wilson d748f8e6fc uxa: Use accelerated get_image for copying to !offscreen
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-19 13:39:48 +01:00
Chris Wilson 78ee25f005 uxa: Match depth 30 to format.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-19 13:39:48 +01:00
Chris Wilson af5c4fc96d uxa: Check for allocation failure.
Check for the NULL Picture prior to passing it to the backends for
inspection.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-19 13:39:48 +01:00
Chris Wilson 94217ed5f5 uxa: Always clip glyphs to destination.
Even if there is only a single clip rect, since the clip may be smaller
than the drawing rectangle on the destination we need to actually
compute the clipped glyph rectangle.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-12 18:07:17 +01:00
Chris Wilson 35a12f0290 Fallback implementation for trapezoids for hung GPUs.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-10 23:02:31 +01:00
Chris Wilson 8c1a8d2297 Revert "xp:trapezoids"
This reverts commit f429fb9d87.

An experimental patch I forgot was on my main branch as I was bugfixing.
ARGH!
2010-06-09 10:03:29 +01:00
Chris Wilson 994aa1ef57 uxa: Handle all-clipped out case with destination glyphs.
Fixes the crash reported in:

  Bug 28446 - Garbled Font with Mathematica 7
  https://bugs.freedesktop.org/show_bug.cgi?id=28446

pDst=0x3d663c0, src_x=0, src_y=0, xDst=142, yDst=112, nlist=0,
list=0x7fffea026580, glyphs=0x7fffea025d88, extents=0x0)
    at uxa-glyphs.c:809
        dx = 0
        y1 = 101
        x2 = 150
        x1 = 142
        dy = 0
        y2 = 112
        rects = 0x5491000
        this_atlas = 0x2456d00
        mask_y = 128
        glyph = 0x35933a0
        mask_x = 736
        priv = 0x39309e0
        screen = 0x8d2cc0
        uxa_screen = 0x2443eb0
        src_pixmap = 0x37c29e0
        dst_pixmap = 0x45ddbf0
        localSrc = 0x361a450
        glyph_atlas = 0x2456d00
        x = 142
        y = 112
        n = 18
        nrect = -9975128
        box = {x1 = 23152, y1 = -5630, x2 = 32767, y2 = 0}
        __PRETTY_FUNCTION__ = "uxa_glyphs_to_dst"

Though the meat of that bug regarding the incorrect remains unsolved.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-09 09:59:36 +01:00
Chris Wilson f429fb9d87 xp:trapezoids 2010-06-08 19:52:46 +01:00
Chris Wilson e6acbc7632 uxa: Setup acceleration functions prior to the damage layer
We need to install the acceleration functions so that they are wrapped
by the Damage layer. This fixes the corruption under a compositing WM
introduced in commit 8700673157.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reported-and-tested-by: Arkadiusz Miśkiewicz <arekm@maven.pl>
2010-06-07 18:23:17 +01:00
Chris Wilson d56ea7a852 Use the direct dixGevPrivate() API when available
This is quicker and smaller than the old indirect function call to
dixLookupPrivate().

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-07 00:20:35 +01:00
Chris Wilson 8700673157 Adapt glyphs for changes in devPrivates API
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-07 00:17:32 +01:00
Keith Packard 42ddc39430 Adapt to DevPrivate API changes
This allows the driver to be built against either the old or new
DevPrivate API.

Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-06 16:00:12 -07:00
Eric Anholt 2c1fda08e8 Use libc instead of deprecated libc wrappers for malloc/calloc/free. 2010-06-06 15:56:35 -07:00
Chris Wilson b586624d4f uxa: Force fallback for copies.
All but uxa_copy_window() perform the preliminary checks for whether
acceleration is available. The simplest method for adding the fallback
for uxa_copy_window() seems to be to add it in the core copy function,
so be it.

This allows X to survive a little longer once we encounter a GPU hang.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-06 17:14:10 +01:00
Chris Wilson a386a003e7 uxa: Spans, try again to get the early break correct.
Trigger happy bug fixing. The sign *was* right, the endpoint was wrong.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-31 22:19:49 +01:00
Chris Wilson 1672ee0421 uxa: Sign reversal on early break from spans passing the YXband
Introduced with e5c971e763.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-31 22:08:43 +01:00
Chris Wilson cd38b705be Disable acceleration if we detect a hardware error.
This is wildly optimistic, but it should work in a surprising number of
error situations and some output in those cases will be hopefully be
better than none...

If we submit a batchbuffer and the kernel reports the GPU is hung (which
will be caused by an earlier execbuffer, and so the kernel should have
had enough time to determine whether or not it could reset the GPU) then
disable any further attempt to accelerate gfx and force fallbacks to map
the buffers and use the CPU. We cannot normally map any more buffers if
the GPU is hung, so only those already mapped prior to the hang can be
written to, or those allocated in system memory. However, we can expect
that the framebuffer is already mapped, and so have a reasonable
expectation to continue to see the display update.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-31 18:00:11 +01:00
Chris Wilson 5fff430046 uxa: Mega-Glyphs!
Rewrite glyph rendering to avoid the intermediate buffer, accumulating
the glyph rectangles directly in the backend composite routines. And
modify the glyph cache routines to fully utilise the allocated size of
the tiled buffer on older hardware. To do this we alias all glyph sizes
into the same texture using a technique suggested by Keith Packard.

PineView:
  885/856-> 1150/1110 kglyph/s (aa/rgb)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-31 14:03:42 +01:00
Eric Anholt a94ae175d6 uxa: Fix prepare_solid being called without check_solid first.
Fixes GPU hang on gen6.
2010-05-28 12:40:46 -07:00
Chris Wilson 66c90158e4 uxa: Skip the redundant miComputeCompositeRects() when adding to the mask
As we are in full control of the destination (the temporary glyph mask)
and the source (the glyph cache) we know that there are no clip regions
on either and so can skip computing the composite rectangles. (We trust
the device clipping to prevent compositing outside the target.)

x11perf on PineView:
701/686 -> 881/856 kglyphs/s [aa/rgb]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-28 17:13:30 +01:00
Chris Wilson 5b2254838e uxa: Make the glyph caches' fixed size explicit.
Until we actual resize the glyph cache dynamically, make it obvious to
the reader and the compiler that the size is fixed.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-28 12:47:26 +01:00
Chris Wilson 11581dda99 uxa: Use a glyph private rather than a hash table.
Store the cache position directly on the glyph using a devPrivate rather
than an through auxiliary hash table.

x11perf on PineView:
650/638 kglyphs/s -> 701/686 kglyphs/s [aa/rgb]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-28 12:44:34 +01:00
Chris Wilson 03bbb4c896 uxa: Perform manual damage for CompositeRects
[xserver-1.8] The damage layer doesn't wrap CompositeRects, so we need to
manually append the damaged region ourselves. This works for
miCompsiteRects since that translates the call into multiple invocations
of either PolyFillRectangle or Composite, which themselves cause damage.

Fixes:

  Bug 28120 - Tint2's tooltip borders end up at 0,0 and do not disappear
  https://bugs.freedesktop.org/show_bug.cgi?id=28120

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-26 10:21:03 +01:00
Chris Wilson b9ada52a30 uxa: Force the alpha value to 0xffff when treating Over as Src
Since we have at most 8 bits of alpha, we treat >= 0xff00 as opaque.
However, being paranoid we should set the alpha value to 0xfff in case
something unexpected happens when converting from the xRenderColor to
the pixel value.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-26 10:21:03 +01:00
Chris Wilson 3055d40164 uxa: Use Composite rather than solid blitter for PolyRect
Due to the relocation overhead, using a single composite with many
rectangles outperforms many solid blits.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-26 10:21:03 +01:00
Chris Wilson ec2437f958 uxa: Add PICT format mapping for depth 4 pixmaps.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-26 10:21:03 +01:00