From c7dff0e614c93c1c890851456477723d5fb22495 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Thu, 20 Jun 2019 13:38:56 +0200 Subject: [PATCH] v3d: keep track of resources written by transform feedback The hardware provides a feature to sync reads from previous transform feedback writes in the same job so if we use this mechanism we no longer have to flush the job. In order to identify this scenario we need a mechanism to identify resources that are written by transform feedback. v2: use _mesa_pointer_set_create (Eric) Reviewed-by: Eric Anholt --- src/gallium/drivers/v3d/v3d_context.h | 2 ++ src/gallium/drivers/v3d/v3d_job.c | 11 +++++++++++ src/gallium/drivers/v3d/v3dx_emit.c | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/v3d/v3d_context.h b/src/gallium/drivers/v3d/v3d_context.h index 21db9997c90..7c8952ebb74 100644 --- a/src/gallium/drivers/v3d/v3d_context.h +++ b/src/gallium/drivers/v3d/v3d_context.h @@ -297,6 +297,7 @@ struct v3d_job { uint32_t referenced_size; struct set *write_prscs; + struct set *tf_write_prscs; /* Size of the submit.bo_handles array. */ uint32_t bo_handles_size; @@ -589,6 +590,7 @@ struct v3d_job *v3d_get_job(struct v3d_context *v3d, struct v3d_job *v3d_get_job_for_fbo(struct v3d_context *v3d); void v3d_job_add_bo(struct v3d_job *job, struct v3d_bo *bo); void v3d_job_add_write_resource(struct v3d_job *job, struct pipe_resource *prsc); +void v3d_job_add_tf_write_resource(struct v3d_job *job, struct pipe_resource *prsc); void v3d_job_submit(struct v3d_context *v3d, struct v3d_job *job); void v3d_flush_jobs_using_bo(struct v3d_context *v3d, struct v3d_bo *bo); void v3d_flush_jobs_writing_resource(struct v3d_context *v3d, diff --git a/src/gallium/drivers/v3d/v3d_job.c b/src/gallium/drivers/v3d/v3d_job.c index 487f514a055..6f3fa709616 100644 --- a/src/gallium/drivers/v3d/v3d_job.c +++ b/src/gallium/drivers/v3d/v3d_job.c @@ -157,6 +157,17 @@ v3d_flush_jobs_using_bo(struct v3d_context *v3d, struct v3d_bo *bo) } } +void +v3d_job_add_tf_write_resource(struct v3d_job *job, struct pipe_resource *prsc) +{ + v3d_job_add_write_resource(job, prsc); + + if (!job->tf_write_prscs) + job->tf_write_prscs = _mesa_pointer_set_create(job); + + _mesa_set_add(job->tf_write_prscs, prsc); +} + void v3d_flush_jobs_writing_resource(struct v3d_context *v3d, struct pipe_resource *prsc) diff --git a/src/gallium/drivers/v3d/v3dx_emit.c b/src/gallium/drivers/v3d/v3dx_emit.c index c54e63f7efe..a3d32f4b7d7 100644 --- a/src/gallium/drivers/v3d/v3dx_emit.c +++ b/src/gallium/drivers/v3d/v3dx_emit.c @@ -766,8 +766,8 @@ v3dX(emit_state)(struct pipe_context *pctx) }; #endif /* V3D_VERSION < 40 */ if (target) { - v3d_job_add_write_resource(v3d->job, - target->buffer); + v3d_job_add_tf_write_resource(v3d->job, + target->buffer); } /* XXX: buffer_size? */ } -- 2.30.2