mesa: Branch 'master' - 2 commits

Michel Daenzer daenzer at kemper.freedesktop.org
Sun Apr 8 05:05:27 PDT 2007


 src/mesa/drivers/dri/common/drirenderbuffer.c |    2 -
 src/mesa/drivers/dri/i915tex/intel_context.c  |    9 +++---
 src/mesa/drivers/dri/i915tex/intel_fbo.c      |   39 +++++++++++++++++---------
 3 files changed, 32 insertions(+), 18 deletions(-)

New commits:
diff-tree 917675217256480163d437015253d1d2b6cad55c (from 79bf6924208136247bca2d5f70547f2fe359ecdb)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Sun Apr 8 14:04:15 2007 +0200

    i915tex: Clean up resizing of renderbuffers.

diff --git a/src/mesa/drivers/dri/i915tex/intel_context.c b/src/mesa/drivers/dri/i915tex/intel_context.c
index a2b0856..6a3456e 100644
--- a/src/mesa/drivers/dri/i915tex/intel_context.c
+++ b/src/mesa/drivers/dri/i915tex/intel_context.c
@@ -587,10 +587,11 @@ intelMakeCurrent(__DRIcontextPrivate * d
       }
 
       /* set GLframebuffer size to match window, if needed */
-      if (driReadPriv != driDrawPriv && readFb->Width != driReadPriv->w) {
-         _mesa_resize_framebuffer(&intel->ctx, readFb,
-                                  driReadPriv->w, driReadPriv->h);
-      }         
+      driUpdateFramebufferSize(&intel->ctx, driDrawPriv);
+
+      if (driReadPriv != driDrawPriv) {
+	 driUpdateFramebufferSize(&intel->ctx, driReadPriv);
+      }
 
       _mesa_make_current(&intel->ctx, &intel_fb->Base, readFb);
 
diff --git a/src/mesa/drivers/dri/i915tex/intel_fbo.c b/src/mesa/drivers/dri/i915tex/intel_fbo.c
index 9b84faa..87ef22f 100644
--- a/src/mesa/drivers/dri/i915tex/intel_fbo.c
+++ b/src/mesa/drivers/dri/i915tex/intel_fbo.c
@@ -309,27 +309,39 @@ static GLboolean
 intel_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
                            GLenum internalFormat, GLuint width, GLuint height)
 {
-   struct intel_context *intel = intel_context(ctx);
-   struct intel_framebuffer *intel_fb;
-
    ASSERT(rb->Name == 0);
    rb->Width = width;
    rb->Height = height;
    rb->_ActualFormat = internalFormat;
 
-   if (intel && intel->driDrawable &&
-       (intel_fb = intel->driDrawable->driverPrivate) &&
-       intel_fb->pf_num_pages == 3 &&
-       rb == &intel_fb->color_rb[intel_fb->pf_current_page]->Base &&
-       (rb = &intel_fb->color_rb[(intel_fb->pf_current_page + 2) % 3]->Base)) {
-      rb->Width = width;
-      rb->Height = height;
-      rb->_ActualFormat = internalFormat;
-   }
-
    return GL_TRUE;
 }
 
+static void
+intel_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb,
+		     GLuint width, GLuint height)
+{
+   struct intel_framebuffer *intel_fb = (struct intel_framebuffer*)fb;
+   int i;
+
+   _mesa_resize_framebuffer(ctx, fb, width, height);
+
+   fb->Initialized = GL_TRUE; /* XXX remove someday */
+
+   if (fb->Name != 0) {
+      return;
+   }
+
+   /* Make sure all window system renderbuffers are up to date */
+   for (i = 0; i < 3; i++) {
+      struct gl_renderbuffer *rb = &intel_fb->color_rb[i]->Base;
+
+      /* only resize if size is changing */
+      if (rb && (rb->Width != width || rb->Height != height)) {
+	 rb->AllocStorage(ctx, rb, rb->InternalFormat, width, height);
+      }
+   }
+}
 
 static GLboolean
 intel_nop_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
@@ -671,4 +683,5 @@ intel_fbo_init(struct intel_context *int
    intel->ctx.Driver.FramebufferRenderbuffer = intel_framebuffer_renderbuffer;
    intel->ctx.Driver.RenderTexture = intel_render_texture;
    intel->ctx.Driver.FinishRenderTexture = intel_finish_render_texture;
+   intel->ctx.Driver.ResizeBuffers = intel_resize_buffers;
 }
diff-tree 79bf6924208136247bca2d5f70547f2fe359ecdb (from f72e7fb1d6bbec67f295988ac22087820dee21ce)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Sun Apr 8 14:02:14 2007 +0200

    driUpdateFramebufferSize: Use ctx->Driver.ResizeBuffers.

diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.c b/src/mesa/drivers/dri/common/drirenderbuffer.c
index 2e47781..d36af3e 100644
--- a/src/mesa/drivers/dri/common/drirenderbuffer.c
+++ b/src/mesa/drivers/dri/common/drirenderbuffer.c
@@ -208,7 +208,7 @@ driUpdateFramebufferSize(GLcontext *ctx,
 {
    struct gl_framebuffer *fb = (struct gl_framebuffer *) dPriv->driverPrivate;
    if (fb && (dPriv->w != fb->Width || dPriv->h != fb->Height)) {
-      _mesa_resize_framebuffer(ctx, fb, dPriv->w, dPriv->h);
+      ctx->Driver.ResizeBuffers(ctx, fb, dPriv->w, dPriv->h);
       assert(fb->Width == dPriv->w);
       assert(fb->Height == dPriv->h);
    }


More information about the mesa-commit mailing list