summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChad Versace <chadversary@chromium.org>2016-10-12 15:48:15 -0700
committerChad Versace <chadversary@chromium.org>2016-10-14 11:19:40 -0700
commita597c8ad5b75f37336257e3f4462caebacb621ef (patch)
treea511f5cdc001958448b535f7f201a681a7bb15d7 /src
parentc177ef9d47943f648a13beed14269f468583c16e (diff)
downloadexternal_mesa3d-a597c8ad5b75f37336257e3f4462caebacb621ef.zip
external_mesa3d-a597c8ad5b75f37336257e3f4462caebacb621ef.tar.gz
external_mesa3d-a597c8ad5b75f37336257e3f4462caebacb621ef.tar.bz2
egl: Implement EGL_MESA_platform_surfaceless
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Diffstat (limited to 'src')
-rw-r--r--src/egl/main/eglapi.c42
-rw-r--r--src/egl/main/egldisplay.c21
-rw-r--r--src/egl/main/egldisplay.h5
-rw-r--r--src/egl/main/eglglobals.c3
4 files changed, 70 insertions, 1 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 4568b8b..d8bd76d 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -393,6 +393,11 @@ _eglGetPlatformDisplayCommon(EGLenum platform, void *native_display,
attrib_list);
break;
#endif
+#ifdef HAVE_SURFACELESS_PLATFORM
+ case EGL_PLATFORM_SURFACELESS_MESA:
+ dpy = _eglGetSurfacelessDisplay(native_display, attrib_list);
+ break;
+#endif
default:
RETURN_EGL_ERROR(NULL, EGL_BAD_PARAMETER, NULL);
}
@@ -837,11 +842,30 @@ _eglCreateWindowSurfaceCommon(_EGLDisplay *disp, EGLConfig config,
_EGLSurface *surf;
EGLSurface ret;
- _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
if (native_window == NULL)
RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
+#ifdef HAVE_SURFACELESS_PLATFORM
+ if (disp->Platform == _EGL_PLATFORM_SURFACELESS) {
+ /* From the EGL_MESA_platform_surfaceless spec (v1):
+ *
+ * eglCreatePlatformWindowSurface fails when called with a <display>
+ * that belongs to the surfaceless platform. It returns
+ * EGL_NO_SURFACE and generates EGL_BAD_NATIVE_WINDOW. The
+ * justification for this unconditional failure is that the
+ * surfaceless platform has no native windows, and therefore the
+ * <native_window> parameter is always invalid.
+ *
+ * This check must occur before checking the EGLConfig, which emits
+ * EGL_BAD_CONFIG.
+ */
+ RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
+ }
+#endif
+
+ _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
+
surf = drv->API.CreateWindowSurface(drv, disp, conf, native_window,
attrib_list);
ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
@@ -943,6 +967,22 @@ _eglCreatePixmapSurfaceCommon(_EGLDisplay *disp, EGLConfig config,
_EGLSurface *surf;
EGLSurface ret;
+#if HAVE_SURFACELESS_PLATFORM
+ if (disp->Platform == _EGL_PLATFORM_SURFACELESS) {
+ /* From the EGL_MESA_platform_surfaceless spec (v1):
+ *
+ * [Like eglCreatePlatformWindowSurface,] eglCreatePlatformPixmapSurface
+ * also fails when called with a <display> that belongs to the
+ * surfaceless platform. It returns EGL_NO_SURFACE and generates
+ * EGL_BAD_NATIVE_PIXMAP.
+ *
+ * This check must occur before checking the EGLConfig, which emits
+ * EGL_BAD_CONFIG.
+ */
+ RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_NO_SURFACE);
+ }
+#endif
+
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
surf = drv->API.CreatePixmapSurface(drv, disp, conf, native_pixmap,
attrib_list);
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 3d4eb81..37711bd 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -540,3 +540,24 @@ _eglGetWaylandDisplay(struct wl_display *native_display,
return _eglFindDisplay(_EGL_PLATFORM_WAYLAND, native_display);
}
#endif /* HAVE_WAYLAND_PLATFORM */
+
+#ifdef HAVE_SURFACELESS_PLATFORM
+_EGLDisplay*
+_eglGetSurfacelessDisplay(void *native_display,
+ const EGLint *attrib_list)
+{
+ /* This platform has no native display. */
+ if (native_display != NULL) {
+ _eglError(EGL_BAD_PARAMETER, "eglGetPlatformDisplay");
+ return NULL;
+ }
+
+ /* This platform recognizes no display attributes. */
+ if (attrib_list != NULL && attrib_list[0] != EGL_NONE) {
+ _eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay");
+ return NULL;
+ }
+
+ return _eglFindDisplay(_EGL_PLATFORM_SURFACELESS, native_display);
+}
+#endif /* HAVE_SURFACELESS_PLATFORM */
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 22fb5c8..62d9a11 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -274,6 +274,11 @@ _eglGetWaylandDisplay(struct wl_display *native_display,
const EGLint *attrib_list);
#endif
+#ifdef HAVE_SURFACELESS_PLATFORM
+_EGLDisplay*
+_eglGetSurfacelessDisplay(void *native_display,
+ const EGLint *attrib_list);
+#endif
#ifdef __cplusplus
}
diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c
index 8fffa55..cb41063 100644
--- a/src/egl/main/eglglobals.c
+++ b/src/egl/main/eglglobals.c
@@ -62,6 +62,9 @@ struct _egl_global _eglGlobal =
#ifdef HAVE_DRM_PLATFORM
" EGL_MESA_platform_gbm"
#endif
+#ifdef HAVE_SURFACELESS_PLATFORM
+ " EGL_MESA_platform_surfaceless"
+#endif
" EGL_KHR_client_get_all_proc_addresses"
" EGL_KHR_debug",