summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_context.h
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2016-09-08 12:56:11 -0700
committerEric Anholt <[email protected]>2016-09-14 06:25:41 +0100
commitf597ac3966405934e13a9aaa18c73211b5a40c7c (patch)
treef7f09bead790e4cdd210e1ed0ca4c4b150dbe35e /src/gallium/drivers/vc4/vc4_context.h
parentf473348468ae1c68e7ef8eaf29f2cc51d17fbec7 (diff)
vc4: Implement job shuffling
Track rendering to each FBO independently and flush rendering only when necessary. This lets us avoid the overhead of storing and loading the frame when an application momentarily switches to rendering to some other texture in order to continue rendering the main scene. Improves glmark -b desktop:effect=shadow:windows=4 by 27% Improves glmark -b desktop:blur-radius=5:effect=blur:passes=1:separable=true:windows=4 by 17% While I haven't tested other apps, this should help X rendering a lot, and I've heard GLBenchmark needed it too.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_context.h')
-rw-r--r--src/gallium/drivers/vc4/vc4_context.h39
1 files changed, 33 insertions, 6 deletions
diff --git a/src/gallium/drivers/vc4/vc4_context.h b/src/gallium/drivers/vc4/vc4_context.h
index 38dc3a5998c..87d8c79241b 100644
--- a/src/gallium/drivers/vc4/vc4_context.h
+++ b/src/gallium/drivers/vc4/vc4_context.h
@@ -190,6 +190,12 @@ struct vc4_vertex_stateobj {
unsigned num_elements;
};
+/* Hash table key for vc4->jobs */
+struct vc4_job_key {
+ struct pipe_surface *cbuf;
+ struct pipe_surface *zsbuf;
+};
+
/**
* A complete bin/render job.
*
@@ -266,6 +272,8 @@ struct vc4_job {
* the current job.
*/
uint32_t draw_calls_queued;
+
+ struct vc4_job_key key;
};
struct vc4_context {
@@ -274,9 +282,21 @@ struct vc4_context {
int fd;
struct vc4_screen *screen;
- /** The render job for the currently bound FBO. */
+ /** The 3D rendering job for the currently bound FBO. */
struct vc4_job *job;
+ /* Map from struct vc4_job_key to the job for that FBO.
+ */
+ struct hash_table *jobs;
+
+ /**
+ * Map from vc4_resource to a job writing to that resource.
+ *
+ * Primarily for flushing jobs rendering to textures that are now
+ * being read from.
+ */
+ struct hash_table *write_jobs;
+
struct slab_mempool transfer_pool;
struct blitter_context *blitter;
@@ -404,7 +424,8 @@ void vc4_program_fini(struct pipe_context *pctx);
void vc4_query_init(struct pipe_context *pctx);
void vc4_simulator_init(struct vc4_screen *screen);
int vc4_simulator_flush(struct vc4_context *vc4,
- struct drm_vc4_submit_cl *args);
+ struct drm_vc4_submit_cl *args,
+ struct vc4_job *job);
void vc4_set_shader_uniform_dirty_flags(struct vc4_compiled_shader *shader);
void vc4_write_uniforms(struct vc4_context *vc4,
@@ -413,11 +434,17 @@ void vc4_write_uniforms(struct vc4_context *vc4,
struct vc4_texture_stateobj *texstate);
void vc4_flush(struct pipe_context *pctx);
-void vc4_job_init(struct vc4_job *job);
+void vc4_job_init(struct vc4_context *vc4);
+struct vc4_job *vc4_get_job(struct vc4_context *vc4,
+ struct pipe_surface *cbuf,
+ struct pipe_surface *zsbuf);
+struct vc4_job *vc4_get_job_for_fbo(struct vc4_context *vc4);
+
void vc4_job_submit(struct vc4_context *vc4, struct vc4_job *job);
-void vc4_job_reset(struct vc4_job *job);
-bool vc4_cl_references_bo(struct pipe_context *pctx, struct vc4_bo *bo,
- bool include_reads);
+void vc4_flush_jobs_writing_resource(struct vc4_context *vc4,
+ struct pipe_resource *prsc);
+void vc4_flush_jobs_reading_resource(struct vc4_context *vc4,
+ struct pipe_resource *prsc);
void vc4_emit_state(struct pipe_context *pctx);
void vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c);
struct qpu_reg *vc4_register_allocate(struct vc4_context *vc4, struct vc4_compile *c);