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 9e38796..8e01f6d 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 b9ea32c..4f78cf5 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 42c7015..dd4c3c0 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 00ae4f7..80e51ca 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;
@@ -72,6 +74,40 @@ struct gen6_draw_session {
 };
 
 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 d080975..2173746 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 7d708c1..3ec24c8 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;
 }