struct wl_shm *shm;
struct wl_data_device_manager *data_device_manager;
EGLDisplay dpy;
- EGLConfig rgb_config;
EGLConfig argb_config;
- EGLContext rgb_ctx;
EGLContext argb_ctx;
- cairo_device_t *rgb_device;
cairo_device_t *argb_device;
int display_fd;
data->display = display;
data->surface = surface;
- if (flags & SURFACE_OPAQUE) {
- config = display->rgb_config;
- device = display->rgb_device;
- } else {
- config = display->argb_config;
- device = display->argb_device;
- }
+ config = display->argb_config;
+ device = display->argb_device;
data->window = wl_egl_window_create(surface,
rectangle->width,
return NULL;
}
- if (flags & SURFACE_OPAQUE) {
- data->device = display->rgb_device;
- content = CAIRO_CONTENT_COLOR;
- } else {
- data->device = display->argb_device;
- content = CAIRO_CONTENT_COLOR_ALPHA;
- }
+ data->device = display->argb_device;
+ content = CAIRO_CONTENT_COLOR_ALPHA;
data->image = display->create_image(dpy, NULL,
EGL_NATIVE_PIXMAP_KHR,
EGL_NONE
};
- static const EGLint rgb_cfg_attribs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PIXMAP_BIT,
- EGL_RED_SIZE, 1,
- EGL_GREEN_SIZE, 1,
- EGL_BLUE_SIZE, 1,
- EGL_ALPHA_SIZE, 0,
- EGL_DEPTH_SIZE, 1,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
- EGL_NONE
- };
-
#ifdef USE_CAIRO_GLESV2
static const EGLint context_attribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
return -1;
}
- if (!eglChooseConfig(d->dpy, rgb_cfg_attribs,
- &d->rgb_config, 1, &n) || n != 1) {
- fprintf(stderr, "failed to choose rgb config\n");
- return -1;
- }
-
- d->rgb_ctx = eglCreateContext(d->dpy, d->rgb_config,
- EGL_NO_CONTEXT, context_attribs);
- if (d->rgb_ctx == NULL) {
- fprintf(stderr, "failed to create context\n");
- return -1;
- }
d->argb_ctx = eglCreateContext(d->dpy, d->argb_config,
EGL_NO_CONTEXT, context_attribs);
if (d->argb_ctx == NULL) {
return -1;
}
- if (!eglMakeCurrent(d->dpy, NULL, NULL, d->rgb_ctx)) {
+ if (!eglMakeCurrent(d->dpy, NULL, NULL, d->argb_ctx)) {
fprintf(stderr, "failed to make context current\n");
return -1;
}
#ifdef HAVE_CAIRO_EGL
- d->rgb_device = cairo_egl_device_create(d->dpy, d->rgb_ctx);
- if (cairo_device_status(d->rgb_device) != CAIRO_STATUS_SUCCESS) {
- fprintf(stderr, "failed to get cairo egl device\n");
- return -1;
- }
d->argb_device = cairo_egl_device_create(d->dpy, d->argb_ctx);
if (cairo_device_status(d->argb_device) != CAIRO_STATUS_SUCCESS) {
fprintf(stderr, "failed to get cairo egl argb device\n");
{
#ifdef HAVE_CAIRO_EGL
cairo_device_destroy(display->argb_device);
- cairo_device_destroy(display->rgb_device);
#endif
eglMakeCurrent(display->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE,
}
EGLConfig
-display_get_rgb_egl_config(struct display *d)
-{
- return d->rgb_config;
-}
-
-EGLConfig
display_get_argb_egl_config(struct display *d)
{
return d->argb_config;
return -1;
if (!ctx) {
- if (device == display->rgb_device)
- ctx = display->rgb_ctx;
- else if (device == display->argb_device)
+ if (device == display->argb_device)
ctx = display->argb_ctx;
else
assert(0);
if (!device)
return;
- if (!eglMakeCurrent(display->dpy, NULL, NULL, display->rgb_ctx))
+ if (!eglMakeCurrent(display->dpy, NULL, NULL, display->argb_ctx))
fprintf(stderr, "failed to make context current\n");
cairo_device_release(device);
#endif