diff options
author | Chad Versace <[email protected]> | 2016-10-12 15:48:15 -0700 |
---|---|---|
committer | Chad Versace <[email protected]> | 2016-10-14 11:19:40 -0700 |
commit | a597c8ad5b75f37336257e3f4462caebacb621ef (patch) | |
tree | a511f5cdc001958448b535f7f201a681a7bb15d7 /src/egl/main/eglapi.c | |
parent | c177ef9d47943f648a13beed14269f468583c16e (diff) |
egl: Implement EGL_MESA_platform_surfaceless
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/egl/main/eglapi.c')
-rw-r--r-- | src/egl/main/eglapi.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 4568b8b9d74..d8bd76dd12c 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); |