Commit Graph

3170 Commits

Author SHA1 Message Date
Gaetan Nadon 00a54eee8f COPYING: replace stub file with actual Copyright notices.
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-06-12 20:24:10 -04: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 5a0a8a1cf6 i830: Limit disabling acceleration following EIO to !i965
Following a conversation with Owain G. Ainsworth, it was decided that
the second best approach to handling a wedged GPU was to hope that the
kernel could successfully reset it, which currently is only possible for
i965 and later chipsets.

The best approach is of course to prevent such hangs from ever occurring
in the first place.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-10 23:02:34 +01:00
Chris Wilson 3bf4ca2cdc i830: Only emit the disabling GPU error message once.
But emit the warning about rendering corruption every time for the
transient errors like out-of-memory.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-10 23:02:34 +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 0776a42b70 implicit-flush 2010-06-08 15:00:16 +01:00
Eric Anholt d41684d545 Allocate rotate shadow buffers using the usual framebuffer allocator.
This means we can get tiling on them, which should significantly boost
performance, and also allow for FBC.
2010-06-07 11:18:09 -07:00
Eric Anholt b5c9de10ba Allocate a correctly sized framebuffer when tiling by using libdrm's support.
When I made libdrm stop overallocating so much memory for the purpose
of bo caching, things started scribbling on the bottom of my
frontbuffer (and vice versa, leading to GPU hangs).  We had the usual
mistake of size = tiled_pitch * height instead of size = tiled_pitch *
tile_aligned_height.
2010-06-07 11:15:28 -07: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 1788b16eb2 i915: Fix typo from previous commit.
A trivial change, I thought, having tested it before rebasing, unworthy
even of a perfunctory compile test. How wrong I was.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-07 15:31:47 +01:00
Chris Wilson d9bc36ae03 i915: Remove screen size limit from video setup.
The i915 textured video routine know how to handle drawing on an output
larger than the 3D pipe, so allow them to do so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-07 15:30:07 +01:00
Chris Wilson 6555ef5fd1 i915: Replace structure passing with macros for shader generation.
gcc is horribly bad at collapsing the constants:

  text     data     bss     dec     hex filename
282336     8720     256  291312   471f0 intel_drv.so.old
269280     8720     256  278256   43ef0 intel_drv.so

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-07 14:23:11 +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 6db1e5231b dri: Protect against NULL dereference following GPU hang.
References:

  Bug 28361 - "glresize" causes server segfault with single buffering.
  https://bugs.freedesktop.org/show_bug.cgi?id=28361

[ 14528.767] (EE) intel(0): Failed to submit batch buffer, expect rendering corruption or even a frozen display: Input/output error.
[ 14528.767] (EE) intel(0): Disabling acceleration.
[ 14528.788] Backtrace:
[ 14528.858] 0: /usr/bin/X (xorg_backtrace+0x28) [0x491818]
[ 14528.858] 1: /usr/bin/X (0x400000+0x65ca9) [0x465ca9]
[ 14528.858] 2: /lib/libpthread.so.0 (0x7f9df2dc9000+0xedf0) [0x7f9df2dd7df0]
[ 14528.858] 3: /usr/local/lib/libdrm_intel.so.1 (drm_intel_bo_flink+0x0) [0x7f9defd60c60]
[ 14528.858] 4: /usr/local/lib/xorg/modules/drivers/intel_drv.so (0x7f9deff6a000+0x2fdfd) [0x7f9deff99dfd]
[ 14528.858] 5: /usr/lib/xorg/modules/extensions/libdri2.so (0x7f9df01b8000+0x19e7) [0x7f9df01b99e7]
[ 14528.858] 6: /usr/lib/xorg/modules/extensions/libdri2.so (0x7f9df01b8000+0x1fdb) [0x7f9df01b9fdb]
[ 14528.858] 7: /usr/lib/xorg/modules/extensions/libdri2.so (DRI2GetBuffersWithFormat+0x10) [0x7f9df01ba250]
[ 14528.858] 8: /usr/lib/xorg/modules/extensions/libdri2.so (0x7f9df01b8000+0x3834) [0x7f9df01bb834]
[ 14528.858] 9: /usr/bin/X (0x400000+0x2fc2c) [0x42fc2c]
[ 14528.858] 10: /usr/bin/X (0x400000+0x24da5) [0x424da5]
[ 14528.858] 11: /lib/libc.so.6 (__libc_start_main+0xe6) [0x7f9df1d60a26]
[ 14528.858] 12: /usr/bin/X (0x400000+0x24959) [0x424959]
[ 14528.858] Segmentation fault at address 0x20
[ 14528.858] Fatal server error:
[ 14528.858] Caught signal 11 (Segmentation fault). Server aborting

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-02 20:43:49 +01:00
Chris Wilson 2989f51caf i830: Remove unused coord-adjust.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-01 23:15:02 +01:00
Chris Wilson dc402334f4 i915: Centre sampling.
Use centre sampling of textures to match pixman, and remove numerous
off-by-one and visual artefacts when rendering. The classic example for
this is cairo/text/xcomposite-projection where the edge of the rotated
rectangle is jaggy due to the incorrect sample position.

Fixes:

  Bug 16917  - [i915] Blur on y-axis also when only x-axis is scaled
               billiear
  https://bugs.freedesktop.org/show_bug.cgi?id=16917

And about 15 tests from the Cairo test suite.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-01 23:15:02 +01:00
Chris Wilson f74b3f82ba i915; Avoid the implicit flush on changing BUF_INFO
3DSTATE_BUF_INFO is an implicit flush of the piepline, so avoid emitting
that and associated state unless the destination pixmap has actually
changed. This is a win of around 3-5% for cairo-perf-trace, notably for
firefox.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-06-01 23:15:02 +01:00
Jesse Barnes f227240203 DRI2: fix new buffer exchange check
Chris's new buffer exchange check is a good one, but we don't want to
hit the immediate blit fallback path if it fails.  We still want to
schedule a blit for sometime in the future, and we need to use it
wherever an exchange might occur (like the secondary flip check or the
currently disabled CanExchange check).

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=28252.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-06-01 13:46:15 -07: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
Chris Wilson d31abccd41 i915: Support textured video on an extended desktop.
Handle rendering textured video onto an extended desktop (>2048) by
using a temporary pixmap. Note that we still cannot handle rendering to
a greater than 2048 destination region, for that we will need to tile.
Hmm, time to request a 2560x1600, 10bpc monitor...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-31 12:23:29 +01:00
Chris Wilson 2cfd5bc134 dri: Compilation fix.
17:53 < arekm> ickle: i830_dri.c:630:28: error: ‘DrawableRec’ has no member named ‘bpp’
17:53 < arekm> ickle: i830_dri.c:630:57: error: ‘DrawableRec’ has no member named ‘bpp’

* sigh. I need to fix this machine to have the right version of the
* headers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-29 17:55:19 +01:00
Chris Wilson e2615cdeef dri: Only flip if the front and back pixmaps match.
An unredirected window (thanks Michel for the reminder) is backed by the
Screen pixmap, and so uses a reference of that as its front buffer. The
back buffer is a pixmap appropriately sized for the drawable. When the
application requests to swap its buffers, obviously we cannot simply
exchange the front and back buffer as they do not match, but need to copy
the appropriate region from the back to the front.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-29 16:40:06 +01:00
Chris Wilson 8b2039187f Revert "dri: Use size from backing pixmap when creating buffers."
This reverts commit 44d45d3fa5.

Michel Dänzer pointed out the flaw in using the pixmap size instead of
the drawable size:

  Using the backing pixmap dimensions for this is not desirable. In
  particular, it means that the DRI2 buffers of non-redirected windows
  always have the same size as the screen. But even for redirected windows
  it wastes some graphics memory with a re-parenting window manager, that
  is if it doesn't break in various ways due to the top left corner of the
  DRI2 buffers no longer corresponding to the top left corner of the window.
2010-05-29 12:14:55 +01:00
Chris Wilson 44d45d3fa5 dri: Use size from backing pixmap when creating buffers.
This avoid using the garbage values stored in the Screen drawable,
instead of the true values which are only maintained in its backing
pixmap. The consequence of using the wrong size was to hand a 1x1
pixmap to metacity/mutter and have it believe it was a full screen
drawable; GPU hangs ensued if using page flipping.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-29 10:39:28 +01:00
Chris Wilson 90c74a4314 i915: Don't re-emit vertex size unless it has changed.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-28 21:50:04 +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 73111cf2a2 Decouple non-reusuable pixmaps from batch lists on unref.
==7596== Invalid write of size 4
==7596==    at 0x491ACA8: intel_batch_teardown (i830_batchbuffer.c:118)
==7596==    by 0x491C9D6: I830CloseScreen (i830_driver.c:1419)
==7596==    by 0x8103A9C: RRCloseScreen (randr.c:105)
==7596==    by 0x80DE794: xf86CrtcCloseScreen (xf86Crtc.c:759)
==7596==    by 0x80BEBA3: DGACloseScreen (xf86DGA.c:268)
==7596==    by 0x80D044B: DPMSClose (xf86DPMS.c:134)
==7596==    by 0x488B050: XvCloseScreen (xvmain.c:320)
==7596==    by 0x81841B1: VidModeClose (xf86VidMode.c:110)
==7596==    by 0x80EB12F: CursorCloseScreen (cursor.c:191)
==7596==    by 0x810CA17: AnimCurCloseScreen (animcur.c:108)
==7596==    by 0x816937E: compCloseScreen (compinit.c:86)
==7596==    by 0x48D39B9: glxCloseScreen (glxscreens.c:221)
==7596==  Address 0x49c1a50 is 24 bytes inside a block of size 52 free'd
==7596==    at 0x4024866: free (vg_replace_malloc.c:325)
==7596==    by 0x80B023C: Xfree (utils.c:1096)
==7596==    by 0x4927CFD: i830_set_pixmap_bo (i830_uxa.c:647)
==7596==    by 0x491C9B4: I830CloseScreen (i830_driver.c:1413)
==7596==    by 0x8103A9C: RRCloseScreen (randr.c:105)
==7596==    by 0x80DE794: xf86CrtcCloseScreen (xf86Crtc.c:759)
==7596==    by 0x80BEBA3: DGACloseScreen (xf86DGA.c:268)
==7596==    by 0x80D044B: DPMSClose (xf86DPMS.c:134)
==7596==    by 0x488B050: XvCloseScreen (xvmain.c:320)
==7596==    by 0x81841B1: VidModeClose (xf86VidMode.c:110)
==7596==    by 0x80EB12F: CursorCloseScreen (cursor.c:191)
==7596==    by 0x810CA17: AnimCurCloseScreen (animcur.c:108)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-26 21:07:46 +01:00
Chris Wilson a6fb6aa5f9 Add vertex bo to the list of buffers to be torn down.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-26 20:31:45 +01:00
Chris Wilson 5dce69002d i965: Remove ATOMIC_BATCH.
This paranoid check is deceased; pining for the fjords.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-26 20:27:29 +01:00
Eric Anholt 06ebb55d30 Add a workaround for Ironlake errata relating to disabling the clipper. 2010-05-26 12:21:09 -07:00
Eric Anholt 158a158dad Add a workaround for Ironlake errata regarding blits and other engines. 2010-05-26 12:21:09 -07:00
Eric Anholt 3461f8f4bc Remove remaining REG_DUMPER build stuff. 2010-05-26 12:21:09 -07: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
Chris Wilson 309bd3a299 i830: Skip an empty fill.
In the extremely unlikely event that the higher layer erroneous gave us
an empty fill, skip it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-05-26 10:21:03 +01:00