From: Chia-I Wu Date: Wed, 22 Dec 2010 05:47:50 +0000 (+0800) Subject: st/egl: Allow single-buffered pixmaps. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0fb2dcc98ff46299094c308b7b4e0cde9e38d5c0;p=mesa.git st/egl: Allow single-buffered pixmaps. All single-buffered configs were ignored before to make sure EGL_RENDER_BUFFER is settable for window surfaces. It is better to allow single-buffered configs and set EGL_WINDOW_BIT only for double-buffered ones. This way there can be single-buffered pixmaps. --- diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index d71ca866cb7..f2b137a674a 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -183,17 +183,21 @@ init_config_attributes(_EGLConfig *conf, const struct native_config *nconf, } surface_type = 0x0; - if (nconf->window_bit) - surface_type |= EGL_WINDOW_BIT; - if (nconf->pixmap_bit) - surface_type |= EGL_PIXMAP_BIT; + /* pixmap surfaces should be EGL_SINGLE_BUFFER */ + if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_FRONT_LEFT)) { + if (nconf->pixmap_bit) + surface_type |= EGL_PIXMAP_BIT; + } + /* the others surfaces should be EGL_BACK_BUFFER (or settable) */ + if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT)) { + if (nconf->window_bit) + surface_type |= EGL_WINDOW_BIT; #ifdef EGL_MESA_screen_surface - if (nconf->scanout_bit) - surface_type |= EGL_SCREEN_BIT_MESA; + if (nconf->scanout_bit) + surface_type |= EGL_SCREEN_BIT_MESA; #endif - - if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT)) surface_type |= EGL_PBUFFER_BIT; + } conf->Conformant = api_mask; conf->RenderableType = api_mask; @@ -252,13 +256,9 @@ egl_g3d_init_config(_EGLDriver *drv, _EGLDisplay *dpy, int preserve_buffer, int max_swap_interval) { struct egl_g3d_config *gconf = egl_g3d_config(conf); - EGLint buffer_mask, api_mask; + EGLint buffer_mask; EGLBoolean valid; - /* skip single-buffered configs */ - if (!(nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT))) - return EGL_FALSE; - buffer_mask = 0x0; if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_FRONT_LEFT)) buffer_mask |= ST_ATTACHMENT_FRONT_LEFT_MASK; @@ -275,22 +275,12 @@ egl_g3d_init_config(_EGLDriver *drv, _EGLDisplay *dpy, gconf->stvis.accum_format = PIPE_FORMAT_NONE; gconf->stvis.samples = 0; + /* will be overridden per surface */ gconf->stvis.render_buffer = (buffer_mask & ST_ATTACHMENT_BACK_LEFT_MASK) ? ST_ATTACHMENT_BACK_LEFT : ST_ATTACHMENT_FRONT_LEFT; - api_mask = dpy->ClientAPIsMask; - /* this is required by EGL, not by OpenGL ES */ - if (nconf->window_bit && - gconf->stvis.render_buffer != ST_ATTACHMENT_BACK_LEFT) - api_mask &= ~(EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT); - - if (!api_mask) { - _eglLog(_EGL_DEBUG, "no state tracker supports config 0x%x", - nconf->native_visual_id); - } - valid = init_config_attributes(&gconf->base, - nconf, api_mask, depth_stencil_format, + nconf, dpy->ClientAPIsMask, depth_stencil_format, preserve_buffer, max_swap_interval); if (!valid) { _eglLog(_EGL_DEBUG, "skip invalid config 0x%x", nconf->native_visual_id); diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c index a15c988c8bc..aeabccfaf18 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -324,7 +324,8 @@ egl_g3d_create_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, } gsurf->stvis = gconf->stvis; - if (gsurf->base.RenderBuffer == EGL_SINGLE_BUFFER) + if (gsurf->base.RenderBuffer == EGL_SINGLE_BUFFER && + gconf->stvis.buffer_mask & ST_ATTACHMENT_FRONT_LEFT_MASK) gsurf->stvis.render_buffer = ST_ATTACHMENT_FRONT_LEFT; gsurf->stfbi = egl_g3d_create_st_framebuffer(&gsurf->base);