aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_draw.c
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_draw.c
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_draw.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_draw.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/gallium/drivers/vc4/vc4_draw.c b/src/gallium/drivers/vc4/vc4_draw.c
index 52a53db9a29..bbdb02010f6 100644
--- a/src/gallium/drivers/vc4/vc4_draw.c
+++ b/src/gallium/drivers/vc4/vc4_draw.c
@@ -116,9 +116,11 @@ vc4_start_draw(struct vc4_context *vc4, int vert_count)
}
static void
-vc4_update_shadow_textures(struct pipe_context *pctx,
+vc4_predraw_check_textures(struct pipe_context *pctx,
struct vc4_texture_stateobj *stage_tex)
{
+ struct vc4_context *vc4 = vc4_context(pctx);
+
for (int i = 0; i < stage_tex->num_textures; i++) {
struct pipe_sampler_view *view = stage_tex->textures[i];
if (!view)
@@ -126,6 +128,8 @@ vc4_update_shadow_textures(struct pipe_context *pctx,
struct vc4_resource *rsc = vc4_resource(view->texture);
if (rsc->shadow_parent)
vc4_update_shadow_baselevel_texture(pctx, view);
+
+ vc4_flush_jobs_writing_resource(vc4, view->texture);
}
}
@@ -263,12 +267,12 @@ static void
vc4_hw_2116_workaround(struct pipe_context *pctx)
{
struct vc4_context *vc4 = vc4_context(pctx);
- struct vc4_job *job = vc4->job;
+ struct vc4_job *job = vc4_get_job_for_fbo(vc4);
if (job->draw_calls_queued == 0x1ef0) {
perf_debug("Flushing batch due to HW-2116 workaround "
"(too many draw calls per scene\n");
- vc4_flush(pctx);
+ vc4_job_submit(vc4, job);
}
}
@@ -276,7 +280,6 @@ static void
vc4_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
{
struct vc4_context *vc4 = vc4_context(pctx);
- struct vc4_job *job = vc4->job;
if (info->mode >= PIPE_PRIM_QUADS) {
util_primconvert_save_index_buffer(vc4->primconvert, &vc4->indexbuf);
@@ -288,11 +291,13 @@ vc4_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
}
/* Before setting up the draw, do any fixup blits necessary. */
- vc4_update_shadow_textures(pctx, &vc4->verttex);
- vc4_update_shadow_textures(pctx, &vc4->fragtex);
+ vc4_predraw_check_textures(pctx, &vc4->verttex);
+ vc4_predraw_check_textures(pctx, &vc4->fragtex);
vc4_hw_2116_workaround(pctx);
+ struct vc4_job *job = vc4_get_job_for_fbo(vc4);
+
vc4_get_draw_cl_space(job, info->count);
if (vc4->prim_mode != info->mode) {
@@ -466,14 +471,15 @@ vc4_clear(struct pipe_context *pctx, unsigned buffers,
const union pipe_color_union *color, double depth, unsigned stencil)
{
struct vc4_context *vc4 = vc4_context(pctx);
- struct vc4_job *job = vc4->job;
+ struct vc4_job *job = vc4_get_job_for_fbo(vc4);
/* We can't flag new buffers for clearing once we've queued draws. We
* could avoid this by using the 3d engine to clear.
*/
if (job->draw_calls_queued) {
perf_debug("Flushing rendering to process new clear.\n");
- vc4_flush(pctx);
+ vc4_job_submit(vc4, job);
+ job = vc4_get_job_for_fbo(vc4);
}
/* Clearing ZS will clear both Z and stencil, so if we're trying to