[Mesa-dev] [PATCH 2/3] st/mesa: move bitmap cache flushing out of state validation
Brian Paul
brianp at vmware.com
Wed Jan 6 08:50:56 PST 2016
Just do it where needed (before drawing, clearing, etc).
---
src/mesa/state_tracker/st_atom.c | 4 ----
src/mesa/state_tracker/st_cb_clear.c | 3 +++
src/mesa/state_tracker/st_cb_drawpixels.c | 5 +++++
src/mesa/state_tracker/st_cb_drawtex.c | 3 +++
src/mesa/state_tracker/st_draw.c | 3 +++
src/mesa/state_tracker/st_draw_feedback.c | 3 +++
6 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index c1a9d00..337213c 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -33,7 +33,6 @@
#include "pipe/p_defines.h"
#include "st_context.h"
#include "st_atom.h"
-#include "st_cb_bitmap.h"
#include "st_program.h"
#include "st_manager.h"
@@ -181,9 +180,6 @@ void st_validate_state( struct st_context *st )
check_attrib_edgeflag(st);
- if (state->mesa)
- st_flush_bitmap_cache(st);
-
check_program_state( st );
st_manager_validate_framebuffers(st);
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index e09f5ec..7b6d10e 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -41,6 +41,7 @@
#include "program/prog_instruction.h"
#include "st_context.h"
#include "st_atom.h"
+#include "st_cb_bitmap.h"
#include "st_cb_clear.h"
#include "st_cb_fbo.h"
#include "st_format.h"
@@ -466,6 +467,8 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
GLbitfield clear_buffers = 0x0;
GLuint i;
+ st_flush_bitmap_cache(st);
+
/* This makes sure the pipe has the latest scissor, etc values */
st_validate_state( st );
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 86e8a55..7ed52dd 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -50,6 +50,7 @@
#include "st_atom.h"
#include "st_atom_constbuf.h"
+#include "st_cb_bitmap.h"
#include "st_cb_drawpixels.h"
#include "st_cb_readpixels.h"
#include "st_cb_fbo.h"
@@ -1063,6 +1064,8 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
/* Mesa state should be up to date by now */
assert(ctx->NewState == 0x0);
+ st_flush_bitmap_cache(st);
+
st_validate_state(st);
/* Limit the size of the glDrawPixels to the max texture size.
@@ -1422,6 +1425,8 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
GLint readX, readY, readW, readH;
struct gl_pixelstore_attrib pack = ctx->DefaultPacking;
+ st_flush_bitmap_cache(st);
+
st_validate_state(st);
if (type == GL_DEPTH_STENCIL) {
diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c
index b3e4b5b..e6ab77f 100644
--- a/src/mesa/state_tracker/st_cb_drawtex.c
+++ b/src/mesa/state_tracker/st_cb_drawtex.c
@@ -21,6 +21,7 @@
#include "st_context.h"
#include "st_atom.h"
+#include "st_cb_bitmap.h"
#include "st_cb_drawtex.h"
#include "pipe/p_context.h"
@@ -113,6 +114,8 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
struct pipe_vertex_element velements[2 + MAX_TEXTURE_UNITS];
unsigned offset;
+ st_flush_bitmap_cache(st);
+
st_validate_state(st);
/* determine if we need vertex color */
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 63b4622..d7a9716 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -48,6 +48,7 @@
#include "st_context.h"
#include "st_atom.h"
+#include "st_cb_bitmap.h"
#include "st_cb_bufferobjects.h"
#include "st_cb_xformfb.h"
#include "st_debug.h"
@@ -197,6 +198,8 @@ st_draw_vbo(struct gl_context *ctx,
/* Mesa core state should have been validated already */
assert(ctx->NewState == 0x0);
+ st_flush_bitmap_cache(st);
+
/* Validate state. */
if (st->dirty.st || ctx->NewDriverState) {
st_validate_state(st);
diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c
index 88c10a8..b6e6dea 100644
--- a/src/mesa/state_tracker/st_draw_feedback.c
+++ b/src/mesa/state_tracker/st_draw_feedback.c
@@ -33,6 +33,7 @@
#include "st_context.h"
#include "st_atom.h"
+#include "st_cb_bitmap.h"
#include "st_cb_bufferobjects.h"
#include "st_draw.h"
#include "st_program.h"
@@ -137,6 +138,8 @@ st_feedback_draw_vbo(struct gl_context *ctx,
assert(draw);
+ st_flush_bitmap_cache(st);
+
st_validate_state(st);
if (!index_bounds_valid)
--
1.9.1
More information about the mesa-dev
mailing list