summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/sis/sis_screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/sis/sis_screen.c')
-rw-r--r--src/mesa/drivers/dri/sis/sis_screen.c142
1 files changed, 48 insertions, 94 deletions
diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c
index f55027e094..5888996af9 100644
--- a/src/mesa/drivers/dri/sis/sis_screen.c
+++ b/src/mesa/drivers/dri/sis/sis_screen.c
@@ -64,12 +64,10 @@ static const GLuint __driNConfigOptions = 3;
extern const struct dri_extension card_extensions[];
-static __GLcontextModes *
-sisFillInModes(int bpp)
+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;
@@ -92,9 +90,6 @@ sisFillInModes(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;
@@ -103,25 +98,15 @@ sisFillInModes(int bpp)
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)) {
+ 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;
}
- return modes;
+ return (const __DRIconfig **) configs;
}
@@ -287,23 +272,52 @@ sisSwapBuffers(__DRIdrawablePrivate *dPriv)
}
-/* Initialize the driver specific screen private data.
+/**
+ * This is the driver specific part of the createNewScreen entry point.
+ *
+ * \todo maybe fold this into intelInitDriver
+ *
+ * \return the __GLcontextModes supported by this driver
*/
-static GLboolean
-sisInitDriver( __DRIscreenPrivate *sPriv )
+static const __DRIconfig **
+sisInitScreen(__DRIscreenPrivate *psp)
{
- sPriv->private = (void *) sisCreateScreen( sPriv );
+ static const __DRIversion ddx_expected = {0, 8, 0};
+ static const __DRIversion dri_expected = {4, 0, 0};
+ static const __DRIversion drm_expected = {1, 0, 0};
+ static const char *driver_name = "SiS";
+ SISDRIPtr dri_priv = (SISDRIPtr)psp->pDevPriv;
- if ( !sPriv->private ) {
- sisDestroyScreen( sPriv );
- return GL_FALSE;
+ if (!driCheckDriDdxDrmVersions2(driver_name,
+ &psp->dri_version, &dri_expected,
+ &psp->ddx_version, &ddx_expected,
+ &psp->drm_version, &drm_expected))
+ 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->private = sisCreateScreen(psp);
+
+ if (!psp->private) {
+ sisDestroyScreen(psp);
+ return NULL;
}
- return GL_TRUE;
+ return sisFillInModes(psp, dri_priv->bytesPerPixel * 8);
}
-static struct __DriverAPIRec sisAPI = {
- .InitDriver = sisInitDriver,
+const struct __DriverAPIRec driDriverAPI = {
+ .InitScreen = sisInitScreen,
.DestroyScreen = sisDestroyScreen,
.CreateContext = sisCreateContext,
.DestroyContext = sisDestroyContext,
@@ -313,69 +327,9 @@ static struct __DriverAPIRec sisAPI = {
.MakeCurrent = sisMakeCurrent,
.UnbindContext = sisUnbindContext,
.GetSwapInfo = NULL,
- .GetMSC = NULL,
+ .GetDrawableMSC = NULL,
.WaitForMSC = NULL,
.WaitForSBC = NULL,
.SwapBuffersMSC = NULL
};
-
-
-/**
- * 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.
- *
- * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on
- * failure.
- */
-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 )
-
-{
- __DRIscreenPrivate *psp;
- static const __DRIversion ddx_expected = {0, 8, 0};
- static const __DRIversion dri_expected = {4, 0, 0};
- static const __DRIversion drm_expected = {1, 0, 0};
- static const char *driver_name = "SiS";
- dri_interface = interface;
-
- if (!driCheckDriDdxDrmVersions2(driver_name, dri_version, &dri_expected,
- ddx_version, &ddx_expected,
- 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, &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
- * 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;
-}