mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 06:35:58 +01:00
render/egl: remove support for EGL_NATIVE_VISUAL_ID
Nobody uses it anymore.
This commit is contained in:
parent
07111828c5
commit
76ed2255ef
11 changed files with 19 additions and 48 deletions
|
@ -193,7 +193,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLint attribs[] = { EGL_NONE };
|
EGLint attribs[] = { EGL_NONE };
|
||||||
wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs, 0);
|
wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs);
|
||||||
|
|
||||||
struct wl_surface *surface = wl_compositor_create_surface(compositor);
|
struct wl_surface *surface = wl_compositor_create_surface(compositor);
|
||||||
struct xdg_surface *xdg_surface =
|
struct xdg_surface *xdg_surface =
|
||||||
|
|
|
@ -158,7 +158,7 @@ int main(int argc, char **argv) {
|
||||||
assert(input_inhibitor);
|
assert(input_inhibitor);
|
||||||
|
|
||||||
EGLint attribs[] = { EGL_NONE };
|
EGLint attribs[] = { EGL_NONE };
|
||||||
wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs, 0);
|
wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs);
|
||||||
|
|
||||||
struct wl_surface *surface = wl_compositor_create_surface(compositor);
|
struct wl_surface *surface = wl_compositor_create_surface(compositor);
|
||||||
assert(surface);
|
assert(surface);
|
||||||
|
|
|
@ -225,7 +225,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLint attribs[] = { EGL_NONE };
|
EGLint attribs[] = { EGL_NONE };
|
||||||
wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs, 0);
|
wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs);
|
||||||
|
|
||||||
struct wl_surface *surface = wl_compositor_create_surface(compositor);
|
struct wl_surface *surface = wl_compositor_create_surface(compositor);
|
||||||
struct xdg_surface *xdg_surface =
|
struct xdg_surface *xdg_surface =
|
||||||
|
|
|
@ -611,7 +611,7 @@ int main(int argc, char **argv) {
|
||||||
assert(cursor_surface);
|
assert(cursor_surface);
|
||||||
|
|
||||||
EGLint attribs[] = { EGL_ALPHA_SIZE, 8, EGL_NONE };
|
EGLint attribs[] = { EGL_ALPHA_SIZE, 8, EGL_NONE };
|
||||||
wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs, 0);
|
wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs);
|
||||||
|
|
||||||
wl_surface = wl_compositor_create_surface(compositor);
|
wl_surface = wl_compositor_create_surface(compositor);
|
||||||
assert(wl_surface);
|
assert(wl_surface);
|
||||||
|
|
|
@ -212,7 +212,7 @@ int main(int argc, char **argv) {
|
||||||
regions[REGION_TYPE_JOINT] = joint_region;
|
regions[REGION_TYPE_JOINT] = joint_region;
|
||||||
|
|
||||||
EGLint attribs[] = { EGL_NONE };
|
EGLint attribs[] = { EGL_NONE };
|
||||||
wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs, 0);
|
wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs);
|
||||||
|
|
||||||
struct wl_surface *surface = wl_compositor_create_surface(compositor);
|
struct wl_surface *surface = wl_compositor_create_surface(compositor);
|
||||||
struct xdg_surface *xdg_surface =
|
struct xdg_surface *xdg_surface =
|
||||||
|
|
|
@ -444,7 +444,7 @@ int main(int argc, char **argv) {
|
||||||
e->width = e->height = 512;
|
e->width = e->height = 512;
|
||||||
|
|
||||||
EGLint attribs[] = { EGL_NONE };
|
EGLint attribs[] = { EGL_NONE };
|
||||||
wlr_egl_init(e->egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs, 0);
|
wlr_egl_init(e->egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs);
|
||||||
|
|
||||||
/* Create the surface and xdg_toplevels, and set listeners */
|
/* Create the surface and xdg_toplevels, and set listeners */
|
||||||
|
|
||||||
|
|
|
@ -364,7 +364,7 @@ int main(int argc, char **argv) {
|
||||||
zwp_text_input_v3_add_listener(text_input, &text_input_listener, NULL);
|
zwp_text_input_v3_add_listener(text_input, &text_input_listener, NULL);
|
||||||
|
|
||||||
EGLint attribs[] = { EGL_NONE };
|
EGLint attribs[] = { EGL_NONE };
|
||||||
wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs, 0);
|
wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs);
|
||||||
|
|
||||||
struct wl_surface *surface = wl_compositor_create_surface(compositor);
|
struct wl_surface *surface = wl_compositor_create_surface(compositor);
|
||||||
struct xdg_surface *xdg_surface =
|
struct xdg_surface *xdg_surface =
|
||||||
|
|
|
@ -219,7 +219,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLint attribs[] = { EGL_NONE };
|
EGLint attribs[] = { EGL_NONE };
|
||||||
wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs, 0);
|
wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs);
|
||||||
|
|
||||||
struct wl_surface *surface = wl_compositor_create_surface(compositor);
|
struct wl_surface *surface = wl_compositor_create_surface(compositor);
|
||||||
struct xdg_surface *xdg_surface =
|
struct xdg_surface *xdg_surface =
|
||||||
|
|
|
@ -89,7 +89,7 @@ struct wlr_egl {
|
||||||
* If config_attribs is NULL, the EGL config is not created.
|
* If config_attribs is NULL, the EGL config is not created.
|
||||||
*/
|
*/
|
||||||
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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Frees all related EGL resources, makes the context not-current and
|
* Frees all related EGL resources, makes the context not-current and
|
||||||
|
|
47
render/egl.c
47
render/egl.c
|
@ -10,41 +10,6 @@
|
||||||
#include <wlr/util/region.h>
|
#include <wlr/util/region.h>
|
||||||
#include <xf86drm.h>
|
#include <xf86drm.h>
|
||||||
|
|
||||||
static bool egl_get_config(EGLDisplay disp, const EGLint *attribs,
|
|
||||||
EGLConfig *out, EGLint visual_id) {
|
|
||||||
EGLint count = 0, matched = 0, ret;
|
|
||||||
|
|
||||||
ret = eglGetConfigs(disp, NULL, 0, &count);
|
|
||||||
if (ret == EGL_FALSE || count == 0) {
|
|
||||||
wlr_log(WLR_ERROR, "eglGetConfigs returned no configs");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
EGLConfig configs[count];
|
|
||||||
|
|
||||||
ret = eglChooseConfig(disp, attribs, configs, count, &matched);
|
|
||||||
if (ret == EGL_FALSE) {
|
|
||||||
wlr_log(WLR_ERROR, "eglChooseConfig failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < matched; ++i) {
|
|
||||||
EGLint visual;
|
|
||||||
if (!eglGetConfigAttrib(disp, configs[i],
|
|
||||||
EGL_NATIVE_VISUAL_ID, &visual)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visual_id || visual == visual_id) {
|
|
||||||
*out = configs[i];
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wlr_log(WLR_ERROR, "no valid egl config found");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static enum wlr_log_importance egl_log_importance_to_wlr(EGLint type) {
|
static enum wlr_log_importance egl_log_importance_to_wlr(EGLint type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EGL_DEBUG_MSG_CRITICAL_KHR: return WLR_ERROR;
|
case EGL_DEBUG_MSG_CRITICAL_KHR: return WLR_ERROR;
|
||||||
|
@ -185,7 +150,7 @@ 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) {
|
||||||
const char *client_exts_str = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
|
const char *client_exts_str = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
|
||||||
if (client_exts_str == NULL) {
|
if (client_exts_str == NULL) {
|
||||||
if (eglGetError() == EGL_BAD_DISPLAY) {
|
if (eglGetError() == EGL_BAD_DISPLAY) {
|
||||||
|
@ -321,8 +286,14 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_attribs != NULL) {
|
if (config_attribs != NULL) {
|
||||||
if (!egl_get_config(egl->display, config_attribs, &egl->config, visual_id)) {
|
EGLint matched = 0;
|
||||||
wlr_log(WLR_ERROR, "Failed to get EGL config");
|
if (!eglChooseConfig(egl->display, config_attribs, &egl->config, 1,
|
||||||
|
&matched)) {
|
||||||
|
wlr_log(WLR_ERROR, "eglChooseConfig failed");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
if (matched == 0) {
|
||||||
|
wlr_log(WLR_ERROR, "Failed to match an EGL config");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -255,7 +255,7 @@ struct wlr_renderer *wlr_renderer_autocreate(EGLenum platform,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wlr_egl_init(egl, platform, remote_display, NULL, 0)) {
|
if (!wlr_egl_init(egl, platform, remote_display, NULL)) {
|
||||||
wlr_log(WLR_ERROR, "Could not initialize EGL");
|
wlr_log(WLR_ERROR, "Could not initialize EGL");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue