summaryrefslogtreecommitdiff
path: root/exa/exa_mixed.c
AgeCommit message (Collapse)AuthorFilesLines
2014-01-12Replace 'pointer' type with 'void *'Keith Packard1-2/+2
This lets us stop using the 'pointer' typedef in Xdefs.h as 'pointer' is used throughout the X server for other things, and having duplicate names generates compiler warnings. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2013-10-14Skip damage calls if DamageCreate fails in exa functionsAlan Coopersmith1-4/+7
Fixes parfait errors such as: Null pointer dereference (CWE 476): Write to null pointer pDamage at line 1833 of miext/damage/damage.c in function 'DamageRegister'. Function DamageCreate may return constant 'NULL' at line 1775, called at line 232 of exa/exa_migration_mixed.c in function 'exaPrepareAccessReg_mixed'. Constant 'NULL' passed into function DamageRegister, argument pDamage, from call at line 237. Null pointer introduced at line 1775 of miext/damage/damage.c in function 'DamageCreate'. Null pointer dereference (CWE 476): Write to null pointer pDamage at line 1833 of miext/damage/damage.c in function 'DamageRegister'. Function DamageCreate may return constant 'NULL' at line 1775, called at line 104 of exa/exa_mixed.c in function 'exaCreatePixmap_mixed'. Constant 'NULL' passed into function DamageRegister, argument pDamage, from call at line 109. Null pointer introduced at line 1775 of miext/damage/damage.c in function 'DamageCreate'. Checks are similar to handling results of other calls to DamageCreate. [ This bug was found by the Parfait 1.3.0 bug checking tool. http://labs.oracle.com/pls/apex/f?p=labs:49:::::P49_PROJECT_ID:13 ] Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-09-10damage: Implicitly unregister on destroyAdam Jackson1-2/+0
There's no reason not to, and it simplifies quite a few callers. Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-07-07exa: pixmap sharing infrastructure (v3)Dave Airlie1-0/+33
This just adds exa interfaces for mixed exa so drivers can share and set shared pixmaps up correctly. v2: update for passing slave screen. v3: update for void * Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-03-21Introduce a consistent coding styleKeith Packard1-109/+112
This is strictly the application of the script 'x-indent-all.sh' from util/modular. Compared to the patch that Daniel posted in January, I've added a few indent flags: -bap -psl -T PrivatePtr -T pmWait -T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT The typedefs were needed to make the output of sdksyms.sh match the previous output, otherwise, the code is formatted badly enough that sdksyms.sh generates incorrect output. The generated code was compared with the previous version and found to be essentially identical -- "assert" line numbers and BUILD_TIME were the only differences found. The comparison was done with this script: dir1=$1 dir2=$2 for dir in $dir1 $dir2; do (cd $dir && find . -name '*.o' | while read file; do dir=`dirname $file` base=`basename $file .o` dump=$dir/$base.dump objdump -d $file > $dump done) done find $dir1 -name '*.dump' | while read dump; do otherdump=`echo $dump | sed "s;$dir1;$dir2;"` diff -u $dump $otherdump done Signed-off-by: Keith Packard <keithp@keithp.com> Acked-by: Daniel Stone <daniel@fooishbar.org> Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-08-10EXA/mixed: Update sys_pitch in MPH even when there's no system memory copy.Michel Dänzer1-10/+13
Otherwise sys_pitch will be stale when a system memory copy is allocated. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=38322 and a crash when unlocking the screen with xscreensaver, reported by Janne Huttunen. Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Tested-by: Janne Huttunen <jahuttun@gmail.com> Tested-by: Jan Kriho <Erbureth@gmail.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2011-06-30Fix UTF-8 encodingMatěj Cepl1-1/+1
Report to find out all non-UTF-8 files created by cat extensions |xargs -I XXXX find . -name \*.XXXX |while read FILE ; do if ( iconv -f utf8 -t ucs2 $FILE >/dev/null 2>/dev/null ) ; then /bin/true else echo $FILE fi done >>report Signed-off-by: Matěj Cepl <mcepl@redhat.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> [Daniel: git am failed for me, so I redid it. The method listed in the commit message also failed, so I just used file/grep/iconv. The results are the same though.] Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-17Revert "dix: Remove usage_hint from pixmaps, store it in ->drawable.class"Keith Packard1-2/+2
This reverts commit 1564c82417d201de5b9a5ec5e7aa4ef14c45fbad. The drivers used the top bits of the usage_hint to store driver private flags (intel, radeon, nouveau). With EXA we need to get at this data so if we migrate the pixmap we can create the correct type of pixmap in the driver, however this commit truncates the usage_hint into 8-bit class and loses all the good stuff. Signed-off-by: Dave Airlie <airlied@gmail.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2011-03-08dix: Remove usage_hint from pixmaps, store it in ->drawable.classAdam Jackson1-2/+2
The class field was unused for pixmaps, and we don't have enough classes to justify a whole uint32 anyway. Reviewed-by: Soren Sandmann <ssp@redhat.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-02-24EXA/mixed: ModifyPixmapHeader pitch fixes. (bug #33929)Michel Dänzer1-4/+5
If there's a GPU copy and a non-zero devKind was passed in, set the GPU copy pitch to that instead of to a possibly bogus value derived from the new width. This is e.g. used by the radeon driver's drmmode_xf86crtc_resize hook, fixes https://bugs.freedesktop.org/show_bug.cgi?id=33929 . On the other hand, the system memory copy doesn't need the pitch to be aligned beyond the PixmapBytePad of the width. Signed-off-by: Michel Dänzer <daenzer@vmware.com> Acked-by: Cyril Brulebois <kibi@debian.org> Tested-by: Cyril Brulebois <kibi@debian.org> Reported-by: Thierry Vignaud <thierry.vignaud@gmail.com> Tested-by: Thierry Vignaud <thierry.vignaud@gmail.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2011-01-06EXA: Pad size of system memory copy for 1x1 pixmaps (bug #32803).Michel Dänzer1-1/+1
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=32803 . Signed-off-by: Michel Dänzer <daenzer@vmware.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-07-13EXA: Finish access to pixmap if it's prepared at destruction time.Michel Dänzer1-3/+1
Previously we assumed every pixmap destroyed during a software fallback was also created during a software fallback and had access prepared, but that's not always true. Fixes a server abort Reported-by: 邓逸昕 <bupt.dengyixin@gmail.com> Signed-off-by: Michel Dänzer <daenzer@vmware.com> Acked-by: Maarten Maathuis <madman2003@gmail.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-06Remove more superfluous if(p) checks around free(p)Mikhail Gusarov1-2/+1
This patch has been generated by the following Coccinelle semantic patch: @@ expression E; @@ -if(E) { free(E); } +free(E); Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Fernando Carrijo <fcarrijo@yahoo.com.br> Reviewed-by: Matt Turner <mattst88@gmail.com>
2010-06-05Rename region macros to eliminate screen argumentKeith Packard1-2/+2
This is a combination of a huge mechanical patch and a few small fixups required to finish the job. They were reviewed separately, but because the server does not build without both pieces, I've merged them together at this time. The mechanical changes were performed by running the included 'fix-region' script over the whole tree: $ git ls-files | grep -v '^fix-' | xargs ./fix-region And then, the white space errors in the resulting patch were fixed using the provided fix-patch-whitespace script. $ sh ./fix-patch-whitespace Thanks to Jamey Sharp for the mighty fine sed-generating sed script. The hand-done changes involve removing functions from dix/region.c that duplicate inline functions in include/regionstr.h, along with their declarations in regionstr.h, mi.h and mispans.h. Reviewed-by: Jamey Sharp <jamey@minilop.net> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-04-21exa: check for NULL pointer before dereferences itTiago Vignatti1-1/+2
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Acked-by: Michel Dänzer <michel@daenzer.net> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2009-12-29EXA/mixed: Handle results of software fallbacks in DamageReport hook.Michel Dänzer1-1/+1
This is more elegant and probably also slightly more correct than doing it at FinishAccess time. Signed-off-by: Michel Dänzer <daenzer@vmware.com> Acked-by: Maarten Maathuis <madman2003@gmail.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2009-12-29EXA: Fix migration avoidance for 1x1 pixmaps.Michel Dänzer1-1/+17
Signed-off-by: Michel Dänzer <daenzer@vmware.com> Acked-by: Maarten Maathuis <madman2003@gmail.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2009-12-10EXA/mixed: Don't consider devKind for detecting dimension change.Michel Dänzer1-1/+0
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=25536 . There should be no reason for the pitch to actually change when none of the other dimensions do, and this could lead to incorrectly freeing the system memory copy when allocating a GPU copy, resulting in loss of valid pixmap contents. Signed-off-by: Michel Dänzer <daenzer@vmware.com> Acked-by: Maarten Maathuis <madman2003@gmail.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2009-12-08EXA: ModifyPixmapHeader_mixed fixes.Michel Dänzer1-3/+40
* Better detection of dimension changes. * Make sure to re-create the system memory copy when the pixmap dimensions change (e.g. the screen pixmap on screen resize). * Clear the valid regions. Signed-off-by: Michel Dänzer <daenzer@vmware.com> Acked-by: Maarten Maathuis <madman2003@gmail.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2009-11-28exa: s/PixmapIsOffscreen/PixmapHasGpuCopy and ↵Maarten Maathuis1-8/+8
s/pExaPixmap->offscreen/pExaPixmap->use_gpu_copy - Fixup some variable names as well. Signed-off-by: Maarten Maathuis <madman2003@gmail.com> Acked-by: Michel Dänzer <michel@daenzer.net> Signed-off-by: Keith Packard <keithp@keithp.com>
2009-11-28exa: handle pixmap create/destroy in lower layersMaarten Maathuis1-0/+8
- Pixmaps that are created during a fallback are automatically prepared access. - During the fallback accelerated ops are blocked to prevent new/scratch gc's from triggering accelerated ops on mapped pixmaps. - A few cases of incorrect wrapping (on the top level pointer instead of between damage and (w)fb) have been removed. Signed-off-by: Maarten Maathuis <madman2003@gmail.com> Acked-by: Michel Dänzer <michel@daenzer.net> Signed-off-by: Keith Packard <keithp@keithp.com>
2009-11-02exa: remove some outdated commentMaarten Maathuis1-4/+0
- This comment is still in exa_driver.c and there it makes sense. Signed-off-by: Maarten Maathuis <madman2003@gmail.com> Acked-by: Michel Dänzer <michel@daenzer.net> Signed-off-by: Keith Packard <keithp@keithp.com>
2009-09-26EXA: Try to minimize UploadToScreen calls for mixed pixmaps.Michel Dänzer1-0/+3
If there are several software fallbacks affecting the system memory copy of the same pixmap, only copy the results back to the driver pixmap when it's used for acceleration again, or in the BlockHandler, whichever happens first.
2009-09-26EXA: Extend mixed pixmaps scheme to allow driver PrepareAccess hook to fail.Michel Dänzer1-52/+35
If the PrepareAccess hook fails, use the DownloadFromScreen hook to retrieve driver pixmap contents to a system RAM copy, perform software rendering on that and copy the results back using the UploadToScreen hook. Use the classic migration logic to minimize transfers (which as a bonus allows slightly cleaning up some of the existing mixed pixmap code). This enables things that weren't possible before with driver-allocated pixmap storage: If some (or all) GPU pixmap storage can't be mapped directly by the CPU, this can be handled between the PrepareAccess and DownloadFrom/UploadToScreen hooks, e.g.: * Radeon KMS on big endian machines can fail PrepareAccess if the pixmap requires byte-swapping and swap bytes in DownloadFrom/UploadToScreen. * Environments where GPU and CPU don't have a shared address space at all. Here the driver PrepareAccess hook will always fail and leave all transfers between GPU / CPU storage to the Download/From/UploadToScreen hooks. Drivers which can handle all pixmaps in the PrepareAccess hook should notice little if any difference.
2009-09-23EXA: Fix some issues pointed out by clang.Michel Dänzer1-3/+1
Remove dead variables, fix use of uninitialized values, that kind of thing.
2009-09-03EXA: Preserve pPixmap->devPrivate.ptr in exaPixmapIsOffscreen_mixed.Michel Dänzer1-1/+3
Otherwise we may incorrectly clobber it to NULL on repeated PrepareAccess calls.
2009-08-08exa: more safetyMaarten Maathuis1-0/+1
2009-08-08exa: minor cleanupMaarten Maathuis1-10/+9
2009-08-07exa: fix a potential loophole in "mixed"Maarten Maathuis1-11/+13
- Always free sys_ptr before setting the pixmap to pinned.
2009-08-06exa: delay malloc for "mixed"Maarten Maathuis1-9/+2
2009-08-06exa: Use damage to optimise away useless copies.Maarten Maathuis1-1/+26
2009-08-06exa: A simple 3rd backend implementation.Maarten Maathuis1-0/+229
- Based on driver pixmaps with some changes (completely transparent to driver). - It helps with the problem of known software fallbacks, such as trapezoids. - exaDoMigration is now called for all cases that provide a do_migration hook. - exa_migration.c is renamed to exa_migration_classic.c