diff options
author | Kenneth Graunke <[email protected]> | 2013-07-03 11:37:51 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2013-07-09 14:09:01 -0700 |
commit | 9147b4049658fe2401c19e03d20220aeea0fafc6 (patch) | |
tree | 3dc12bea608d4b7881709edba91ed804a02415c1 /src/mesa/drivers/dri/i965 | |
parent | e43043c316a8274f5f07a8cf818960ef1387a788 (diff) |
i965: Move front buffer rendering fields from intel_context to brw.
Signed-off-by: Kenneth Graunke <[email protected]>
Acked-by: Chris Forbes <[email protected]>
Acked-by: Paul Berry <[email protected]>
Acked-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_clear.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 25 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_draw.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_buffers.c | 21 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_context.c | 17 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_context.h | 24 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_pixel_read.c | 11 |
8 files changed, 52 insertions, 53 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_clear.c b/src/mesa/drivers/dri/i965/brw_clear.c index f68969157e1..b0a9fe74a28 100644 --- a/src/mesa/drivers/dri/i965/brw_clear.c +++ b/src/mesa/drivers/dri/i965/brw_clear.c @@ -217,7 +217,7 @@ brw_clear(struct gl_context *ctx, GLbitfield mask) return; if (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT)) { - intel->front_buffer_dirty = true; + brw->front_buffer_dirty = true; } intel_prepare_render(brw); diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 21894cdd89a..6d2393e7b2e 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -802,6 +802,31 @@ struct brw_context } vtbl; + /** + * Set if rendering has occured to the drawable's front buffer. + * + * This is used in the DRI2 case to detect that glFlush should also copy + * the contents of the fake front buffer to the real front buffer. + */ + bool front_buffer_dirty; + + /** + * Track whether front-buffer rendering is currently enabled + * + * A separate flag is used to track this in order to support MRT more + * easily. + */ + bool is_front_buffer_rendering; + + /** + * Track whether front-buffer is the current read target. + * + * This is closely associated with is_front_buffer_rendering, but may + * be set separately. The DRI2 fake front buffer must be referenced + * either way. + */ + bool is_front_buffer_reading; + /** drirc option cache */ driOptionCache optionCache; diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index e5fdef31cf2..5742fad712c 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -335,7 +335,6 @@ brw_predraw_resolve_buffers(struct brw_context *brw) */ static void brw_postdraw_set_buffers_need_resolve(struct brw_context *brw) { - struct intel_context *intel = &brw->intel; struct gl_context *ctx = &brw->intel.ctx; struct gl_framebuffer *fb = ctx->DrawBuffer; @@ -343,7 +342,7 @@ static void brw_postdraw_set_buffers_need_resolve(struct brw_context *brw) struct intel_renderbuffer *back_irb = intel_get_renderbuffer(fb, BUFFER_BACK_LEFT); struct intel_renderbuffer *depth_irb = intel_get_renderbuffer(fb, BUFFER_DEPTH); - if (intel->is_front_buffer_rendering) + if (brw->is_front_buffer_rendering) front_irb = intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT); if (front_irb) diff --git a/src/mesa/drivers/dri/i965/intel_buffers.c b/src/mesa/drivers/dri/i965/intel_buffers.c index 502eba52eb2..a89c902b07b 100644 --- a/src/mesa/drivers/dri/i965/intel_buffers.c +++ b/src/mesa/drivers/dri/i965/intel_buffers.c @@ -36,7 +36,7 @@ /** * Check if we're about to draw into the front color buffer. - * If so, set the intel->front_buffer_dirty field to true. + * If so, set the brw->front_buffer_dirty field to true. */ void intel_check_front_buffer_rendering(struct brw_context *brw) @@ -47,7 +47,7 @@ intel_check_front_buffer_rendering(struct brw_context *brw) /* drawing to window system buffer */ if (fb->_NumColorDrawBuffers > 0) { if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) { - intel->front_buffer_dirty = true; + brw->front_buffer_dirty = true; } } } @@ -57,18 +57,18 @@ static void intelDrawBuffer(struct gl_context * ctx, GLenum mode) { if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer)) { + struct brw_context *const brw = brw_context(ctx); struct intel_context *const intel = intel_context(ctx); - const bool was_front_buffer_rendering = - intel->is_front_buffer_rendering; + const bool was_front_buffer_rendering = brw->is_front_buffer_rendering; - intel->is_front_buffer_rendering = (mode == GL_FRONT_LEFT) + brw->is_front_buffer_rendering = (mode == GL_FRONT_LEFT) || (mode == GL_FRONT) || (mode == GL_FRONT_AND_BACK); /* If we weren't front-buffer rendering before but we are now, * invalidate our DRI drawable so we'll ask for new buffers * (including the fake front) before we start rendering again. */ - if (!was_front_buffer_rendering && intel->is_front_buffer_rendering) + if (!was_front_buffer_rendering && brw->is_front_buffer_rendering) dri2InvalidateDrawable(intel->driContext->driDrawablePriv); } } @@ -78,18 +78,17 @@ static void intelReadBuffer(struct gl_context * ctx, GLenum mode) { if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer)) { + struct brw_context *const brw = brw_context(ctx); struct intel_context *const intel = intel_context(ctx); - const bool was_front_buffer_reading = - intel->is_front_buffer_reading; + const bool was_front_buffer_reading = brw->is_front_buffer_reading; - intel->is_front_buffer_reading = (mode == GL_FRONT_LEFT) - || (mode == GL_FRONT); + brw->is_front_buffer_reading = mode == GL_FRONT_LEFT || mode == GL_FRONT; /* If we weren't front-buffer reading before but we are now, * invalidate our DRI drawable so we'll ask for new buffers * (including the fake front) before we start reading again. */ - if (!was_front_buffer_reading && intel->is_front_buffer_reading) + if (!was_front_buffer_reading && brw->is_front_buffer_reading) dri2InvalidateDrawable(intel->driContext->driReadablePriv); } } diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c index 73609921baf..8a8d2e2e438 100644 --- a/src/mesa/drivers/dri/i965/intel_context.c +++ b/src/mesa/drivers/dri/i965/intel_context.c @@ -133,7 +133,7 @@ intel_flush_front(struct gl_context *ctx) __DRIdrawable *driDrawable = driContext->driDrawablePriv; __DRIscreen *const screen = intel->intelScreen->driScrnPriv; - if (intel->front_buffer_dirty && _mesa_is_winsys_fbo(ctx->DrawBuffer)) { + if (brw->front_buffer_dirty && _mesa_is_winsys_fbo(ctx->DrawBuffer)) { if (screen->dri2.loader->flushFrontBuffer != NULL && driDrawable && driDrawable->loaderPrivate) { @@ -153,7 +153,7 @@ intel_flush_front(struct gl_context *ctx) /* We set the dirty bit in intel_prepare_render() if we're * front buffer rendering once we get there. */ - intel->front_buffer_dirty = false; + brw->front_buffer_dirty = false; } } } @@ -265,8 +265,8 @@ intel_prepare_render(struct brw_context *brw) * that will happen next will probably dirty the front buffer. So * mark it as dirty here. */ - if (intel->is_front_buffer_rendering) - intel->front_buffer_dirty = true; + if (brw->is_front_buffer_rendering) + brw->front_buffer_dirty = true; /* Wait for the swapbuffers before the one we just emitted, so we * don't get too many swaps outstanding for apps that are GPU-heavy @@ -350,11 +350,12 @@ _intel_flush(struct gl_context *ctx, const char *file, int line) static void intel_glFlush(struct gl_context *ctx) { + struct brw_context *brw = brw_context(ctx); struct intel_context *intel = intel_context(ctx); intel_flush(ctx); intel_flush_front(ctx); - if (intel->is_front_buffer_rendering) + if (brw->is_front_buffer_rendering) intel->need_throttle = true; } @@ -793,8 +794,8 @@ intel_query_dri2_buffers(struct brw_context *brw, back_rb = intel_get_renderbuffer(fb, BUFFER_BACK_LEFT); memset(attachments, 0, sizeof(attachments)); - if ((intel->is_front_buffer_rendering || - intel->is_front_buffer_reading || + if ((brw->is_front_buffer_rendering || + brw->is_front_buffer_reading || !back_rb) && front_rb) { /* If a fake front buffer is in use, then querying for * __DRI_BUFFER_FRONT_LEFT will cause the server to copy the image from @@ -807,7 +808,7 @@ intel_query_dri2_buffers(struct brw_context *brw, attachments[i++] = __DRI_BUFFER_FRONT_LEFT; attachments[i++] = intel_bits_per_pixel(front_rb); - } else if (front_rb && intel->front_buffer_dirty) { + } else if (front_rb && brw->front_buffer_dirty) { /* We have pending front buffer rendering, but we aren't querying for a * front buffer. If the front buffer we have is a fake front buffer, * the X server is going to throw it away when it processes the query. diff --git a/src/mesa/drivers/dri/i965/intel_context.h b/src/mesa/drivers/dri/i965/intel_context.h index 5ea17af5322..089da634c00 100644 --- a/src/mesa/drivers/dri/i965/intel_context.h +++ b/src/mesa/drivers/dri/i965/intel_context.h @@ -165,30 +165,6 @@ struct intel_context GLenum reduced_primitive; - /** - * Set if rendering has occured to the drawable's front buffer. - * - * This is used in the DRI2 case to detect that glFlush should also copy - * the contents of the fake front buffer to the real front buffer. - */ - bool front_buffer_dirty; - - /** - * Track whether front-buffer rendering is currently enabled - * - * A separate flag is used to track this in order to support MRT more - * easily. - */ - bool is_front_buffer_rendering; - /** - * Track whether front-buffer is the current read target. - * - * This is closely associated with is_front_buffer_rendering, but may - * be set separately. The DRI2 fake front buffer must be referenced - * either way. - */ - bool is_front_buffer_reading; - int driFd; __DRIcontext *driContext; diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index bc2f10c986c..460779db1c0 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -715,7 +715,7 @@ intel_miptree_create_for_dri2_buffer(struct brw_context *brw, multisample_mt->singlesample_mt = singlesample_mt; multisample_mt->need_downsample = false; - if (intel->is_front_buffer_rendering && + if (brw->is_front_buffer_rendering && (dri_attachment == __DRI_BUFFER_FRONT_LEFT || dri_attachment == __DRI_BUFFER_FAKE_FRONT_LEFT)) { intel_miptree_upsample(brw, multisample_mt); diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c b/src/mesa/drivers/dri/i965/intel_pixel_read.c index c1d5fb00eee..b12e349458c 100644 --- a/src/mesa/drivers/dri/i965/intel_pixel_read.c +++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c @@ -76,7 +76,6 @@ do_blit_readpixels(struct gl_context * ctx, const struct gl_pixelstore_attrib *pack, GLvoid * pixels) { struct brw_context *brw = brw_context(ctx); - struct intel_context *intel = intel_context(ctx); struct intel_buffer_object *dst = intel_buffer_object(pack->BufferObj); GLuint dst_offset; drm_intel_bo *dst_buffer; @@ -124,9 +123,9 @@ do_blit_readpixels(struct gl_context * ctx, return true; } - dirty = intel->front_buffer_dirty; + dirty = brw->front_buffer_dirty; intel_prepare_render(brw); - intel->front_buffer_dirty = dirty; + brw->front_buffer_dirty = dirty; all = (width * height * irb->mt->cpp == dst->Base.Size && x == 0 && dst_offset == 0); @@ -183,9 +182,9 @@ intelReadPixels(struct gl_context * ctx, /* glReadPixels() wont dirty the front buffer, so reset the dirty * flag after calling intel_prepare_render(). */ - dirty = intel->front_buffer_dirty; + dirty = brw->front_buffer_dirty; intel_prepare_render(brw); - intel->front_buffer_dirty = dirty; + brw->front_buffer_dirty = dirty; /* Update Mesa state before calling _mesa_readpixels(). * XXX this may not be needed since ReadPixels no longer uses the @@ -198,5 +197,5 @@ intelReadPixels(struct gl_context * ctx, _mesa_readpixels(ctx, x, y, width, height, format, type, pack, pixels); /* There's an intel_prepare_render() call in intelSpanRenderStart(). */ - intel->front_buffer_dirty = dirty; + brw->front_buffer_dirty = dirty; } |