freedreno: Don't ignore geom/tess stage resources

The draw resource-tracking logic looks like it never was updated to
account for HS/DS/GS stages.  Add it bitmask of bound stages so we only
have to loop over the bound stages.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9581>
This commit is contained in:
Rob Clark 2021-03-15 08:15:21 -07:00
parent 8cb51ba30e
commit 66985973aa
4 changed files with 28 additions and 30 deletions

View File

@ -189,18 +189,6 @@ spec@arb_texture_float@fbo-alphatest-formats,Fail
spec@arb_texture_float@fbo-blending-formats,Fail
spec@arb_texture_float@texwrap formats bordercolor-swizzled,Fail
spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch,Fail
spec@arb_texture_multisample@texelfetch@2-gs-isampler2dms,Fail
spec@arb_texture_multisample@texelfetch@2-gs-isampler2dmsarray,Fail
spec@arb_texture_multisample@texelfetch@2-gs-sampler2dms,Fail
spec@arb_texture_multisample@texelfetch@2-gs-sampler2dmsarray,Fail
spec@arb_texture_multisample@texelfetch@2-gs-usampler2dms,Fail
spec@arb_texture_multisample@texelfetch@2-gs-usampler2dmsarray,Fail
spec@arb_texture_multisample@texelfetch@4-gs-isampler2dms,Fail
spec@arb_texture_multisample@texelfetch@4-gs-isampler2dmsarray,Fail
spec@arb_texture_multisample@texelfetch@4-gs-sampler2dms,Fail
spec@arb_texture_multisample@texelfetch@4-gs-sampler2dmsarray,Fail
spec@arb_texture_multisample@texelfetch@4-gs-usampler2dms,Fail
spec@arb_texture_multisample@texelfetch@4-gs-usampler2dmsarray,Fail
spec@arb_texture_rectangle@1-1-linear-texture,Fail
spec@arb_texture_rectangle@copyteximage rect,Crash
spec@arb_texture_rectangle@copyteximage rect samples=2,Crash

View File

@ -358,6 +358,7 @@ struct fd_context {
struct fd_texture_stateobj tex[PIPE_SHADER_TYPES] dt;
struct fd_program_stateobj prog dt;
uint32_t bound_shader_stages dt;
struct fd_vertex_state vtx dt;

View File

@ -149,14 +149,18 @@ batch_draw_tracking_for_dirty_bits(struct fd_batch *batch)
}
}
if (ctx->dirty_shader[PIPE_SHADER_VERTEX] & FD_DIRTY_SHADER_CONST) {
u_foreach_bit (i, ctx->constbuf[PIPE_SHADER_VERTEX].enabled_mask)
resource_read(batch, ctx->constbuf[PIPE_SHADER_VERTEX].cb[i].buffer);
}
u_foreach_bit (s, ctx->bound_shader_stages) {
/* Mark constbuf as being read: */
if (ctx->dirty_shader[s] & FD_DIRTY_SHADER_CONST) {
u_foreach_bit (i, ctx->constbuf[s].enabled_mask)
resource_read(batch, ctx->constbuf[s].cb[i].buffer);
}
if (ctx->dirty_shader[PIPE_SHADER_FRAGMENT] & FD_DIRTY_SHADER_CONST) {
u_foreach_bit (i, ctx->constbuf[PIPE_SHADER_FRAGMENT].enabled_mask)
resource_read(batch, ctx->constbuf[PIPE_SHADER_FRAGMENT].cb[i].buffer);
/* Mark textures as being read */
if (ctx->dirty_shader[s] & FD_DIRTY_SHADER_TEX) {
u_foreach_bit (i, ctx->tex[s].valid_textures)
resource_read(batch, ctx->tex[s].textures[i]->texture);
}
}
/* Mark VBOs as being read */
@ -167,17 +171,6 @@ batch_draw_tracking_for_dirty_bits(struct fd_batch *batch)
}
}
/* Mark textures as being read */
if (ctx->dirty_shader[PIPE_SHADER_VERTEX] & FD_DIRTY_SHADER_TEX) {
u_foreach_bit (i, ctx->tex[PIPE_SHADER_VERTEX].valid_textures)
resource_read(batch, ctx->tex[PIPE_SHADER_VERTEX].textures[i]->texture);
}
if (ctx->dirty_shader[PIPE_SHADER_FRAGMENT] & FD_DIRTY_SHADER_TEX) {
u_foreach_bit (i, ctx->tex[PIPE_SHADER_FRAGMENT].valid_textures)
resource_read(batch, ctx->tex[PIPE_SHADER_FRAGMENT].textures[i]->texture);
}
/* Mark streamout buffers as being written.. */
if (ctx->dirty & FD_DIRTY_STREAMOUT) {
for (unsigned i = 0; i < ctx->streamout.num_targets; i++)

View File

@ -32,6 +32,17 @@
#include "freedreno_program.h"
#include "freedreno_context.h"
static void
update_bound_stage(struct fd_context *ctx, enum pipe_shader_type shader, bool bound)
assert_dt
{
if (bound) {
ctx->bound_shader_stages |= BIT(shader);
} else {
ctx->bound_shader_stages &= ~BIT(shader);
}
}
static void
fd_vs_state_bind(struct pipe_context *pctx, void *hwcso)
in_dt
@ -39,6 +50,7 @@ fd_vs_state_bind(struct pipe_context *pctx, void *hwcso)
struct fd_context *ctx = fd_context(pctx);
ctx->prog.vs = hwcso;
fd_context_dirty_shader(ctx, PIPE_SHADER_VERTEX, FD_DIRTY_SHADER_PROG);
update_bound_stage(ctx, PIPE_SHADER_VERTEX, !!hwcso);
}
static void
@ -48,6 +60,7 @@ fd_tcs_state_bind(struct pipe_context *pctx, void *hwcso)
struct fd_context *ctx = fd_context(pctx);
ctx->prog.hs = hwcso;
fd_context_dirty_shader(ctx, PIPE_SHADER_TESS_CTRL, FD_DIRTY_SHADER_PROG);
update_bound_stage(ctx, PIPE_SHADER_TESS_CTRL, !!hwcso);
}
static void
@ -57,6 +70,7 @@ fd_tes_state_bind(struct pipe_context *pctx, void *hwcso)
struct fd_context *ctx = fd_context(pctx);
ctx->prog.ds = hwcso;
fd_context_dirty_shader(ctx, PIPE_SHADER_TESS_EVAL, FD_DIRTY_SHADER_PROG);
update_bound_stage(ctx, PIPE_SHADER_TESS_EVAL, !!hwcso);
}
static void
@ -66,6 +80,7 @@ fd_gs_state_bind(struct pipe_context *pctx, void *hwcso)
struct fd_context *ctx = fd_context(pctx);
ctx->prog.gs = hwcso;
fd_context_dirty_shader(ctx, PIPE_SHADER_GEOMETRY, FD_DIRTY_SHADER_PROG);
update_bound_stage(ctx, PIPE_SHADER_GEOMETRY, !!hwcso);
}
static void
@ -75,6 +90,7 @@ fd_fs_state_bind(struct pipe_context *pctx, void *hwcso)
struct fd_context *ctx = fd_context(pctx);
ctx->prog.fs = hwcso;
fd_context_dirty_shader(ctx, PIPE_SHADER_FRAGMENT, FD_DIRTY_SHADER_PROG);
update_bound_stage(ctx, PIPE_SHADER_FRAGMENT, !!hwcso);
}
static const char *solid_fs =