summaryrefslogtreecommitdiff
path: root/dix/privates.c
AgeCommit message (Collapse)AuthorFilesLines
2016-09-13dix: Add dixPrivatesCreated helper functionDave Airlie1-0/+9
This is a preparation patch for adding prime hw-cursor support. Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-09-21privates: Clear screen-specific keys during CloseScreenAaron Plattner1-0/+9
The modesetting driver corrupts memory when used after a server regeneration because not enough memory is allocated for its pixmap privates. This happens because its call to dixRegisterScreenSpecificPrivateKey() does nothing because key->initialized is still TRUE from the first server generation. However, the key is not in the screen's linked list of screen-specific privates because that's freed and reallocated during the server generation loop in dix_main(). Fix this by clearing key->initialized before CloseScreen and add a call to dixFreeScreenSpecificPrivates() for GPU screens. v2: Just set key->initialized to FALSE and move dixFreeScreenSpecificPrivates() calls to after CloseScreen. v3: Move dixFreeScreenSpecificPrivates() calls back to just before CloseScreen. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2014-01-12Replace 'pointer' type with 'void *'Keith Packard1-3/+3
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-09-10dbe: Fold the window private private into the window privateAdam Jackson1-1/+0
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-07-09privates: Resize GPU screen-specific privates tooKeith Packard1-0/+5
When allocating new global privates, make sure the gpu screens get their private offsets updated. This only affects GPU screens that enumerate before the non-GPU screens, which generally requires that the related device be present when the system boots so that it can get an earlier DRM filename. Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-06dix: introduce gpu screens. (v5)Dave Airlie1-0/+4
This patch introduces gpu screens into screenInfo. It adds interfaces for adding and removing gpu screens, along with adding private fixup, block handler support, and scratch pixmap init. GPU screens have a myNum that is offset by GPU_SCREEN_OFFSET (256), this is used for logging etc. RemoveGPUScreen isn't used until "xfree86: add platform bus hotplug support". v2: no glyph pictures for GPU screens for now. v3: introduce MAXGPUSCREENS, fix return value check v4: fixup myNum when renumbering screens (ajax) v5: drop cursor privates for now. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-05privates: Allow device privates to be allocated after server startKeith Packard1-1/+21
This will permit midispcur to allocate its privates for hotplug outputs Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
2012-07-05Add screen-specific privates.Keith Packard1-77/+308
Screen-specific privates areas are only allocated for objects related to the target screen; objects allocated for other screens will not have the private space reserved. This saves memory in these objects while also allowing hot-plug screens to have additional private allocation space beyond what the core screens are using. Drivers are encouraged to switch to this mechanism as it will reduce memory usage in multi-GPU environments, but it is only required for drivers which will be loaded after the server starts, like modesetting. Objects providing screen-specific privates *must* be managed by the screen-specific private API when allocating or initializing privates so that the per-screen area can be initialized properly. The objects which support screen-specific privates are: Windows Pixmaps GCs Pictures Extending this list to include Colormaps would be possible, but require slightly more work as the default colormap is created before all colormap privates are allocated during server startup, and hence gets a bunch of special treatment. Of particular note, glyphs are *not* capable of supporting screen-specific privates as they are global objects, not allocated on a screen-specific basis, and so each driver must be able to see their privates within the glyph. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
2012-03-21Introduce a consistent coding styleKeith Packard1-141/+156
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>
2010-12-06Add fence sync driver interfaceJames Jones1-0/+1
-Add fence sync objects -Add fence sync devPrivates -Add a X sync module screen private -Add wrappable functions to create and destroy fence sync objects -Give fence sync objects wrappable functions to trigger, test, and reset their 'triggered' value. -Give fence sync objects wrappable functions to notify driver when adding/removing triggers to/ from the sync object. Signed-off-by: James Jones <jajones@nvidia.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2010-09-18Introduce per-object per-screen privates.Jamey Sharp1-13/+20
This replaces dixCreatePrivateKey and the only uses, which were in midispcur. Commit by Jamey Sharp and Josh Triplett. Signed-off-by: Jamey Sharp <jamey@minilop.net> Signed-off-by: Josh Triplett <josh@joshtriplett.org> Reviewed-by: Keith Packard <keithp@keithp.com>
2010-09-10Add screens to the PRIVATE_XSELINUX set.Eamon Walsh1-0/+1
The SELinux extension does store a security label in the screen devPrivates. Fixes crash caused by overwriting another private. Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov> Reported-by: Justin Mattock <justinmattock@gmail.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-05Add dixCreatePrivateKey APIKeith Packard1-2/+30
Keys need to persist through server reset so that the private system can be cleaned up in dixResetPrivates. In particular, this means that keys cannot live in objects freed at reset time. This API provides suitable object lifetime by having the privates code free the key in the reset path. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-06-05Change devPrivates implementation.Keith Packard1-149/+327
Each key now declares which object type it belongs to, this permits keys for different types to share the same offset within the allocated privates. As a special case for XSELinux, a key may be allocated as PRIVATE_XSELINUX which will allow it to continue to be used across the relevant object types. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-06-05Change the devPrivates API to require dixRegisterPrivateKeyKeith Packard1-19/+52
This patch only changes the API, not the implementation of the devPrivates infrastructure. This will permit a new devPrivates implementation to be layed into the server without requiring simultaneous changes in every devPrivates user. Signed-off-by: Keith Packard <keithp@keithp.com> Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2010-06-05Remove dixRegisterPrivateOffset; hard-code devPrivates offsets insteadKeith Packard1-43/+15
For predefined resource types, the offset of the devPrivates field was already kept in a constant table. The only non-predefined type needing this treatment was dbeDrawableResType, which is just a magic alias for RT_PIXMAP. This patch special-cases looking up RC_DRAWABLE offsets and uses the table directly for everything else. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-05-13Remove devPrivates init and delete callback lists.Keith Packard1-40/+0
XSELinux was the only consumer of these interfaces and it no longer needs them. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-05-13Replace X-allocation functions with their C89 counterpartsMikhail Gusarov1-8/+8
The only remaining X-functions used in server are XNF*, the rest is converted to plain alloc/calloc/realloc/free/strdup. X* functions are still exported from server and x* macros are still defined in header file, so both ABI and API are not affected by this change. Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-10-07dix: Fix a double free in dixFreePrivates.Francisco Jerez1-0/+1
It can be reproduced when the server is regenerated and for some reason the private keys are reassigned in a different order: a manually allocated private may get an index formerly used by a preallocated private. In that case it will first be manually freed and then again by dixFreePrivates, as items[i].size was never zeroed out. Do it in dixResetPrivates. Signed-off-by: Francisco Jerez <currojerez@riseup.net> Acked-by: Eamon Walsh <ewalsh@tycho.nsa.gov> Signed-off-by: Keith Packard <keithp@keithp.com>
2009-01-22Remove a bunch of useless casts.Adam Jackson1-1/+1
We've had void * for twenty years now people let's try to act like we know how it works.
2008-12-03Rework symbol visibility for easier maintenancePaulo Cesar Pereira de Andrade1-11/+11
Save in a few special cases, _X_EXPORT should not be used in C source files. Instead, it should be used in headers, and the proper C source include that header. Some special cases are symbols that need to be shared between modules, but not expected to be used by external drivers, and symbols that are accessible via LoaderSymbol/dlopen. This patch also adds conditionally some new sdk header files, depending on extensions enabled. These files were added to match pattern for other extensions/modules, that is, have the headers "deciding" symbol visibility in the sdk. These headers are: o Xext/panoramiXsrv.h, Xext/panoramiX.h o fbpict.h (unconditionally) o vidmodeproc.h o mioverlay.h (unconditionally, used only by xaa) o xfixes.h (unconditionally, symbols required by dri2) LoaderSymbol and similar functions now don't have different prototypes, in loaderProcs.h and xf86Module.h, so that both headers can be included, without the need of defining IN_LOADER. xf86NewInputDevice() device prototype readded to xf86Xinput.h, but not exported (and with a comment about it).
2008-11-29Export symbols defined in the sdk.Paulo Cesar Pereira de Andrade1-1/+1
This is the biggest "visibility" patch. Instead of doing a "export" symbol on demand, export everything in the sdk, so that if some module fails due to an unresolved symbol, it is because it is using a symbol not in the sdk. Most exported symbols shouldn't really be made visible, neither advertised in the sdk, as they are only used by a single shared object. Symbols in the sdk (or referenced in sdk macros), but not defined anywhere include: XkbBuildCoreState() XkbInitialMap XkbXIUnsupported XkbCheckActionVMods() XkbSendCompatNotify() XkbDDXFakePointerButton() XkbDDXApplyConfig() _XkbStrCaseCmp() _XkbErrMessages[] _XkbErrCode _XkbErrLocation _XkbErrData XkbAccessXDetailText() XkbNKNDetailMaskText() XkbLookupGroupAndLevel() XkbInitAtoms() XkbGetOrderedDrawables() XkbFreeOrderedDrawables() XkbConvertXkbComponents() XkbWriteXKBSemantics() XkbWriteXKBLayout() XkbWriteXKBKeymap() XkbWriteXKBFile() XkbWriteCFile() XkbWriteXKMFile() XkbWriteToServer() XkbMergeFile() XkmFindTOCEntry() XkmReadFileSection() XkmReadFileSectionName() InitExtInput() xf86CheckButton() xf86SwitchCoreDevice() RamDacSetGamma() RamDacRestoreDACValues() xf86Bpp xf86ConfigPix24 xf86MouseCflags[] xf86SupportedMouseTypes[] xf86NumMouseTypes xf86ChangeBusIndex() xf86EntityEnter() xf86EntityLeave() xf86WrapperInit() xf86RingBell() xf86findOptionBoolean() xf86debugListOptions() LoadSubModuleLocal() LoaderSymbolLocal() getInt10Rec() xf86CurrentScreen xf86ReallocatePciResources() xf86NewSerialNumber() xf86RandRSetInitialMode() fbCompositeSolidMask_nx1xn fbCompositeSolidMask_nx8888x0565C fbCompositeSolidMask_nx8888x8888C fbCompositeSolidMask_nx8x0565 fbCompositeSolidMask_nx8x0888 fbCompositeSolidMask_nx8x8888 fbCompositeSrc_0565x0565 fbCompositeSrc_8888x0565 fbCompositeSrc_8888x0888 fbCompositeSrc_8888x8888 fbCompositeSrcAdd_1000x1000 fbCompositeSrcAdd_8000x8000 fbCompositeSrcAdd_8888x8888 fbGeneration fbIn fbOver fbOver24 fbOverlayGeneration fbRasterizeEdges fbRestoreAreas fbSaveAreas composeFunctions VBEBuildVbeModeList() VBECalcVbeModeIndex() TIramdac3030CalculateMNPForClock() shadowBufPtr shadowFindBuf() miRRGetScreenInfo() RRSetScreenConfig() RRModePruneUnused() PixmanImageFromPicture() extern int miPointerGetMotionEvents() miClipPicture() miRasterizeTriangle() fbPush1toN() fbInitializeBackingStore() ddxBeforeReset() SetupSprite() InitSprite() DGADeliverEvent() SPECIAL CASES o defined as _X_INTERNAL xf86NewInputDevice() o defined as static fbGCPrivateKey fbOverlayScreenPrivateKey fbScreenPrivateKey fbWinPrivateKey o defined in libXfont.so, but declared in xorg/dixfont.h GetGlyphs() QueryGlyphExtents() QueryTextExtents() ParseGlyphCachingMode() InitGlyphCaching() SetGlyphCachingMode()
2008-09-12Array-index based devPrivates implementation.Eamon Walsh1-101/+108
Note: DevPrivateKey is now pointer-to-int, which means each key now needs to point to some global storage of size at least sizeof(int).
2008-06-13Make devPrivates lookup functions ABI instead of static inlines.Eamon Walsh1-0/+65
This is required to preserve compatibility across changes to the internal representation of the privates list.
2008-01-03devPrivates rework: Free callback lists after use.Eamon Walsh1-0/+2
2007-09-06devPrivates rework: register an offset for every resource type, useEamon Walsh1-19/+23
signed values so -1 actually works correctly, and provide a macro for adding an offset to a pointer.
2007-08-28devPrivates rework: since API is already broken, switch everythingEamon Walsh1-448/+0
over to new system. Need to update documentation and address some remaining vestiges of old system such as CursorRec structure, fb "offman" structure, and FontRec privates.
2007-08-16devPrivates rework: Nevermind, can't const due to return value warnings.Eamon Walsh1-1/+1
This reverts commit 6fd0a0b08de912421718aca17fe34a55ae285ae7.
2007-08-16devPrivates rework: add const qualifier to key type.Eamon Walsh1-1/+1
2007-08-16devPrivates rework: use camelcase standard for name of key type.Eamon Walsh1-6/+6
2007-04-17Merge branch 'master' into XACE-SELINUXEamon Walsh1-14/+14
Conflicts: dix/privates.c
2007-04-09Bug #10560: Code-Cleanup: function declarations () -> (void)Stefan Huehner1-14/+14
X.Org Bugzilla #10560: <https://bugs.freedesktop.org/show_bug.cgi?id=10560> Patch #9511 <https://bugs.freedesktop.org/attachment.cgi?id=9511>
2007-04-05devPrivates rework: minor fix; use calloc and avoid initialization.Eamon Walsh1-4/+2
2007-04-03devPrivates rework: zero out newly allocated private space.Eamon Walsh1-1/+1
2007-03-26Merge branch 'master' into XACE-SELINUXEamon Walsh1-3/+3
2007-03-08devPrivates rework: pass address of pointer to private callbacks instead ofEamon Walsh1-2/+2
the pointer itself.
2007-03-08devPrivates rework: redo field offset registration, drop RC_PRIVATES class.Eamon Walsh1-6/+10
2007-03-08devPrivates rework: redo interface again, dropping parent and type parametersEamon Walsh1-74/+15
as well as preallocation routine.
2007-03-08devPrivates rework: hook up new mechanism in backwards-compatibility modeEamon Walsh1-26/+36
on existing structures that support devPrivates.
2007-03-08dix: remove 'register' keyword for all variables.Peter Hutterer1-3/+3
2007-03-07devPrivates rework: move reset functions into a single call.Eamon Walsh1-8/+27
2007-03-07Merge branch 'master' into XACE-SELINUXEamon Walsh1-2/+0
2007-03-06remove PIXPRIV checks as this flag is always set.Eamon Walsh1-2/+0
2007-03-05devPrivates rework: remove some debugging code from dixFreePrivates.Eamon Walsh1-3/+0
2007-03-05devPrivates rework: redo interface and implementation.Eamon Walsh1-241/+192
2007-02-23devPrivates rework: add new interface implementation.Eamon Walsh1-0/+317
2006-08-21Merge branch 'XACE-modular' into my-XACE-modularEamon Walsh1-3/+0
2006-07-31Added devPrivates support to the ExtensionEntry structure.Eamon Walsh1-0/+58
2006-07-21Remove RCS tags. Fix Xprint makefile braindamage.Adam Jackson1-3/+0
2006-02-15Mark everything in dixsym.c as _X_EXPORT.Adam Jackson1-13/+13