egl/x11: factor out dri2_get_xcb_connection()
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 <f20878473f414da183da19ee25c8722cc1d711e4@collabora.com>
Reviewed-by: Eric Engestrom <de0b63cf2dfb1fae8ed3c3b4244856a05677d4f0@imgtec.com> (v1)

metora/MesaGLSLCompiler,metora/MesaGLSLCompiler,metora/MesaGLSLCompiler