[Mesa-dev] [PATCH] intel: Fix initial MakeCurrent for single-buffer drawables

Zhang, Xiong Y xiong.y.zhang at intel.com
Mon Jan 27 01:12:48 PST 2014


hi, Kristian:
  This patch block the startup of desktop-shell client in weston.
  Panel surface and background surface share a common context.  
  First when client redraw panel surface,  _mesa_make_current will set
brw->ctx.ViewportInitialized to true.
  Later when client redraw background surface, intelMakeCurrent() won't
call  intel_prepare_render(). So there isn't drawbuffer for background
surface.
  Please check!
 
thanks
On Tue, 2014-01-21 at 12:39 -0800, Kristian Høgsberg wrote:
> Commit 05da4a7a5e7d5bd988cb31f94ed8e1f053d9ee39 attempts to eliminate the
> call to intel_update_renderbuffer() in the case where we already have a
> drawbuffer for the drawable.  Unfortunately this only checks the
> back left renderbuffer, which breaks in case of single buffer drawables.
> 
> This means that the initial viewport will not be set in that case.  Instead,
> we now check whether the initial viewport has not been set and the
> drawable size is 0x0, in which case we call out to intel_update_renderbuffer().
> This gives us the correct behaviour but also further eliminates a
> call to intel_update_renderbuffer() in the case where we make a newly
> created drawable current with a context that already has an initial viewport.
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=73862
> 
> Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>
> ---
>  src/mesa/drivers/dri/i965/brw_context.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
> index d6c41e6..9183dda 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.c
> +++ b/src/mesa/drivers/dri/i965/brw_context.c
> @@ -917,7 +917,6 @@ 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();
> @@ -925,7 +924,6 @@ 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;
>        }
> @@ -937,11 +935,11 @@ intelMakeCurrent(__DRIcontext * driContextPriv,
>        intel_gles3_srgb_workaround(brw, fb);
>        intel_gles3_srgb_workaround(brw, readFb);
>  
> -      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. */
> +      /* If the context viewport hasn't been initialized, force a call out to
> +       * the loader to get buffers so we have a drawable size for the initial
> +       * viewport. */
> +      if (!brw->ctx.ViewportInitialized && fb->Width == 0 && fb->Height == 0)
>           intel_prepare_render(brw);
> -      }
>  
>        _mesa_make_current(ctx, fb, readFb);
>     } else {



More information about the mesa-dev mailing list