ilo: make ilo_render_emit_rectlist() direct
authorChia-I Wu <olvaffe@gmail.com>
Thu, 25 Sep 2014 04:02:33 +0000 (12:02 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Fri, 26 Sep 2014 13:15:55 +0000 (21:15 +0800)
Remove emit_rectlist() and ILO_RENDER_RECTLIST indirections.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
src/gallium/drivers/ilo/ilo_draw.c
src/gallium/drivers/ilo/ilo_render.c
src/gallium/drivers/ilo/ilo_render.h
src/gallium/drivers/ilo/ilo_render_gen.h
src/gallium/drivers/ilo/ilo_render_gen6.c
src/gallium/drivers/ilo/ilo_render_gen7.c

index 9e38796b54ea53550a0c96d4375e4930371a9227..8e01f6d3d6f46698b2eb3e463e0dd1915817442a 100644 (file)
@@ -375,8 +375,7 @@ ilo_draw_rectlist(struct ilo_context *ilo)
 
    ilo_draw_set_owner(ilo);
 
-   max_len = ilo_render_estimate_size(ilo->render,
-         ILO_RENDER_RECTLIST, ilo->blitter);
+   max_len = ilo_render_get_rectlist_len(ilo->render, ilo->blitter);
    max_len += ilo_render_get_flush_len(ilo->render) * 2;
 
    if (max_len > ilo_cp_space(ilo->cp)) {
index b9ea32c5fb9c242de0c663c12445d19a6b09bc61..4f78cf59eadf9c624e6d5f093236ca038f5684c5 100644 (file)
@@ -368,3 +368,23 @@ ilo_render_emit_query(struct ilo_render *render,
    assert(ilo_builder_batch_used(render->builder) <= batch_used +
          ilo_render_get_query_len(render, q->type));
 }
+
+int
+ilo_render_get_rectlist_len(const struct ilo_render *render,
+                            const struct ilo_blitter *blitter)
+{
+   ILO_DEV_ASSERT(render->dev, 6, 7.5);
+
+   return ilo_render_get_rectlist_dynamic_states_len(render, blitter) +
+          ilo_render_get_rectlist_commands_len(render, blitter);
+}
+
+void
+ilo_render_emit_rectlist(struct ilo_render *render,
+                         const struct ilo_blitter *blitter)
+{
+   ILO_DEV_ASSERT(render->dev, 6, 7.5);
+
+   ilo_render_emit_rectlist_dynamic_states(render, blitter);
+   ilo_render_emit_rectlist_commands(render, blitter);
+}
index 42c7015d4b4b1105bcb2ab5f94f46207537a8bfe..dd4c3c0f95a863e11092a370c215189956cb3982 100644 (file)
@@ -39,7 +39,6 @@ struct ilo_state_vector;
 
 enum ilo_render_action {
    ILO_RENDER_DRAW,
-   ILO_RENDER_RECTLIST,
 };
 
 /**
@@ -62,9 +61,6 @@ struct ilo_render {
    void (*emit_draw)(struct ilo_render *render,
                      const struct ilo_state_vector *vec);
 
-   void (*emit_rectlist)(struct ilo_render *render,
-                         const struct ilo_blitter *blitter);
-
    bool hw_ctx_changed;
 
    /*
@@ -165,13 +161,6 @@ ilo_render_emit_draw(struct ilo_render *render,
    render->emit_draw(render, vec);
 }
 
-static inline void
-ilo_render_emit_rectlist(struct ilo_render *render,
-                         const struct ilo_blitter *blitter)
-{
-   render->emit_rectlist(render, blitter);
-}
-
 void
 ilo_render_get_sample_position(const struct ilo_render *render,
                                unsigned sample_count,
@@ -198,4 +187,12 @@ void
 ilo_render_emit_query(struct ilo_render *render,
                       struct ilo_query *q, uint32_t offset);
 
+int
+ilo_render_get_rectlist_len(const struct ilo_render *render,
+                            const struct ilo_blitter *blitter);
+
+void
+ilo_render_emit_rectlist(struct ilo_render *render,
+                         const struct ilo_blitter *blitter);
+
 #endif /* ILO_RENDER_H */
index 00ae4f7e51de414a3cf73b4e9faabb5e4aa95128..80e51cab31d23baf070395c57897433c1ffcc662 100644 (file)
@@ -29,6 +29,8 @@
 #define ILO_RENDER_GEN_H
 
 #include "ilo_common.h"
+#include "ilo_builder.h"
+#include "ilo_render.h"
 
 struct ilo_blitter;
 struct ilo_render;
@@ -71,6 +73,40 @@ struct gen6_draw_session {
    int num_surfaces[PIPE_SHADER_TYPES];
 };
 
+int
+ilo_render_get_rectlist_commands_len_gen6(const struct ilo_render *render,
+                                          const struct ilo_blitter *blitter);
+
+static inline int
+ilo_render_get_rectlist_commands_len(const struct ilo_render *render,
+                                     const struct ilo_blitter *blitter)
+{
+   return ilo_render_get_rectlist_commands_len_gen6(render, blitter);
+}
+
+void
+ilo_render_emit_rectlist_commands_gen6(struct ilo_render *r,
+                                       const struct ilo_blitter *blitter);
+
+void
+ilo_render_emit_rectlist_commands_gen7(struct ilo_render *r,
+                                       const struct ilo_blitter *blitter);
+
+static inline void
+ilo_render_emit_rectlist_commands(struct ilo_render *render,
+                                  const struct ilo_blitter *blitter)
+{
+   const unsigned batch_used = ilo_builder_batch_used(render->builder);
+
+   if (ilo_dev_gen(render->dev) >= ILO_GEN(7))
+      ilo_render_emit_rectlist_commands_gen7(render, blitter);
+   else
+      ilo_render_emit_rectlist_commands_gen6(render, blitter);
+
+   assert(ilo_builder_batch_used(render->builder) <= batch_used +
+         ilo_render_get_rectlist_commands_len(render, blitter));
+}
+
 int
 ilo_render_get_draw_dynamic_states_len(const struct ilo_render *render,
                                        const struct ilo_state_vector *vec);
index d0809759111dfe1bd2d5b29af509012b3143133d..2173746c83bff6d2400f05ffb42a5d838b3d02d5 100644 (file)
@@ -1028,10 +1028,21 @@ gen6_rectlist_wm_multisample(struct ilo_render *r,
          (1 << blitter->fb.num_samples) - 1);
 }
 
-static void
-gen6_rectlist_commands(struct ilo_render *r,
-                       const struct ilo_blitter *blitter)
+int
+ilo_render_get_rectlist_commands_len_gen6(const struct ilo_render *render,
+                                          const struct ilo_blitter *blitter)
 {
+   ILO_DEV_ASSERT(render->dev, 6, 7.5);
+
+   return 256;
+}
+
+void
+ilo_render_emit_rectlist_commands_gen6(struct ilo_render *r,
+                                       const struct ilo_blitter *blitter)
+{
+   ILO_DEV_ASSERT(r->dev, 6, 6);
+
    gen6_wa_pre_non_pipelined(r);
 
    gen6_rectlist_wm_multisample(r, blitter);
@@ -1074,14 +1085,6 @@ gen6_rectlist_commands(struct ilo_render *r,
    gen6_3DPRIMITIVE(r->builder, &blitter->draw, NULL);
 }
 
-static void
-ilo_render_emit_rectlist_gen6(struct ilo_render *render,
-                              const struct ilo_blitter *blitter)
-{
-   ilo_render_emit_rectlist_dynamic_states(render, blitter);
-   gen6_rectlist_commands(render, blitter);
-}
-
 static int
 gen6_render_max_command_size(const struct ilo_render *render)
 {
@@ -1145,14 +1148,6 @@ ilo_render_estimate_size_gen6(struct ilo_render *render,
             ilo_render_get_draw_surface_states_len(render, vec);
       }
       break;
-   case ILO_RENDER_RECTLIST:
-      {
-         const struct ilo_blitter *blitter = arg;
-
-         size = ilo_render_get_rectlist_dynamic_states_len(render, blitter);
-         size += 256; /* commands */
-      }
-      break;
    default:
       assert(!"unknown render action");
       size = 0;
@@ -1167,5 +1162,4 @@ ilo_render_init_gen6(struct ilo_render *render)
 {
    render->estimate_size = ilo_render_estimate_size_gen6;
    render->emit_draw = ilo_render_emit_draw_gen6;
-   render->emit_rectlist = ilo_render_emit_rectlist_gen6;
 }
index 7d708c109ede4faa1bcb56e10badbd6d9cdf531c..3ec24c823c33e9004eb1175e50265b8f67adf220 100644 (file)
@@ -838,10 +838,12 @@ gen7_rectlist_wm_multisample(struct ilo_render *r,
          (1 << blitter->fb.num_samples) - 1, blitter->fb.num_samples);
 }
 
-static void
-gen7_rectlist_commands(struct ilo_render *r,
-                       const struct ilo_blitter *blitter)
+void
+ilo_render_emit_rectlist_commands_gen7(struct ilo_render *r,
+                                       const struct ilo_blitter *blitter)
 {
+   ILO_DEV_ASSERT(r->dev, 7, 7.5);
+
    gen7_rectlist_wm_multisample(r, blitter);
 
    gen6_state_base_address(r->builder, true);
@@ -885,14 +887,6 @@ gen7_rectlist_commands(struct ilo_render *r,
    gen7_3DPRIMITIVE(r->builder, &blitter->draw, NULL);
 }
 
-static void
-ilo_render_emit_rectlist_gen7(struct ilo_render *render,
-                              const struct ilo_blitter *blitter)
-{
-   ilo_render_emit_rectlist_dynamic_states(render, blitter);
-   gen7_rectlist_commands(render, blitter);
-}
-
 static int
 gen7_render_max_command_size(const struct ilo_render *render)
 {
@@ -961,14 +955,6 @@ ilo_render_estimate_size_gen7(struct ilo_render *render,
             ilo_render_get_draw_surface_states_len(render, vec);
       }
       break;
-   case ILO_RENDER_RECTLIST:
-      {
-         const struct ilo_blitter *blitter = arg;
-
-         size = ilo_render_get_rectlist_dynamic_states_len(render, blitter);
-         size += 256; /* commands */
-      }
-      break;
    default:
       assert(!"unknown render action");
       size = 0;
@@ -983,5 +969,4 @@ ilo_render_init_gen7(struct ilo_render *render)
 {
    render->estimate_size = ilo_render_estimate_size_gen7;
    render->emit_draw = ilo_render_emit_draw_gen7;
-   render->emit_rectlist = ilo_render_emit_rectlist_gen7;
 }