summaryrefslogtreecommitdiff
path: root/lib/mesa/src/egl/drivers/dri2/egl_dri2.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2019-07-01 08:36:49 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2019-07-01 08:36:49 +0000
commitcaba34dab78a511c668481b21144cd9e1f4a0d44 (patch)
tree98afd1b0c919969abdf482b843819f2ff5695abb /lib/mesa/src/egl/drivers/dri2/egl_dri2.c
parent2710d6d469f07ac1e3d994de08797b1a6978f35b (diff)
Merge Mesa 19.0.8
Diffstat (limited to 'lib/mesa/src/egl/drivers/dri2/egl_dri2.c')
-rw-r--r--lib/mesa/src/egl/drivers/dri2/egl_dri2.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/mesa/src/egl/drivers/dri2/egl_dri2.c b/lib/mesa/src/egl/drivers/dri2/egl_dri2.c
index 645d72574..6504204ac 100644
--- a/lib/mesa/src/egl/drivers/dri2/egl_dri2.c
+++ b/lib/mesa/src/egl/drivers/dri2/egl_dri2.c
@@ -1433,6 +1433,37 @@ dri2_surf_update_fence_fd(_EGLContext *ctx,
dri2_surface_set_out_fence_fd(surf, fence_fd);
}
+EGLBoolean
+dri2_create_drawable(struct dri2_egl_display *dri2_dpy,
+ const __DRIconfig *config,
+ struct dri2_egl_surface *dri2_surf)
+{
+ __DRIcreateNewDrawableFunc createNewDrawable;
+ void *loaderPrivate = dri2_surf;
+
+ if (dri2_dpy->image_driver)
+ createNewDrawable = dri2_dpy->image_driver->createNewDrawable;
+ else if (dri2_dpy->dri2)
+ createNewDrawable = dri2_dpy->dri2->createNewDrawable;
+ else if (dri2_dpy->swrast)
+ createNewDrawable = dri2_dpy->swrast->createNewDrawable;
+ else
+ return _eglError(EGL_BAD_ALLOC, "no createNewDrawable");
+
+ /* As always gbm is a bit special.. */
+#ifdef HAVE_DRM_PLATFORM
+ if (dri2_surf->gbm_surf)
+ loaderPrivate = dri2_surf->gbm_surf;
+#endif
+
+ dri2_surf->dri_drawable = (*createNewDrawable)(dri2_dpy->dri_screen,
+ config, loaderPrivate);
+ if (dri2_surf->dri_drawable == NULL)
+ return _eglError(EGL_BAD_ALLOC, "createNewDrawable");
+
+ return EGL_TRUE;
+}
+
/**
* Called via eglMakeCurrent(), drv->API.MakeCurrent().
*/