diff options
| author | Kristian Høgsberg <krh@redhat.com> | 2008-12-19 12:13:42 -0500 |
|---|---|---|
| committer | Kristian Høgsberg <krh@redhat.com> | 2008-12-19 12:13:42 -0500 |
| commit | 15d0f8b236efde6db3211182bdc45b10bdf61d2d (patch) | |
| tree | 9b227b84945ce78211a021375f7a9a1f2d14cc19 | |
| parent | 112c0bee18b36786a5154c4090120d59bf830beb (diff) | |
| download | wayland-15d0f8b236efde6db3211182bdc45b10bdf61d2d.tar.gz wayland-15d0f8b236efde6db3211182bdc45b10bdf61d2d.tar.xz wayland-15d0f8b236efde6db3211182bdc45b10bdf61d2d.zip | |
Use the new eagle config chooser for picking the config.
| -rw-r--r-- | egl-compositor.c | 69 |
1 files changed, 13 insertions, 56 deletions
diff --git a/egl-compositor.c b/egl-compositor.c index 9f3c082..3d607a1 100644 --- a/egl-compositor.c +++ b/egl-compositor.c @@ -955,59 +955,6 @@ create_frontbuffer(struct egl_compositor *ec) 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 = { "visual", 1, }; @@ -1098,14 +1045,24 @@ static void watch_for_vt_changes(struct egl_compositor *ec, struct wl_event_loop static struct egl_compositor * 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; struct egl_compositor *ec; struct screenshooter *shooter; uint32_t fb_name; int i; struct wl_event_loop *loop; - const static EGLint attribs[] = - { EGL_RENDER_BUFFER, EGL_BACK_BUFFER, EGL_NONE }; ec = malloc(sizeof *ec); if (ec == NULL) @@ -1124,7 +1081,7 @@ egl_compositor_create(struct wl_display *display) return NULL; } - if (pick_config(ec)) + if (!eglChooseConfig(ec->display, config_attribs, &ec->config, 1, NULL)) return NULL; fb_name = create_frontbuffer(ec); |
