summaryrefslogtreecommitdiffstats
path: root/src/egl/main/egldisplay.c
diff options
context:
space:
mode:
authorAdam Jackson <[email protected]>2017-05-02 12:27:01 -0400
committerAdam Jackson <[email protected]>2017-05-04 12:52:18 -0400
commitddb99127a6f6c6d0284f3395e0b06aed575f0ecd (patch)
tree575cdd13039615992811e91f7fc110a69dcdf21f /src/egl/main/egldisplay.c
parent939b015736d5091faeabde4f5a373e6a1612c5ed (diff)
egl/x11: Honor the EGL_PLATFORM_X11_SCREEN_EXT attribute
Introduce _egl_display::Options::Platforms for private storage. For X11 platforms we can use it for the screen number as set by EGL_PLATFORM_X11_SCREEN_EXT. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Adam Jackson <[email protected]>
Diffstat (limited to 'src/egl/main/egldisplay.c')
-rw-r--r--src/egl/main/egldisplay.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 37711bd8695..b047a5de429 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -472,7 +472,7 @@ _eglUnlinkResource(_EGLResource *res, _EGLResourceType type)
#ifdef HAVE_X11_PLATFORM
static EGLBoolean
-_eglParseX11DisplayAttribList(const EGLint *attrib_list)
+_eglParseX11DisplayAttribList(_EGLDisplay *display, const EGLint *attrib_list)
{
int i;
@@ -486,11 +486,10 @@ _eglParseX11DisplayAttribList(const EGLint *attrib_list)
/* EGL_EXT_platform_x11 recognizes exactly one attribute,
* EGL_PLATFORM_X11_SCREEN_EXT, which is optional.
- *
- * Mesa supports connecting to only the default screen, so we reject
- * screen != 0.
*/
- if (attrib != EGL_PLATFORM_X11_SCREEN_EXT || value != 0) {
+ if (attrib == EGL_PLATFORM_X11_SCREEN_EXT) {
+ display->Options.Platform = (void *)value;
+ } else {
_eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay");
return EGL_FALSE;
}
@@ -503,11 +502,17 @@ _EGLDisplay*
_eglGetX11Display(Display *native_display,
const EGLint *attrib_list)
{
- if (!_eglParseX11DisplayAttribList(attrib_list)) {
+ _EGLDisplay *display = _eglFindDisplay(_EGL_PLATFORM_X11,
+ native_display);
+
+ if (!display)
+ _eglError(EGL_BAD_ALLOC, "eglGetPlatformDisplay");
+
+ if (!_eglParseX11DisplayAttribList(display, attrib_list)) {
return NULL;
}
- return _eglFindDisplay(_EGL_PLATFORM_X11, native_display);
+ return display;
}
#endif /* HAVE_X11_PLATFORM */