[Mesa-dev] [PATCH] gallium: Mute arrays for several meta like callbacks v3

Mathias.Froehlich at gmx.net Mathias.Froehlich at gmx.net
Thu Feb 8 18:55:21 UTC 2018


From: Mathias Fröhlich <Mathias.Froehlich at gmx.net>

Hi Marek,

you mean like this?
Well, not perfect but that survives piglit quick on radeonsi then.

Please review

best and thanks

Mathias



Set the _DrawArray pointer to NULL when calling into the Drivers
Bitmap/CopyPixels/DrawAtlasBitmaps/DrawPixels/DrawTex hooks.
This fixes an assert that gets uncovered when the following
patch gets applied.

v2: Mute from within the state tracker instead of generic mesa.
v3: Avoid evaluating _DrawArrays from within st_validate_state.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
---
 src/mesa/state_tracker/st_atom.c          | 10 ++++++++++
 src/mesa/state_tracker/st_atom.h          |  3 +++
 src/mesa/state_tracker/st_cb_bitmap.c     |  4 ++--
 src/mesa/state_tracker/st_cb_drawpixels.c |  4 ++--
 src/mesa/state_tracker/st_cb_drawtex.c    |  2 +-
 5 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 253b508164..b597c62632 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -203,6 +203,16 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
       pipeline_mask = ST_PIPELINE_CLEAR_STATE_MASK;
       break;
 
+   case ST_PIPELINE_META:
+      if (st->gfx_shaders_may_be_dirty) {
+         check_program_state(st);
+         st->gfx_shaders_may_be_dirty = false;
+      }
+
+      st_manager_validate_framebuffers(st);
+      pipeline_mask = ST_PIPELINE_META_STATE_MASK;
+      break;
+
    case ST_PIPELINE_UPDATE_FRAMEBUFFER:
       st_manager_validate_framebuffers(st);
       pipeline_mask = ST_PIPELINE_UPDATE_FB_STATE_MASK;
diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h
index f9711d5393..68388a5674 100644
--- a/src/mesa/state_tracker/st_atom.h
+++ b/src/mesa/state_tracker/st_atom.h
@@ -44,6 +44,7 @@ struct st_context;
 enum st_pipeline {
    ST_PIPELINE_RENDER,
    ST_PIPELINE_CLEAR,
+   ST_PIPELINE_META,
    ST_PIPELINE_UPDATE_FRAMEBUFFER,
    ST_PIPELINE_COMPUTE,
 };
@@ -149,6 +150,8 @@ enum {
 #define ST_PIPELINE_CLEAR_STATE_MASK (ST_NEW_FB_STATE | \
                                       ST_NEW_SCISSOR | \
                                       ST_NEW_WINDOW_RECTANGLES)
+#define ST_PIPELINE_META_STATE_MASK (ST_PIPELINE_RENDER_STATE_MASK & \
+                                     ~ST_NEW_VERTEX_ARRAYS)
 /* For ReadPixels, ReadBuffer, GetSamplePosition: */
 #define ST_PIPELINE_UPDATE_FB_STATE_MASK (ST_NEW_FB_STATE)
 
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index 0a30ffa0f3..c41ed2ba02 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -626,7 +626,7 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y,
    if ((st->dirty | ctx->NewDriverState) & ~ST_NEW_CONSTANTS &
        ST_PIPELINE_RENDER_STATE_MASK ||
        st->gfx_shaders_may_be_dirty) {
-      st_validate_state(st, ST_PIPELINE_RENDER);
+      st_validate_state(st, ST_PIPELINE_META);
    }
 
    if (UseBitmapCache && accum_bitmap(ctx, x, y, width, height, unpack, bitmap))
@@ -681,7 +681,7 @@ st_DrawAtlasBitmaps(struct gl_context *ctx,
 
    st_flush_bitmap_cache(st);
 
-   st_validate_state(st, ST_PIPELINE_RENDER);
+   st_validate_state(st, ST_PIPELINE_META);
    st_invalidate_readpix_cache(st);
 
    sv = st_create_texture_sampler_view(pipe, stObj->pt);
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index ddf6926332..471eb19661 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -1147,7 +1147,7 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
    st_flush_bitmap_cache(st);
    st_invalidate_readpix_cache(st);
 
-   st_validate_state(st, ST_PIPELINE_RENDER);
+   st_validate_state(st, ST_PIPELINE_META);
 
    /* Limit the size of the glDrawPixels to the max texture size.
     * Strictly speaking, that's not correct but since we don't handle
@@ -1514,7 +1514,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
    st_flush_bitmap_cache(st);
    st_invalidate_readpix_cache(st);
 
-   st_validate_state(st, ST_PIPELINE_RENDER);
+   st_validate_state(st, ST_PIPELINE_META);
 
    if (type == GL_DEPTH_STENCIL) {
       /* XXX make this more efficient */
diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c
index 01c5757a73..f18925ecfe 100644
--- a/src/mesa/state_tracker/st_cb_drawtex.c
+++ b/src/mesa/state_tracker/st_cb_drawtex.c
@@ -120,7 +120,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
    st_flush_bitmap_cache(st);
    st_invalidate_readpix_cache(st);
 
-   st_validate_state(st, ST_PIPELINE_RENDER);
+   st_validate_state(st, ST_PIPELINE_META);
 
    /* determine if we need vertex color */
    if (ctx->FragmentProgram._Current->info.inputs_read & VARYING_BIT_COL0)
-- 
2.14.3



More information about the mesa-dev mailing list