summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/common/drirenderbuffer.c26
-rw-r--r--src/mesa/drivers/dri/common/drirenderbuffer.h5
2 files changed, 29 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.c b/src/mesa/drivers/dri/common/drirenderbuffer.c
index df0d27302c..764dafc7f4 100644
--- a/src/mesa/drivers/dri/common/drirenderbuffer.c
+++ b/src/mesa/drivers/dri/common/drirenderbuffer.c
@@ -1,15 +1,19 @@
#include "mtypes.h"
#include "drirenderbuffer.h"
+#include "framebuffer.h"
#include "renderbuffer.h"
#include "imports.h"
/**
- * This will get called when a window is resized.
+ * This will get called when a window (gl_framebuffer) is resized (probably
+ * via driUpdateFramebufferSize(), below).
* Just update width, height and internal format fields for now.
* There's usually no memory allocation above because the present
- * DRI drivers use statically-allocated full-screen buffers.
+ * DRI drivers use statically-allocated full-screen buffers. If that's not
+ * the case for a DRI driver, a different AllocStorage method should
+ * be used.
*/
static GLboolean
driRenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *rb,
@@ -164,3 +168,21 @@ driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped)
}
}
}
+
+
+/**
+ * Check that the gl_framebuffer associated with dPriv is the right size.
+ * Resize the gl_framebuffer if needed.
+ * It's expected that the dPriv->driverPrivate member points to a
+ * gl_framebuffer object.
+ */
+void
+driUpdateFramebufferSize(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);
+ assert(fb->Width == dPriv->w);
+ assert(fb->Height == dPriv->h);
+ }
+}
diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.h b/src/mesa/drivers/dri/common/drirenderbuffer.h
index f2cc357ff9..cd73b78174 100644
--- a/src/mesa/drivers/dri/common/drirenderbuffer.h
+++ b/src/mesa/drivers/dri/common/drirenderbuffer.h
@@ -67,4 +67,9 @@ driNewRenderbuffer(GLenum format, GLvoid *addr,
extern void
driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped);
+
+extern void
+driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawablePrivate *dPriv);
+
+
#endif /* DRIRENDERBUFFER_H */