Pull createNewScreen entry point into dri_util.c.

This pulls the top level createNewScreen entry point out of the drivers
and rewrites __driUtilCreateNewScreen in dri_util.c to be the new entry point.

The change moves more logic into the common/ layer and changes the
createNewScreen entry point to only be defined in one place.
This commit is contained in:
Kristian Høgsberg
2007-05-14 16:58:37 -04:00
committed by Kristian Høgsberg
parent efd03a278a
commit 64106d0d9a
17 changed files with 411 additions and 689 deletions

View File

@@ -667,9 +667,12 @@ static void driDestroyScreen(__DRIscreen *screen)
/** /**
* Utility function used to create a new driver-private screen structure. * This is the bootstrap function for the driver. libGL supplies all of the
* requisite information about the system, and the driver initializes itself.
* This routine also fills in the linked list pointed to by \c driver_modes
* with the \c __GLcontextModes that the driver can support for windows or
* pbuffers.
* *
* \param dpy Display pointer
* \param scrn Index of the screen * \param scrn Index of the screen
* \param psc DRI screen data (not driver private) * \param psc DRI screen data (not driver private)
* \param modes Linked list of known display modes. This list is, at a * \param modes Linked list of known display modes. This list is, at a
@@ -690,35 +693,34 @@ static void driDestroyScreen(__DRIscreen *screen)
* driver and libGL. * driver and libGL.
* \param driverAPI Driver API functions used by other routines in dri_util.c. * \param driverAPI Driver API functions used by other routines in dri_util.c.
* *
* \note * \note There is no need to check the minimum API version in this
* There is no need to check the minimum API version in this function. Since * function. Since the name of this function is versioned, it is
* the \c __driCreateNewScreen function is versioned, it is impossible for a * impossible for a loader that is too old to even load this driver.
* loader that is too old to even load this driver.
*/ */
__DRIscreenPrivate * PUBLIC
__driUtilCreateNewScreen(int scr, __DRIscreen *psc, void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc,
__GLcontextModes * modes, const __GLcontextModes * modes,
const __DRIversion * ddx_version, const __DRIversion * ddx_version,
const __DRIversion * dri_version, const __DRIversion * dri_version,
const __DRIversion * drm_version, const __DRIversion * drm_version,
const __DRIframebuffer * frame_buffer, const __DRIframebuffer * frame_buffer,
drm_sarea_t *pSAREA, drmAddress pSAREA, int fd,
int fd, int internal_api_version,
int internal_api_version, const __DRIinterfaceMethods * interface,
const struct __DriverAPIRec *driverAPI) __GLcontextModes ** driver_modes )
{ {
__DRIscreenPrivate *psp; __DRIscreenPrivate *psp;
dri_interface = interface;
api_ver = internal_api_version; api_ver = internal_api_version;
psp = (__DRIscreenPrivate *)_mesa_malloc(sizeof(__DRIscreenPrivate)); psp = _mesa_malloc(sizeof(*psp));
if (!psp) { if (!psp)
return NULL; return NULL;
}
psp->psc = psc; psp->psc = psc;
psp->modes = modes; psp->modes = NULL;
/* /*
** NOT_DONE: This is used by the X server to detect when the client ** NOT_DONE: This is used by the X server to detect when the client
@@ -731,9 +733,6 @@ __driUtilCreateNewScreen(int scr, __DRIscreen *psc,
psp->ddx_version = *ddx_version; psp->ddx_version = *ddx_version;
psp->dri_version = *dri_version; psp->dri_version = *dri_version;
/* install driver's callback functions */
memcpy( &psp->DriverAPI, driverAPI, sizeof(struct __DriverAPIRec) );
psp->pSAREA = pSAREA; psp->pSAREA = pSAREA;
psp->pFB = frame_buffer->base; psp->pFB = frame_buffer->base;
@@ -746,7 +745,7 @@ __driUtilCreateNewScreen(int scr, __DRIscreen *psc,
psp->fbBPP = psp->fbStride * 8 / frame_buffer->width; psp->fbBPP = psp->fbStride * 8 / frame_buffer->width;
psp->fd = fd; psp->fd = fd;
psp->myNum = scr; psp->myNum = scrn;
/* /*
** Do not init dummy context here; actual initialization will be ** Do not init dummy context here; actual initialization will be
@@ -763,17 +762,15 @@ __driUtilCreateNewScreen(int scr, __DRIscreen *psc,
if (internal_api_version >= 20070121) if (internal_api_version >= 20070121)
psc->setTexOffset = psp->DriverAPI.setTexOffset; psc->setTexOffset = psp->DriverAPI.setTexOffset;
if ( (psp->DriverAPI.InitDriver != NULL) *driver_modes = __driDriverInitScreen(psp);
&& !(*psp->DriverAPI.InitDriver)(psp) ) { if (*driver_modes == NULL) {
_mesa_free( psp ); _mesa_free(psp);
return NULL; return NULL;
} }
return psp; return psp;
} }
/** /**
* Compare the current GLX API version with a driver supplied required version. * Compare the current GLX API version with a driver supplied required version.
* *

View File

@@ -66,6 +66,13 @@ typedef struct __DRIswapInfoRec __DRIswapInfo;
typedef struct __DRIutilversionRec2 __DRIutilversion2; typedef struct __DRIutilversionRec2 __DRIutilversion2;
/**
* Driver specific entry point. Implemented by the driver. Called
* from the top level createNewScreen entry point to initialize the
* __DRIscreenPrivate struct.
*/
extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp);
/** /**
* Used by DRI_VALIDATE_DRAWABLE_INFO * Used by DRI_VALIDATE_DRAWABLE_INFO
*/ */
@@ -109,11 +116,6 @@ do { \
* this structure. * this structure.
*/ */
struct __DriverAPIRec { struct __DriverAPIRec {
/**
* Driver initialization callback
*/
GLboolean (*InitDriver)(__DRIscreenPrivate *driScrnPriv);
/** /**
* Screen destruction callback * Screen destruction callback
*/ */

View File

@@ -605,7 +605,6 @@ void ffbXMesaUpdateState(ffbContextPtr fmesa)
} }
static const struct __DriverAPIRec ffbAPI = { static const struct __DriverAPIRec ffbAPI = {
.InitDriver = ffbInitDriver,
.DestroyScreen = ffbDestroyScreen, .DestroyScreen = ffbDestroyScreen,
.CreateContext = ffbCreateContext, .CreateContext = ffbCreateContext,
.DestroyContext = ffbDestroyContext, .DestroyContext = ffbDestroyContext,
@@ -704,49 +703,28 @@ ffbFillInModes( unsigned pixel_bits, unsigned depth_bits,
/** /**
* This is the bootstrap function for the driver. libGL supplies all of the * This is the driver specific part of the createNewScreen entry point.
* requisite information about the system, and the driver initializes itself.
* This routine also fills in the linked list pointed to by \c driver_modes
* with the \c __GLcontextModes that the driver can support for windows or
* pbuffers.
* *
* \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on * \todo maybe fold this into intelInitDriver
* failure. *
* \return the __GLcontextModes supported by this driver
*/ */
PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp)
void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
const __GLcontextModes * modes,
const __DRIversion * ddx_version,
const __DRIversion * dri_version,
const __DRIversion * drm_version,
const __DRIframebuffer * frame_buffer,
drmAddress pSAREA, int fd,
int internal_api_version,
const __DRIinterfaceMethods * interface,
__GLcontextModes ** driver_modes)
{ {
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 0, 1, 1 }; static const __DRIversion ddx_expected = { 0, 1, 1 };
static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 0, 0, 1 }; static const __DRIversion drm_expected = { 0, 0, 1 };
dri_interface = interface;
if ( ! driCheckDriDdxDrmVersions2( "ffb", if ( ! driCheckDriDdxDrmVersions2( "ffb",
dri_version, & dri_expected, &psp->dri_version, & dri_expected,
ddx_version, & ddx_expected, &psp->ddx_version, & ddx_expected,
drm_version, & drm_expected ) ) { &psp->drm_version, & drm_expected ) )
return NULL; return NULL;
}
psp = __driUtilCreateNewScreen(scrn, psc, NULL, psp->DriverAPI = ffbAPI;
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &ffbAPI);
if ( psp != NULL ) {
*driver_modes = ffbFillInModes( 32, 16, 0, GL_TRUE );
}
return (void *) psp; if (!ffbInitDriver(psp))
return NULL;
return ffbFillInModes( 32, 16, 0, GL_TRUE );
} }

View File

@@ -403,7 +403,6 @@ i810DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
static const struct __DriverAPIRec i810API = { static const struct __DriverAPIRec i810API = {
.InitDriver = i810InitDriver,
.DestroyScreen = i810DestroyScreen, .DestroyScreen = i810DestroyScreen,
.CreateContext = i810CreateContext, .CreateContext = i810CreateContext,
.DestroyContext = i810DestroyContext, .DestroyContext = i810DestroyContext,
@@ -421,51 +420,30 @@ static const struct __DriverAPIRec i810API = {
/** /**
* This is the bootstrap function for the driver. libGL supplies all of the * This is the driver specific part of the createNewScreen entry point.
* requisite information about the system, and the driver initializes itself. *
* This routine also fills in the linked list pointed to by \c driver_modes * \todo maybe fold this into intelInitDriver
* with the \c __GLcontextModes that the driver can support for windows or
* pbuffers.
* *
* \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on * \return the __GLcontextModes supported by this driver
* failure.
*/ */
PUBLIC PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp)
void *__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
const __GLcontextModes * modes,
const __DRIversion * ddx_version,
const __DRIversion * dri_version,
const __DRIversion * drm_version,
const __DRIframebuffer * frame_buffer,
drmAddress pSAREA, int fd,
int internal_api_version,
const __DRIinterfaceMethods * interface,
__GLcontextModes ** driver_modes)
{ {
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 1, 0, 0 }; static const __DRIversion ddx_expected = { 1, 0, 0 };
static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 1, 2, 0 }; static const __DRIversion drm_expected = { 1, 2, 0 };
dri_interface = interface;
if ( ! driCheckDriDdxDrmVersions2( "i810", if ( ! driCheckDriDdxDrmVersions2( "i810",
dri_version, & dri_expected, &psp->dri_version, & dri_expected,
ddx_version, & ddx_expected, &psp->ddx_version, & ddx_expected,
drm_version, & drm_expected ) ) { &psp->drm_version, & drm_expected ) ) {
return NULL; return NULL;
} }
psp = __driUtilCreateNewScreen(scrn, psc, NULL, psp->DriverAPI = i810API;
ddx_version, dri_version, drm_version, driInitExtensions( NULL, card_extensions, GL_TRUE );
frame_buffer, pSAREA, fd,
internal_api_version, &i810API);
if ( psp != NULL ) {
*driver_modes = i810FillInModes( 16,
16, 0,
1);
driInitExtensions( NULL, card_extensions, GL_TRUE );
}
return (void *) psp; if (!i810InitDriver(psp))
return NULL;
return i810FillInModes(16, 16, 0, 1);
} }

View File

@@ -771,7 +771,6 @@ intelCreateContext(const __GLcontextModes * mesaVis,
static const struct __DriverAPIRec intelAPI = { static const struct __DriverAPIRec intelAPI = {
.InitDriver = intelInitDriver,
.DestroyScreen = intelDestroyScreen, .DestroyScreen = intelDestroyScreen,
.CreateContext = intelCreateContext, .CreateContext = intelCreateContext,
.DestroyContext = intelDestroyContext, .DestroyContext = intelDestroyContext,
@@ -876,64 +875,46 @@ intelFillInModes(unsigned pixel_bits, unsigned depth_bits,
/** /**
* This is the bootstrap function for the driver. libGL supplies all of the * This is the driver specific part of the createNewScreen entry point.
* requisite information about the system, and the driver initializes itself.
* This routine also fills in the linked list pointed to by \c driver_modes
* with the \c __GLcontextModes that the driver can support for windows or
* pbuffers.
* *
* \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on * \todo maybe fold this into intelInitDriver
* failure. *
* \return the __GLcontextModes supported by this driver
*/ */
PUBLIC PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp)
void * __DRI_CREATE_NEW_SCREEN(int scrn,
__DRIscreen * psc,
const __GLcontextModes * modes,
const __DRIversion * ddx_version,
const __DRIversion * dri_version,
const __DRIversion * drm_version,
const __DRIframebuffer * frame_buffer,
drmAddress pSAREA, int fd,
int internal_api_version,
const __DRIinterfaceMethods * interface,
__GLcontextModes ** driver_modes)
{ {
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 1, 5, 0 }; static const __DRIversion ddx_expected = { 1, 5, 0 };
static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 1, 5, 0 }; static const __DRIversion drm_expected = { 1, 5, 0 };
I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv;
dri_interface = interface; psp->DriverAPI = intelAPI;
if (!driCheckDriDdxDrmVersions2("i915", if (!driCheckDriDdxDrmVersions2("i915",
dri_version, &dri_expected, &psp->dri_version, &dri_expected,
ddx_version, &ddx_expected, &psp->ddx_version, &ddx_expected,
drm_version, &drm_expected)) { &psp->drm_version, &drm_expected)) {
return NULL; return NULL;
} }
psp = __driUtilCreateNewScreen(scrn, psc, NULL, /* Calling driInitExtensions here, with a NULL context pointer,
ddx_version, dri_version, drm_version, * does not actually enable the extensions. It just makes sure
frame_buffer, pSAREA, fd, * that all the dispatch offsets for all the extensions that
internal_api_version, &intelAPI); * *might* be enables are known. This is needed because the
if (psp != NULL) { * dispatch offsets need to be known when _mesa_context_create is
I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; * called, but we can't enable the extensions until we have a
*driver_modes = intelFillInModes(dri_priv->cpp * 8, * context pointer.
(dri_priv->cpp == 2) ? 16 : 24, *
(dri_priv->cpp == 2) ? 0 : 8, 1); * Hello chicken. Hello egg. How are you two today?
*/
driInitExtensions(NULL, card_extensions, GL_FALSE);
/* Calling driInitExtensions here, with a NULL context pointer, does not actually if (!intelInitDriver(psp))
* enable the extensions. It just makes sure that all the dispatch offsets for all return NULL;
* the extensions that *might* be enables are known. This is needed because the
* dispatch offsets need to be known when _mesa_context_create is called, but we can't
* enable the extensions until we have a context pointer.
*
* Hello chicken. Hello egg. How are you two today?
*/
driInitExtensions(NULL, card_extensions, GL_FALSE);
}
return (void *) psp; return intelFillInModes(dri_priv->cpp * 8,
(dri_priv->cpp == 2) ? 16 : 24,
(dri_priv->cpp == 2) ? 0 : 8, 1);
} }
struct intel_context *intelScreenContext(intelScreenPrivate *intelScreen) struct intel_context *intelScreenContext(intelScreenPrivate *intelScreen)

View File

@@ -540,7 +540,6 @@ static GLboolean intelCreateContext( const __GLcontextModes *mesaVis,
static const struct __DriverAPIRec intelAPI = { static const struct __DriverAPIRec intelAPI = {
.InitDriver = intelInitDriver,
.DestroyScreen = intelDestroyScreen, .DestroyScreen = intelDestroyScreen,
.CreateContext = intelCreateContext, .CreateContext = intelCreateContext,
.DestroyContext = intelDestroyContext, .DestroyContext = intelDestroyContext,
@@ -639,62 +638,44 @@ intelFillInModes( unsigned pixel_bits, unsigned depth_bits,
/** /**
* This is the bootstrap function for the driver. libGL supplies all of the * This is the driver specific part of the createNewScreen entry point.
* requisite information about the system, and the driver initializes itself.
* This routine also fills in the linked list pointed to by \c driver_modes
* with the \c __GLcontextModes that the driver can support for windows or
* pbuffers.
* *
* \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on * \todo maybe fold this into intelInitDriver
* failure. *
* \return the __GLcontextModes supported by this driver
*/ */
PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp)
void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc,
const __GLcontextModes * modes,
const __DRIversion * ddx_version,
const __DRIversion * dri_version,
const __DRIversion * drm_version,
const __DRIframebuffer * frame_buffer,
drmAddress pSAREA, int fd,
int internal_api_version,
const __DRIinterfaceMethods * interface,
__GLcontextModes ** driver_modes )
{ {
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 1, 6, 0 }; static const __DRIversion ddx_expected = { 1, 6, 0 };
static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 1, 3, 0 }; static const __DRIversion drm_expected = { 1, 3, 0 };
I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv;
dri_interface = interface; psp->DriverAPI = intelAPI;
if ( ! driCheckDriDdxDrmVersions2( "i915", if ( ! driCheckDriDdxDrmVersions2( "i915",
dri_version, & dri_expected, &psp->dri_version, &dri_expected,
ddx_version, & ddx_expected, &psp->ddx_version, &ddx_expected,
drm_version, & drm_expected ) ) { &psp->drm_version, &drm_expected ) ) {
return NULL; return NULL;
} }
psp = __driUtilCreateNewScreen(scrn, psc, NULL, /* Calling driInitExtensions here, with a NULL context pointer,
ddx_version, dri_version, drm_version, * does not actually enable the extensions. It just makes sure
frame_buffer, pSAREA, fd, * that all the dispatch offsets for all the extensions that
internal_api_version, &intelAPI); * *might* be enables are known. This is needed because the
if ( psp != NULL ) { * dispatch offsets need to be known when _mesa_context_create is
I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; * called, but we can't enable the extensions until we have a
*driver_modes = intelFillInModes( dri_priv->cpp * 8, * context pointer.
(dri_priv->cpp == 2) ? 16 : 24, *
(dri_priv->cpp == 2) ? 0 : 8, * Hello chicken. Hello egg. How are you two today?
GL_TRUE ); */
/* Calling driInitExtensions here, with a NULL context pointer, does not actually intelInitExtensions(NULL, GL_FALSE);
* enable the extensions. It just makes sure that all the dispatch offsets for all
* the extensions that *might* be enables are known. This is needed because the
* dispatch offsets need to be known when _mesa_context_create is called, but we can't
* enable the extensions until we have a context pointer.
*
* Hello chicken. Hello egg. How are you two today?
*/
intelInitExtensions(NULL, GL_FALSE);
}
return (void *) psp; if (!intelInitDriver(psp))
return NULL;
return intelFillInModes( dri_priv->cpp * 8,
(dri_priv->cpp == 2) ? 16 : 24,
(dri_priv->cpp == 2) ? 0 : 8,
GL_TRUE );
} }

View File

@@ -476,7 +476,6 @@ mach64InitDriver( __DRIscreenPrivate *driScreen )
static struct __DriverAPIRec mach64API = { static struct __DriverAPIRec mach64API = {
.InitDriver = mach64InitDriver,
.DestroyScreen = mach64DestroyScreen, .DestroyScreen = mach64DestroyScreen,
.CreateContext = mach64CreateContext, .CreateContext = mach64CreateContext,
.DestroyContext = mach64DestroyContext, .DestroyContext = mach64DestroyContext,
@@ -494,63 +493,41 @@ static struct __DriverAPIRec mach64API = {
/** /**
* This is the bootstrap function for the driver. libGL supplies all of the * This is the driver specific part of the createNewScreen entry point.
* requisite information about the system, and the driver initializes itself.
* This routine also fills in the linked list pointed to by \c driver_modes
* with the \c __GLcontextModes that the driver can support for windows or
* pbuffers.
* *
* \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on * \todo maybe fold this into intelInitDriver
* failure. *
* \return the __GLcontextModes supported by this driver
*/ */
PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp)
void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
const __GLcontextModes * modes,
const __DRIversion * ddx_version,
const __DRIversion * dri_version,
const __DRIversion * drm_version,
const __DRIframebuffer * frame_buffer,
drmAddress pSAREA, int fd,
int internal_api_version,
const __DRIinterfaceMethods * interface,
__GLcontextModes ** driver_modes)
{ {
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 6, 4, 0 }; static const __DRIversion ddx_expected = { 6, 4, 0 };
static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 2, 0, 0 }; static const __DRIversion drm_expected = { 2, 0, 0 };
ATIDRIPtr dri_priv = (ATIDRIPtr) psp->pDevPriv;
dri_interface = interface; psp->DriverAPI = mach64API;
if ( ! driCheckDriDdxDrmVersions2( "Mach64", if ( ! driCheckDriDdxDrmVersions2( "Mach64",
dri_version, & dri_expected, &psp->dri_version, & dri_expected,
ddx_version, & ddx_expected, &psp->ddx_version, & ddx_expected,
drm_version, & drm_expected ) ) { &psp->drm_version, & drm_expected ) ) {
return NULL; return NULL;
} }
/* 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
* *might* be enables are known. This is needed because the
* dispatch offsets need to be known when _mesa_context_create is
* called, but we can't enable the extensions until we have a
* context pointer.
*
* Hello chicken. Hello egg. How are you two today?
*/
driInitExtensions( NULL, card_extensions, GL_FALSE );
psp = __driUtilCreateNewScreen(scrn, psc, NULL, if (!mach64InitDriver(psp))
ddx_version, dri_version, drm_version, return NULL;
frame_buffer, pSAREA, fd,
internal_api_version, &mach64API);
if ( psp != NULL ) {
ATIDRIPtr dri_priv = (ATIDRIPtr) psp->pDevPriv;
*driver_modes = mach64FillInModes( dri_priv->cpp * 8,
16,
0,
1);
/* Calling driInitExtensions here, with a NULL context pointer, does not actually return mach64FillInModes( dri_priv->cpp * 8, 16, 0, 1);
* enable the extensions. It just makes sure that all the dispatch offsets for all
* the extensions that *might* be enables are known. This is needed because the
* dispatch offsets need to be known when _mesa_context_create is called, but we can't
* enable the extensions until we have a context pointer.
*
* Hello chicken. Hello egg. How are you two today?
*/
driInitExtensions( NULL, card_extensions, GL_FALSE );
}
return (void *) psp;
} }

View File

@@ -934,7 +934,6 @@ void mgaGetLock( mgaContextPtr mmesa, GLuint flags )
static const struct __DriverAPIRec mgaAPI = { static const struct __DriverAPIRec mgaAPI = {
.InitDriver = mgaInitDriver,
.DestroyScreen = mgaDestroyScreen, .DestroyScreen = mgaDestroyScreen,
.CreateContext = mgaCreateContext, .CreateContext = mgaCreateContext,
.DestroyContext = mgaDestroyContext, .DestroyContext = mgaDestroyContext,
@@ -952,69 +951,50 @@ static const struct __DriverAPIRec mgaAPI = {
/** /**
* This is the bootstrap function for the driver. libGL supplies all of the * This is the driver specific part of the createNewScreen entry point.
* requisite information about the system, and the driver initializes itself.
* This routine also fills in the linked list pointed to by \c driver_modes
* with the \c __GLcontextModes that the driver can support for windows or
* pbuffers.
* *
* \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on * \todo maybe fold this into intelInitDriver
* failure. *
* \return the __GLcontextModes supported by this driver
*/ */
PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp)
void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
const __GLcontextModes * modes,
const __DRIversion * ddx_version,
const __DRIversion * dri_version,
const __DRIversion * drm_version,
const __DRIframebuffer * frame_buffer,
drmAddress pSAREA, int fd,
int internal_api_version,
const __DRIinterfaceMethods * interface,
__GLcontextModes ** driver_modes)
{ {
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 1, 2, 0 }; static const __DRIversion ddx_expected = { 1, 2, 0 };
static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 3, 0, 0 }; static const __DRIversion drm_expected = { 3, 0, 0 };
MGADRIPtr dri_priv = (MGADRIPtr) psp->pDevPriv;
dri_interface = interface; psp->DriverAPI = mgaAPI;
if ( ! driCheckDriDdxDrmVersions2( "MGA", if ( ! driCheckDriDdxDrmVersions2( "MGA",
dri_version, & dri_expected, &psp->dri_version, & dri_expected,
ddx_version, & ddx_expected, &psp->ddx_version, & ddx_expected,
drm_version, & drm_expected ) ) { &psp->drm_version, & drm_expected ) )
return NULL; return NULL;
}
psp = __driUtilCreateNewScreen(scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &mgaAPI);
if ( psp != NULL ) {
MGADRIPtr dri_priv = (MGADRIPtr) psp->pDevPriv;
*driver_modes = mgaFillInModes( dri_priv->cpp * 8,
(dri_priv->cpp == 2) ? 16 : 24,
(dri_priv->cpp == 2) ? 0 : 8,
(dri_priv->backOffset != dri_priv->depthOffset) );
/* Calling driInitExtensions here, with a NULL context pointer, does not actually /* Calling driInitExtensions here, with a NULL context pointer,
* enable the extensions. It just makes sure that all the dispatch offsets for all * does not actually enable the extensions. It just makes sure
* the extensions that *might* be enables are known. This is needed because the * that all the dispatch offsets for all the extensions that
* dispatch offsets need to be known when _mesa_context_create is called, but we can't * *might* be enables are known. This is needed because the
* enable the extensions until we have a context pointer. * dispatch offsets need to be known when _mesa_context_create is
* * called, but we can't enable the extensions until we have a
* Hello chicken. Hello egg. How are you two today? * context pointer.
*/ *
driInitExtensions( NULL, card_extensions, GL_FALSE ); * Hello chicken. Hello egg. How are you two today?
driInitExtensions( NULL, g400_extensions, GL_FALSE ); */
driInitSingleExtension( NULL, ARB_vp_extension );
driInitExtensions( NULL, NV_vp_extensions, GL_FALSE );
} driInitExtensions( NULL, card_extensions, GL_FALSE );
driInitExtensions( NULL, g400_extensions, GL_FALSE );
driInitSingleExtension( NULL, ARB_vp_extension );
driInitExtensions( NULL, NV_vp_extensions, GL_FALSE );
return (void *) psp; if (!mgaInitDriver(psp))
return NULL;
return mgaFillInModes( dri_priv->cpp * 8,
(dri_priv->cpp == 2) ? 16 : 24,
(dri_priv->cpp == 2) ? 0 : 8,
(dri_priv->backOffset != dri_priv->depthOffset) );
} }

View File

@@ -195,7 +195,6 @@ nouveauGetSwapInfo(__DRIdrawablePrivate *dpriv, __DRIswapInfo *sInfo)
} }
static const struct __DriverAPIRec nouveauAPI = { static const struct __DriverAPIRec nouveauAPI = {
.InitDriver = nouveauInitDriver,
.DestroyScreen = nouveauDestroyScreen, .DestroyScreen = nouveauDestroyScreen,
.CreateContext = nouveauCreateContext, .CreateContext = nouveauCreateContext,
.DestroyContext = nouveauDestroyContext, .DestroyContext = nouveauDestroyContext,
@@ -285,81 +284,62 @@ nouveauFillInModes( unsigned pixel_bits, unsigned depth_bits,
/** /**
* This is the bootstrap function for the driver. libGL supplies all of the * This is the driver specific part of the createNewScreen entry point.
* requisite information about the system, and the driver initializes itself.
* This routine also fills in the linked list pointed to by \c driver_modes
* with the \c __GLcontextModes that the driver can support for windows or
* pbuffers.
* *
* \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on * \todo maybe fold this into intelInitDriver
* failure. *
* \return the __GLcontextModes supported by this driver
*/ */
PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp)
void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
const __GLcontextModes * modes,
const __DRIversion * ddx_version,
const __DRIversion * dri_version,
const __DRIversion * drm_version,
const __DRIframebuffer * frame_buffer,
drmAddress pSAREA, int fd,
int internal_api_version,
const __DRIinterfaceMethods * interface,
__GLcontextModes ** driver_modes)
{ {
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 1, 2, 0 }; static const __DRIversion ddx_expected = { 1, 2, 0 };
static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL }; static const __DRIversion drm_expected = { 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL };
NOUVEAUDRIPtr dri_priv = (NOUVEAUDRIPtr)psp->pDevPriv;
#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 10 #if NOUVEAU_DRM_HEADER_PATCHLEVEL != 10
#error nouveau_drm.h version doesn't match expected version #error nouveau_drm.h version doesn't match expected version
#endif #endif
dri_interface = interface;
if (!driCheckDriDdxDrmVersions2("nouveau", if (!driCheckDriDdxDrmVersions2("nouveau",
dri_version, & dri_expected, &psp->dri_version, & dri_expected,
ddx_version, & ddx_expected, &psp->ddx_version, & ddx_expected,
drm_version, & drm_expected)) { &psp->drm_version, & drm_expected))
return NULL; return NULL;
}
// temporary lock step versioning // temporary lock step versioning
if (drm_expected.patch!=drm_version->patch) { if (drm_expected.patch != psp->drm_version.patch) {
__driUtilMessage("%s: wrong DRM version, expected %d, got %d\n", __driUtilMessage("%s: wrong DRM version, expected %d, got %d\n",
__func__, __func__,
drm_expected.patch, drm_version->patch); drm_expected.patch, psp->drm_version.patch);
return NULL; return NULL;
} }
psp = __driUtilCreateNewScreen(scrn, psc, NULL, psp->DriverAPI = nouveauAPI;
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &nouveauAPI);
if ( psp != NULL ) {
NOUVEAUDRIPtr dri_priv = (NOUVEAUDRIPtr)psp->pDevPriv;
*driver_modes = nouveauFillInModes(dri_priv->bpp, /* Calling driInitExtensions here, with a NULL context
(dri_priv->bpp == 16) ? 16 : 24, * pointer, does not actually enable the extensions. It just
(dri_priv->bpp == 16) ? 0 : 8, * makes sure that all the dispatch offsets for all the
1 * extensions that *might* be enables are known. This is
); * needed because the dispatch offsets need to be known when
* _mesa_context_create is called, but we can't enable the
* extensions until we have a context pointer.
*
* Hello chicken. Hello egg. How are you two today?
*/
driInitExtensions( NULL, common_extensions, GL_FALSE );
driInitExtensions( NULL, nv10_extensions, GL_FALSE );
driInitExtensions( NULL, nv10_extensions, GL_FALSE );
driInitExtensions( NULL, nv30_extensions, GL_FALSE );
driInitExtensions( NULL, nv40_extensions, GL_FALSE );
driInitExtensions( NULL, nv50_extensions, GL_FALSE );
/* Calling driInitExtensions here, with a NULL context pointer, does not actually if (!nouveauInitDriver(psp))
* enable the extensions. It just makes sure that all the dispatch offsets for all return NULL;
* the extensions that *might* be enables are known. This is needed because the
* dispatch offsets need to be known when _mesa_context_create is called, but we can't
* enable the extensions until we have a context pointer.
*
* Hello chicken. Hello egg. How are you two today?
*/
driInitExtensions( NULL, common_extensions, GL_FALSE );
driInitExtensions( NULL, nv10_extensions, GL_FALSE );
driInitExtensions( NULL, nv10_extensions, GL_FALSE );
driInitExtensions( NULL, nv30_extensions, GL_FALSE );
driInitExtensions( NULL, nv40_extensions, GL_FALSE );
driInitExtensions( NULL, nv50_extensions, GL_FALSE );
}
return (void *) psp; return nouveauFillInModes(dri_priv->bpp,
(dri_priv->bpp == 16) ? 16 : 24,
(dri_priv->bpp == 16) ? 0 : 8,
1);
} }

View File

@@ -403,7 +403,6 @@ r128InitDriver( __DRIscreenPrivate *sPriv )
static struct __DriverAPIRec r128API = { static struct __DriverAPIRec r128API = {
.InitDriver = r128InitDriver,
.DestroyScreen = r128DestroyScreen, .DestroyScreen = r128DestroyScreen,
.CreateContext = r128CreateContext, .CreateContext = r128CreateContext,
.DestroyContext = r128DestroyContext, .DestroyContext = r128DestroyContext,
@@ -503,64 +502,43 @@ r128FillInModes( unsigned pixel_bits, unsigned depth_bits,
/** /**
* This is the bootstrap function for the driver. libGL supplies all of the * This is the driver specific part of the createNewScreen entry point.
* requisite information about the system, and the driver initializes itself.
* This routine also fills in the linked list pointed to by \c driver_modes
* with the \c __GLcontextModes that the driver can support for windows or
* pbuffers.
* *
* \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on * \todo maybe fold this into intelInitDriver
* failure. *
* \return the __GLcontextModes supported by this driver
*/ */
PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp)
void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
const __GLcontextModes * modes,
const __DRIversion * ddx_version,
const __DRIversion * dri_version,
const __DRIversion * drm_version,
const __DRIframebuffer * frame_buffer,
drmAddress pSAREA, int fd,
int internal_api_version,
const __DRIinterfaceMethods * interface,
__GLcontextModes ** driver_modes)
{ {
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 4, 0, 0 }; static const __DRIversion ddx_expected = { 4, 0, 0 };
static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 2, 2, 0 }; static const __DRIversion drm_expected = { 2, 2, 0 };
R128DRIPtr dri_priv = (R128DRIPtr) psp->pDevPriv;
psp->DriverAPI = r128API;
dri_interface = interface;
if ( ! driCheckDriDdxDrmVersions2( "Rage128", if ( ! driCheckDriDdxDrmVersions2( "Rage128",
dri_version, & dri_expected, &psp->dri_version, & dri_expected,
ddx_version, & ddx_expected, &psp->ddx_version, & ddx_expected,
drm_version, & drm_expected ) ) { &psp->drm_version, & drm_expected ) )
return NULL; return NULL;
}
psp = __driUtilCreateNewScreen(scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &r128API);
if ( psp != NULL ) {
R128DRIPtr dri_priv = (R128DRIPtr) psp->pDevPriv;
*driver_modes = r128FillInModes( dri_priv->bpp,
(dri_priv->bpp == 16) ? 16 : 24,
(dri_priv->bpp == 16) ? 0 : 8,
(dri_priv->backOffset != dri_priv->depthOffset) );
/* Calling driInitExtensions here, with a NULL context pointer, does not actually /* Calling driInitExtensions here, with a NULL context pointer,
* enable the extensions. It just makes sure that all the dispatch offsets for all * does not actually enable the extensions. It just makes sure
* the extensions that *might* be enables are known. This is needed because the * that all the dispatch offsets for all the extensions that
* dispatch offsets need to be known when _mesa_context_create is called, but we can't * *might* be enables are known. This is needed because the
* enable the extensions until we have a context pointer. * dispatch offsets need to be known when _mesa_context_create is
* * called, but we can't enable the extensions until we have a
* Hello chicken. Hello egg. How are you two today? * context pointer.
*/ *
driInitExtensions( NULL, card_extensions, GL_FALSE ); * Hello chicken. Hello egg. How are you two today?
} */
driInitExtensions( NULL, card_extensions, GL_FALSE );
return (void *) psp; if (!r128InitDriver(psp))
return NULL;
return r128FillInModes( dri_priv->bpp,
(dri_priv->bpp == 16) ? 16 : 24,
(dri_priv->bpp == 16) ? 0 : 8,
(dri_priv->backOffset != dri_priv->depthOffset) );
} }

View File

@@ -938,7 +938,6 @@ static void radeonDestroyContext(__DRIcontextPrivate * driContextPriv)
#if !RADEON_COMMON || (RADEON_COMMON && defined(RADEON_COMMON_FOR_R300)) #if !RADEON_COMMON || (RADEON_COMMON && defined(RADEON_COMMON_FOR_R300))
static struct __DriverAPIRec radeonAPI = { static struct __DriverAPIRec radeonAPI = {
.InitDriver = radeonInitDriver,
.DestroyScreen = radeonDestroyScreen, .DestroyScreen = radeonDestroyScreen,
.CreateContext = radeonCreateContext, .CreateContext = radeonCreateContext,
.DestroyContext = radeonDestroyContext, .DestroyContext = radeonDestroyContext,
@@ -959,7 +958,6 @@ static struct __DriverAPIRec radeonAPI = {
}; };
#else #else
static const struct __DriverAPIRec r200API = { static const struct __DriverAPIRec r200API = {
.InitDriver = radeonInitDriver,
.DestroyScreen = radeonDestroyScreen, .DestroyScreen = radeonDestroyScreen,
.CreateContext = r200CreateContext, .CreateContext = r200CreateContext,
.DestroyContext = r200DestroyContext, .DestroyContext = r200DestroyContext,
@@ -978,29 +976,16 @@ static const struct __DriverAPIRec r200API = {
}; };
#endif #endif
/** /**
* This is the bootstrap function for the driver. libGL supplies all of the * This is the driver specific part of the createNewScreen entry point.
* requisite information about the system, and the driver initializes itself. *
* This routine also fills in the linked list pointed to by \c driver_modes * \todo maybe fold this into intelInitDriver
* with the \c __GLcontextModes that the driver can support for windows or
* pbuffers.
* *
* \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on * \return the __GLcontextModes supported by this driver
* failure.
*/ */
PUBLIC void * __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp)
__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
const __GLcontextModes * modes,
const __DRIversion * ddx_version,
const __DRIversion * dri_version,
const __DRIversion * drm_version,
const __DRIframebuffer * frame_buffer,
drmAddress pSAREA, int fd,
int internal_api_version,
const __DRIinterfaceMethods * interface,
__GLcontextModes ** driver_modes)
{ {
__DRIscreenPrivate *psp;
#if !RADEON_COMMON #if !RADEON_COMMON
static const char *driver_name = "Radeon"; static const char *driver_name = "Radeon";
static const __DRIutilversion2 ddx_expected = { 4, 5, 0, 0 }; static const __DRIutilversion2 ddx_expected = { 4, 5, 0, 0 };
@@ -1017,57 +1002,46 @@ __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 1, 24, 0 }; static const __DRIversion drm_expected = { 1, 24, 0 };
#endif #endif
RADEONDRIPtr dri_priv = (RADEONDRIPtr) psp->pDevPriv;
dri_interface = interface;
if ( ! driCheckDriDdxDrmVersions3( driver_name, if ( ! driCheckDriDdxDrmVersions3( driver_name,
dri_version, & dri_expected, &psp->dri_version, & dri_expected,
ddx_version, & ddx_expected, &psp->ddx_version, & ddx_expected,
drm_version, & drm_expected ) ) { &psp->drm_version, & drm_expected ) ) {
return NULL; return NULL;
} }
#if !RADEON_COMMON || (RADEON_COMMON && defined(RADEON_COMMON_FOR_R300)) #if !RADEON_COMMON || (RADEON_COMMON && defined(RADEON_COMMON_FOR_R300))
psp = __driUtilCreateNewScreen(scrn, psc, NULL, psp->DriverAPI = radeonAPI;
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &radeonAPI);
#elif RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) #elif RADEON_COMMON && defined(RADEON_COMMON_FOR_R200)
psp = __driUtilCreateNewScreen(scrn, psc, NULL, psp->DriverAPI = r200API;
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &r200API);
#endif #endif
if ( psp != NULL ) { /* Calling driInitExtensions here, with a NULL context pointer,
RADEONDRIPtr dri_priv = (RADEONDRIPtr) psp->pDevPriv; * does not actually enable the extensions. It just makes sure
if (driver_modes) { * that all the dispatch offsets for all the extensions that
*driver_modes = radeonFillInModes( dri_priv->bpp, * *might* be enables are known. This is needed because the
(dri_priv->bpp == 16) ? 16 : 24, * dispatch offsets need to be known when _mesa_context_create
(dri_priv->bpp == 16) ? 0 : 8, * is called, but we can't enable the extensions until we have a
(dri_priv->backOffset != dri_priv->depthOffset) ); * context pointer.
} *
* Hello chicken. Hello egg. How are you two today?
/* Calling driInitExtensions here, with a NULL context pointer, */
* does not actually enable the extensions. It just makes sure driInitExtensions( NULL, card_extensions, GL_FALSE );
* that all the dispatch offsets for all the extensions that
* *might* be enables are known. This is needed because the
* dispatch offsets need to be known when _mesa_context_create
* is called, but we can't enable the extensions until we have a
* context pointer.
*
* Hello chicken. Hello egg. How are you two today?
*/
driInitExtensions( NULL, card_extensions, GL_FALSE );
#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200)
driInitExtensions( NULL, blend_extensions, GL_FALSE ); driInitExtensions( NULL, blend_extensions, GL_FALSE );
driInitSingleExtension( NULL, ARB_vp_extension ); driInitSingleExtension( NULL, ARB_vp_extension );
driInitSingleExtension( NULL, NV_vp_extension ); driInitSingleExtension( NULL, NV_vp_extension );
driInitSingleExtension( NULL, ATI_fs_extension ); driInitSingleExtension( NULL, ATI_fs_extension );
driInitExtensions( NULL, point_extensions, GL_FALSE ); driInitExtensions( NULL, point_extensions, GL_FALSE );
#endif #endif
}
return (void *) psp; if (!radeonInitDriver(psp))
return NULL;
return radeonFillInModes( dri_priv->bpp,
(dri_priv->bpp == 16) ? 16 : 24,
(dri_priv->bpp == 16) ? 0 : 8,
(dri_priv->backOffset != dri_priv->depthOffset) );
} }

View File

@@ -329,7 +329,6 @@ s3vUnbindContext( __DRIcontextPrivate *driContextPriv )
static struct __DriverAPIRec s3vAPI = { static struct __DriverAPIRec s3vAPI = {
s3vInitDriver,
s3vDestroyScreen, s3vDestroyScreen,
s3vCreateContext, s3vCreateContext,
s3vDestroyContext, s3vDestroyContext,
@@ -355,6 +354,9 @@ void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
DEBUG(("__driCreateScreen: psp = %p\n", psp)); DEBUG(("__driCreateScreen: psp = %p\n", psp));
psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &s3vAPI); psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &s3vAPI);
DEBUG(("__driCreateScreen: psp = %p\n", psp)); DEBUG(("__driCreateScreen: psp = %p\n", psp));
if (!s3vInitDriver(psp))
return NULLL
return (void *) psp; return (void *) psp;
} }
#endif #endif

View File

@@ -919,7 +919,6 @@ void savageGetLock( savageContextPtr imesa, GLuint flags )
static const struct __DriverAPIRec savageAPI = { static const struct __DriverAPIRec savageAPI = {
savageInitDriver,
savageDestroyScreen, savageDestroyScreen,
savageCreateContext, savageCreateContext,
savageDestroyContext, savageDestroyContext,
@@ -1016,63 +1015,44 @@ savageFillInModes( unsigned pixel_bits, unsigned depth_bits,
/** /**
* This is the bootstrap function for the driver. libGL supplies all of the * This is the driver specific part of the createNewScreen entry point.
* requisite information about the system, and the driver initializes itself.
* This routine also fills in the linked list pointed to by \c driver_modes
* with the \c __GLcontextModes that the driver can support for windows or
* pbuffers.
* *
* \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on * \todo maybe fold this into intelInitDriver
* failure. *
* \return the __GLcontextModes supported by this driver
*/ */
PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp)
void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
const __GLcontextModes * modes,
const __DRIversion * ddx_version,
const __DRIversion * dri_version,
const __DRIversion * drm_version,
const __DRIframebuffer * frame_buffer,
drmAddress pSAREA, int fd,
int internal_api_version,
const __DRIinterfaceMethods * interface,
__GLcontextModes ** driver_modes )
{ {
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 2, 0, 0 }; static const __DRIversion ddx_expected = { 2, 0, 0 };
static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 2, 1, 0 }; static const __DRIversion drm_expected = { 2, 1, 0 };
SAVAGEDRIPtr dri_priv = (SAVAGEDRIPtr)psp->pDevPriv;
dri_interface = interface;
if ( ! driCheckDriDdxDrmVersions2( "Savage", if ( ! driCheckDriDdxDrmVersions2( "Savage",
dri_version, & dri_expected, &psp->dri_version, & dri_expected,
ddx_version, & ddx_expected, &psp->ddx_version, & ddx_expected,
drm_version, & drm_expected ) ) { &psp->drm_version, & drm_expected ) )
return NULL; return NULL;
}
psp = __driUtilCreateNewScreen(scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &savageAPI);
if ( psp != NULL ) {
SAVAGEDRIPtr dri_priv = (SAVAGEDRIPtr)psp->pDevPriv;
*driver_modes = savageFillInModes( dri_priv->cpp*8,
(dri_priv->cpp == 2) ? 16 : 24,
(dri_priv->cpp == 2) ? 0 : 8,
(dri_priv->backOffset != dri_priv->depthOffset) );
/* Calling driInitExtensions here, with a NULL context pointer, does not actually psp->DriverAPI = savageAPI;
* enable the extensions. It just makes sure that all the dispatch offsets for all
* the extensions that *might* be enables are known. This is needed because the
* dispatch offsets need to be known when _mesa_context_create is called, but we can't
* enable the extensions until we have a context pointer.
*
* Hello chicken. Hello egg. How are you two today?
*/
driInitExtensions( NULL, card_extensions, GL_FALSE );
}
return (void *) psp; /* 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
* *might* be enables are known. This is needed because the
* dispatch offsets need to be known when _mesa_context_create is
* called, but we can't enable the extensions until we have a
* context pointer.
*
* Hello chicken. Hello egg. How are you two today?
*/
driInitExtensions( NULL, card_extensions, GL_FALSE );
if (!savageInitDriver(psp))
return NULL;
return savageFillInModes( dri_priv->cpp*8,
(dri_priv->cpp == 2) ? 16 : 24,
(dri_priv->cpp == 2) ? 0 : 8,
(dri_priv->backOffset != dri_priv->depthOffset) );
} }

View File

@@ -304,7 +304,6 @@ sisInitDriver( __DRIscreenPrivate *sPriv )
} }
static struct __DriverAPIRec sisAPI = { static struct __DriverAPIRec sisAPI = {
.InitDriver = sisInitDriver,
.DestroyScreen = sisDestroyScreen, .DestroyScreen = sisDestroyScreen,
.CreateContext = sisCreateContext, .CreateContext = sisCreateContext,
.DestroyContext = sisDestroyContext, .DestroyContext = sisDestroyContext,
@@ -323,59 +322,42 @@ static struct __DriverAPIRec sisAPI = {
/** /**
* This is the bootstrap function for the driver. libGL supplies all of the * This is the driver specific part of the createNewScreen entry point.
* requisite information about the system, and the driver initializes itself. *
* This routine also fills in the linked list pointed to by \c driver_modes * \todo maybe fold this into intelInitDriver
* with the \c __GLcontextModes that the driver can support for windows or
* pbuffers.
* *
* \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on * \return the __GLcontextModes supported by this driver
* failure.
*/ */
PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp)
void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
const __GLcontextModes *modes,
const __DRIversion *ddx_version,
const __DRIversion *dri_version,
const __DRIversion *drm_version,
const __DRIframebuffer *frame_buffer,
drmAddress pSAREA, int fd,
int internal_api_version,
const __DRIinterfaceMethods * interface,
__GLcontextModes **driver_modes)
{ {
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = {0, 8, 0}; static const __DRIversion ddx_expected = {0, 8, 0};
static const __DRIversion dri_expected = {4, 0, 0}; static const __DRIversion dri_expected = {4, 0, 0};
static const __DRIversion drm_expected = {1, 0, 0}; static const __DRIversion drm_expected = {1, 0, 0};
static const char *driver_name = "SiS"; static const char *driver_name = "SiS";
dri_interface = interface; SISDRIPtr dri_priv = (SISDRIPtr)psp->pDevPriv;
if (!driCheckDriDdxDrmVersions2(driver_name, dri_version, &dri_expected, if (!driCheckDriDdxDrmVersions2(driver_name,
ddx_version, &ddx_expected, &psp->dri_version, &dri_expected,
drm_version, &drm_expected)) { &psp->ddx_version, &ddx_expected,
&psp->drm_version, &drm_expected))
return NULL; return NULL;
}
psp = __driUtilCreateNewScreen(scrn, psc, NULL, psp->DriverAPI = sisAPI;
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &sisAPI);
if (psp != NULL) {
SISDRIPtr dri_priv = (SISDRIPtr)psp->pDevPriv;
*driver_modes = sisFillInModes(dri_priv->bytesPerPixel * 8);
/* Calling driInitExtensions here, with a NULL context pointer, does not actually /* Calling driInitExtensions here, with a NULL context pointer,
* enable the extensions. It just makes sure that all the dispatch offsets for all * does not actually enable the extensions. It just makes sure
* the extensions that *might* be enables are known. This is needed because the * that all the dispatch offsets for all the extensions that
* dispatch offsets need to be known when _mesa_context_create is called, but we can't * *might* be enables are known. This is needed because the
* enable the extensions until we have a context pointer. * dispatch offsets need to be known when _mesa_context_create is
* * called, but we can't enable the extensions until we have a
* Hello chicken. Hello egg. How are you two today? * context pointer.
*/ *
driInitExtensions( NULL, card_extensions, GL_FALSE ); * Hello chicken. Hello egg. How are you two today?
} */
driInitExtensions( NULL, card_extensions, GL_FALSE );
return (void *)psp; if (!sisInitDriver(psp))
return NULL;
return sisFillInModes(dri_priv->bytesPerPixel * 8);
} }

View File

@@ -345,7 +345,6 @@ tdfxSwapBuffers( __DRIdrawablePrivate *driDrawPriv )
static const struct __DriverAPIRec tdfxAPI = { static const struct __DriverAPIRec tdfxAPI = {
.InitDriver = tdfxInitDriver,
.DestroyScreen = tdfxDestroyScreen, .DestroyScreen = tdfxDestroyScreen,
.CreateContext = tdfxCreateContext, .CreateContext = tdfxCreateContext,
.DestroyContext = tdfxDestroyContext, .DestroyContext = tdfxDestroyContext,
@@ -431,69 +430,50 @@ static __GLcontextModes *tdfxFillInModes(unsigned pixel_bits,
} }
/** /**
* This is the bootstrap function for the driver. libGL supplies all of the * This is the driver specific part of the createNewScreen entry point.
* requisite information about the system, and the driver initializes itself. *
* This routine also fills in the linked list pointed to by \c driver_modes * \todo maybe fold this into intelInitDriver
* with the \c __GLcontextModes that the driver can support for windows or
* pbuffers.
* *
* \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on * \return the __GLcontextModes supported by this driver
* failure.
*/ */
PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp)
void *__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
const __GLcontextModes * modes,
const __DRIversion * ddx_version,
const __DRIversion * dri_version,
const __DRIversion * drm_version,
const __DRIframebuffer * frame_buffer,
drmAddress pSAREA, int fd,
int internal_api_version,
const __DRIinterfaceMethods * interface,
__GLcontextModes ** driver_modes)
{ {
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 1, 1, 0 }; static const __DRIversion ddx_expected = { 1, 1, 0 };
static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 1, 0, 0 }; static const __DRIversion drm_expected = { 1, 0, 0 };
dri_interface = interface; /* divined from tdfx_dri.c, sketchy */
TDFXDRIPtr dri_priv = (TDFXDRIPtr) psp->pDevPriv;
/* XXX i wish it was like this */
/* bpp = dri_priv->bpp */
int bpp = (dri_priv->cpp > 2) ? 24 : 16;
if ( ! driCheckDriDdxDrmVersions2( "tdfx", if ( ! driCheckDriDdxDrmVersions2( "tdfx",
dri_version, & dri_expected, &psp->dri_version, & dri_expected,
ddx_version, & ddx_expected, &psp->ddx_version, & ddx_expected,
drm_version, & drm_expected ) ) { &psp->drm_version, & drm_expected ) )
return NULL; return NULL;
}
psp = __driUtilCreateNewScreen(scrn, psc, NULL, psp->DriverAPI = tdfxAPI;
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &tdfxAPI);
if (psp != NULL) { /* Calling driInitExtensions here, with a NULL context pointer,
/* divined from tdfx_dri.c, sketchy */ * does not actually enable the extensions. It just makes sure
TDFXDRIPtr dri_priv = (TDFXDRIPtr) psp->pDevPriv; * that all the dispatch offsets for all the extensions that
int bpp = (dri_priv->cpp > 2) ? 24 : 16; * *might* be enables are known. This is needed because the
* dispatch offsets need to be known when _mesa_context_create is
* called, but we can't enable the extensions until we have a
* context pointer.
*
* Hello chicken. Hello egg. How are you two today?
*/
driInitExtensions( NULL, card_extensions, GL_FALSE );
driInitExtensions( NULL, napalm_extensions, GL_FALSE );
/* XXX i wish it was like this */ if (!tdfxInitDriver(psp))
/* bpp = dri_priv->bpp */ return NULL;
*driver_modes = tdfxFillInModes(bpp, (bpp == 16) ? 16 : 24, return tdfxFillInModes(bpp, (bpp == 16) ? 16 : 24,
(bpp == 16) ? 0 : 8, (bpp == 16) ? 0 : 8,
(dri_priv->backOffset!=dri_priv->depthOffset)); (dri_priv->backOffset!=dri_priv->depthOffset));
/* 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 *might* be enables are known. This is needed because the
* dispatch offsets need to be known when _mesa_context_create is called, but we can't
* enable the extensions until we have a context pointer.
*
* Hello chicken. Hello egg. How are you two today?
*/
driInitExtensions( NULL, card_extensions, GL_FALSE );
driInitExtensions( NULL, napalm_extensions, GL_FALSE );
}
return (void *)psp;
} }

View File

@@ -418,7 +418,6 @@ tridentInitDriver(__DRIscreenPrivate *sPriv)
} }
static struct __DriverAPIRec tridentAPI = { static struct __DriverAPIRec tridentAPI = {
tridentInitDriver,
tridentDestroyScreen, tridentDestroyScreen,
tridentCreateContext, tridentCreateContext,
tridentDestroyContext, tridentDestroyContext,
@@ -430,43 +429,36 @@ static struct __DriverAPIRec tridentAPI = {
}; };
PUBLIC void * /**
__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, * This is the driver specific part of the createNewScreen entry point.
const __GLcontextModes * modes, *
const __DRIversion * ddx_version, * \todo maybe fold this into intelInitDriver
const __DRIversion * dri_version, *
const __DRIversion * drm_version, * \return the __GLcontextModes supported by this driver
const __DRIframebuffer * frame_buffer, */
drmAddress pSAREA, int fd, __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp)
int internal_api_version,
const __DRIinterfaceMethods * interface,
__GLcontextModes ** driver_modes)
{ {
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 4, 0, 0 }; static const __DRIversion ddx_expected = { 4, 0, 0 };
static const __DRIversion dri_expected = { 3, 1, 0 }; static const __DRIversion dri_expected = { 3, 1, 0 };
static const __DRIversion drm_expected = { 1, 0, 0 }; static const __DRIversion drm_expected = { 1, 0, 0 };
dri_interface = interface;
if ( ! driCheckDriDdxDrmVersions2( "Trident", if ( ! driCheckDriDdxDrmVersions2( "Trident",
dri_version, & dri_expected, &psp->dri_version, & dri_expected,
ddx_version, & ddx_expected, &psp->ddx_version, & ddx_expected,
drm_version, & drm_expected ) ) { &psp->drm_version, & drm_expected ) )
return NULL; return NULL;
}
psp = __driUtilCreateNewScreen(scrn, psc, NULL, psp->DriverAPI = tridentAPI;
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &tridentAPI);
if ( psp != NULL ) { if (!tridentInitDriver(psp))
return NULL;
/* Wait... what? This driver doesn't report any modes... */
#if 0 #if 0
TRIDENTDRIPtr dri_priv = (TRIDENTDRIPtr) psp->pDevPriv; TRIDENTDRIPtr dri_priv = (TRIDENTDRIPtr) psp->pDevPriv;
*driver_modes = tridentFillInModes( dri_priv->bytesPerPixel * 8, *driver_modes = tridentFillInModes( dri_priv->bytesPerPixel * 8,
GL_TRUE ); GL_TRUE );
#endif #endif
}
return (void *) psp; return NULL;
} }

View File

@@ -325,7 +325,6 @@ viaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
static struct __DriverAPIRec viaAPI = { static struct __DriverAPIRec viaAPI = {
.InitDriver = viaInitDriver,
.DestroyScreen = viaDestroyScreen, .DestroyScreen = viaDestroyScreen,
.CreateContext = viaCreateContext, .CreateContext = viaCreateContext,
.DestroyContext = viaDestroyContext, .DestroyContext = viaDestroyContext,
@@ -407,66 +406,47 @@ viaFillInModes( unsigned pixel_bits, GLboolean have_back_buffer )
/** /**
* This is the bootstrap function for the driver. libGL supplies all of the * This is the driver specific part of the createNewScreen entry point.
* requisite information about the system, and the driver initializes itself.
* This routine also fills in the linked list pointed to by \c driver_modes
* with the \c __GLcontextModes that the driver can support for windows or
* pbuffers.
* *
* \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on * \todo maybe fold this into intelInitDriver
* failure. *
* \return the __GLcontextModes supported by this driver
*/ */
PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp)
void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
const __GLcontextModes * modes,
const __DRIversion * ddx_version,
const __DRIversion * dri_version,
const __DRIversion * drm_version,
const __DRIframebuffer * frame_buffer,
drmAddress pSAREA, int fd,
int internal_api_version,
const __DRIinterfaceMethods * interface,
__GLcontextModes ** driver_modes)
{ {
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { VIA_DRIDDX_VERSION_MAJOR, static const __DRIversion ddx_expected = { VIA_DRIDDX_VERSION_MAJOR,
VIA_DRIDDX_VERSION_MINOR, VIA_DRIDDX_VERSION_MINOR,
VIA_DRIDDX_VERSION_PATCH }; VIA_DRIDDX_VERSION_PATCH };
static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 2, 3, 0 }; static const __DRIversion drm_expected = { 2, 3, 0 };
static const char *driver_name = "Unichrome"; static const char *driver_name = "Unichrome";
VIADRIPtr dri_priv = (VIADRIPtr) psp->pDevPriv;
dri_interface = interface;
if ( ! driCheckDriDdxDrmVersions2( driver_name, if ( ! driCheckDriDdxDrmVersions2( driver_name,
dri_version, & dri_expected, &psp->dri_version, & dri_expected,
ddx_version, & ddx_expected, &psp->ddx_version, & ddx_expected,
drm_version, & drm_expected) ) { &psp->drm_version, & drm_expected) )
return NULL; return NULL;
}
psp = __driUtilCreateNewScreen(scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &viaAPI);
if ( psp != NULL ) {
VIADRIPtr dri_priv = (VIADRIPtr) psp->pDevPriv;
*driver_modes = viaFillInModes( dri_priv->bytesPerPixel * 8,
GL_TRUE );
/* Calling driInitExtensions here, with a NULL context pointer, does not actually psp->DriverAPI = viaAPI;
* enable the extensions. It just makes sure that all the dispatch offsets for all
* the extensions that *might* be enables are known. This is needed because the /* Calling driInitExtensions here, with a NULL context pointer,
* dispatch offsets need to be known when _mesa_context_create is called, but we can't * does not actually enable the extensions. It just makes sure
* enable the extensions until we have a context pointer. * that all the dispatch offsets for all the extensions that
* * *might* be enables are known. This is needed because the
* Hello chicken. Hello egg. How are you two today? * dispatch offsets need to be known when _mesa_context_create is
*/ * called, but we can't enable the extensions until we have a
driInitExtensions( NULL, card_extensions, GL_FALSE ); * context pointer.
} *
* Hello chicken. Hello egg. How are you two today?
*/
driInitExtensions( NULL, card_extensions, GL_FALSE );
if (!viaInitDriver(psp))
return NULL;
return viaFillInModes( dri_priv->bytesPerPixel * 8, GL_TRUE );
return (void *) psp;
} }