From 17e7582465e2210f479350449b9598864728b4d0 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 22 Sep 2014 10:12:06 +0800 Subject: ilo: move size estimation check out of pipeline It can be done outside of the pipeline. Let's move it. --- src/gallium/drivers/ilo/ilo_3d.c | 12 ++++++++++-- src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c | 7 ------- src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.h | 1 - 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/gallium/drivers/ilo') diff --git a/src/gallium/drivers/ilo/ilo_3d.c b/src/gallium/drivers/ilo/ilo_3d.c index 4be4ce4fc0d..066a4df6282 100644 --- a/src/gallium/drivers/ilo/ilo_3d.c +++ b/src/gallium/drivers/ilo/ilo_3d.c @@ -357,7 +357,8 @@ static bool draw_vbo(struct ilo_3d *hw3d, const struct ilo_state_vector *vec) { bool need_flush = false; - int max_len; + bool success; + int max_len, before_space; ilo_3d_own_render_ring(hw3d); @@ -388,10 +389,17 @@ draw_vbo(struct ilo_3d *hw3d, const struct ilo_state_vector *vec) assert(max_len <= ilo_cp_space(hw3d->cp)); } + /* space available before emission */ + before_space = ilo_cp_space(hw3d->cp); + if (need_flush) ilo_3d_pipeline_emit_flush(hw3d->pipeline); + success = ilo_3d_pipeline_emit_draw(hw3d->pipeline, vec); + + /* sanity check size estimation */ + assert(before_space - ilo_cp_space(hw3d->cp) <= max_len); - return ilo_3d_pipeline_emit_draw(hw3d->pipeline, vec); + return success; } bool diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c index 49bd7e79cbd..856e9ecce38 100644 --- a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c +++ b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c @@ -1361,9 +1361,6 @@ gen6_pipeline_prepare(const struct ilo_3d_pipeline *p, session->pipe_dirty = vec->dirty; session->reduced_prim = u_reduced_prim(vec->draw->mode); - /* available space before the session */ - session->init_cp_space = ilo_cp_space(p->cp); - session->hw_ctx_changed = (p->invalidate_flags & ILO_3D_PIPELINE_INVALIDATE_HW); @@ -1425,10 +1422,6 @@ gen6_pipeline_end(struct ilo_3d_pipeline *p, const struct ilo_state_vector *vec, struct gen6_pipeline_session *session) { - /* sanity check size estimation */ - assert(session->init_cp_space - ilo_cp_space(p->cp) <= - ilo_3d_pipeline_estimate_size(p, ILO_3D_PIPELINE_DRAW, vec)); - p->state.reduced_prim = session->reduced_prim; p->state.primitive_restart = vec->draw->primitive_restart; } diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.h b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.h index 968e3ef2a24..247e10e11dc 100644 --- a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.h +++ b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.h @@ -38,7 +38,6 @@ struct gen6_pipeline_session { uint32_t pipe_dirty; int reduced_prim; - int init_cp_space; bool hw_ctx_changed; bool batch_bo_changed; -- cgit v1.2.3