aboutsummaryrefslogtreecommitdiff
path: root/src/egl.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-03-10 23:17:44 +0100
committerdec05eba <dec05eba@protonmail.com>2024-03-10 23:17:44 +0100
commit0d25ffb2a97ff7ff51fab72b6780024909f3e1a6 (patch)
treeab9bf059479d2ed29687067785aaddfa3c76ec7c /src/egl.c
parent8b3afca0c676aef7e821330e8698220fca79f15c (diff)
Show the correct monitors when using prime-run
Diffstat (limited to 'src/egl.c')
-rw-r--r--src/egl.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/egl.c b/src/egl.c
index 0ad9f13..b574f90 100644
--- a/src/egl.c
+++ b/src/egl.c
@@ -221,6 +221,7 @@ static bool gsr_egl_load_egl(gsr_egl *self, void *library) {
{ (void**)&self->eglDestroyContext, "eglDestroyContext" },
{ (void**)&self->eglDestroySurface, "eglDestroySurface" },
{ (void**)&self->eglBindAPI, "eglBindAPI" },
+ { (void**)&self->eglGetProcAddress, "eglGetProcAddress" },
{ NULL, NULL }
};
@@ -248,6 +249,13 @@ static bool gsr_egl_load_gl(gsr_egl *self, void *library) {
return true;
}
+static bool gsr_egl_proc_load_egl(gsr_egl *self) {
+ self->eglQueryDisplayAttribEXT = (FUNC_eglQueryDisplayAttribEXT)self->eglGetProcAddress("eglQueryDisplayAttribEXT");
+ self->eglQueryDeviceStringEXT = (FUNC_eglQueryDeviceStringEXT)self->eglGetProcAddress("eglQueryDeviceStringEXT");
+
+ return true;
+}
+
bool gsr_egl_load(gsr_egl *self, Display *dpy, bool wayland) {
memset(self, 0, sizeof(gsr_egl));
self->x11.dpy = dpy;
@@ -274,9 +282,18 @@ bool gsr_egl_load(gsr_egl *self, Display *dpy, bool wayland) {
if(!gsr_egl_load_gl(self, gl_lib))
goto fail;
+ if(!gsr_egl_proc_load_egl(self))
+ goto fail;
+
if(!gsr_egl_create_window(self, wayland))
goto fail;
+ if(self->eglQueryDisplayAttribEXT && self->eglQueryDeviceStringEXT) {
+ intptr_t device = 0;
+ if(self->eglQueryDisplayAttribEXT(self->egl_display, EGL_DEVICE_EXT, &device) && device)
+ self->dri_card_path = self->eglQueryDeviceStringEXT((void*)device, EGL_DRM_DEVICE_FILE_EXT);
+ }
+
self->egl_library = egl_lib;
self->gl_library = gl_lib;
return true;