+ if (dri2_dpy->image) {
+ disp->Extensions.MESA_drm_image = EGL_TRUE;
+ disp->Extensions.KHR_image_base = EGL_TRUE;
+ disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
+ }
+}
+
+EGLBoolean
+dri2_create_screen(_EGLDisplay *disp)
+{
+ const __DRIextension **extensions;
+ struct dri2_egl_display *dri2_dpy;
+
+ 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);
+ } 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->dri_screen == NULL) {
+ _eglLog(_EGL_WARNING, "DRI2: failed to create dri screen");
+ return EGL_FALSE;
+ }
+
+ dri2_dpy->own_dri_screen = 1;
+
+ extensions = dri2_dpy->core->getExtensions(dri2_dpy->dri_screen);
+
+ if (dri2_dpy->dri2) {
+ if (!dri2_bind_extensions(dri2_dpy, dri2_core_extensions, extensions))
+ goto cleanup_dri_screen;
+ } else {
+ assert(dri2_dpy->swrast);
+ if (!dri2_bind_extensions(dri2_dpy, swrast_core_extensions, extensions))
+ goto cleanup_dri_screen;
+ }
+
+ dri2_setup_screen(disp);
+