v3d: add a helper function to flush jobs using a BO
authorIago Toral Quiroga <itoral@igalia.com>
Fri, 14 Jun 2019 10:06:25 +0000 (12:06 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Tue, 18 Jun 2019 06:09:03 +0000 (08:09 +0200)
v2: use _mesa_set_search() (Eric)

Reviewed-by: Eric Anholt <eric@anholt.net>
src/gallium/drivers/v3d/v3d_context.h
src/gallium/drivers/v3d/v3d_job.c

index 225ebe2f5abf0308f3c383f0c3e150f37ad15186..3ab227afb6c9fe2f5eff1f7ac24c4169538e7fb8 100644 (file)
@@ -583,6 +583,7 @@ 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_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,
                                      struct pipe_resource *prsc);
 void v3d_flush_jobs_reading_resource(struct v3d_context *v3d,
index 73546adfc667363c8d81c1973162893a418eb0ef..487f514a055c51d54533c845247819453b162a50 100644 (file)
@@ -146,6 +146,17 @@ v3d_job_add_write_resource(struct v3d_job *job, struct pipe_resource *prsc)
         _mesa_hash_table_insert(v3d->write_jobs, prsc, job);
 }
 
+void
+v3d_flush_jobs_using_bo(struct v3d_context *v3d, struct v3d_bo *bo)
+{
+        hash_table_foreach(v3d->jobs, entry) {
+                struct v3d_job *job = entry->data;
+
+                if (_mesa_set_search(job->bos, bo))
+                        v3d_job_submit(v3d, job);
+        }
+}
+
 void
 v3d_flush_jobs_writing_resource(struct v3d_context *v3d,
                                 struct pipe_resource *prsc)