Commit Graph

58 Commits

Author SHA1 Message Date
Michel Dänzer
29586101dc EXA: Only record damage generated by rendering operations.
Recording damage from other operations (e.g. creating a client damage record)
may confuse the migration code resulting in corruption.

Option "EXAOptimizeMigration" appears safe now, so enable it by default. Also
remove it from the manpage, as it should only be necessary on request in the
course of bug report diagnostics anymore.
2008-05-24 20:01:41 +02:00
Michel Dänzer
d733043982 EXA: Don't suggest exaCopyDirty be inlined.
Leave the decision to the compiler toolchain.
2008-05-24 20:01:31 +02:00
Michel Dänzer
9bee1c6912 EXA: Disable problematic optimization of dest pixmap migration by default.
Also add some code comments about these optimizations.
2007-11-07 19:01:24 +01:00
Michel Dänzer
5d74416740 EXA: Don't attempt to move in pixmaps that can't be accelerated.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=12815 .
2007-10-18 17:44:14 +02:00
Dave Airlie
566dd3b7d7 exa: add new flags to denote driver handles all pixmap migration/hiding 2007-10-03 12:01:37 +10:00
Michel Dänzer
547ad2125e EXA: Make sure driver hooks get correct offscreen offsets from exaCopyDirty.
This should ensure the driver UploadTo/DownloadFromScreen hooks can always
work as intended.
2007-09-17 20:40:13 +02:00
Michel Dänzer
6c9d7ed61b EXA: Hide pixmap pointer outside of exaPrepare/FinishAccess whenever possible.
We finally want to catch all cases where the pixmap pointer is dereferenced
outside of exaPrepare/FinishAccess.

Also fix a couple of such cases exposed by this change.
2007-09-07 18:41:30 +02:00
Michel Dänzer
962eddd7a2 EXA: Support partial migration of pixmap contents between Sys and FB.
The initiator of migration can pass in a region that defines the relevant area
of each source pixmap or the irrelevant area of the destination pixmap. By
default, the pending damage region is assumed relevant for the destination
pixmap, and everything for source pixmaps.

Thanks to Jarno Manninen for reassuring me that my own ideas for this were
feasible and for providing additional ideas.
2007-09-07 18:41:30 +02:00
Michel Dänzer
5c7ee3f47f EXA: Track valid bits in Sys and FB separately.
Also consolidate exaCopyDirtyToFb/Sys.
2007-09-07 18:41:29 +02:00
Michel Dänzer
8cfcf9973c EXA: Migrate out pixmap in exaPrepareAccess.
Also fix exaFinishAccessGC not to use the same index for tile and stipple.
2007-09-07 18:41:29 +02:00
Michel Dänzer
c19f227b46 EXA: Only mark offscreen memory as used when it really is. 2007-08-24 13:05:52 +02:00
Michel Dänzer
e869573b52 EXA: exaAssertNotDirty improvements.
* Return early if the valid region is empty or the pixmap is pinned.
* Fix loop for several cliprects.
2007-04-29 23:45:48 +02:00
Eric Anholt
7a12952fd4 Bug #7639: Only swap out pixmaps (rather than everything) on VT switch in EXA.
This is a new behavior for version 2.1 of EXA, and only takes effect if the
driver has requested that.  Otherwise, the previous behavior remains the same.
2007-01-24 13:34:58 -08:00
Michel Dänzer
f9f33b72e3 Track per-drawable damage to minimize UTS and DFS transfers.
Based on work by Eric Anholt.
2006-06-12 20:19:11 +02:00
Eric Anholt
005529a1c9 Correct some bugs causing performance issues in the "Smart" scheme. 2006-04-28 03:26:30 +00:00
Eric Anholt
6d156c0440 Improve the migration debugging output. 2006-04-26 01:33:15 +00:00
Eric Anholt
074dc9a023 Add an option to verify at the point of migration that pixmaps which aren't
marked dirty are in fact not dirty. This will hopefully help catch
    issues like the previous commit. Leave it on in fakexa.
2006-04-25 16:47:23 +00:00
Eric Anholt
b17a4de83e Add a new migration scheme, called "Smart" for lack of a better name. This
one behaves somewhat between Greedy and Always. It moves in if we can
    accelerate, unless the destination is clean and shouldn't be kept in
    framebuffer according to the score, in which case we migrate out (and
    force-migrate anything where migration is free). This should help fix
    lack of acceleration for drivers without UTS since removing
    exaAsyncPixmapGCOps, and has removed one performance trap with Radeon
    I'd noticed. It is the new default.
2006-04-18 19:14:07 +00:00
Eric Anholt
2e38fedd29 Add an option to EXA for the DDX to request that EXA hide the pixmap's
devPrivate.ptr when pointing at offscreen memory, outside of
    exaPrepare/FinishAccess(). This was used with fakexa to find (by NULL
    dereference) many instances of un-Prepared CPU access to the
    framebuffer:
- GC tiles used in several ops when fillStyle == FillTiled were never
    Prepared.
- Migration could lead to un-Prepared access to mask data in render's
    Trapezoids and Triangles
- PutImage's UploadToScreen failure fallback failed to Prepare.
2006-03-31 19:41:28 +00:00
Eric Anholt
14aafc258c Change EXA so that exaMoveOutPixmap() retains the framebuffer copy of the
pixmap, and damage is tracked so that a later exaMoveInPixmap won't
    result in an upload if no upload is necessary. This will likely improve
    the performance of the "Always" migration scheme significantly, and is
    a step in the path to more exact damage tracking between framebuffer
    and system memory.
2006-03-16 18:43:55 +00:00
Eric Anholt
c74464d92c Don't let pinned pixmaps get migrated in when using the "Always" migration
scheme. This notably keeps the visible screen from getting migrated in
    to a new location in framebuffer.
Reported by: Michel Dänzer.
2006-03-15 16:59:45 +00:00
Eric Anholt
c1601717d5 Add a new migration scheme, "always", which will move pixmaps to their
desired location always (unless they don't fit in FB, in which case
    they all get moved out for software rendering). The default remains as
    before, but can be controlled by the MigrationHeuristic xorg.conf
    option (which is intentionally not documented, as it may be
    short-lived). This is part of the exa-damagetrack work, which appears
    stable in testing with fakexa, unlike the work as a whole.
2006-03-15 01:20:08 +00:00
Eric Anholt
693e42114f Move migration logic to a new function, exaDoMigration(). This is largely a
manual conversion to allow for different migration schemes to be
    implemented reasonably, but does include some minor improvements such
    as accounting for pinned pixmaps not being acceleratable, and for our
    current GetImage and GetSpans not being accelerated.
2006-03-14 21:30:12 +00:00
Eric Anholt
2822cbc1fb Rearrange EXA driver structures so that there's a hope of maintaining ABI
when extending the driver interface. The card and accel structures are
    merged into the ExaDriverRec, which is to be allocated using
    exaDriverAlloc(). The driver structure also grows exa_major and
    exa_minor, which drivers fill in and have checked by EXA
    (double-checking that the driver really did check that the EXA version
    was correct). Removes exaInitCard(), which is replaced by the driver
    filling in the rec by hand, and the exaGetVersion() and related
    EXA_*VERSION which are replaced by always using the XFree86 loadable
    module versioning.
2006-03-09 06:04:07 +00:00
Eric Anholt
dc0354104c Move EXA implementation up to the top level and remove its XFree86
dependencies. It was nearly abstract enough already to be used by
    multiple DDXes. This will be useful for EXA development through
    providing a fake acceleration implementation within Xephyr, so that
    testing can be done on new EXA code without worrying about buggy
    drivers.
2006-02-16 00:14:11 +00:00
Eric Anholt
c3d1403672 Remove libcwrapper usage from xorg server modules. The libcwrapper is only
of (marginal) use in the drivers, and that usage remains.
2006-02-10 22:00:30 +00:00
Eric Anholt
5e2a7af23b Move the frequently-repeated code to get the pixmap that backs a drawable
to a new function, exaGetDrawablePixmap().
2006-02-02 21:07:06 +00:00
Eric Anholt
3366b68365 Rearrange and rename EXA code to be a bit more logically organized. Also
removes a little bit of debugging leftovers. Summary:
exa.c -> exa.c (miscellaneous code) exa_accel.c (all acceleration code)
    exa_migration.c (migration logic) exaasync.c -> exa_unaccel.c (software
    fallbacks) exapict.c -> exa_render.c (render extension stuff)
    exaoffscreen.c -> exa_offscreen.c exaPriv.h -> exa_priv.h
2006-02-02 20:09:14 +00:00
Thomas Hellstrom
890ed0e082 Fix a bug where a system memory pixmap got a wrong address if memcpy()
fallback was used for downloading from screen.
2005-11-06 16:40:59 +00:00
Thomas Winischhofer
1f43d218cc EXA: The "optimization" for using a fill operation instead of 1x1 copies
checked the destination drawable's dimensions (!) instead of the
    tile's. Really....
2005-10-20 21:45:40 +00:00
Eric Anholt
744aa34ca5 Add an additional meaning to the "dirty" flag. Now, if !dirty && !area, the
pixmaps's contents are undefined, so we won't need to upload the
    undefined contents in MoveIn. Use the ExaCheck* for async ops as well,
    so that dirty is always tracked. While the performance impact for my ls
    -lR test was not significant (though the avoiding-upload path was being
    hit), it's likely to be important for the upcoming Get/PutImage
    acceleration from ajax.
2005-10-15 02:19:09 +00:00
Eric Anholt
55efb41f6c If a window background is a 1x1 pixmap, read the value out and go to
exaFillRegionSolid rather than sending piles and piles of Copies to the
    hardware.
2005-10-12 07:35:20 +00:00
Benjamin Herrenschmidt
13f958fbe8 Add missing {Prepare,Finish}Access() wrappers for the tile pixmap in the
fallback case
2005-10-10 05:58:41 +00:00
Eric Anholt
ecaa46380e Bugzilla #4616:
- Merge various fb/ bits of COMPOSITE support from xserver, which weren't
    necessary before due to cw hiding the issues. Fixes offset calculations
    for a number of operations, and may pull some fixes that cairo has
    wanted for XAA as well.
- Add a new call, miDisableCompositeWrapper(), which a DDX can call to keep
    cw from getting initialized from the damage code. While it would be
    cleaner to have each DDX initialize it if it needs it, we don't have
    control over all of them (e.g. nvidia).
- Use the miDisableCompositeWrapper() to keep cw from getting set up for
    screens using EXA, because EXA is already aware of composite. Avoiding
    cw improved performance 0-35% on operations tested by ajax in x11perf.
2005-10-02 08:28:27 +00:00
Adam Jackson
aa74468aa5 sparse cleanups. s/0/NULL/ and mark a few things static. 2005-09-30 02:03:45 +00:00
Eric Anholt
58abce3f90 - Use the dirty flag (which should be set correctly all the time,
particularly thanks to Prepare/FinishAccess) to avoid DFS/memcpy on
    pixmap move-out if it's unnecessary. This was disabled in KAA because
    cache misuse on ATI made me guess that this code was wrong.
- Unwrap Glyphs on closescreen.
2005-09-28 20:01:37 +00:00
Eric Anholt
361a9eb953 - Change migration-in rule slightly: previously, if your score was less
than the max, it was bumped, and then if you were above the threshhold
    you got moved in. Instead, do the above-threshhold check separate from
    score starting out less than max. While this will likely make thrashing
    cases worse, I hope it will fix some issues with long term performance
    (think of an xcompmgr with a backbuffer it's doing only accelerated
    operations to. If some new pixmap comes in and bumps it out, even once,
    it will never get a chance to re-migrate because its score will be
    maxed). Change migration-out to be the same way for symmetry, though it
    shouldn't ever affect anything.
- Fix a lot of debugging output, both in terms of printing quality, and
    completeness. The fallback debugging covers a lot more now, pointing
    out new areas for improvement. Debugging toggles are now centralized in
    exaPriv.h.
2005-09-21 10:27:53 +00:00
Eric Anholt
6a29c4cec1 Add support for hardware accelerating tiled background painting. One
example of this is the root weave, which paints slightly slower on SiS
    now in my testing. However, according to keithp some apps use this
    feature for a sort of cheap backing store, which this could help with
    significantly. While I haven't done much performance testing with it,
    it will at least rule out one possible source of terrible performance.
2005-09-21 07:43:01 +00:00
Eric Anholt
a1bcf25a1f Break EXA ABI while we still can. Add coordinates to the UploadToScreen
hook so we can upload a subset of a pixmap, and convert the current
    drivers to respect that. Use this support to directly UploadToScreen in
    exaGlyphs, providing a 47.4% +/-2.4% decrease in wall time for ls -lR
    programs/Xserver in an antialiased gnome-terminal on an M6 (n=3, caches
    hot). I would have bumped major version, only I can't tell what the
    EXA_VERSION_* is supposed to be doing as opposed to the module version.
2005-09-18 02:32:23 +00:00
Eric Anholt
074913c8a9 - Don't try to upload 0 byte-per-pixel (PICT_a1) data using
RADEONHostDataBlit.
- Disable the shortcut for switching from 3d to 3d in radeon_exa.c. It
    appears that we do need the cache flush here, thought it's not clear
    why. Disable the 2d to 2d shortcut while here, since I'm unsure of what
    we're doing. Exposed by the following bit:
- Bug #4485: Add a new routine, exaGlyphs, to handle font drawing. Glyphs
    were being accumulated in from non-migratable scratch pixmaps, causing
    the destination pixmap to move towards screen but the migration
    necessary for source never to happen, leading to abysmal performance.
    Instead, copy the scratch glyph data into a real pixmap first, then
    composite from that into the destination, allowing for migration. time
    ls -lR from programs/Xserver showed 26.9% (+/- 6.3%) decrease in wall
    time (n=3).
- Create exaDrawableUse* wrapping exaPixmapUse*, but which are aware of
    windows needing backing store. Makes migration code prettier, and
    ensures that composited windows will be migrated as normal when we turn
    off cw for EXA. (issue brought up by keithp)
2005-09-17 20:02:02 +00:00
Daniel Stone
c3d6799cee Bug #594: CAN-2005-2495: Fix exploitable integer overflow in pixmap
creation, where we could create a far smaller pixmap than we thought,
    allowing changes to arbitrary chunks of memory. (Søren Sandmann
    Pedersen)
2005-09-13 01:33:19 +00:00
Eric Anholt
1c003ccf5d Add a pair of hooks, PrepareAccess() and FinishAccess(), which get called
around CPU access to the framebuffer. This allows the hardware to set
    up swappers to deal with endianness, or to tell EXA to move the pixmap
    out to framebuffer if insufficient swappers are available (note: must
    not fail on front buffer!).
Submitted by: benh
2005-09-11 19:08:10 +00:00
Eric Anholt
0c74799af4 Remove existing broken maxX/maxY code for composite (results in infinite
loops, doesn't deal with failure, doesn't present the interface to
    drivers that I expected) and instead replace it with a simple fallback
    to software when coordinate limits could be violated. Act similarly in
    other acceleration cases as well.
The solution I want to see (and intend to do soon) is to (when necessary)
    create temporary pictures/pixmaps pointing towards the real ones' bits,
    with the offsets adjusted, then render from/to those using adjusted
    coordinates.
2005-08-30 04:41:04 +00:00
Adam Jackson
0926cf79c0 Add diagnostic messages for exaDriverInit failure cases. 2005-08-26 20:21:57 +00:00
Eric Anholt
0711502f18 Bugzilla #4226: Change the pixmap migration strategy for the CopyNtoN case.
Now, if either source or dest were in framebuffer, try to get both
    there, but prefer system memory for both otherwise. Required making
    exaasync.c go through the try-acceleration path. This significantly
    improves window resizing under composite, because previously the
    pattern of creating a new pixmap and copying default contents from the
    screen caused a fallback every time due to the new destination pixmap
    being in system memory.
2005-08-24 23:48:11 +00:00
Eric Anholt
55c5c6953a Bugzilla #4090: Introduce getters for pixmap pitch and offset, to
simplify/clarify it for driver writers who probably don't want to know
    what pPixmap->devPrivate.ptr or pPixmap->devKind mean. Converts the sis
    driver to use them, and bumps the EXA module minor version.
2005-08-24 22:43:27 +00:00
Eric Anholt
8fd250e5e4 Bugzilla #4089: Fix crashes in !EXA_OFFSCREEN_PIXMAPS case by not trying to
do migration when the EXA pixmap private is NULL.
2005-08-24 21:51:28 +00:00
Eric Anholt
ebedc8bbb5 - Fix the exa pixmap offset/pitch alignment to deal with non-POT alignment
requirements. MGA, notably, uses a multiple of 3 in some cases.
- Rename the pixmap offset/pitch alignment fields to more clearly state
    their meaning.
2005-08-14 19:46:55 +00:00
Chris Lee
cc67bd187f EXA support in the modular build. 2005-08-06 23:34:09 +00:00
Zack Rusin
3c92389185 Patch from Thomas Winischhofer to kick out all pixmaps to system ram upon a
VT switch and vice versa when returning.
2005-07-09 14:15:35 +00:00