intel: avoid unnecessary front buffer flushing/updating
Before, if we just called glXMakeCurrent() and didn't render anything we'd still trigger a flushFrontBuffer() call. Now only set the intel->front_buffer_dirty field at state validation time just before we draw something. NOTE: additional calls to intel_check_front_buffer_rendering() might be needed if I missed some rendering paths.
This commit is contained in:
@@ -1088,6 +1088,7 @@ intelRenderStart(GLcontext * ctx)
|
|||||||
{
|
{
|
||||||
struct intel_context *intel = intel_context(ctx);
|
struct intel_context *intel = intel_context(ctx);
|
||||||
|
|
||||||
|
intel_check_front_buffer_rendering(intel);
|
||||||
intel->vtbl.render_start(intel_context(ctx));
|
intel->vtbl.render_start(intel_context(ctx));
|
||||||
intel->vtbl.emit_state(intel);
|
intel->vtbl.emit_state(intel);
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include "brw_context.h"
|
#include "brw_context.h"
|
||||||
#include "brw_state.h"
|
#include "brw_state.h"
|
||||||
#include "intel_batchbuffer.h"
|
#include "intel_batchbuffer.h"
|
||||||
|
#include "intel_buffers.h"
|
||||||
|
|
||||||
/* This is used to initialize brw->state.atoms[]. We could use this
|
/* This is used to initialize brw->state.atoms[]. We could use this
|
||||||
* list directly except for a single atom, brw_constant_buffer, which
|
* list directly except for a single atom, brw_constant_buffer, which
|
||||||
@@ -324,6 +325,8 @@ void brw_validate_state( struct brw_context *brw )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
intel_check_front_buffer_rendering(intel);
|
||||||
|
|
||||||
/* Make sure that the textures which are referenced by the current
|
/* Make sure that the textures which are referenced by the current
|
||||||
* brw fragment program are actually present/valid.
|
* brw fragment program are actually present/valid.
|
||||||
* If this fails, we can experience GPU lock-ups.
|
* If this fails, we can experience GPU lock-ups.
|
||||||
|
@@ -132,6 +132,25 @@ intel_get_cliprects(struct intel_context *intel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if we're about to draw into the front color buffer.
|
||||||
|
* If so, set the intel->front_buffer_dirty field to true.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
intel_check_front_buffer_rendering(struct intel_context *intel)
|
||||||
|
{
|
||||||
|
const struct gl_framebuffer *fb = intel->ctx.DrawBuffer;
|
||||||
|
if (fb->Name == 0) {
|
||||||
|
/* drawing to window system buffer */
|
||||||
|
if (fb->_NumColorDrawBuffers > 0) {
|
||||||
|
if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) {
|
||||||
|
intel->front_buffer_dirty = GL_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the hardware state for drawing into a window or framebuffer object.
|
* Update the hardware state for drawing into a window or framebuffer object.
|
||||||
*
|
*
|
||||||
@@ -202,8 +221,6 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
|
|||||||
intel_batchbuffer_flush(intel->batch);
|
intel_batchbuffer_flush(intel->batch);
|
||||||
intel->front_cliprects = GL_TRUE;
|
intel->front_cliprects = GL_TRUE;
|
||||||
colorRegions[0] = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);
|
colorRegions[0] = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);
|
||||||
|
|
||||||
intel->front_buffer_dirty = GL_TRUE;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!intel->constant_cliprect && intel->front_cliprects)
|
if (!intel->constant_cliprect && intel->front_cliprects)
|
||||||
|
@@ -45,6 +45,8 @@ extern struct intel_region *intel_readbuf_region(struct intel_context *intel);
|
|||||||
|
|
||||||
extern struct intel_region *intel_drawbuf_region(struct intel_context *intel);
|
extern struct intel_region *intel_drawbuf_region(struct intel_context *intel);
|
||||||
|
|
||||||
|
extern void intel_check_front_buffer_rendering(struct intel_context *intel);
|
||||||
|
|
||||||
extern void intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb);
|
extern void intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb);
|
||||||
|
|
||||||
extern void intelInitBufferFuncs(struct dd_function_table *functions);
|
extern void intelInitBufferFuncs(struct dd_function_table *functions);
|
||||||
|
@@ -501,6 +501,8 @@ intel_map_unmap_framebuffer(struct intel_context *intel,
|
|||||||
else
|
else
|
||||||
intel_renderbuffer_unmap(intel, fb->_StencilBuffer->Wrapped);
|
intel_renderbuffer_unmap(intel, fb->_StencilBuffer->Wrapped);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
intel_check_front_buffer_rendering(intel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user