mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-03-28 07:58:44 -04:00
Use the new eagle config chooser for picking the config.
This commit is contained in:
parent
112c0bee18
commit
15d0f8b236
1 changed files with 13 additions and 56 deletions
|
|
@ -955,59 +955,6 @@ create_frontbuffer(struct egl_compositor *ec)
|
||||||
return flink.name;
|
return flink.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
pick_config(struct egl_compositor *ec)
|
|
||||||
{
|
|
||||||
EGLConfig configs[100];
|
|
||||||
EGLint value, count;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!eglGetConfigs(ec->display, configs, ARRAY_LENGTH(configs), &count)) {
|
|
||||||
fprintf(stderr, "failed to get configs\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ec->config = EGL_NO_CONFIG;
|
|
||||||
for (i = 0; i < count; i++) {
|
|
||||||
eglGetConfigAttrib(ec->display,
|
|
||||||
configs[i],
|
|
||||||
EGL_DEPTH_SIZE,
|
|
||||||
&value);
|
|
||||||
if (value > 0) {
|
|
||||||
fprintf(stderr, "config %d has depth size %d\n", i, value);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
eglGetConfigAttrib(ec->display,
|
|
||||||
configs[i],
|
|
||||||
EGL_STENCIL_SIZE,
|
|
||||||
&value);
|
|
||||||
if (value > 0) {
|
|
||||||
fprintf(stderr, "config %d has stencil size %d\n", i, value);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
eglGetConfigAttrib(ec->display,
|
|
||||||
configs[i],
|
|
||||||
EGL_CONFIG_CAVEAT,
|
|
||||||
&value);
|
|
||||||
if (value != EGL_NONE) {
|
|
||||||
fprintf(stderr, "config %d has caveat %d\n", i, value);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ec->config = configs[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ec->config == EGL_NO_CONFIG) {
|
|
||||||
fprintf(stderr, "found no config without depth or stencil buffers\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct wl_interface visual_interface = {
|
static const struct wl_interface visual_interface = {
|
||||||
"visual", 1,
|
"visual", 1,
|
||||||
};
|
};
|
||||||
|
|
@ -1098,14 +1045,24 @@ static void watch_for_vt_changes(struct egl_compositor *ec, struct wl_event_loop
|
||||||
static struct egl_compositor *
|
static struct egl_compositor *
|
||||||
egl_compositor_create(struct wl_display *display)
|
egl_compositor_create(struct wl_display *display)
|
||||||
{
|
{
|
||||||
|
static const EGLint config_attribs[] = {
|
||||||
|
EGL_DEPTH_SIZE, 0,
|
||||||
|
EGL_STENCIL_SIZE, 0,
|
||||||
|
EGL_CONFIG_CAVEAT, EGL_NONE,
|
||||||
|
EGL_NONE
|
||||||
|
};
|
||||||
|
|
||||||
|
const static EGLint attribs[] = {
|
||||||
|
EGL_RENDER_BUFFER, EGL_BACK_BUFFER,
|
||||||
|
EGL_NONE
|
||||||
|
};
|
||||||
|
|
||||||
EGLint major, minor;
|
EGLint major, minor;
|
||||||
struct egl_compositor *ec;
|
struct egl_compositor *ec;
|
||||||
struct screenshooter *shooter;
|
struct screenshooter *shooter;
|
||||||
uint32_t fb_name;
|
uint32_t fb_name;
|
||||||
int i;
|
int i;
|
||||||
struct wl_event_loop *loop;
|
struct wl_event_loop *loop;
|
||||||
const static EGLint attribs[] =
|
|
||||||
{ EGL_RENDER_BUFFER, EGL_BACK_BUFFER, EGL_NONE };
|
|
||||||
|
|
||||||
ec = malloc(sizeof *ec);
|
ec = malloc(sizeof *ec);
|
||||||
if (ec == NULL)
|
if (ec == NULL)
|
||||||
|
|
@ -1124,7 +1081,7 @@ egl_compositor_create(struct wl_display *display)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pick_config(ec))
|
if (!eglChooseConfig(ec->display, config_attribs, &ec->config, 1, NULL))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
fb_name = create_frontbuffer(ec);
|
fb_name = create_frontbuffer(ec);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue