diff options
author | marha <marha@users.sourceforge.net> | 2011-06-03 08:22:14 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-06-03 08:22:14 +0200 |
commit | 6aea3a7470dfb2c513378b82c27f0ad87afda7f3 (patch) | |
tree | cefb863bdf986b740d8f9475514df400a56ff003 /xorg-server/include/privates.h | |
parent | 5e835037510a4ccf001fb8f0a9aed29a28072fec (diff) | |
parent | cda19b1d226d565f1ca4327aeae827c621b3dfd6 (diff) | |
download | vcxsrv-6aea3a7470dfb2c513378b82c27f0ad87afda7f3.tar.gz vcxsrv-6aea3a7470dfb2c513378b82c27f0ad87afda7f3.tar.bz2 vcxsrv-6aea3a7470dfb2c513378b82c27f0ad87afda7f3.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
mesalib/configs/linux-dri
mesalib/src/gallium/auxiliary/util/u_math.h
mesalib/src/mapi/glapi/gen/Makefile
mesalib/src/mapi/glapi/glapi_mapi_tmp.h
mesalib/src/mapi/glapi/glapi_sparc.S
mesalib/src/mapi/glapi/glapi_x86-64.S
mesalib/src/mapi/glapi/glapi_x86.S
mesalib/src/mapi/glapi/glapitable.h
mesalib/src/mapi/glapi/glapitemp.h
mesalib/src/mapi/glapi/glprocs.h
mesalib/src/mesa/drivers/dri/Makefile.template
mesalib/src/mesa/main/dd.h
mesalib/src/mesa/main/fbobject.c
mesalib/src/mesa/main/remap_helper.h
mesalib/src/mesa/main/shaderapi.c
mesalib/src/mesa/main/teximage.c
mesalib/src/mesa/main/uniforms.c
mesalib/src/mesa/state_tracker/st_format.c
mesalib/src/mesa/vbo/vbo_exec_array.c
xorg-server/configure.ac
xorg-server/dix/main.c
xorg-server/dix/window.c
xorg-server/hw/xquartz/GL/indirect.c
xorg-server/hw/xquartz/X11Application.m
xorg-server/hw/xquartz/darwin.c
xorg-server/hw/xquartz/darwin.h
xorg-server/hw/xquartz/mach-startup/Makefile.am
xorg-server/hw/xquartz/pbproxy/app-main.m
xorg-server/hw/xquartz/pbproxy/pbproxy.h
xorg-server/hw/xquartz/pbproxy/x-selection.m
xorg-server/hw/xquartz/xpr/xpr.h
xorg-server/hw/xquartz/xpr/xprEvent.c
xorg-server/hw/xquartz/xpr/xprScreen.c
xorg-server/include/privates.h
xorg-server/include/protocol-versions.h
xorg-server/test/Makefile.am
xorg-server/xfixes/cursor.c
xorg-server/xfixes/xfixes.c
xorg-server/xkeyboard-config/configure.in
xorg-server/xkeyboard-config/rules/base.extras.xml.in
xorg-server/xkeyboard-config/rules/base.xml.in
xorg-server/xkeyboard-config/symbols/de
xorg-server/xkeyboard-config/symbols/lk
xorg-server/xkeyboard-config/symbols/ru
Diffstat (limited to 'xorg-server/include/privates.h')
-rw-r--r-- | xorg-server/include/privates.h | 596 |
1 files changed, 298 insertions, 298 deletions
diff --git a/xorg-server/include/privates.h b/xorg-server/include/privates.h index ec2604cab..2b0040cba 100644 --- a/xorg-server/include/privates.h +++ b/xorg-server/include/privates.h @@ -1,298 +1,298 @@ -/***********************************************************
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-******************************************************************/
-
-#ifndef PRIVATES_H
-#define PRIVATES_H 1
-
-#include <X11/Xdefs.h>
-#include <X11/Xosdefs.h>
-#include <X11/Xfuncproto.h>
-#include "misc.h"
-
-/*****************************************************************
- * STUFF FOR PRIVATES
- *****************************************************************/
-
-typedef struct _Private PrivateRec, *PrivatePtr;
-
-typedef enum {
- /* XSELinux uses the same private keys for numerous objects */
- PRIVATE_XSELINUX,
-
- /* Otherwise, you get a private in just the requested structure
- */
- /* These can have objects created before all of the keys are registered */
- PRIVATE_SCREEN,
- PRIVATE_EXTENSION,
- PRIVATE_COLORMAP,
-
- /* These cannot have any objects before all relevant keys are registered */
- PRIVATE_DEVICE,
- PRIVATE_CLIENT,
- PRIVATE_PROPERTY,
- PRIVATE_SELECTION,
- PRIVATE_WINDOW,
- PRIVATE_PIXMAP,
- PRIVATE_GC,
- PRIVATE_CURSOR,
- PRIVATE_CURSOR_BITS,
-
- /* extension privates */
- PRIVATE_DBE_WINDOW,
- PRIVATE_DAMAGE,
- PRIVATE_GLYPH,
- PRIVATE_GLYPHSET,
- PRIVATE_PICTURE,
- PRIVATE_SYNC_FENCE,
-
- /* last private type */
- PRIVATE_LAST,
-} DevPrivateType;
-
-typedef struct _DevPrivateKeyRec {
- int offset;
- int size;
- Bool initialized;
- Bool allocated;
- DevPrivateType type;
- struct _DevPrivateKeyRec *next;
-} DevPrivateKeyRec, *DevPrivateKey;
-
-typedef struct _DevScreenPrivateKeyRec {
- DevPrivateKeyRec screenKey;
-} DevScreenPrivateKeyRec, *DevScreenPrivateKey;
-
-/*
- * Let drivers know how to initialize private keys
- */
-
-#define HAS_DEVPRIVATEKEYREC 1
-#define HAS_DIXREGISTERPRIVATEKEY 1
-
-/*
- * Register a new private index for the private type.
- *
- * This initializes the specified key and optionally requests pre-allocated
- * private space for your driver/module. If you request no extra space, you
- * may set and get a single pointer value using this private key. Otherwise,
- * you can get the address of the extra space and store whatever data you like
- * there.
- *
- * You may call dixRegisterPrivateKey more than once on the same key, but the
- * size and type must match or the server will abort.
- *
- * dixRegisterPrivateKey returns FALSE if it fails to allocate memory
- * during its operation.
- */
-extern _X_EXPORT Bool
-dixRegisterPrivateKey(DevPrivateKey key, DevPrivateType type, unsigned size);
-
-/*
- * Check whether a private key has been registered
- */
-static inline Bool
-dixPrivateKeyRegistered(DevPrivateKey key)
-{
- return key->initialized;
-}
-
-/*
- * Get the address of the private storage.
- *
- * For keys with pre-defined storage, this gets the base of that storage
- * Otherwise, it returns the place where the private pointer is stored.
- */
-static inline void *
-dixGetPrivateAddr(PrivatePtr *privates, const DevPrivateKey key)
-{
- assert(key->initialized);
- return (char *) (*privates) + key->offset;
-}
-
-/*
- * Fetch a private pointer stored in the object
- *
- * Returns the pointer stored with dixSetPrivate.
- * This must only be used with keys that have
- * no pre-defined storage
- */
-static inline void *
-dixGetPrivate(PrivatePtr *privates, const DevPrivateKey key)
-{
- assert (key->size == 0);
- return *(void **) dixGetPrivateAddr(privates, key);
-}
-
-/*
- * Associate 'val' with 'key' in 'privates' so that later calls to
- * dixLookupPrivate(privates, key) will return 'val'.
- */
-static inline void
-dixSetPrivate(PrivatePtr *privates, const DevPrivateKey key, pointer val)
-{
- assert (key->size == 0);
- *(pointer *) dixGetPrivateAddr(privates, key) = val;
-}
-
-#include "dix.h"
-#include "resource.h"
-
-/*
- * Lookup a pointer to the private record.
- *
- * For privates with defined storage, return the address of the
- * storage. For privates without defined storage, return the pointer
- * contents
- */
-static inline pointer
-dixLookupPrivate(PrivatePtr *privates, const DevPrivateKey key)
-{
- if (key->size)
- return dixGetPrivateAddr(privates, key);
- else
- return dixGetPrivate(privates, key);
-}
-
-/*
- * Look up the address of the pointer to the storage
- *
- * This returns the place where the private pointer is stored,
- * which is only valid for privates without predefined storage.
- */
-static inline pointer *
-dixLookupPrivateAddr(PrivatePtr *privates, const DevPrivateKey key)
-{
- assert (key->size == 0);
- return (pointer *)dixGetPrivateAddr(privates, key);
-}
-
-extern _X_EXPORT Bool
-dixRegisterScreenPrivateKey(DevScreenPrivateKey key, ScreenPtr pScreen, DevPrivateType type, unsigned size);
-
-extern _X_EXPORT DevPrivateKey
-_dixGetScreenPrivateKey(const DevScreenPrivateKey key, ScreenPtr pScreen);
-
-static inline void *
-dixGetScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
-{
- return dixGetPrivateAddr(privates, _dixGetScreenPrivateKey(key, pScreen));
-}
-
-static inline void *
-dixGetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
-{
- return dixGetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen));
-}
-
-static inline void
-dixSetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen, pointer val)
-{
- dixSetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen), val);
-}
-
-static inline pointer
-dixLookupScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
-{
- return dixLookupPrivate(privates, _dixGetScreenPrivateKey(key, pScreen));
-}
-
-static inline pointer *
-dixLookupScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
-{
- return dixLookupPrivateAddr(privates, _dixGetScreenPrivateKey(key, pScreen));
-}
-
-/*
- * Allocates private data separately from main object.
- *
- * For objects created during server initialization, this allows those
- * privates to be re-allocated as new private keys are registered.
- *
- * This includes screens, the serverClient, default colormaps and
- * extensions entries.
- */
-extern _X_EXPORT Bool
-dixAllocatePrivates(PrivatePtr *privates, DevPrivateType type);
-
-/*
- * Frees separately allocated private data
- */
-extern _X_EXPORT void
-dixFreePrivates(PrivatePtr privates, DevPrivateType type);
-
-/*
- * Initialize privates by zeroing them
- */
-extern _X_EXPORT void
-_dixInitPrivates(PrivatePtr *privates, void *addr, DevPrivateType type);
-
-#define dixInitPrivates(o, v, type) _dixInitPrivates(&(o)->devPrivates, (v), type);
-
-/*
- * Clean up privates
- */
-extern _X_EXPORT void
-_dixFiniPrivates(PrivatePtr privates, DevPrivateType type);
-
-#define dixFiniPrivates(o,t) _dixFiniPrivates((o)->devPrivates,t)
-
-/*
- * Allocates private data at object creation time. Required
- * for almost all objects, except for the list described
- * above for dixAllocatePrivates.
- */
-extern _X_EXPORT void *
-_dixAllocateObjectWithPrivates(unsigned size, unsigned clear, unsigned offset, DevPrivateType type);
-
-#define dixAllocateObjectWithPrivates(t, type) (t *) _dixAllocateObjectWithPrivates(sizeof(t), sizeof(t), offsetof(t, devPrivates), type)
-
-extern _X_EXPORT void
-_dixFreeObjectWithPrivates(void *object, PrivatePtr privates, DevPrivateType type);
-
-#define dixFreeObjectWithPrivates(o,t) _dixFreeObjectWithPrivates(o, (o)->devPrivates, t)
-
-/*
- * Return size of privates for the specified type
- */
-extern _X_EXPORT int
-dixPrivatesSize(DevPrivateType type);
-
-/*
- * Dump out private stats to ErrorF
- */
-extern void
-dixPrivateUsage(void);
-
-/*
- * Resets the privates subsystem. dixResetPrivates is called from the main loop
- * before each server generation. This function must only be called by main().
- */
-extern _X_EXPORT void
-dixResetPrivates(void);
-
-/*
- * Looks up the offset where the devPrivates field is located.
- *
- * Returns -1 if the specified resource has no dev privates.
- * The position of the devPrivates field varies by structure
- * and calling code might only know the resource type, not the
- * structure definition.
- */
-extern _X_EXPORT int
-dixLookupPrivateOffset(RESTYPE type);
-
-/*
- * Convenience macro for adding an offset to an object pointer
- * when making a call to one of the devPrivates functions
- */
-#define DEVPRIV_AT(ptr, offset) ((PrivatePtr *)((char *)(ptr) + offset))
-
-#endif /* PRIVATES_H */
+/*********************************************************** + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#ifndef PRIVATES_H +#define PRIVATES_H 1 + +#include <X11/Xdefs.h> +#include <X11/Xosdefs.h> +#include <X11/Xfuncproto.h> +#include "misc.h" + +/***************************************************************** + * STUFF FOR PRIVATES + *****************************************************************/ + +typedef struct _Private PrivateRec, *PrivatePtr; + +typedef enum { + /* XSELinux uses the same private keys for numerous objects */ + PRIVATE_XSELINUX, + + /* Otherwise, you get a private in just the requested structure + */ + /* These can have objects created before all of the keys are registered */ + PRIVATE_SCREEN, + PRIVATE_EXTENSION, + PRIVATE_COLORMAP, + + /* These cannot have any objects before all relevant keys are registered */ + PRIVATE_DEVICE, + PRIVATE_CLIENT, + PRIVATE_PROPERTY, + PRIVATE_SELECTION, + PRIVATE_WINDOW, + PRIVATE_PIXMAP, + PRIVATE_GC, + PRIVATE_CURSOR, + PRIVATE_CURSOR_BITS, + + /* extension privates */ + PRIVATE_DBE_WINDOW, + PRIVATE_DAMAGE, + PRIVATE_GLYPH, + PRIVATE_GLYPHSET, + PRIVATE_PICTURE, + PRIVATE_SYNC_FENCE, + + /* last private type */ + PRIVATE_LAST, +} DevPrivateType; + +typedef struct _DevPrivateKeyRec { + int offset; + int size; + Bool initialized; + Bool allocated; + DevPrivateType type; + struct _DevPrivateKeyRec *next; +} DevPrivateKeyRec, *DevPrivateKey; + +typedef struct _DevScreenPrivateKeyRec { + DevPrivateKeyRec screenKey; +} DevScreenPrivateKeyRec, *DevScreenPrivateKey; + +/* + * Let drivers know how to initialize private keys + */ + +#define HAS_DEVPRIVATEKEYREC 1 +#define HAS_DIXREGISTERPRIVATEKEY 1 + +/* + * Register a new private index for the private type. + * + * This initializes the specified key and optionally requests pre-allocated + * private space for your driver/module. If you request no extra space, you + * may set and get a single pointer value using this private key. Otherwise, + * you can get the address of the extra space and store whatever data you like + * there. + * + * You may call dixRegisterPrivateKey more than once on the same key, but the + * size and type must match or the server will abort. + * + * dixRegisterPrivateKey returns FALSE if it fails to allocate memory + * during its operation. + */ +extern _X_EXPORT Bool +dixRegisterPrivateKey(DevPrivateKey key, DevPrivateType type, unsigned size); + +/* + * Check whether a private key has been registered + */ +static inline Bool +dixPrivateKeyRegistered(DevPrivateKey key) +{ + return key->initialized; +} + +/* + * Get the address of the private storage. + * + * For keys with pre-defined storage, this gets the base of that storage + * Otherwise, it returns the place where the private pointer is stored. + */ +static inline void * +dixGetPrivateAddr(PrivatePtr *privates, const DevPrivateKey key) +{ + assert(key->initialized); + return (char *) (*privates) + key->offset; +} + +/* + * Fetch a private pointer stored in the object + * + * Returns the pointer stored with dixSetPrivate. + * This must only be used with keys that have + * no pre-defined storage + */ +static inline void * +dixGetPrivate(PrivatePtr *privates, const DevPrivateKey key) +{ + assert (key->size == 0); + return *(void **) dixGetPrivateAddr(privates, key); +} + +/* + * Associate 'val' with 'key' in 'privates' so that later calls to + * dixLookupPrivate(privates, key) will return 'val'. + */ +static inline void +dixSetPrivate(PrivatePtr *privates, const DevPrivateKey key, pointer val) +{ + assert (key->size == 0); + *(pointer *) dixGetPrivateAddr(privates, key) = val; +} + +#include "dix.h" +#include "resource.h" + +/* + * Lookup a pointer to the private record. + * + * For privates with defined storage, return the address of the + * storage. For privates without defined storage, return the pointer + * contents + */ +static inline pointer +dixLookupPrivate(PrivatePtr *privates, const DevPrivateKey key) +{ + if (key->size) + return dixGetPrivateAddr(privates, key); + else + return dixGetPrivate(privates, key); +} + +/* + * Look up the address of the pointer to the storage + * + * This returns the place where the private pointer is stored, + * which is only valid for privates without predefined storage. + */ +static inline pointer * +dixLookupPrivateAddr(PrivatePtr *privates, const DevPrivateKey key) +{ + assert (key->size == 0); + return (pointer *)dixGetPrivateAddr(privates, key); +} + +extern _X_EXPORT Bool +dixRegisterScreenPrivateKey(DevScreenPrivateKey key, ScreenPtr pScreen, DevPrivateType type, unsigned size); + +extern _X_EXPORT DevPrivateKey +_dixGetScreenPrivateKey(const DevScreenPrivateKey key, ScreenPtr pScreen); + +static inline void * +dixGetScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen) +{ + return dixGetPrivateAddr(privates, _dixGetScreenPrivateKey(key, pScreen)); +} + +static inline void * +dixGetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen) +{ + return dixGetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen)); +} + +static inline void +dixSetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen, pointer val) +{ + dixSetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen), val); +} + +static inline pointer +dixLookupScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen) +{ + return dixLookupPrivate(privates, _dixGetScreenPrivateKey(key, pScreen)); +} + +static inline pointer * +dixLookupScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen) +{ + return dixLookupPrivateAddr(privates, _dixGetScreenPrivateKey(key, pScreen)); +} + +/* + * Allocates private data separately from main object. + * + * For objects created during server initialization, this allows those + * privates to be re-allocated as new private keys are registered. + * + * This includes screens, the serverClient, default colormaps and + * extensions entries. + */ +extern _X_EXPORT Bool +dixAllocatePrivates(PrivatePtr *privates, DevPrivateType type); + +/* + * Frees separately allocated private data + */ +extern _X_EXPORT void +dixFreePrivates(PrivatePtr privates, DevPrivateType type); + +/* + * Initialize privates by zeroing them + */ +extern _X_EXPORT void +_dixInitPrivates(PrivatePtr *privates, void *addr, DevPrivateType type); + +#define dixInitPrivates(o, v, type) _dixInitPrivates(&(o)->devPrivates, (v), type); + +/* + * Clean up privates + */ +extern _X_EXPORT void +_dixFiniPrivates(PrivatePtr privates, DevPrivateType type); + +#define dixFiniPrivates(o,t) _dixFiniPrivates((o)->devPrivates,t) + +/* + * Allocates private data at object creation time. Required + * for almost all objects, except for the list described + * above for dixAllocatePrivates. + */ +extern _X_EXPORT void * +_dixAllocateObjectWithPrivates(unsigned size, unsigned clear, unsigned offset, DevPrivateType type); + +#define dixAllocateObjectWithPrivates(t, type) (t *) _dixAllocateObjectWithPrivates(sizeof(t), sizeof(t), offsetof(t, devPrivates), type) + +extern _X_EXPORT void +_dixFreeObjectWithPrivates(void *object, PrivatePtr privates, DevPrivateType type); + +#define dixFreeObjectWithPrivates(o,t) _dixFreeObjectWithPrivates(o, (o)->devPrivates, t) + +/* + * Return size of privates for the specified type + */ +extern _X_EXPORT int +dixPrivatesSize(DevPrivateType type); + +/* + * Dump out private stats to ErrorF + */ +extern void +dixPrivateUsage(void); + +/* + * Resets the privates subsystem. dixResetPrivates is called from the main loop + * before each server generation. This function must only be called by main(). + */ +extern _X_EXPORT void +dixResetPrivates(void); + +/* + * Looks up the offset where the devPrivates field is located. + * + * Returns -1 if the specified resource has no dev privates. + * The position of the devPrivates field varies by structure + * and calling code might only know the resource type, not the + * structure definition. + */ +extern _X_EXPORT int +dixLookupPrivateOffset(RESTYPE type); + +/* + * Convenience macro for adding an offset to an object pointer + * when making a call to one of the devPrivates functions + */ +#define DEVPRIV_AT(ptr, offset) ((PrivatePtr *)((char *)(ptr) + offset)) + +#endif /* PRIVATES_H */ |