if (gl_renderer->display_create(b->compositor,
EGL_PLATFORM_GBM_KHR,
(void *)b->gbm,
- gl_renderer->opaque_attribs,
format,
n_formats) < 0) {
return -1;
if (gl_renderer->output_window_create(&output->base,
(EGLNativeWindowType)output->gbm_surface,
output->gbm_surface,
- gl_renderer->opaque_attribs,
format,
n_formats) < 0) {
weston_log("failed to create gl renderer output state\n");
if (gl_renderer->output_window_create(&output->base,
output->gl.egl_window,
output->gl.egl_window,
- gl_renderer->alpha_attribs,
wayland_formats,
ARRAY_LENGTH(wayland_formats)) < 0)
goto cleanup_window;
if (gl_renderer->display_create(compositor,
EGL_PLATFORM_WAYLAND_KHR,
b->parent.wl_display,
- gl_renderer->alpha_attribs,
wayland_formats,
ARRAY_LENGTH(wayland_formats)) < 0) {
weston_log("Failed to initialize the GL renderer; "
ret = gl_renderer->output_window_create(&output->base,
(EGLNativeWindowType) output->window,
&xid,
- gl_renderer->opaque_attribs,
x11_formats,
ARRAY_LENGTH(x11_formats));
if (ret < 0)
&output->base,
(EGLNativeWindowType) output->window,
&xid,
- gl_renderer->opaque_attribs,
x11_formats,
ARRAY_LENGTH(x11_formats));
if (ret < 0)
ret = gl_renderer->display_create(b->compositor, EGL_PLATFORM_X11_KHR,
(void *) b->dpy,
- gl_renderer->opaque_attribs,
x11_formats,
ARRAY_LENGTH(x11_formats));
EGLConfig
gl_renderer_get_egl_config(struct gl_renderer *gr,
- const EGLint *config_attribs,
const uint32_t *drm_formats,
unsigned drm_formats_count)
{
const struct pixel_format_info *pinfo[16];
unsigned pinfo_count;
unsigned i;
+ EGLint config_attribs[] = {
+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+ EGL_RED_SIZE, 1,
+ EGL_GREEN_SIZE, 1,
+ EGL_BLUE_SIZE, 1,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+ EGL_NONE
+ };
assert(drm_formats_count < ARRAY_LENGTH(pinfo));
drm_formats_count = MIN(drm_formats_count, ARRAY_LENGTH(pinfo));
EGLConfig
gl_renderer_get_egl_config(struct gl_renderer *gr,
- const EGLint *config_attribs,
const uint32_t *drm_formats,
unsigned drm_formats_count);
gl_renderer_create_window_surface(struct gl_renderer *gr,
EGLNativeWindowType window_for_legacy,
void *window_for_platform,
- const EGLint *config_attribs,
const uint32_t *drm_formats,
unsigned drm_formats_count)
{
EGLSurface egl_surface = EGL_NO_SURFACE;
EGLConfig egl_config;
- egl_config = gl_renderer_get_egl_config(gr, config_attribs,
+ egl_config = gl_renderer_get_egl_config(gr,
drm_formats, drm_formats_count);
if (egl_config == EGL_NO_CONFIG_KHR)
return EGL_NO_SURFACE;
gl_renderer_output_window_create(struct weston_output *output,
EGLNativeWindowType window_for_legacy,
void *window_for_platform,
- const EGLint *config_attribs,
const uint32_t *drm_formats,
unsigned drm_formats_count)
{
egl_surface = gl_renderer_create_window_surface(gr,
window_for_legacy,
window_for_platform,
- config_attribs,
drm_formats,
drm_formats_count);
if (egl_surface == EGL_NO_SURFACE) {
free(gr);
}
-static const EGLint gl_renderer_opaque_attribs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_RED_SIZE, 1,
- EGL_GREEN_SIZE, 1,
- EGL_BLUE_SIZE, 1,
- EGL_ALPHA_SIZE, 0,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_NONE
-};
-
-static const EGLint gl_renderer_alpha_attribs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_RED_SIZE, 1,
- EGL_GREEN_SIZE, 1,
- EGL_BLUE_SIZE, 1,
- EGL_ALPHA_SIZE, 1,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_NONE
-};
-
-
/** Checks whether a platform EGL client extension is supported
*
* \param ec The weston compositor
gl_renderer_display_create(struct weston_compositor *ec,
EGLenum platform,
void *native_display,
- const EGLint *config_attribs,
const uint32_t *drm_formats,
unsigned drm_formats_count)
{
goto fail_with_error;
if (!gr->has_configless_context) {
- gr->egl_config = gl_renderer_get_egl_config(gr, config_attribs,
+ gr->egl_config = gl_renderer_get_egl_config(gr,
drm_formats,
drm_formats_count);
if (gr->egl_config == EGL_NO_CONFIG_KHR) {
}
WL_EXPORT struct gl_renderer_interface gl_renderer_interface = {
- .opaque_attribs = gl_renderer_opaque_attribs,
- .alpha_attribs = gl_renderer_alpha_attribs,
-
.display_create = gl_renderer_display_create,
.output_window_create = gl_renderer_output_window_create,
.output_destroy = gl_renderer_output_destroy,
};
struct gl_renderer_interface {
- const EGLint *opaque_attribs;
- const EGLint *alpha_attribs;
-
int (*display_create)(struct weston_compositor *ec,
EGLenum platform,
void *native_display,
- const EGLint *config_attribs,
const uint32_t *drm_formats,
unsigned drm_formats_count);
int (*output_window_create)(struct weston_output *output,
EGLNativeWindowType window_for_legacy,
void *window_for_platform,
- const EGLint *config_attribs,
const uint32_t *drm_formats,
unsigned drm_formats_count);