Remove intelUpdateFramebufferSize(), use st_resize_framebuffer().
authorBrian <brian.paul@tungstengraphics.com>
Sat, 3 Nov 2007 16:19:38 +0000 (10:19 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Mon, 5 Nov 2007 15:04:48 +0000 (08:04 -0700)
src/mesa/drivers/dri/intel_winsys/intel_context.c
src/mesa/drivers/dri/intel_winsys/intel_context.h
src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c

index 721f73b..8cc2852 100644 (file)
@@ -169,7 +169,6 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
 {
    struct intel_context *intel =
       (struct intel_context *) driContextPriv->driverPrivate;
-   GLcontext *ctx = intel->st->ctx;
 
    assert(intel);               /* should never be null */
    if (intel) {
@@ -203,55 +202,36 @@ intelUnbindContext(__DRIcontextPrivate * driContextPriv)
 }
 
 
-/**
- * Copied/modified from drirenderbuffer.c
- */
-void
-intelUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawablePrivate *dPriv)
-{
-   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);
-      /* if the driver needs the hw lock for ResizeBuffers, the drawable
-         might have changed again by now */
-      assert(fb->Width == dPriv->w);
-      assert(fb->Height == dPriv->h);
-   }
-}
-
-
 GLboolean
 intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
                  __DRIdrawablePrivate * driDrawPriv,
                  __DRIdrawablePrivate * driReadPriv)
 {
    if (driContextPriv) {
-      struct intel_context *intel =
-         (struct intel_context *) driContextPriv->driverPrivate;
+      struct intel_context *intel
+         (struct intel_context *) driContextPriv->driverPrivate;
       struct st_framebuffer *draw_fb
          = (struct st_framebuffer *) driDrawPriv->driverPrivate;
       struct st_framebuffer *read_fb
          = (struct st_framebuffer *) driReadPriv->driverPrivate;
-      GLcontext *ctx = intel->st->ctx;
 
       /* this is a hack so we have a valid context when the region allocation
          is done. Need a per-screen context? */
       intel->intelScreen->dummyctxptr = intel;
 
-      /* update GLframebuffer size to match window if needed */
-      intelUpdateFramebufferSize(ctx, driDrawPriv);
+      st_make_current(intel->st, draw_fb, read_fb);
 
+      /* update size of Mesa framebuffer(s) to match window */
+      st_resize_framebuffer(draw_fb, driDrawPriv->w, driDrawPriv->h);
       if (driReadPriv != driDrawPriv) {
-         intelUpdateFramebufferSize(ctx, driReadPriv);
+         st_resize_framebuffer(read_fb, driReadPriv->w, driReadPriv->h);
       }
 
-      st_make_current(intel->st, draw_fb, read_fb);
-
       if ((intel->driDrawable != driDrawPriv) ||
          (intel->lastStamp != driDrawPriv->lastStamp)) {
-           intel->driDrawable = driDrawPriv;
-           intelWindowMoved(intel);
-           intel->lastStamp = driDrawPriv->lastStamp;
+         intel->driDrawable = driDrawPriv;
+         intelWindowMoved(intel);
+         intel->lastStamp = driDrawPriv->lastStamp;
       }
    }
    else {
index efaf22e..8f3ce02 100644 (file)
@@ -140,7 +140,4 @@ intel_context(GLcontext * ctx)
 }
 
 
-extern void
-intelUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawablePrivate *dPriv);
-
 #endif
index a80b5a4..387e3bc 100644 (file)
@@ -34,6 +34,7 @@
 #include "context.h"
 
 #include "pipe/p_context.h"
+#include "state_tracker/st_public.h"
 #include "state_tracker/st_context.h"
 #include "state_tracker/st_cb_fbo.h"
 
@@ -237,17 +238,17 @@ intelDisplaySurface(__DRIdrawablePrivate * dPriv,
 
 /**
  * This will be called whenever the currently bound window is moved/resized.
- * XXX: actually, it seems to NOT be called when the window is only moved (BP).
  */
 void
 intelWindowMoved(struct intel_context *intel)
 {
-   GLcontext *ctx = intel->st->ctx;
    __DRIdrawablePrivate *dPriv = intel->driDrawable;
    struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
+   struct st_framebuffer *stfb
+      = (struct st_framebuffer *) dPriv->driverPrivate;
+
+   st_resize_framebuffer(stfb, dPriv->w, dPriv->h);
 
-   /* Update Mesa's notion of window size */
-   intelUpdateFramebufferSize(ctx, dPriv);
    intel_fb->Base.Initialized = GL_TRUE; /* XXX remove someday */
 }