egl/x11: set EGL_BAD_NATIVE_(PIXMAP|WINDOW) for invalid pixmaps/windows
authorFrank Binns <frank.binns@imgtec.com>
Tue, 4 Aug 2015 13:32:44 +0000 (14:32 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Thu, 13 Aug 2015 16:36:06 +0000 (17:36 +0100)
commit3b491cbc42f6cfad2e750957f720b15b95278acf
tree1599c196e8bc3626a52c4fa73555afe52faeda52
parent2900e8ca9077d20c5b29bb5a4171ac59ea9d1767
egl/x11: set EGL_BAD_NATIVE_(PIXMAP|WINDOW) for invalid pixmaps/windows

Both eglCreatePixmapSurface and eglCreateWindowSurface were incorrectly
setting the EGL error to be EGL_BAD_ALLOC when an invalid native drawable
handle was being passed in. The EGL spec states the following for
eglCreatePixmapSurface:

"If pixmap is not a valid native pixmap handle, then an EGL_BAD_-
 NATIVE_PIXMAP error should be generated."

(eglCreateWindowSurface has similar text)

Correctly set the EGL error value based on xcb_get_geometry_reply returning
an error structure containing something other than BadAlloc.

v2: Check for BadAlloc error and update commit message to reflect this

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
src/egl/drivers/dri2/platform_x11.c