diff options
author | Chia-I Wu <[email protected]> | 2014-09-22 10:46:15 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2014-09-22 11:45:38 +0800 |
commit | 61c6a294dd8f6e6fba8149d5a32e882ec42dcbf4 (patch) | |
tree | a8ebdb09097071af140a19613fd300f00e5315df | |
parent | 672592de7e4b05b13765f5eac777e5427f84c0f0 (diff) |
ilo: move aperture checks out of pipeline
They can be done outside of the pipeline. Move them and let the pipeline
focus on building commands.
-rw-r--r-- | src/gallium/drivers/ilo/ilo_3d.c | 68 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_3d_pipeline.c | 71 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_3d_pipeline.h | 2 |
3 files changed, 69 insertions, 72 deletions
diff --git a/src/gallium/drivers/ilo/ilo_3d.c b/src/gallium/drivers/ilo/ilo_3d.c index 4bc70c67d87..291ff1c102c 100644 --- a/src/gallium/drivers/ilo/ilo_3d.c +++ b/src/gallium/drivers/ilo/ilo_3d.c @@ -357,7 +357,7 @@ static bool draw_vbo(struct ilo_3d *hw3d, const struct ilo_state_vector *vec) { bool need_flush = false; - bool success; + bool success = true; int max_len, before_space; /* on GEN7+, we need SOL_RESET to reset the SO write offsets */ @@ -402,7 +402,30 @@ draw_vbo(struct ilo_3d *hw3d, const struct ilo_state_vector *vec) if (need_flush) ilo_3d_pipeline_emit_flush(hw3d->pipeline); - success = ilo_3d_pipeline_emit_draw(hw3d->pipeline, vec); + + while (true) { + struct ilo_builder_snapshot snapshot; + + ilo_builder_batch_snapshot(&hw3d->cp->builder, &snapshot); + + ilo_3d_pipeline_emit_draw(hw3d->pipeline, vec); + + if (!ilo_builder_validate(&hw3d->cp->builder, 0, NULL)) { + ilo_builder_batch_restore(&hw3d->cp->builder, &snapshot); + + /* flush and try again */ + if (ilo_builder_batch_used(&hw3d->cp->builder)) { + ilo_cp_submit(hw3d->cp, "out of aperture"); + continue; + } + + success = false; + } + + break; + } + + hw3d->pipeline->invalidate_flags = 0x0; /* sanity check size estimation */ assert(before_space - ilo_cp_space(hw3d->cp) <= max_len); @@ -442,8 +465,22 @@ ilo_3d_pass_render_condition(struct ilo_context *ilo) void ilo_3d_draw_rectlist(struct ilo_3d *hw3d, const struct ilo_blitter *blitter) { + int max_len, before_space; + ilo_3d_own_render_ring(hw3d); + max_len = ilo_3d_pipeline_estimate_size(hw3d->pipeline, + ILO_3D_PIPELINE_RECTLIST, blitter); + max_len += ilo_3d_pipeline_estimate_size(hw3d->pipeline, + ILO_3D_PIPELINE_FLUSH, NULL) * 2; + + if (max_len > ilo_cp_space(hw3d->cp)) { + ilo_cp_submit(hw3d->cp, "out of space"); + assert(max_len <= ilo_cp_space(hw3d->cp)); + } + + before_space = ilo_cp_space(hw3d->cp); + /* * From the Sandy Bridge PRM, volume 2 part 1, page 313: * @@ -465,16 +502,37 @@ ilo_3d_draw_rectlist(struct ilo_3d *hw3d, const struct ilo_blitter *blitter) * - we may sample from the fb shortly after * * Skip checking blitter->op and do the flushes. - * - * XXX need space check */ if (!hw3d->new_batch) ilo_3d_pipeline_emit_flush(hw3d->pipeline); - ilo_3d_pipeline_emit_rectlist(hw3d->pipeline, blitter); + while (true) { + struct ilo_builder_snapshot snapshot; + + ilo_builder_batch_snapshot(&hw3d->cp->builder, &snapshot); + + ilo_3d_pipeline_emit_rectlist(hw3d->pipeline, blitter); + + if (!ilo_builder_validate(&hw3d->cp->builder, 0, NULL)) { + ilo_builder_batch_restore(&hw3d->cp->builder, &snapshot); + + /* flush and try again */ + if (ilo_builder_batch_used(&hw3d->cp->builder)) { + ilo_cp_submit(hw3d->cp, "out of aperture"); + continue; + } + } + + break; + } + + ilo_3d_pipeline_invalidate(hw3d->pipeline, ILO_3D_PIPELINE_INVALIDATE_HW); ilo_3d_pipeline_emit_flush(hw3d->pipeline); + /* sanity check size estimation */ + assert(before_space - ilo_cp_space(hw3d->cp) <= max_len); + hw3d->new_batch = false; } diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline.c b/src/gallium/drivers/ilo/ilo_3d_pipeline.c index 298c2ec65b6..cf7ce0bd680 100644 --- a/src/gallium/drivers/ilo/ilo_3d_pipeline.c +++ b/src/gallium/drivers/ilo/ilo_3d_pipeline.c @@ -148,44 +148,12 @@ handle_invalid_batch_bo(struct ilo_3d_pipeline *p, bool unset) /** * Emit context states and 3DPRIMITIVE. */ -bool +void ilo_3d_pipeline_emit_draw(struct ilo_3d_pipeline *p, const struct ilo_state_vector *vec) { - bool success; - - while (true) { - struct ilo_builder_snapshot snapshot; - - /* we will rewind if aperture check below fails */ - ilo_builder_batch_snapshot(&p->cp->builder, &snapshot); - - handle_invalid_batch_bo(p, false); - - /* draw! */ - p->emit_draw(p, vec); - - if (ilo_builder_validate(&p->cp->builder, 0, NULL)) { - success = true; - } else { - /* rewind */ - ilo_builder_batch_restore(&p->cp->builder, &snapshot); - - /* flush and try again */ - if (ilo_builder_batch_used(&p->cp->builder)) { - ilo_cp_submit(p->cp, "out of aperture"); - continue; - } - - success = false; - } - - break; - } - - p->invalidate_flags = 0x0; - - return success; + handle_invalid_batch_bo(p, false); + p->emit_draw(p, vec); } /** @@ -213,37 +181,8 @@ void ilo_3d_pipeline_emit_rectlist(struct ilo_3d_pipeline *p, const struct ilo_blitter *blitter) { - const int max_len = ilo_3d_pipeline_estimate_size(p, - ILO_3D_PIPELINE_RECTLIST, blitter); - - if (max_len > ilo_cp_space(p->cp)) - ilo_cp_submit(p->cp, "out of space"); - - while (true) { - struct ilo_builder_snapshot snapshot; - - /* we will rewind if aperture check below fails */ - ilo_builder_batch_snapshot(&p->cp->builder, &snapshot); - - handle_invalid_batch_bo(p, false); - - p->emit_rectlist(p, blitter); - - if (!ilo_builder_validate(&p->cp->builder, 0, NULL)) { - /* rewind */ - ilo_builder_batch_restore(&p->cp->builder, &snapshot); - - /* flush and try again */ - if (ilo_builder_batch_used(&p->cp->builder)) { - ilo_cp_submit(p->cp, "out of aperture"); - continue; - } - } - - break; - } - - ilo_3d_pipeline_invalidate(p, ILO_3D_PIPELINE_INVALIDATE_HW); + handle_invalid_batch_bo(p, false); + p->emit_rectlist(p, blitter); } void diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline.h b/src/gallium/drivers/ilo/ilo_3d_pipeline.h index 802c965a8c4..8e074bcc4a0 100644 --- a/src/gallium/drivers/ilo/ilo_3d_pipeline.h +++ b/src/gallium/drivers/ilo/ilo_3d_pipeline.h @@ -159,7 +159,7 @@ ilo_3d_pipeline_estimate_size(struct ilo_3d_pipeline *pipeline, return pipeline->estimate_size(pipeline, action, arg); } -bool +void ilo_3d_pipeline_emit_draw(struct ilo_3d_pipeline *p, const struct ilo_state_vector *vec); |