2007-02-23 19:19:53 +01:00
|
|
|
/***********************************************************
|
|
|
|
|
|
|
|
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 "dix.h"
|
|
|
|
#include "resource.h"
|
|
|
|
|
|
|
|
/*****************************************************************
|
|
|
|
* STUFF FOR PRIVATES
|
|
|
|
*****************************************************************/
|
|
|
|
|
2008-09-13 01:11:53 +02:00
|
|
|
typedef int *DevPrivateKey;
|
2008-06-13 22:39:40 +02:00
|
|
|
struct _Private;
|
|
|
|
typedef struct _Private PrivateRec;
|
2007-03-01 21:00:02 +01:00
|
|
|
|
2007-02-23 19:19:53 +01:00
|
|
|
/*
|
2010-04-28 21:37:08 +02:00
|
|
|
* Request pre-allocated private space for your driver/module. This function
|
|
|
|
* increases the amount of space allocated automatically when dixLookupPrivate
|
|
|
|
* is called on a PrivateRec that does not yet have a value associated with
|
|
|
|
* 'key'.
|
|
|
|
*
|
|
|
|
* This function will only increase the reserved size: if a size was previously
|
|
|
|
* requested, then dixRequestPrivate causes later calls to dixLookupPrivate to
|
|
|
|
* allocate the maximum of the old size and 'size'. Requested sizes are reset
|
|
|
|
* to 0 by dixResetPrivates, which is called before each server generation.
|
|
|
|
*
|
|
|
|
* If dixRequestPrivate is not called with a nonzero size for 'key', then the
|
|
|
|
* module responsible for 'key' must manage the associated pointer itself with
|
|
|
|
* dixSetPrivate.
|
|
|
|
*
|
|
|
|
* dixRequestPrivate returns FALSE if it cannot store the requested size.
|
2007-02-23 19:19:53 +01:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
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-12-03 08:43:34 +01:00
|
|
|
extern _X_EXPORT int
|
2007-08-16 21:30:25 +02:00
|
|
|
dixRequestPrivate(const DevPrivateKey key, unsigned size);
|
2007-02-23 19:19:53 +01:00
|
|
|
|
|
|
|
/*
|
2010-04-28 21:37:08 +02:00
|
|
|
* Allocates space for an association of 'key' with a value in 'privates'.
|
|
|
|
*
|
|
|
|
* If a nonzero size was requested with dixRequestPrivate, then
|
|
|
|
* dixAllocatePrivate also allocates the requested amount of memory and
|
|
|
|
* associates the pointer to that memory with 'key' in 'privates'. The
|
|
|
|
* allocated memory is initialized to zero. This memory can only be freed by
|
|
|
|
* dixFreePrivates.
|
|
|
|
*
|
|
|
|
* If dixRequestPrivate was never called with a nonzero size, then
|
|
|
|
* dixAllocatePrivate associates NULL with 'key' in 'privates'.
|
|
|
|
*
|
|
|
|
* dixAllocatePrivate returns a pointer to the value associated with 'key' in
|
|
|
|
* 'privates', unless a memory allocation fails, in which case it returns NULL.
|
2007-02-23 19:19:53 +01:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
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-12-03 08:43:34 +01:00
|
|
|
extern _X_EXPORT pointer *
|
2007-08-16 21:30:25 +02:00
|
|
|
dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key);
|
2007-02-23 19:19:53 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Look up a private pointer.
|
2010-04-28 21:37:08 +02:00
|
|
|
*
|
|
|
|
* If no value is currently associated with 'key' in 'privates', then
|
|
|
|
* dixLookupPrivate calls dixAllocatePrivate and returns the resulting
|
|
|
|
* associated value.
|
|
|
|
*
|
|
|
|
* dixLookupPrivate returns NULL if a memory allocation fails.
|
2007-02-23 19:19:53 +01:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
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-12-03 08:43:34 +01:00
|
|
|
extern _X_EXPORT pointer
|
2008-06-13 22:39:40 +02:00
|
|
|
dixLookupPrivate(PrivateRec **privates, const DevPrivateKey key);
|
2007-03-01 21:00:02 +01:00
|
|
|
|
|
|
|
/*
|
2010-04-28 21:37:08 +02:00
|
|
|
* Look up the address of a private pointer. If 'key' is not associated with a
|
|
|
|
* value in 'privates', then dixLookupPrivateAddr calls dixAllocatePrivate and
|
|
|
|
* returns a pointer to the resulting associated value.
|
|
|
|
*
|
|
|
|
* dixLookupPrivateAddr returns NULL if 'key' was not previously associated in
|
|
|
|
* 'privates' and a memory allocation fails.
|
2007-03-01 21:00:02 +01:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
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-12-03 08:43:34 +01:00
|
|
|
extern _X_EXPORT pointer *
|
2008-06-13 22:39:40 +02:00
|
|
|
dixLookupPrivateAddr(PrivateRec **privates, const DevPrivateKey key);
|
2007-03-01 21:00:02 +01:00
|
|
|
|
|
|
|
/*
|
2010-04-28 21:37:08 +02:00
|
|
|
* Associate 'val' with 'key' in 'privates' so that later calls to
|
|
|
|
* dixLookupPrivate(privates, key) will return 'val'.
|
|
|
|
*
|
|
|
|
* dixSetPrivate returns FALSE if a memory allocation fails.
|
2007-03-01 21:00:02 +01:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
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-12-03 08:43:34 +01:00
|
|
|
extern _X_EXPORT int
|
2008-06-13 22:39:40 +02:00
|
|
|
dixSetPrivate(PrivateRec **privates, const DevPrivateKey key, pointer val);
|
2007-02-23 19:19:53 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Register callbacks to be called on private allocation/freeing.
|
|
|
|
* The calldata argument to the callbacks is a PrivateCallbackPtr.
|
|
|
|
*/
|
|
|
|
typedef struct _PrivateCallback {
|
2007-08-16 22:10:44 +02:00
|
|
|
DevPrivateKey key; /* private registration key */
|
2007-08-16 21:30:25 +02:00
|
|
|
pointer *value; /* address of private pointer */
|
2007-03-01 21:00:02 +01:00
|
|
|
} PrivateCallbackRec;
|
2007-02-23 19:19:53 +01:00
|
|
|
|
2010-04-28 21:37:08 +02:00
|
|
|
/*
|
|
|
|
* Register a function to be called when dixAllocPrivate successfully associates
|
|
|
|
* 'key' with a new PrivateRec.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
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-12-03 08:43:34 +01:00
|
|
|
extern _X_EXPORT int
|
2007-08-16 21:30:25 +02:00
|
|
|
dixRegisterPrivateInitFunc(const DevPrivateKey key,
|
2007-02-23 19:19:53 +01:00
|
|
|
CallbackProcPtr callback, pointer userdata);
|
|
|
|
|
2010-04-28 21:37:08 +02:00
|
|
|
/*
|
|
|
|
* Register a function to be called when dixFreePrivates unassociates 'key' with
|
|
|
|
* a PrivateRec.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
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-12-03 08:43:34 +01:00
|
|
|
extern _X_EXPORT int
|
2007-08-16 21:30:25 +02:00
|
|
|
dixRegisterPrivateDeleteFunc(const DevPrivateKey key,
|
2007-02-23 19:19:53 +01:00
|
|
|
CallbackProcPtr callback, pointer userdata);
|
|
|
|
|
|
|
|
/*
|
2010-04-28 21:37:08 +02:00
|
|
|
* Unassociates all keys from 'privates', calls the callbacks registered with
|
|
|
|
* dixRegisterPrivateDeleteFunc, and frees all private data automatically
|
|
|
|
* allocated via dixRequestPrivate.
|
2007-02-23 19:19:53 +01:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
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-12-03 08:43:34 +01:00
|
|
|
extern _X_EXPORT void
|
2007-03-01 21:00:02 +01:00
|
|
|
dixFreePrivates(PrivateRec *privates);
|
2007-02-23 19:19:53 +01:00
|
|
|
|
2007-03-01 21:00:02 +01:00
|
|
|
/*
|
2010-04-28 21:37:08 +02:00
|
|
|
* Resets the privates subsystem. dixResetPrivates is called from the main loop
|
|
|
|
* before each server generation. This function must only be called by main().
|
2007-03-01 21:00:02 +01:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
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-12-03 08:43:34 +01:00
|
|
|
extern _X_EXPORT int
|
2007-03-01 21:00:02 +01:00
|
|
|
dixResetPrivates(void);
|
2007-02-23 19:19:53 +01:00
|
|
|
|
2007-03-01 21:00:02 +01:00
|
|
|
/*
|
|
|
|
* These next two functions are necessary because the position of
|
|
|
|
* the devPrivates field varies by structure and calling code might
|
|
|
|
* only know the resource type, not the structure definition.
|
|
|
|
*/
|
2007-02-23 19:19:53 +01:00
|
|
|
|
2007-03-01 21:00:02 +01:00
|
|
|
/*
|
2007-03-08 18:13:36 +01:00
|
|
|
* Looks up the offset where the devPrivates field is located.
|
|
|
|
* Returns -1 if no offset has been registered for the resource type.
|
2007-03-01 21:00:02 +01:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
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-12-03 08:43:34 +01:00
|
|
|
extern _X_EXPORT int
|
2007-03-01 21:00:02 +01:00
|
|
|
dixLookupPrivateOffset(RESTYPE type);
|
2007-02-23 19:19:53 +01:00
|
|
|
|
2007-03-01 21:00:02 +01:00
|
|
|
/*
|
|
|
|
* Specifies the offset where the devPrivates field is located.
|
2007-09-06 22:55:51 +02:00
|
|
|
* A negative value indicates no devPrivates field is available.
|
2007-03-01 21:00:02 +01:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
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-12-03 08:43:34 +01:00
|
|
|
extern _X_EXPORT int
|
2007-09-06 22:55:51 +02:00
|
|
|
dixRegisterPrivateOffset(RESTYPE type, int offset);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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) ((PrivateRec **)((char *)ptr + offset))
|
2007-02-23 19:19:53 +01:00
|
|
|
|
|
|
|
#endif /* PRIVATES_H */
|