From af64dd2ae0aa31261002335f10d46492000f552b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 2 Feb 2007 17:10:25 +0100 Subject: i915tex: Make page flipping work again. --- src/mesa/drivers/dri/i915tex/intel_fbo.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers/dri/i915tex/intel_fbo.c') diff --git a/src/mesa/drivers/dri/i915tex/intel_fbo.c b/src/mesa/drivers/dri/i915tex/intel_fbo.c index ab0e569bd9..b739e22cca 100644 --- a/src/mesa/drivers/dri/i915tex/intel_fbo.c +++ b/src/mesa/drivers/dri/i915tex/intel_fbo.c @@ -78,8 +78,23 @@ intel_get_renderbuffer(struct gl_framebuffer *fb, GLuint attIndex) struct intel_region * intel_get_rb_region(struct gl_framebuffer *fb, GLuint attIndex) { - struct intel_renderbuffer *irb - = intel_renderbuffer(fb->Attachment[attIndex].Renderbuffer); + GET_CURRENT_CONTEXT(ctx); + struct intel_context *intel = intel_context(ctx); + struct intel_renderbuffer *irb; + + if (intel->sarea->pf_current_page) { + switch (attIndex) { + case BUFFER_BACK_LEFT: + attIndex = BUFFER_FRONT_LEFT; + break; + case BUFFER_FRONT_LEFT: + attIndex = BUFFER_BACK_LEFT; + break; + } + } + + irb = intel_renderbuffer(fb->Attachment[attIndex].Renderbuffer); + if (irb) return irb->region; else -- cgit v1.2.3 From 6b99cafd69a791d03ce749d0fd2b9f59ca265677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 15 Feb 2007 16:30:40 +0100 Subject: i915tex: Support page flipping on both CRTCs independently. No longer track page flipping state per context but per window, via struct intel_framebuffer which wraps struct gl_framebuffer for windows. --- src/mesa/drivers/dri/i915tex/intel_fbo.c | 36 +++++++++++++++++--------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'src/mesa/drivers/dri/i915tex/intel_fbo.c') diff --git a/src/mesa/drivers/dri/i915tex/intel_fbo.c b/src/mesa/drivers/dri/i915tex/intel_fbo.c index b739e22cca..104cf1d9bb 100644 --- a/src/mesa/drivers/dri/i915tex/intel_fbo.c +++ b/src/mesa/drivers/dri/i915tex/intel_fbo.c @@ -71,6 +71,21 @@ intel_renderbuffer(struct gl_renderbuffer *rb) struct intel_renderbuffer * intel_get_renderbuffer(struct gl_framebuffer *fb, GLuint attIndex) { + if (fb->Name == 0) { + struct intel_framebuffer *intel_fb = (struct intel_framebuffer*)fb; + + if (intel_fb->pf_current_page) { + switch (attIndex) { + case BUFFER_BACK_LEFT: + attIndex = BUFFER_FRONT_LEFT; + break; + case BUFFER_FRONT_LEFT: + attIndex = BUFFER_BACK_LEFT; + break; + } + } + } + return intel_renderbuffer(fb->Attachment[attIndex].Renderbuffer); } @@ -78,22 +93,7 @@ intel_get_renderbuffer(struct gl_framebuffer *fb, GLuint attIndex) struct intel_region * intel_get_rb_region(struct gl_framebuffer *fb, GLuint attIndex) { - GET_CURRENT_CONTEXT(ctx); - struct intel_context *intel = intel_context(ctx); - struct intel_renderbuffer *irb; - - if (intel->sarea->pf_current_page) { - switch (attIndex) { - case BUFFER_BACK_LEFT: - attIndex = BUFFER_FRONT_LEFT; - break; - case BUFFER_FRONT_LEFT: - attIndex = BUFFER_BACK_LEFT; - break; - } - } - - irb = intel_renderbuffer(fb->Attachment[attIndex].Renderbuffer); + struct intel_renderbuffer *irb = intel_get_renderbuffer(fb, attIndex); if (irb) return irb->region; @@ -109,7 +109,9 @@ intel_get_rb_region(struct gl_framebuffer *fb, GLuint attIndex) static struct gl_framebuffer * intel_new_framebuffer(GLcontext * ctx, GLuint name) { - /* there's no intel_framebuffer at this time, just use Mesa's class */ + /* Only drawable state in intel_framebuffer at this time, just use Mesa's + * class + */ return _mesa_new_framebuffer(ctx, name); } -- cgit v1.2.3 From e33a9d689415e00bded306699abdf93b96c0b9ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 20 Feb 2007 19:14:23 +0100 Subject: i915tex: Triple buffering support, only effective with page flipping so far. Pending flips are tracked per renderbuffer and the colour renderbuffer attachments of window framebuffer objects are rotated on flips to avoid stalling the pipeline for pending flips unnecessarily. --- src/mesa/drivers/dri/i915tex/intel_fbo.c | 49 +++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 14 deletions(-) (limited to 'src/mesa/drivers/dri/i915tex/intel_fbo.c') diff --git a/src/mesa/drivers/dri/i915tex/intel_fbo.c b/src/mesa/drivers/dri/i915tex/intel_fbo.c index 104cf1d9bb..ad078451bf 100644 --- a/src/mesa/drivers/dri/i915tex/intel_fbo.c +++ b/src/mesa/drivers/dri/i915tex/intel_fbo.c @@ -71,22 +71,29 @@ intel_renderbuffer(struct gl_renderbuffer *rb) struct intel_renderbuffer * intel_get_renderbuffer(struct gl_framebuffer *fb, GLuint attIndex) { - if (fb->Name == 0) { - struct intel_framebuffer *intel_fb = (struct intel_framebuffer*)fb; - - if (intel_fb->pf_current_page) { - switch (attIndex) { - case BUFFER_BACK_LEFT: - attIndex = BUFFER_FRONT_LEFT; - break; - case BUFFER_FRONT_LEFT: - attIndex = BUFFER_BACK_LEFT; - break; - } - } + return intel_renderbuffer(fb->Attachment[attIndex].Renderbuffer); +} + + +void +intel_flip_renderbuffers(struct intel_framebuffer *intel_fb) +{ + int current_page = intel_fb->pf_current_page; + int next_page = (current_page + 1) % intel_fb->pf_num_pages; + + if (intel_fb->Base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer != + &intel_fb->color_rb[current_page]->Base) { + _mesa_remove_renderbuffer(&intel_fb->Base, BUFFER_FRONT_LEFT); + _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_FRONT_LEFT, + &intel_fb->color_rb[current_page]->Base); } - return intel_renderbuffer(fb->Attachment[attIndex].Renderbuffer); + if (intel_fb->Base.Attachment[BUFFER_BACK_LEFT].Renderbuffer != + &intel_fb->color_rb[next_page]->Base) { + _mesa_remove_renderbuffer(&intel_fb->Base, BUFFER_BACK_LEFT); + _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_BACK_LEFT, + &intel_fb->color_rb[next_page]->Base); + } } @@ -288,10 +295,24 @@ 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; } -- cgit v1.2.3 From 3c578455e103664e6f93a7792999da7c06dd9a3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Wed, 28 Feb 2007 17:42:54 +0100 Subject: i915tex: Check that intel_rb is valid before trying to add it to an fbo. --- src/mesa/drivers/dri/i915tex/intel_fbo.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers/dri/i915tex/intel_fbo.c') diff --git a/src/mesa/drivers/dri/i915tex/intel_fbo.c b/src/mesa/drivers/dri/i915tex/intel_fbo.c index ad078451bf..8d43055382 100644 --- a/src/mesa/drivers/dri/i915tex/intel_fbo.c +++ b/src/mesa/drivers/dri/i915tex/intel_fbo.c @@ -81,14 +81,16 @@ intel_flip_renderbuffers(struct intel_framebuffer *intel_fb) int current_page = intel_fb->pf_current_page; int next_page = (current_page + 1) % intel_fb->pf_num_pages; - if (intel_fb->Base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer != + if (intel_fb->color_rb[current_page] && + intel_fb->Base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer != &intel_fb->color_rb[current_page]->Base) { _mesa_remove_renderbuffer(&intel_fb->Base, BUFFER_FRONT_LEFT); _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_FRONT_LEFT, &intel_fb->color_rb[current_page]->Base); } - if (intel_fb->Base.Attachment[BUFFER_BACK_LEFT].Renderbuffer != + if (intel_fb->color_rb[next_page] && + intel_fb->Base.Attachment[BUFFER_BACK_LEFT].Renderbuffer != &intel_fb->color_rb[next_page]->Base) { _mesa_remove_renderbuffer(&intel_fb->Base, BUFFER_BACK_LEFT); _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_BACK_LEFT, -- cgit v1.2.3