diff options
author | Kristian Høgsberg <[email protected]> | 2008-03-08 20:02:22 -0500 |
---|---|---|
committer | Kristian Høgsberg <[email protected]> | 2008-03-08 20:02:22 -0500 |
commit | 53dc86363665b9b22f042c5d950b7de0ed02b4c8 (patch) | |
tree | 271c372db97264faaf93180559c30d5a3b027399 /src/glx/x11/dri_glx.c | |
parent | a1ea6f6198d80f716936a308cfab235f18a014e1 (diff) |
Move DRI specific parts of CreateContext into dri_glx.c.
Diffstat (limited to 'src/glx/x11/dri_glx.c')
-rw-r--r-- | src/glx/x11/dri_glx.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c index 194517a6577..2b43a74e66a 100644 --- a/src/glx/x11/dri_glx.c +++ b/src/glx/x11/dri_glx.c @@ -657,6 +657,42 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc, return psp; } + +static void driCreateContext(__GLXscreenConfigs *psc, + const __GLcontextModes *mode, + GLXContext gc, + GLXContext shareList, int renderType) +{ + drm_context_t hwContext; + __DRIcontext *shared; + + if (psc && psc->driScreen.private) { + shared = (shareList != NULL) ? &shareList->driContext : NULL; + + if (!XF86DRICreateContextWithConfig(psc->dpy, psc->scr, + mode->visualID, + &gc->hwContextID, &hwContext)) + /* gah, handle this better */ + return; + + gc->driContext.private = + (*psc->driScreen.createNewContext)( &psc->driScreen, + mode, renderType, + shared, + hwContext, + &gc->driContext ); + if (gc->driContext.private) { + gc->isDirect = GL_TRUE; + gc->screen = mode->screen; + gc->psc = psc; + gc->mode = mode; + } + else { + XF86DRIDestroyContext(psc->dpy, psc->scr, gc->hwContextID); + } + } +} + static void driDestroyScreen(__GLXscreenConfigs *psc) { /* Free the direct rendering per screen data */ @@ -698,6 +734,7 @@ static void driCreateScreen(__GLXscreenConfigs *psc, int screen, __glXScrEnableDRIExtension(psc); psc->driDestroyScreen = driDestroyScreen; + psc->driCreateContext = driCreateContext; } /* Called from __glXFreeDisplayPrivate. |