summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2019-08-07 11:34:03 -0700
committerRob Clark <[email protected]>2019-08-13 08:11:26 -0700
commitab01ab4d4fbabf78af04fdd8fc20a2b9773d8f82 (patch)
treeceb72f8a9c3ded4d1d9d3d68a6c40a70a3341804 /src/gallium/drivers/freedreno
parent882d53d8e36592a39cde947e890969a81b2b1226 (diff)
freedreno/a6xx: move VS driverparams to it's own stateobj
If driver-params are required, we really should emit it on every draw for correctness. And if not required, we should emit a DISABLE so that un-applied state updates from previous draws don't corrupt the const state. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_emit.c19
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_emit.h1
2 files changed, 15 insertions, 5 deletions
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
index 59e0a9780e0..49b653bdf8f 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
@@ -934,9 +934,6 @@ fd6_emit_state(struct fd_ringbuffer *ring, struct fd6_emit *emit)
ir3_emit_image_dims(ctx->screen, vp, vsconstobj,
&ctx->shaderimg[PIPE_SHADER_VERTEX]);
- if (ir3_needs_vs_driver_params(vp))
- ir3_emit_vs_driver_params(vp, vsconstobj, ctx, emit->info);
-
fd6_emit_take_group(emit, vsconstobj, FD6_GROUP_VS_CONST, 0x7);
}
@@ -956,6 +953,16 @@ fd6_emit_state(struct fd_ringbuffer *ring, struct fd6_emit *emit)
fd6_emit_take_group(emit, fsconstobj, FD6_GROUP_FS_CONST, 0x6);
}
+ /* if driver-params are needed, emit each time: */
+ if (ir3_needs_vs_driver_params(vp)) {
+ struct fd_ringbuffer *dpconstobj = fd_submit_new_ringbuffer(
+ ctx->batch->submit, IR3_DP_VS_COUNT * 4, FD_RINGBUFFER_STREAMING);
+ ir3_emit_vs_driver_params(vp, dpconstobj, ctx, emit->info);
+ fd6_emit_take_group(emit, dpconstobj, FD6_GROUP_VS_DRIVER_PARAMS, 0x7);
+ } else {
+ fd6_emit_take_group(emit, NULL, FD6_GROUP_VS_DRIVER_PARAMS, 0x7);
+ }
+
struct ir3_stream_output_info *info = &vp->shader->stream_output;
if (info->num_outputs)
fd6_emit_streamout(ring, emit, info);
@@ -1054,7 +1061,8 @@ fd6_emit_state(struct fd_ringbuffer *ring, struct fd6_emit *emit)
OUT_PKT7(ring, CP_SET_DRAW_STATE, 3 * emit->num_groups);
for (unsigned i = 0; i < emit->num_groups; i++) {
struct fd6_state_group *g = &emit->groups[i];
- unsigned n = fd_ringbuffer_size(g->stateobj) / 4;
+ unsigned n = g->stateobj ?
+ fd_ringbuffer_size(g->stateobj) / 4 : 0;
if (n == 0) {
OUT_RING(ring, CP_SET_DRAW_STATE__0_COUNT(0) |
@@ -1070,7 +1078,8 @@ fd6_emit_state(struct fd_ringbuffer *ring, struct fd6_emit *emit)
OUT_RB(ring, g->stateobj);
}
- fd_ringbuffer_del(g->stateobj);
+ if (g->stateobj)
+ fd_ringbuffer_del(g->stateobj);
}
emit->num_groups = 0;
}
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.h b/src/gallium/drivers/freedreno/a6xx/fd6_emit.h
index bc66884fb5a..490cffb95b5 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.h
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.h
@@ -51,6 +51,7 @@ enum fd6_state_id {
FD6_GROUP_VBO,
FD6_GROUP_VS_CONST,
FD6_GROUP_FS_CONST,
+ FD6_GROUP_VS_DRIVER_PARAMS,
FD6_GROUP_VS_TEX,
FD6_GROUP_FS_TEX,
FD6_GROUP_IBO,