egl/x11: factor out dri2_get_xcb_connection()
authorEmil Velikov <emil.velikov@collabora.com>
Mon, 21 Nov 2016 13:46:50 +0000 (13:46 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Tue, 22 Nov 2016 15:13:41 +0000 (15:13 +0000)
commitb9880d2e93a260c348b9413cb2c633365ba13b6e
tree18795e84d697ed69cd200e0baefa7062d07da416
parenta56a505db72b0a5ff973a489a094186d7dfcd9e7
egl/x11: factor out dri2_get_xcb_connection()

Identical throughout dri2, dri3 and drisw. Next patch will add more
common code, so rather than duplicating it factor out the function.

Note: this also sets eglError on failure. Something that's quite
inconsistent throughout the codebase.

v2: Call xcb_disconnect() on error (Eric)

Note: use xcb_disconnect() even in the xcb_connection_has_error() case
as per the manual:
... memory will not be freed until xcb_disconnect...

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
src/egl/drivers/dri2/platform_x11.c