st/egl: Hookup gbm for drm backend
[mesa.git] / src / gallium / state_trackers / egl / common / egl_g3d.c
index e60a56074dd57a5dbec4945482d869495f6ad7a9..6a40f4d2a4bd248440d6ce2e46d4bb2d5e5c3ce6 100644 (file)
@@ -72,10 +72,26 @@ egl_g3d_new_sw_screen(struct native_display *ndpy, struct sw_winsys *ws)
    return gdpy->loader->create_sw_screen(ws);
 }
 
+static struct pipe_resource *
+egl_g3d_lookup_egl_image(struct native_display *ndpy, void *egl_image)
+{
+   _EGLDisplay *dpy = (_EGLDisplay *) ndpy->user_data;
+   struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
+   struct st_egl_image img;
+   struct pipe_resource *resource = NULL;
+
+   memset(&img, 0, sizeof(img));
+   if (gdpy->smapi->get_egl_image(gdpy->smapi, egl_image, &img))
+      resource = img.texture;
+
+   return resource;
+}
+
 static struct native_event_handler egl_g3d_native_event_handler = {
    egl_g3d_invalid_surface,
    egl_g3d_new_drm_screen,
-   egl_g3d_new_sw_screen
+   egl_g3d_new_sw_screen,
+   egl_g3d_lookup_egl_image
 };
 
 /**
@@ -259,6 +275,10 @@ init_config_attributes(_EGLConfig *conf, const struct native_config *nconf,
    conf->DepthSize = depth_stencil[0];
    conf->StencilSize = depth_stencil[1];
 
+   /* st/vega will allocate the mask on demand */
+   if (api_mask & EGL_OPENVG_BIT)
+      conf->AlphaMaskSize = 8;
+
    conf->SurfaceType = surface_type;
 
    conf->NativeRenderable = EGL_TRUE;
@@ -368,7 +388,7 @@ egl_g3d_fill_depth_stencil_formats(_EGLDisplay *dpy,
       /* pick the first supported format */
       for (i = 0; i < n; i++) {
          if (screen->is_format_supported(screen, fmt[i],
-                  PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL, 0)) {
+                  PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL)) {
             formats[count++] = fmt[i];
             break;
          }
@@ -552,6 +572,11 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy)
    if (dpy->Platform == _EGL_PLATFORM_WAYLAND && gdpy->native->buffer)
       dpy->Extensions.MESA_drm_image = EGL_TRUE;
 
+#ifdef EGL_WL_bind_wayland_display
+   if (gdpy->native->wayland_bufmgr)
+      dpy->Extensions.WL_bind_wayland_display = EGL_TRUE;
+#endif
+
    if (egl_g3d_add_configs(drv, dpy, 1) == 1) {
       _eglError(EGL_NOT_INITIALIZED, "eglInitialize(unable to add configs)");
       goto fail;