libobs-opengl: Try to use the platform display if available
We need to ensure we're running all X11 code on the same display.
This commit is contained in:
parent
2b3cb54771
commit
137966e01f
@ -324,14 +324,19 @@ static void gl_x11_egl_windowinfo_destroy(struct gl_windowinfo *info)
|
|||||||
bfree(info);
|
bfree(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Display *open_windowless_display(void)
|
static Display *open_windowless_display(Display *platform_display)
|
||||||
{
|
{
|
||||||
Display *display = XOpenDisplay(NULL);
|
Display *display;
|
||||||
xcb_connection_t *xcb_conn;
|
xcb_connection_t *xcb_conn;
|
||||||
xcb_screen_iterator_t screen_iterator;
|
xcb_screen_iterator_t screen_iterator;
|
||||||
xcb_screen_t *screen;
|
xcb_screen_t *screen;
|
||||||
int screen_num;
|
int screen_num;
|
||||||
|
|
||||||
|
if (platform_display)
|
||||||
|
display = platform_display;
|
||||||
|
else
|
||||||
|
display = XOpenDisplay(NULL);
|
||||||
|
|
||||||
if (!display) {
|
if (!display) {
|
||||||
blog(LOG_ERROR, "Unable to open new X connection!");
|
blog(LOG_ERROR, "Unable to open new X connection!");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -392,7 +397,8 @@ static struct gl_platform *gl_x11_egl_platform_create(gs_device_t *device,
|
|||||||
For an explanation see here: http://xcb.freedesktop.org/MixingCalls/
|
For an explanation see here: http://xcb.freedesktop.org/MixingCalls/
|
||||||
Essentially, EGL requires Xlib. Everything else we use xcb. */
|
Essentially, EGL requires Xlib. Everything else we use xcb. */
|
||||||
struct gl_platform *plat = bmalloc(sizeof(struct gl_platform));
|
struct gl_platform *plat = bmalloc(sizeof(struct gl_platform));
|
||||||
Display *display = open_windowless_display();
|
Display *platform_display = obs_get_nix_platform_display();
|
||||||
|
Display *display = open_windowless_display(platform_display);
|
||||||
|
|
||||||
if (!display) {
|
if (!display) {
|
||||||
goto fail_display_open;
|
goto fail_display_open;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user