diff options
author | Kristian Høgsberg <krh@redhat.com> | 2008-03-26 19:26:59 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2008-03-31 16:51:26 -0400 |
commit | e82dd8c6e1fa2fff5b960de26961080ba5e9651d (patch) | |
tree | 1bd230661a032b1ab539998f947573de1acaf80d /src/mesa/drivers/dri/tdfx | |
parent | 63d8a8417d68365cd10c11178516378411c09f87 (diff) |
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
Diffstat (limited to 'src/mesa/drivers/dri/tdfx')
-rw-r--r-- | src/mesa/drivers/dri/tdfx/tdfx_screen.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 9c7ded0180..fd21d8d51b 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -343,31 +343,14 @@ tdfxSwapBuffers( __DRIdrawablePrivate *driDrawPriv ) } } - -static const struct __DriverAPIRec tdfxAPI = { - .DestroyScreen = tdfxDestroyScreen, - .CreateContext = tdfxCreateContext, - .DestroyContext = tdfxDestroyContext, - .CreateBuffer = tdfxCreateBuffer, - .DestroyBuffer = tdfxDestroyBuffer, - .SwapBuffers = tdfxSwapBuffers, - .MakeCurrent = tdfxMakeCurrent, - .UnbindContext = tdfxUnbindContext, - .GetSwapInfo = NULL, - .GetDrawableMSC = NULL, - .WaitForMSC = NULL, - .WaitForSBC = NULL, - .SwapBuffersMSC = NULL -}; - - -static __GLcontextModes *tdfxFillInModes(__DRIscreenPrivate *psp, - unsigned pixel_bits, - unsigned depth_bits, - unsigned stencil_bits, - GLboolean have_back_buffer) +static const __DRIconfig ** +tdfxFillInModes(__DRIscreenPrivate *psp, + unsigned pixel_bits, + unsigned depth_bits, + unsigned stencil_bits, + GLboolean have_back_buffer) { - __GLcontextModes *modes; + __DRIconfig **configs, **c; __GLcontextModes *m; unsigned num_modes; unsigned vis[2] = { GLX_TRUE_COLOR, GLX_DIRECT_COLOR }; @@ -382,14 +365,16 @@ static __GLcontextModes *tdfxFillInModes(__DRIscreenPrivate *psp, num_modes = (depth_bits == 16) ? 32 : 16; - modes = (*psp->contextModes->createContextModes)(num_modes, sizeof(__GLcontextModes)); - m = modes; + configs = _mesa_malloc(num_modes * sizeof *configs); + c = configs; for (i = 0; i <= 1; i++) { for (db = 0; db <= 1; db++) { for (depth = 0; depth <= 1; depth++) { for (accum = 0; accum <= 1; accum++) { for (stencil = 0; stencil <= !deep; stencil++) { + *c = _mesa_malloc(sizeof **c); + m = &(*c++)->modes; if (deep) stencil = depth; m->redBits = deep ? 8 : 5; m->greenBits = deep ? 8 : 6; @@ -419,7 +404,6 @@ static __GLcontextModes *tdfxFillInModes(__DRIscreenPrivate *psp, m->visualRating = ((stencil && !deep) || accum) ? GLX_SLOW_CONFIG : GLX_NONE; - m = m->next; if (deep) stencil = 0; } } @@ -427,7 +411,7 @@ static __GLcontextModes *tdfxFillInModes(__DRIscreenPrivate *psp, } } - return modes; + return (const __DRIconfig **) configs; } /** @@ -437,7 +421,8 @@ static __GLcontextModes *tdfxFillInModes(__DRIscreenPrivate *psp, * * \return the __GLcontextModes supported by this driver */ -__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) +static const __DRIconfig ** +tdfxInitScreen(__DRIscreen *psp) { static const __DRIversion ddx_expected = { 1, 1, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; @@ -456,8 +441,6 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) &psp->drm_version, & drm_expected ) ) return NULL; - psp->DriverAPI = tdfxAPI; - /* Calling driInitExtensions here, with a NULL context pointer, * does not actually enable the extensions. It just makes sure * that all the dispatch offsets for all the extensions that @@ -479,3 +462,20 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) (bpp == 16) ? 0 : 8, (dri_priv->backOffset!=dri_priv->depthOffset)); } + +const struct __DriverAPIRec driDriverAPI = { + .InitScreen = tdfxInitScreen, + .DestroyScreen = tdfxDestroyScreen, + .CreateContext = tdfxCreateContext, + .DestroyContext = tdfxDestroyContext, + .CreateBuffer = tdfxCreateBuffer, + .DestroyBuffer = tdfxDestroyBuffer, + .SwapBuffers = tdfxSwapBuffers, + .MakeCurrent = tdfxMakeCurrent, + .UnbindContext = tdfxUnbindContext, + .GetSwapInfo = NULL, + .GetDrawableMSC = NULL, + .WaitForMSC = NULL, + .WaitForSBC = NULL, + .SwapBuffersMSC = NULL +}; |