From d591e2fd36107717803b653ec5d0c33c01a7956e Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 25 Jan 2018 09:55:21 +1100 Subject: [PATCH] [client] added xlib-shim to disable calls to XSync The compiled xlib-shim.so can be used to intercept and prevent SDL from calling XSync, which causes latency issues on some video hardware. To use specify the full path to the file in the LD_PRELOAD environment variable, like so: LD_PRELOAD=/full/path/xlib-shim.so ./looking-glass --- client/Makefile | 5 ++++- client/xlib-shim.c | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 client/xlib-shim.c diff --git a/client/Makefile b/client/Makefile index 256e3719..d68d1564 100644 --- a/client/Makefile +++ b/client/Makefile @@ -26,7 +26,10 @@ OBJS = main.o \ BUILD_OBJS = $(foreach obj,$(OBJS),$(BUILD)/$(obj)) -all: $(BIN)/$(BINARY) +all: $(BIN)/$(BINARY) $(BIN)/xlib-shim.so + +$(BIN)/xlib-shim.so: + gcc -fPIC $(CFLAGS) -shared -o $@ xlib-shim.c $(BUILD)/%.o: %.c @mkdir -p $(dir $@) diff --git a/client/xlib-shim.c b/client/xlib-shim.c new file mode 100644 index 00000000..c3feb517 --- /dev/null +++ b/client/xlib-shim.c @@ -0,0 +1,15 @@ +#include +#include +#include "debug.h" + +int XSync(Display * display, Bool discard) +{ + static bool doneInfo = false; + if (!doneInfo) + { + DEBUG_INFO("XSync Override Enabled"); + doneInfo = true; + } + + return 0; +} \ No newline at end of file