mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 21:05:58 +01:00
render/egl: explicit client extension handling
Prior to this commit, wlr_egl_init seemed to assume the extension string queried via EGL_NO_DISPLAY was a subset of the extension string queried via an initialized display. This isn't correct. EGL_EXT_client_extensions [1] defines two types of extensions: client extensions and display extensions. The set of supported client and display extensions are disjoint (ie. an extension is either a client or a display extension, not both). Client extensions are queried via EGL_NO_DISPLAY, display extensions are queried via an initialized display. Rename the variables to make this clear. Remove the misleading comment. Log both client and display extensions. [1]: https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_client_extensions.txt
This commit is contained in:
parent
79e03c7d45
commit
7f9bbaaa17
1 changed files with 25 additions and 21 deletions
46
render/egl.c
46
render/egl.c
|
@ -145,16 +145,17 @@ out:
|
||||||
|
|
||||||
bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
|
bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
|
||||||
const EGLint *config_attribs, EGLint visual_id) {
|
const EGLint *config_attribs, EGLint visual_id) {
|
||||||
// Check for EGL_EXT_platform_base before creating a display, because we
|
const char *client_exts_str = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
|
||||||
// actually use this extension to create displays. Check for EGL_KHR_debug
|
if (client_exts_str == NULL) {
|
||||||
// before creating display to get EGL logs as soon as possible.
|
if (eglGetError() == EGL_BAD_DISPLAY) {
|
||||||
const char *exts_str = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
|
wlr_log(WLR_ERROR, "EGL_EXT_client_extensions not supported");
|
||||||
if (exts_str == NULL) {
|
} else {
|
||||||
wlr_log(WLR_ERROR, "Failed to query EGL extensions");
|
wlr_log(WLR_ERROR, "Failed to query EGL client extensions");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!check_egl_ext(exts_str, "EGL_EXT_platform_base")) {
|
if (!check_egl_ext(client_exts_str, "EGL_EXT_platform_base")) {
|
||||||
wlr_log(WLR_ERROR, "EGL_EXT_platform_base not supported");
|
wlr_log(WLR_ERROR, "EGL_EXT_platform_base not supported");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +164,7 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
|
||||||
load_egl_proc(&egl->procs.eglCreatePlatformWindowSurfaceEXT,
|
load_egl_proc(&egl->procs.eglCreatePlatformWindowSurfaceEXT,
|
||||||
"eglCreatePlatformWindowSurfaceEXT");
|
"eglCreatePlatformWindowSurfaceEXT");
|
||||||
|
|
||||||
if (check_egl_ext(exts_str, "EGL_KHR_debug")) {
|
if (check_egl_ext(client_exts_str, "EGL_KHR_debug")) {
|
||||||
load_egl_proc(&egl->procs.eglDebugMessageControlKHR,
|
load_egl_proc(&egl->procs.eglDebugMessageControlKHR,
|
||||||
"eglDebugMessageControlKHR");
|
"eglDebugMessageControlKHR");
|
||||||
|
|
||||||
|
@ -197,34 +198,36 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
exts_str = eglQueryString(egl->display, EGL_EXTENSIONS);
|
const char *display_exts_str = eglQueryString(egl->display, EGL_EXTENSIONS);
|
||||||
if (exts_str == NULL) {
|
if (display_exts_str == NULL) {
|
||||||
wlr_log(WLR_ERROR, "Failed to query EGL extensions");
|
wlr_log(WLR_ERROR, "Failed to query EGL display extensions");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_egl_ext(exts_str, "EGL_KHR_image_base")) {
|
if (check_egl_ext(display_exts_str, "EGL_KHR_image_base")) {
|
||||||
egl->exts.image_base_khr = true;
|
egl->exts.image_base_khr = true;
|
||||||
load_egl_proc(&egl->procs.eglCreateImageKHR, "eglCreateImageKHR");
|
load_egl_proc(&egl->procs.eglCreateImageKHR, "eglCreateImageKHR");
|
||||||
load_egl_proc(&egl->procs.eglDestroyImageKHR, "eglDestroyImageKHR");
|
load_egl_proc(&egl->procs.eglDestroyImageKHR, "eglDestroyImageKHR");
|
||||||
}
|
}
|
||||||
|
|
||||||
egl->exts.buffer_age_ext =
|
egl->exts.buffer_age_ext =
|
||||||
check_egl_ext(exts_str, "EGL_EXT_buffer_age");
|
check_egl_ext(display_exts_str, "EGL_EXT_buffer_age");
|
||||||
|
|
||||||
if (check_egl_ext(exts_str, "EGL_KHR_swap_buffers_with_damage")) {
|
if (check_egl_ext(display_exts_str, "EGL_KHR_swap_buffers_with_damage")) {
|
||||||
egl->exts.swap_buffers_with_damage = true;
|
egl->exts.swap_buffers_with_damage = true;
|
||||||
load_egl_proc(&egl->procs.eglSwapBuffersWithDamage,
|
load_egl_proc(&egl->procs.eglSwapBuffersWithDamage,
|
||||||
"eglSwapBuffersWithDamageKHR");
|
"eglSwapBuffersWithDamageKHR");
|
||||||
} else if (check_egl_ext(exts_str, "EGL_EXT_swap_buffers_with_damage")) {
|
} else if (check_egl_ext(display_exts_str,
|
||||||
|
"EGL_EXT_swap_buffers_with_damage")) {
|
||||||
egl->exts.swap_buffers_with_damage = true;
|
egl->exts.swap_buffers_with_damage = true;
|
||||||
load_egl_proc(&egl->procs.eglSwapBuffersWithDamage,
|
load_egl_proc(&egl->procs.eglSwapBuffersWithDamage,
|
||||||
"eglSwapBuffersWithDamageEXT");
|
"eglSwapBuffersWithDamageEXT");
|
||||||
}
|
}
|
||||||
|
|
||||||
egl->exts.image_dmabuf_import_ext =
|
egl->exts.image_dmabuf_import_ext =
|
||||||
check_egl_ext(exts_str, "EGL_EXT_image_dma_buf_import");
|
check_egl_ext(display_exts_str, "EGL_EXT_image_dma_buf_import");
|
||||||
if (check_egl_ext(exts_str, "EGL_EXT_image_dma_buf_import_modifiers")) {
|
if (check_egl_ext(display_exts_str,
|
||||||
|
"EGL_EXT_image_dma_buf_import_modifiers")) {
|
||||||
egl->exts.image_dmabuf_import_modifiers_ext = true;
|
egl->exts.image_dmabuf_import_modifiers_ext = true;
|
||||||
load_egl_proc(&egl->procs.eglQueryDmaBufFormatsEXT,
|
load_egl_proc(&egl->procs.eglQueryDmaBufFormatsEXT,
|
||||||
"eglQueryDmaBufFormatsEXT");
|
"eglQueryDmaBufFormatsEXT");
|
||||||
|
@ -232,7 +235,7 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
|
||||||
"eglQueryDmaBufModifiersEXT");
|
"eglQueryDmaBufModifiersEXT");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_egl_ext(exts_str, "EGL_MESA_image_dma_buf_export")) {
|
if (check_egl_ext(display_exts_str, "EGL_MESA_image_dma_buf_export")) {
|
||||||
egl->exts.image_dma_buf_export_mesa = true;
|
egl->exts.image_dma_buf_export_mesa = true;
|
||||||
load_egl_proc(&egl->procs.eglExportDMABUFImageQueryMESA,
|
load_egl_proc(&egl->procs.eglExportDMABUFImageQueryMESA,
|
||||||
"eglExportDMABUFImageQueryMESA");
|
"eglExportDMABUFImageQueryMESA");
|
||||||
|
@ -240,7 +243,7 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
|
||||||
"eglExportDMABUFImageMESA");
|
"eglExportDMABUFImageMESA");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_egl_ext(exts_str, "EGL_WL_bind_wayland_display")) {
|
if (check_egl_ext(display_exts_str, "EGL_WL_bind_wayland_display")) {
|
||||||
egl->exts.bind_wayland_display_wl = true;
|
egl->exts.bind_wayland_display_wl = true;
|
||||||
load_egl_proc(&egl->procs.eglBindWaylandDisplayWL,
|
load_egl_proc(&egl->procs.eglBindWaylandDisplayWL,
|
||||||
"eglBindWaylandDisplayWL");
|
"eglBindWaylandDisplayWL");
|
||||||
|
@ -256,13 +259,14 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(WLR_INFO, "Using EGL %d.%d", (int)major, (int)minor);
|
wlr_log(WLR_INFO, "Using EGL %d.%d", (int)major, (int)minor);
|
||||||
wlr_log(WLR_INFO, "Supported EGL extensions: %s", exts_str);
|
wlr_log(WLR_INFO, "Supported EGL client extensions: %s", client_exts_str);
|
||||||
|
wlr_log(WLR_INFO, "Supported EGL display extensions: %s", display_exts_str);
|
||||||
wlr_log(WLR_INFO, "EGL vendor: %s", eglQueryString(egl->display, EGL_VENDOR));
|
wlr_log(WLR_INFO, "EGL vendor: %s", eglQueryString(egl->display, EGL_VENDOR));
|
||||||
|
|
||||||
init_dmabuf_formats(egl);
|
init_dmabuf_formats(egl);
|
||||||
|
|
||||||
bool ext_context_priority =
|
bool ext_context_priority =
|
||||||
check_egl_ext(exts_str, "EGL_IMG_context_priority");
|
check_egl_ext(display_exts_str, "EGL_IMG_context_priority");
|
||||||
|
|
||||||
size_t atti = 0;
|
size_t atti = 0;
|
||||||
EGLint attribs[5];
|
EGLint attribs[5];
|
||||||
|
|
Loading…
Reference in a new issue