diff options
Diffstat (limited to 'src/mesa/drivers/dri/sis')
-rw-r--r-- | src/mesa/drivers/dri/sis/sis_screen.c | 93 |
1 files changed, 33 insertions, 60 deletions
diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index ad2fe51e448..bf0b1ce2767 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -65,12 +65,10 @@ static const GLuint __driNConfigOptions = 3; extern const struct dri_extension card_extensions[]; -static __GLcontextModes * +static const __DRIconfig ** sisFillInModes(__DRIscreenPrivate *psp, int bpp) { - __GLcontextModes *modes; - __GLcontextModes *m; - unsigned num_modes; + __DRIconfig **configs; unsigned depth_buffer_factor; unsigned back_buffer_factor; GLenum fb_format; @@ -93,9 +91,6 @@ sisFillInModes(__DRIscreenPrivate *psp, int bpp) depth_buffer_factor = 4; back_buffer_factor = 2; - /* Last 4 is for GLX_TRUE_COLOR & GLX_DIRECT_COLOR, with/without accum */ - num_modes = depth_buffer_factor * back_buffer_factor * 4; - if (bpp == 16) { fb_format = GL_RGB; fb_type = GL_UNSIGNED_SHORT_5_6_5; @@ -104,25 +99,15 @@ sisFillInModes(__DRIscreenPrivate *psp, int bpp) fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - modes = (*psp->contextModes->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)) { + 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; } - 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; - } - - return modes; + return (const __DRIconfig **) configs; } @@ -288,39 +273,6 @@ sisSwapBuffers(__DRIdrawablePrivate *dPriv) } -/* Initialize the driver specific screen private data. - */ -static GLboolean -sisInitDriver( __DRIscreenPrivate *sPriv ) -{ - sPriv->private = (void *) sisCreateScreen( sPriv ); - - if ( !sPriv->private ) { - sisDestroyScreen( sPriv ); - return GL_FALSE; - } - - return GL_TRUE; -} - -static struct __DriverAPIRec sisAPI = { - .DestroyScreen = sisDestroyScreen, - .CreateContext = sisCreateContext, - .DestroyContext = sisDestroyContext, - .CreateBuffer = sisCreateBuffer, - .DestroyBuffer = sisDestroyBuffer, - .SwapBuffers = sisSwapBuffers, - .MakeCurrent = sisMakeCurrent, - .UnbindContext = sisUnbindContext, - .GetSwapInfo = NULL, - .GetDrawableMSC = NULL, - .WaitForMSC = NULL, - .WaitForSBC = NULL, - .SwapBuffersMSC = NULL - -}; - - /** * This is the driver specific part of the createNewScreen entry point. * @@ -328,7 +280,8 @@ static struct __DriverAPIRec sisAPI = { * * \return the __GLcontextModes supported by this driver */ -__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) +static const __DRIconfig ** +sisInitScreen(__DRIscreenPrivate *psp) { static const __DRIversion ddx_expected = {0, 8, 0}; static const __DRIversion dri_expected = {4, 0, 0}; @@ -342,8 +295,6 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) &psp->drm_version, &drm_expected)) return NULL; - psp->DriverAPI = sisAPI; - /* 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 @@ -356,8 +307,30 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) */ driInitExtensions( NULL, card_extensions, GL_FALSE ); - if (!sisInitDriver(psp)) - return NULL; + psp->private = sisCreateScreen(psp); + + if (!psp->private) { + sisDestroyScreen(psp); + return NULL; + } return sisFillInModes(psp, dri_priv->bytesPerPixel * 8); } + +const struct __DriverAPIRec driDriverAPI = { + .InitScreen = sisInitScreen, + .DestroyScreen = sisDestroyScreen, + .CreateContext = sisCreateContext, + .DestroyContext = sisDestroyContext, + .CreateBuffer = sisCreateBuffer, + .DestroyBuffer = sisDestroyBuffer, + .SwapBuffers = sisSwapBuffers, + .MakeCurrent = sisMakeCurrent, + .UnbindContext = sisUnbindContext, + .GetSwapInfo = NULL, + .GetDrawableMSC = NULL, + .WaitForMSC = NULL, + .WaitForSBC = NULL, + .SwapBuffersMSC = NULL + +}; |