egl_error_string(code), (long)code);
}
-static int
-android_output_make_current(struct android_output *output)
-{
- struct android_compositor *compositor = output->compositor;
- EGLBoolean ret;
- static int errored;
-
- ret = eglMakeCurrent(compositor->base.egl_display,
- output->base.egl_surface,
- output->base.egl_surface,
- compositor->base.egl_context);
- if (ret == EGL_FALSE) {
- if (errored)
- return -1;
- errored = 1;
- weston_log("Failed to make EGL context current.\n");
- print_egl_error_state();
- return -1;
- }
-
- return 0;
-}
-
static void
android_finish_frame(void *data)
{
EGLint eglmajor, eglminor;
int ret;
- static const EGLint context_attrs[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE
- };
-
static const EGLint config_attrs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RED_SIZE, 1,
return -1;
}
- if (!eglBindAPI(EGL_OPENGL_ES_API)) {
- weston_log("Failed to bind EGL_OPENGL_ES_API.\n");
- print_egl_error_state();
- return -1;
- }
-
ret = android_egl_choose_config(compositor, output->fb, config_attrs);
if (ret < 0) {
weston_log("Failed to find an EGL config.\n");
return -1;
}
- compositor->base.egl_context =
- eglCreateContext(compositor->base.egl_display,
- compositor->base.egl_config,
- EGL_NO_CONTEXT,
- context_attrs);
- if (compositor->base.egl_context == EGL_NO_CONTEXT) {
- weston_log("Failed to create a GL ES 2 context.\n");
- print_egl_error_state();
- return -1;
- }
-
output->base.egl_surface =
eglCreateWindowSurface(compositor->base.egl_display,
compositor->base.egl_config,
return -1;
}
- if (android_output_make_current(output) < 0)
- return -1;
-
return 0;
}
EGLint major, minor, n;
const char *filename, *sysnum;
int fd;
- static const EGLint context_attribs[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE
- };
-
static const EGLint config_attribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RED_SIZE, 1,
return -1;
}
- if (!eglBindAPI(EGL_OPENGL_ES_API)) {
- weston_log("failed to bind api EGL_OPENGL_ES_API\n");
- return -1;
- }
-
if (!eglChooseConfig(ec->base.egl_display, config_attribs,
&ec->base.egl_config, 1, &n) || n != 1) {
weston_log("failed to choose config: %d\n", n);
return -1;
}
- ec->base.egl_context =
- eglCreateContext(ec->base.egl_display, ec->base.egl_config,
- EGL_NO_CONTEXT, context_attribs);
- if (ec->base.egl_context == NULL) {
- weston_log("failed to create context\n");
- return -1;
- }
-
return 0;
}
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_NONE
};
- static const EGLint context_attribs[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE
- };
c->base.egl_display = eglGetDisplay(c->parent.wl_display);
if (c->base.egl_display == NULL) {
return -1;
}
- if (!eglBindAPI(EGL_OPENGL_ES_API)) {
- weston_log("failed to bind EGL_OPENGL_ES_API\n");
- return -1;
- }
if (!eglChooseConfig(c->base.egl_display, config_attribs,
&c->base.egl_config, 1, &n) || n == 0) {
weston_log("failed to choose config: %d\n", n);
return -1;
}
- c->base.egl_context =
- eglCreateContext(c->base.egl_display, c->base.egl_config,
- EGL_NO_CONTEXT, context_attribs);
- if (c->base.egl_context == NULL) {
- weston_log("failed to create context\n");
- return -1;
- }
-
return 0;
}
goto cleanup_window;
}
- if (!eglMakeCurrent(c->base.egl_display, output->base.egl_surface,
- output->base.egl_surface, c->base.egl_context)) {
- weston_log("failed to make surface current\n");
- goto cleanup_surface;
- return -1;
- }
-
output->parent.shell_surface =
wl_shell_get_shell_surface(c->parent.shell,
output->parent.surface);
return 0;
-cleanup_surface:
- eglDestroySurface(c->base.egl_display, output->base.egl_surface);
cleanup_window:
wl_egl_window_destroy(output->parent.egl_window);
cleanup_output:
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_NONE
};
- static const EGLint context_attribs[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE
- };
c->base.egl_display = eglGetDisplay(c->dpy);
if (c->base.egl_display == NULL) {
return -1;
}
- if (!eglBindAPI(EGL_OPENGL_ES_API)) {
- weston_log("failed to bind EGL_OPENGL_ES_API\n");
- return -1;
- }
if (!eglChooseConfig(c->base.egl_display, config_attribs,
&c->base.egl_config, 1, &n) || n == 0) {
weston_log("failed to choose config: %d\n", n);
return -1;
}
- c->base.egl_context =
- eglCreateContext(c->base.egl_display, c->base.egl_config,
- EGL_NO_CONTEXT, context_attribs);
- if (c->base.egl_context == NULL) {
- weston_log("failed to create context\n");
- return -1;
- }
-
return 0;
}
weston_log("failed to create window surface\n");
return NULL;
}
- if (!eglMakeCurrent(c->base.egl_display, output->base.egl_surface,
- output->base.egl_surface, c->base.egl_context)) {
- weston_log("failed to make surface current\n");
- return NULL;
- }
loop = wl_display_get_event_loop(c->base.wl_display);
output->finish_frame_timer =
struct weston_output *output;
EGLBoolean ret;
+ static const EGLint context_attribs[] = {
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL_NONE
+ };
+
renderer = malloc(sizeof *renderer);
if (renderer == NULL)
return -1;
+ if (!eglBindAPI(EGL_OPENGL_ES_API)) {
+ weston_log("failed to bind EGL_OPENGL_ES_API\n");
+ print_egl_error_state();
+ return -1;
+ }
+ ec->egl_context = eglCreateContext(ec->egl_display, ec->egl_config,
+ EGL_NO_CONTEXT, context_attribs);
+ if (ec->egl_context == NULL) {
+ weston_log("failed to create context\n");
+ print_egl_error_state();
+ return -1;
+ }
+
output = container_of(ec->output_list.next,
struct weston_output, link);
ret = eglMakeCurrent(ec->egl_display, output->egl_surface,