gfxstream-x11: handle libX11.so opening failure
When this happens, most likely it is due to missing
symlink to libX11.so.6; we will simply try the later
again.
Bug: 280284109
Test:
Intel ubuntu 22.04, launch gfxstream emulator,it
should not complain aboult failing to open
default display (XOpenDisplay should succeed)
Change-Id: Iabf7f921286b9881a1a50facd1d0c002382d3864
diff --git a/stream-servers/apigen-codec-common/X11Support.cpp b/stream-servers/apigen-codec-common/X11Support.cpp
index 356c949..8c8f55d 100644
--- a/stream-servers/apigen-codec-common/X11Support.cpp
+++ b/stream-servers/apigen-codec-common/X11Support.cpp
@@ -14,6 +14,14 @@
public:
X11FunctionGetter() :
mX11Lib(android::base::SharedLibrary::open("libX11")) {
+ if (!mX11Lib) {
+ fprintf(stderr, "WARNING: could not open libX11.so, try libX11.so.6\n");
+ mX11Lib = (android::base::SharedLibrary::open("libX11.so.6"));
+ if (!mX11Lib) {
+ fprintf(stderr, "ERROR: could not open libX11.so.6, give up\n");
+ return;
+ }
+ }
#define X11_ASSIGN_DUMMY_IMPL(funcname) mApi.funcname = dummy_##funcname;