diff options
author | Eric Anholt <[email protected]> | 2013-09-27 11:39:25 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2013-10-24 14:04:20 -0700 |
commit | f93533d118b6dab00022cc9bc1448615a25946dc (patch) | |
tree | eac8fb7a9f34ba1f8b14738aef46dfc0184c6dd1 /src/egl/drivers | |
parent | 67caf36489e29c93ed1a25541944b191ed50df52 (diff) |
dri: Pass in the dlsym()ed driver extension to screen creation.
This will allow a megadrivers build to reference the actual driver being
loaded from the shared dri_util screen creation code.
v2: Fix indentation, fallback case in EGL (review by Emil).
Reviewed-by: Matt Turner <[email protected]> (v1)
Reviewed-by: Chad Versace <[email protected]> (v1)
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/egl/drivers')
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.c | 30 | ||||
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.h | 1 |
2 files changed, 25 insertions, 6 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index c2576846380..a64f4e8e9c2 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -449,6 +449,7 @@ dri2_load_driver(_EGLDisplay *disp) dlclose(dri2_dpy->driver); return EGL_FALSE; } + dri2_dpy->driver_extensions = extensions; return EGL_TRUE; } @@ -469,6 +470,7 @@ dri2_load_driver_swrast(_EGLDisplay *disp) dlclose(dri2_dpy->driver); return EGL_FALSE; } + dri2_dpy->driver_extensions = extensions; return EGL_TRUE; } @@ -534,14 +536,30 @@ dri2_create_screen(_EGLDisplay *disp) dri2_dpy = disp->DriverData; if (dri2_dpy->dri2) { - dri2_dpy->dri_screen = - dri2_dpy->dri2->createNewScreen(0, dri2_dpy->fd, dri2_dpy->extensions, - &dri2_dpy->driver_configs, disp); + if (dri2_dpy->dri2->base.version >= 4) { + dri2_dpy->dri_screen = + dri2_dpy->dri2->createNewScreen2(0, dri2_dpy->fd, + dri2_dpy->extensions, + dri2_dpy->driver_extensions, + &dri2_dpy->driver_configs, disp); + } else { + dri2_dpy->dri_screen = + dri2_dpy->dri2->createNewScreen(0, dri2_dpy->fd, + dri2_dpy->extensions, + &dri2_dpy->driver_configs, disp); + } } else { assert(dri2_dpy->swrast); - dri2_dpy->dri_screen = - dri2_dpy->swrast->createNewScreen(0, dri2_dpy->extensions, - &dri2_dpy->driver_configs, disp); + if (dri2_dpy->swrast->base.version >= 4) { + dri2_dpy->dri_screen = + dri2_dpy->swrast->createNewScreen2(0, dri2_dpy->extensions, + dri2_dpy->driver_extensions, + &dri2_dpy->driver_configs, disp); + } else { + dri2_dpy->dri_screen = + dri2_dpy->swrast->createNewScreen(0, dri2_dpy->extensions, + &dri2_dpy->driver_configs, disp); + } } if (dri2_dpy->dri_screen == NULL) { diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index 4a39efbde09..c7d64846c7e 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -118,6 +118,7 @@ struct dri2_egl_display __DRIdri2LoaderExtension dri2_loader_extension; __DRIswrastLoaderExtension swrast_loader_extension; const __DRIextension *extensions[4]; + const __DRIextension **driver_extensions; #ifdef HAVE_X11_PLATFORM xcb_connection_t *conn; |