diff options
author | Ian Romanick <[email protected]> | 2005-07-26 02:44:01 +0000 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2005-07-26 02:44:01 +0000 |
commit | 5f1ba3e21b62cee1a4f900a2e6964728f3eeea9b (patch) | |
tree | 986059d9e958763f9663c78a92313db2c3579269 /include/GL/internal/dri_interface.h | |
parent | 1201348a337aa00a85b6bc6dec4963cfc5898e77 (diff) |
Fixes the glXGetProcAddress portion of the interface. Most of the functions
that are currently obtained via glXGetProcAddress and all of the XF86DRI
functions are replaced with a funciton table. This table will be passed to
__driCreateNewScreen.
One of the functions in the table is getProcAddress. This allows some
loaders to expose functionality not in all loaders. This will be immediatly
used for glxEnableExtension (formerly known to drivers as
__glXScrEnableExtension). libGL (and in the future libglx) expose this
function so that drivers can enable GLX extensions. libEGL should exposed
eglEnableExtension to enable EGL extensions. The same function cannot be
used for both because the extensions have different names and (possibly)
different semantics. Drivers can optionally use one, both, or neither.
The key parts are in the __DRIinterfaceMethodsRec structure in
dri_interface.h. A pointer to one of these structures is passed into
__driCreateNewScreen. Because of this, the version of the API is bumped to
20050725. Since the previous version(s) were never in a release, their
existance is erased.
I was actually a little surprised by how much code this cuts from the
drivers. A lot of glXGetProcAddress calls disappear, and a lot of
version checks go with them. Nice.
The one thing I'm not sure of is removing __glXInitialize. For some
reason that function was in the glXGetProcAddress table, but *nothing*
in the Mesa tree used it. Did something with DRI conf. use this
function? It seems odd...
Diffstat (limited to 'include/GL/internal/dri_interface.h')
-rw-r--r-- | include/GL/internal/dri_interface.h | 160 |
1 files changed, 112 insertions, 48 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index e5c5a7759d1..1b1aeba55f9 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -62,6 +62,7 @@ typedef struct __DRIdrawableRec __DRIdrawable; typedef struct __DRIdriverRec __DRIdriver; typedef struct __DRIframebufferRec __DRIframebuffer; typedef struct __DRIversionRec __DRIversion; +typedef struct __DRIinterfaceMethodsRec __DRIinterfaceMethods; typedef unsigned long __DRIid; typedef void __DRInativeDisplay; /*@}*/ @@ -74,38 +75,6 @@ typedef void __DRInativeDisplay; extern __DRIscreen *__glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn); -/** - * Type of a pointer to \c __glXGetInternalVersion, as returned by - * \c glXGetProcAddress. - * - * \sa __glXGetInternalVersion, glXGetProcAddress - */ -typedef int (* PFNGLXGETINTERNALVERSIONPROC) ( void ); - -/** - * Type of a pointer to \c __glXWindowExists, as returned by - * \c glXGetProcAddress. - * - * \sa __glXWindowExists, glXGetProcAddress - */ -typedef GLboolean (* PFNGLXWINDOWEXISTSPROC) (__DRInativeDisplay *dpy, __DRIid draw); - -/** - * Type of a pointer to \c __glXGetUST, as returned by \c glXGetProcAddress. - * - * \sa __glXGetUST, glXGetProcAddress - */ -typedef int (* PFNGLXGETUSTPROC) ( int64_t * ust ); - -/** - * Type of pointer to \c __glXCreateContextModes, as returned by - * \c glXGetProcAddress. - * - * \sa _gl_context_modes_create, glXGetProcAddress - */ - -typedef __GLcontextModes * (* PFNGLXCREATECONTEXTMODES) ( unsigned count, - size_t minimum_bytes_per_struct ); /** * Type of a pointer to \c glXGetScreenDriver, as returned by @@ -135,19 +104,6 @@ typedef const char * (* PFNGLXGETDRIVERCONFIGPROC) (const char *driverName); */ typedef void (* PFNGLXSCRENABLEEXTENSIONPROC) ( void *psc, const char * name ); -/** - * Type of a pointer to \c __glXGetDrawableInfo, as returned by - * \c glXGetProcAddress. This function is used to get information about the - * position, size, and clip rects of a drawable. - * - * \sa __glXGetDrawableInfo, glXGetProcAddress - */ -typedef GLboolean (* PFNGLXGETDRAWABLEINFOPROC) ( __DRInativeDisplay *dpy, int scrn, - __DRIid draw, unsigned int * index, unsigned int * stamp, - int * x, int * y, int * width, int * height, - int * numClipRects, drm_clip_rect_t ** pClipRects, - int * backX, int * backY, - int * numBackClipRects, drm_clip_rect_t ** pBackClipRects ); /* Test for the xf86dri.h header file */ #ifndef _XF86DRI_H_ @@ -173,9 +129,10 @@ typedef void *(CREATENEWSCREENFUNC)(__DRInativeDisplay *dpy, int scrn, const __DRIversion * ddx_version, const __DRIversion * dri_version, const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer, void * pSAREA, int fd, int internal_api_version, + const __DRIinterfaceMethods * interface, __GLcontextModes ** driver_modes); typedef CREATENEWSCREENFUNC* PFNCREATENEWSCREENFUNC; -extern CREATENEWSCREENFUNC __driCreateNewScreen_20050722; +extern CREATENEWSCREENFUNC __driCreateNewScreen_20050725; /** @@ -202,6 +159,113 @@ struct __DRIversionRec { int patch; /**< Patch-level. */ }; + +typedef void (*__DRIfuncPtr)(void); + +struct __DRIinterfaceMethodsRec { + /** + * Get pointer to named function. + */ + __DRIfuncPtr (*getProcAddress)( const char * proc_name ); + + /** + * Create a list of \c __GLcontextModes structures. + */ + __GLcontextModes * (*createContextModes)(unsigned count, + size_t minimum_bytes_per_struct); + + /** + * Destroy a list of \c __GLcontextModes structures. + * + * \todo + * Determine if the drivers actually need to call this. + */ + void (*destroyContextModes)( __GLcontextModes * modes ); + + /** + * Get the \c __DRIscreen for a given display and screen number. + */ + __DRIscreen *(*getScreen)(__DRInativeDisplay *dpy, int screenNum); + + + /** + * \name Client/server protocol functions. + * + * These functions implement the DRI client/server protocol for + * context and drawable operations. Platforms that do not implement + * the wire protocol (e.g., EGL) will implement glorified no-op functions. + */ + /*@{*/ + /** + * Determine if the specified window ID still exists. + * + * \note + * Implementations may assume that the driver will only pass an ID into + * this function that actually corresponds to a window. On + * implementations where windows can only be destroyed by the DRI driver + * (e.g., EGL), this function is allowed to always return \c GL_TRUE. + */ + GLboolean (*windowExists)(__DRInativeDisplay *dpy, __DRIid draw); + + /** + * Create the server-side portion of the GL context. + */ + GLboolean (* createContext)( __DRInativeDisplay *dpy, int screenNum, + int configID, void * contextID, drm_context_t * hw_context ); + + /** + * Destroy the server-side portion of the GL context. + */ + GLboolean (* destroyContext)( __DRInativeDisplay *dpy, int screenNum, + __DRIid context ); + + /** + * Create the server-side portion of the drawable. + */ + GLboolean (*createDrawable)( __DRInativeDisplay * ndpy, int screen, + __DRIid drawable, drm_drawable_t * hHWDrawable ); + + /** + * Destroy the server-side portion of the drawable. + */ + GLboolean (*destroyDrawable)( __DRInativeDisplay * ndpy, int screen, + __DRIid drawable ); + + /** + * This function is used to get information about the position, size, and + * clip rects of a drawable. + */ + GLboolean (* getDrawableInfo) ( __DRInativeDisplay *dpy, int scrn, + __DRIid draw, unsigned int * index, unsigned int * stamp, + int * x, int * y, int * width, int * height, + int * numClipRects, drm_clip_rect_t ** pClipRects, + int * backX, int * backY, + int * numBackClipRects, drm_clip_rect_t ** pBackClipRects ); + /*@}*/ + + + /** + * \name Timing related functions. + */ + /*@{*/ + /** + * Get the 64-bit unadjusted system time (UST). + */ + int (*getUST)(int64_t * ust); + + /** + * Get the media stream counter (MSC) rate. + * + * Matching the definition in GLX_OML_sync_control, this function returns + * the rate of the "media stream counter". In practical terms, this is + * the frame refresh rate of the display. + */ + GLboolean (*getMSCRate)(__DRInativeDisplay * dpy, __DRIid drawable, + int32_t * numerator, int32_t * denominator); + /*@}*/ +}; + + /** * Framebuffer information record. Used by libGL to communicate information * about the framebuffer to the driver's \c __driCreateNewScreen function. @@ -332,7 +396,7 @@ struct __DRIcontextRec { /** * Method to bind a DRI drawable to a DRI graphics context. * - * \since Internal API version 20050722. + * \since Internal API version 20050725. */ GLboolean (*bindContext)(__DRInativeDisplay *dpy, int scrn, __DRIid draw, __DRIid read, __DRIcontext *ctx); @@ -340,7 +404,7 @@ struct __DRIcontextRec { /** * Method to unbind a DRI drawable from a DRI graphics context. * - * \since Internal API version 20050722. + * \since Internal API version 20050725. */ GLboolean (*unbindContext)(__DRInativeDisplay *dpy, int scrn, __DRIid draw, __DRIid read, __DRIcontext *ctx); |