Check shm extension is supported before using it

If shm extension is not supported (for example by connecting to a remote X11 server), the xcb_shm_query_version call set an error in connection (error 2, XCB_CONN_CLOSED_EXT_NOTSUPPORTED), making it unusable for other calls.

Bug: swiftshader:169
Change-Id: Iaeac93208913b8f1407664fa4c913add4a943683
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/61928
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Peng Huang <penghuang@chromium.org>
Tested-by: Thomas Laroche <tho.laroche@gmail.com>
Commit-Queue: Thomas Laroche <tho.laroche@gmail.com>
diff --git a/src/WSI/libXCB.cpp b/src/WSI/libXCB.cpp
index e94da9e..60be41e 100644
--- a/src/WSI/libXCB.cpp
+++ b/src/WSI/libXCB.cpp
@@ -29,12 +29,14 @@
 	getFuncAddress(libxcb, "xcb_put_image", &xcb_put_image);
 	getFuncAddress(libxcb, "xcb_copy_area", &xcb_copy_area);
 	getFuncAddress(libxcb, "xcb_free_pixmap", &xcb_free_pixmap);
+	getFuncAddress(libxcb, "xcb_get_extension_data", &xcb_get_extension_data);
 
 	getFuncAddress(libshm, "xcb_shm_query_version", &xcb_shm_query_version);
 	getFuncAddress(libshm, "xcb_shm_query_version_reply", &xcb_shm_query_version_reply);
 	getFuncAddress(libshm, "xcb_shm_attach", &xcb_shm_attach);
 	getFuncAddress(libshm, "xcb_shm_detach", &xcb_shm_detach);
 	getFuncAddress(libshm, "xcb_shm_create_pixmap", &xcb_shm_create_pixmap);
+	xcb_shm_id = (xcb_extension_t *)getProcAddress(libshm, "xcb_shm_id");
 }
 
 LibXcbExports *LibXCB::operator->()