summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/ffb/ffb_xmesa.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/ffb/ffb_xmesa.c')
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_xmesa.c132
1 files changed, 49 insertions, 83 deletions
diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c
index a31cd57e88..3b7aa45903 100644
--- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c
+++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c
@@ -604,35 +604,18 @@ void ffbXMesaUpdateState(ffbContextPtr fmesa)
}
}
-static const struct __DriverAPIRec ffbAPI = {
- .InitDriver = ffbInitDriver,
- .DestroyScreen = ffbDestroyScreen,
- .CreateContext = ffbCreateContext,
- .DestroyContext = ffbDestroyContext,
- .CreateBuffer = ffbCreateBuffer,
- .DestroyBuffer = ffbDestroyBuffer,
- .SwapBuffers = ffbSwapBuffers,
- .MakeCurrent = ffbMakeCurrent,
- .UnbindContext = ffbUnbindContext,
- .GetSwapInfo = NULL,
- .GetMSC = NULL,
- .WaitForMSC = NULL,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-static __GLcontextModes *
-ffbFillInModes( unsigned pixel_bits, unsigned depth_bits,
- unsigned stencil_bits, GLboolean have_back_buffer )
+static const __DRIconfig **
+ffbFillInModes( __DRIscreenPrivate *psp,
+ unsigned pixel_bits, unsigned depth_bits,
+ unsigned stencil_bits, GLboolean have_back_buffer )
{
- __GLcontextModes * modes;
- __GLcontextModes * m;
- unsigned num_modes;
+ __DRIconfig **configs;
+ __GLcontextModes *m;
unsigned depth_buffer_factor;
unsigned back_buffer_factor;
GLenum fb_format;
GLenum fb_type;
+ int i;
/* GLX_SWAP_COPY_OML is only supported because the FFB driver doesn't
* support pageflipping at all.
@@ -644,7 +627,6 @@ ffbFillInModes( unsigned pixel_bits, unsigned depth_bits,
uint8_t depth_bits_array[3];
uint8_t stencil_bits_array[3];
-
depth_bits_array[0] = 0;
depth_bits_array[1] = depth_bits;
depth_bits_array[2] = depth_bits;
@@ -660,8 +642,6 @@ ffbFillInModes( unsigned pixel_bits, unsigned depth_bits,
depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1;
back_buffer_factor = (have_back_buffer) ? 3 : 1;
- num_modes = depth_buffer_factor * back_buffer_factor * 4;
-
if ( pixel_bits == 16 ) {
fb_format = GL_RGB;
fb_type = GL_UNSIGNED_SHORT_5_6_5;
@@ -671,82 +651,68 @@ ffbFillInModes( unsigned pixel_bits, unsigned depth_bits,
fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
- modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) );
- m = modes;
- if ( ! driFillInModes( & m, fb_format, fb_type,
- depth_bits_array, stencil_bits_array, depth_buffer_factor,
- back_buffer_modes, back_buffer_factor,
- GLX_TRUE_COLOR ) ) {
- fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
- __func__, __LINE__ );
- return NULL;
- }
- if ( ! driFillInModes( & m, fb_format, fb_type,
- depth_bits_array, stencil_bits_array, depth_buffer_factor,
- back_buffer_modes, back_buffer_factor,
- GLX_DIRECT_COLOR ) ) {
- fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
- __func__, __LINE__ );
- return NULL;
+ configs = driCreateConfigs(fb_format, fb_type,
+ depth_bits_array, stencil_bits_array,
+ depth_buffer_factor, back_buffer_modes,
+ back_buffer_factor);
+ if (configs == NULL) {
+ fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
+ __LINE__);
+ return NULL;
}
-
/* Mark the visual as slow if there are "fake" stencil bits.
*/
- for ( m = modes ; m != NULL ; m = m->next ) {
- if ( (m->stencilBits != 0) && (m->stencilBits != stencil_bits) ) {
- m->visualRating = GLX_SLOW_CONFIG;
+ for (i = 0; configs[i]; i++) {
+ m = &configs[i]->modes;
+ if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) {
+ m->visualRating = GLX_SLOW_CONFIG;
}
}
- return modes;
+ return (const __DRIconfig **) configs;
}
/**
- * 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.
+ * This is the driver specific part of the createNewScreen entry point.
*
- * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on
- * failure.
+ * \todo maybe fold this into intelInitDriver
+ *
+ * \return the __GLcontextModes supported by this driver
*/
-PUBLIC
-void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, 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 )
-
+static const __DRIconfig **
+ffbInitScreen(__DRIscreen *psp)
{
- __DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 0, 1, 1 };
static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 0, 0, 1 };
- dri_interface = interface;
-
if ( ! driCheckDriDdxDrmVersions2( "ffb",
- dri_version, & dri_expected,
- ddx_version, & ddx_expected,
- drm_version, & drm_expected ) ) {
+ &psp->dri_version, & dri_expected,
+ &psp->ddx_version, & ddx_expected,
+ &psp->drm_version, & drm_expected ) )
return NULL;
- }
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
- 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 );
- }
+ if (!ffbInitDriver(psp))
+ return NULL;
- return (void *) psp;
+ return ffbFillInModes( psp, 32, 16, 0, GL_TRUE );
}
+
+const struct __DriverAPIRec driDriverAPI = {
+ .InitScreen = ffbInitScreen,
+ .DestroyScreen = ffbDestroyScreen,
+ .CreateContext = ffbCreateContext,
+ .DestroyContext = ffbDestroyContext,
+ .CreateBuffer = ffbCreateBuffer,
+ .DestroyBuffer = ffbDestroyBuffer,
+ .SwapBuffers = ffbSwapBuffers,
+ .MakeCurrent = ffbMakeCurrent,
+ .UnbindContext = ffbUnbindContext,
+ .GetSwapInfo = NULL,
+ .GetDrawableMSC = NULL,
+ .WaitForMSC = NULL,
+ .WaitForSBC = NULL,
+ .SwapBuffersMSC = NULL
+};