ilo: move size estimation check out of pipeline
authorChia-I Wu <olvaffe@gmail.com>
Mon, 22 Sep 2014 02:12:06 +0000 (10:12 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Mon, 22 Sep 2014 02:36:27 +0000 (10:36 +0800)
It can be done outside of the pipeline.  Let's move it.

src/gallium/drivers/ilo/ilo_3d.c
src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c
src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.h

index 4be4ce4fc0d7101157b15c3a39d1f9dd5672a85b..066a4df62821144580b2defc632a537bc8422ccd 100644 (file)
@@ -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
index 49bd7e79cbd4d15a7b5873722b10506003ca45b1..856e9ecce383356f1777b97de29fe4dd16ea4c93 100644 (file)
@@ -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;
 }
index 968e3ef2a247d2745d042093de5ad26245ac2020..247e10e11dce15feecc73205ae989c0362865359 100644 (file)
@@ -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;