[Mesa-dev] [PATCH] intel: Set ctx's drawbuffer according to drawables visual

Eric Anholt eric at anholt.net
Thu Aug 4 08:51:41 PDT 2011


On Thu,  4 Aug 2011 14:31:01 +0200, Benjamin Franzke <benjaminfranzke at googlemail.com> wrote:
> Fixes https://bugs.freedesktop.org/show_bug.cgi?id=39588
> 
> egl_dri2 creates contexts with a doubleBufferConfig when PIXMAP and
> WINDOW bit is request, so _mesa_init_color sets DrawBuffer[0] to
> GL_BACK.
> If a pixmap surface is created egl_dri2 will use a single buffer config,
> so MakeCurrent has to adjust DrawBuffer[0] to the current drawable.
> ---
>  src/mesa/drivers/dri/intel/intel_context.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
> index fe8be08..0eeffc0 100644
> --- a/src/mesa/drivers/dri/intel/intel_context.c
> +++ b/src/mesa/drivers/dri/intel/intel_context.c
> @@ -970,6 +970,12 @@ intelMakeCurrent(__DRIcontext * driContextPriv,
>  	 readFb = driReadPriv->driverPrivate;
>  	 driContextPriv->dri2.draw_stamp = driDrawPriv->dri2.stamp - 1;
>  	 driContextPriv->dri2.read_stamp = driReadPriv->dri2.stamp - 1;
> +
> +         if (fb->Visual.doubleBufferMode) {
> +            intel->ctx.Color.DrawBuffer[0] = GL_BACK;
> +         } else {
> +            intel->ctx.Color.DrawBuffer[0] = GL_FRONT;
> +         }
>        }

Something touching this seems like it should live in _mesa_make_current,
not as a driver workaround.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110804/e4c12f7e/attachment.pgp>


More information about the mesa-dev mailing list