From 437cae411e7664e01d9c1c280317274b3ffc0734 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mathias=20Fr=C3=B6hlich?= Date: Mon, 5 Feb 2018 22:02:51 +0100 Subject: [PATCH] gallium: Mute arrays for several meta like callbacks. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Marek Olšák --- 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 253b5081640..b597c62632e 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 f9711d53938..68388a5674d 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 0a30ffa0f38..c41ed2ba02b 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 ddf69263328..471eb196614 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 01c5757a734..f18925ecfe6 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.30.2