diff options
author | Frank Binns <[email protected]> | 2015-08-04 14:32:43 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2015-08-13 17:36:06 +0100 |
commit | 2900e8ca9077d20c5b29bb5a4171ac59ea9d1767 (patch) | |
tree | 25e4e517321293a751b4dcf8573718060d67878c /src/egl | |
parent | 8dffa89e013b611cdafbb2cc5216450fa248cb7c (diff) |
egl/x11: fix use of EGL_BAD_NATIVE_WINDOW
Commit 4ed23fd590 introduced some calls to _eglError inappropriately
passing it EGL_BAD_NATIVE_WINDOW. This was actually harmless in two of the
cases as _eglError gets called later on with a more appropriate error code
but (just to be safe) switch these to _eglLog calls instead.
The final case is a little trickier as it actually needs to set an error
of which the following are available (according to the EGL spec):
EGL_BAD_MATCH, EGL_BAD_CONFIG, EGL_BAD_NATIVE_(PIXMAP|WINDOW) and
EGL_BAD_ALLOC.
Of these, EGL_BAD_ALLOC seems to be the most appropriate given that
failure can occur either as a result of xcb_get_setup failing due to an
earlier error on the connection (where the most commonly occurring error
code is XCB_CONN_CLOSED_MEM_INSUFFICIENT) or as a result of the
xcb_screen_iterator_t 'rem' field being 0.
In addition to this, commit af2aea40d2 unconditionally set the error to
EGL_BAD_NATIVE_WINDOW when creating a window or pixmap surface with a NULL
native handle. Change this to correctly set the error based on surface
type.
v2: Updated patch description (Emil Velikov)
Return EGL_BAD_NATIVE_PIXMAP when eglCreatePixmapSurface is called
with a NULL native pixmap handle
Signed-off-by: Frank Binns <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/egl')
-rw-r--r-- | src/egl/drivers/dri2/platform_x11.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 9b040f7d491..3b5277738ae 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -226,7 +226,7 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn)); screen = get_xcb_screen(s, dri2_dpy->screen); if (!screen) { - _eglError(EGL_BAD_NATIVE_WINDOW, "dri2_create_surface"); + _eglError(EGL_BAD_ALLOC, "failed to get xcb screen"); goto cleanup_surf; } @@ -236,7 +236,10 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, dri2_surf->base.Width, dri2_surf->base.Height); } else { if (!drawable) { - _eglError(EGL_BAD_NATIVE_WINDOW, "dri2_create_surface"); + if (type == EGL_WINDOW_BIT) + _eglError(EGL_BAD_NATIVE_WINDOW, "dri2_create_surface"); + else + _eglError(EGL_BAD_NATIVE_PIXMAP, "dri2_create_surface"); goto cleanup_surf; } dri2_surf->drawable = drawable; @@ -544,7 +547,7 @@ dri2_x11_connect(struct dri2_egl_display *dri2_dpy) s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn)); screen = get_xcb_screen(s, dri2_dpy->screen); if (!screen) { - _eglError(EGL_BAD_NATIVE_WINDOW, "dri2_x11_connect"); + _eglLog(_EGL_WARNING, "DRI2: failed to get xcb screen"); return EGL_FALSE; } connect_cookie = xcb_dri2_connect_unchecked(dri2_dpy->conn, screen->root, @@ -635,7 +638,7 @@ dri2_x11_authenticate(_EGLDisplay *disp, uint32_t id) screen = get_xcb_screen(s, dri2_dpy->screen); if (!screen) { - _eglError(EGL_BAD_NATIVE_WINDOW, "dri2_x11_authenticate"); + _eglLog(_EGL_WARNING, "DRI2: failed to get xcb screen"); return -1; } |