[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
This commit is contained in:
Geoffrey McRae 2018-01-25 09:55:21 +11:00
parent c61d97b0ac
commit d591e2fd36
2 changed files with 19 additions and 1 deletions

View File

@ -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 $@)

15
client/xlib-shim.c Normal file
View File

@ -0,0 +1,15 @@
#include <X11/Xlib.h>
#include <stdbool.h>
#include "debug.h"
int XSync(Display * display, Bool discard)
{
static bool doneInfo = false;
if (!doneInfo)
{
DEBUG_INFO("XSync Override Enabled");
doneInfo = true;
}
return 0;
}