From 05da4a7a5e7d5bd988cb31f94ed8e1f053d9ee39 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 17 Jan 2014 16:55:31 -0800 Subject: [PATCH] i965: Only update renderbuffers on initial intelMakeCurrent MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We call intel_prepare_render() in intelMakeCurrent() to make sure we have renderbuffers before calling _mesa_make_current(). The only reason we do this is so that we can have valid defaults for width and height. If we already have buffers for the drawable we're making current, we don't need this step. In itself, this is a small optimization, but it also avoids a round trip that could block on the display server in a unexpected place. https://bugs.freedesktop.org/show_bug.cgi?id=72540 https://bugs.freedesktop.org/show_bug.cgi?id=72612 Signed-off-by: Kristian Høgsberg Reviewed-by: Chad Versace --- src/mesa/drivers/dri/i965/brw_context.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 51918b9ffd0..173f95a6adf 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -906,6 +906,7 @@ intelMakeCurrent(__DRIcontext * driContextPriv, if (driContextPriv) { struct gl_context *ctx = &brw->ctx; struct gl_framebuffer *fb, *readFb; + struct intel_renderbuffer *rb = NULL; if (driDrawPriv == NULL && driReadPriv == NULL) { fb = _mesa_get_incomplete_framebuffer(); @@ -913,6 +914,7 @@ intelMakeCurrent(__DRIcontext * driContextPriv, } else { fb = driDrawPriv->driverPrivate; readFb = driReadPriv->driverPrivate; + rb = intel_get_renderbuffer(fb, BUFFER_BACK_LEFT); driContextPriv->dri2.draw_stamp = driDrawPriv->dri2.stamp - 1; driContextPriv->dri2.read_stamp = driReadPriv->dri2.stamp - 1; } @@ -924,7 +926,12 @@ intelMakeCurrent(__DRIcontext * driContextPriv, intel_gles3_srgb_workaround(brw, fb); intel_gles3_srgb_workaround(brw, readFb); - intel_prepare_render(brw); + if (rb && !rb->mt) { + /* If we don't have buffers for the drawable yet, force a call to + * getbuffers here so we can have a default drawable size. */ + intel_prepare_render(brw); + } + _mesa_make_current(ctx, fb, readFb); } else { _mesa_make_current(NULL, NULL, NULL); -- 2.30.2