From: Ian Romanick Date: Fri, 18 Sep 2015 16:00:28 +0000 (-0400) Subject: radeon: Drop broken front_buffer_reading/drawing optimization X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bf5e0276b6527fbcf51fd2af1769c83c25ec16e5;p=mesa.git radeon: Drop broken front_buffer_reading/drawing optimization Signed-off-by: Ian Romanick Acked-by: Timothy Arceri --- diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index 155d3a392c7..61cbf599f81 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -323,22 +323,17 @@ void radeonDrawBuffer( struct gl_context *ctx, GLenum mode ) fprintf(stderr, "%s %s\n", __func__, _mesa_enum_to_string( mode )); - if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { + if (_mesa_is_front_buffer_drawing(ctx->DrawBuffer)) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); - const GLboolean was_front_buffer_rendering = - radeon->is_front_buffer_rendering; - - radeon->is_front_buffer_rendering = (mode == GL_FRONT_LEFT) || - (mode == GL_FRONT); - - /* If we weren't front-buffer rendering before but we are now, make sure - * that the front-buffer has actually been allocated. - */ - if (!was_front_buffer_rendering && radeon->is_front_buffer_rendering) { - radeon_update_renderbuffers(radeon->driContext, - radeon->driContext->driDrawablePriv, GL_FALSE); - } + /* If we might be front-buffer rendering on this buffer for + * the first time, invalidate our DRI drawable so we'll ask + * for new buffers (including the fake front) before we start + * rendering again. + */ + radeon_update_renderbuffers(radeon->driContext, + radeon->driContext->driDrawablePriv, + GL_FALSE); } radeon_draw_buffer(ctx, ctx->DrawBuffer); @@ -346,16 +341,10 @@ void radeonDrawBuffer( struct gl_context *ctx, GLenum mode ) void radeonReadBuffer( struct gl_context *ctx, GLenum mode ) { - if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer)) { + if (_mesa_is_front_buffer_reading(ctx->ReadBuffer)) { struct radeon_context *const rmesa = RADEON_CONTEXT(ctx); - const GLboolean was_front_buffer_reading = rmesa->is_front_buffer_reading; - rmesa->is_front_buffer_reading = (mode == GL_FRONT_LEFT) - || (mode == GL_FRONT); - - if (!was_front_buffer_reading && rmesa->is_front_buffer_reading) { - radeon_update_renderbuffers(rmesa->driContext, - rmesa->driContext->driReadablePriv, GL_FALSE); - } + radeon_update_renderbuffers(rmesa->driContext, + rmesa->driContext->driReadablePriv, GL_FALSE); } /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */ if (ctx->ReadBuffer == ctx->DrawBuffer) { @@ -381,7 +370,7 @@ void radeon_viewport(struct gl_context *ctx) void (*old_viewport)(struct gl_context *ctx); if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { - if (radeon->is_front_buffer_rendering) { + if (_mesa_is_front_buffer_drawing(ctx->DrawBuffer)) { ctx->Driver.Flush(ctx); } radeon_update_renderbuffers(driContext, driContext->driDrawablePriv, GL_FALSE); diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 7e24f6d7f77..47719baa575 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -352,7 +352,7 @@ void radeon_prepare_render(radeonContextPtr radeon) * that will happen next will probably dirty the front buffer. So * mark it as dirty here. */ - if (radeon->is_front_buffer_rendering) + if (_mesa_is_front_buffer_drawing(radeon->glCtx.DrawBuffer)) radeon->front_buffer_dirty = GL_TRUE; } @@ -389,10 +389,10 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable, struct radeon_renderbuffer *stencil_rb; i = 0; - if ((front_only || radeon->is_front_buffer_rendering || - radeon->is_front_buffer_reading || - !draw->color_rb[1]) - && draw->color_rb[0]) { + if ((front_only || _mesa_is_front_buffer_drawing(&draw->base) || + _mesa_is_front_buffer_reading(&draw->base) || + !draw->color_rb[1]) + && draw->color_rb[0]) { attachments[i++] = __DRI_BUFFER_FRONT_LEFT; attachments[i++] = radeon_bits_per_pixel(draw->color_rb[0]); } diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h index 328b545fdbf..bd7343f4082 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h @@ -426,23 +426,6 @@ struct radeon_context { */ GLboolean 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. - */ - GLboolean 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. - */ - GLboolean is_front_buffer_reading; - struct { struct radeon_query_object *current; struct radeon_state_atom queryobj;