ilo: update rectlist command emission for Gen8
authorChia-I Wu <olvaffe@gmail.com>
Wed, 11 Feb 2015 06:21:42 +0000 (14:21 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Wed, 11 Feb 2015 23:56:13 +0000 (07:56 +0800)
src/gallium/drivers/ilo/ilo_render.c
src/gallium/drivers/ilo/ilo_render_dynamic.c
src/gallium/drivers/ilo/ilo_render_gen.h
src/gallium/drivers/ilo/ilo_render_gen8.c

index 8fadf01057214978649595e81b115e33fead126e..48191cb24d534ec230f2eac50e877adf48b78da6 100644 (file)
@@ -405,7 +405,7 @@ int
 ilo_render_get_rectlist_len(const struct ilo_render *render,
                             const struct ilo_blitter *blitter)
 {
-   ILO_DEV_ASSERT(render->dev, 6, 7.5);
+   ILO_DEV_ASSERT(render->dev, 6, 8);
 
    return ilo_render_get_rectlist_dynamic_states_len(render, blitter) +
           ilo_render_get_rectlist_commands_len(render, blitter);
@@ -417,7 +417,7 @@ ilo_render_emit_rectlist(struct ilo_render *render,
 {
    struct ilo_render_rectlist_session session;
 
-   ILO_DEV_ASSERT(render->dev, 6, 7.5);
+   ILO_DEV_ASSERT(render->dev, 6, 8);
 
    memset(&session, 0, sizeof(session));
    ilo_render_emit_rectlist_dynamic_states(render, blitter, &session);
index a42f65d6a7219641663adc389129054f9e181006..24a3825ebbbc46cbed1d75b0c24e3df969fc4e6b 100644 (file)
@@ -416,9 +416,9 @@ int
 ilo_render_get_rectlist_dynamic_states_len(const struct ilo_render *render,
                                            const struct ilo_blitter *blitter)
 {
-   ILO_DEV_ASSERT(render->dev, 6, 7.5);
+   ILO_DEV_ASSERT(render->dev, 6, 8);
 
-   return 96;
+   return (ilo_dev_gen(render->dev) >= ILO_GEN(8)) ? 0 : 96;
 }
 
 void
@@ -428,7 +428,10 @@ ilo_render_emit_rectlist_dynamic_states(struct ilo_render *render,
 {
    const unsigned dynamic_used = ilo_builder_dynamic_used(render->builder);
 
-   ILO_DEV_ASSERT(render->dev, 6, 7.5);
+   ILO_DEV_ASSERT(render->dev, 6, 8);
+
+   if (ilo_dev_gen(render->dev) >= ILO_GEN(8))
+      return;
 
    /* both are inclusive */
    session->vb_start = gen6_user_vertex_buffer(render->builder,
index a0952f90849cc229cb03902c6cd17c293b22269b..012c3d7daeb341ae25b167d4d3d60821e8adee87 100644 (file)
@@ -240,11 +240,18 @@ int
 ilo_render_get_rectlist_commands_len_gen6(const struct ilo_render *render,
                                           const struct ilo_blitter *blitter);
 
+int
+ilo_render_get_rectlist_commands_len_gen8(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);
+   if (ilo_dev_gen(render->dev) >= ILO_GEN(8))
+      return ilo_render_get_rectlist_commands_len_gen8(render, blitter);
+   else
+      return ilo_render_get_rectlist_commands_len_gen6(render, blitter);
 }
 
 void
@@ -257,6 +264,11 @@ ilo_render_emit_rectlist_commands_gen7(struct ilo_render *r,
                                        const struct ilo_blitter *blitter,
                                        const struct ilo_render_rectlist_session *session);
 
+void
+ilo_render_emit_rectlist_commands_gen8(struct ilo_render *r,
+                                       const struct ilo_blitter *blitter,
+                                       const struct ilo_render_rectlist_session *session);
+
 static inline void
 ilo_render_emit_rectlist_commands(struct ilo_render *render,
                                   const struct ilo_blitter *blitter,
@@ -264,7 +276,9 @@ ilo_render_emit_rectlist_commands(struct ilo_render *render,
 {
    const unsigned batch_used = ilo_builder_batch_used(render->builder);
 
-   if (ilo_dev_gen(render->dev) >= ILO_GEN(7))
+   if (ilo_dev_gen(render->dev) >= ILO_GEN(8))
+      ilo_render_emit_rectlist_commands_gen8(render, blitter, session);
+   else if (ilo_dev_gen(render->dev) >= ILO_GEN(7))
       ilo_render_emit_rectlist_commands_gen7(render, blitter, session);
    else
       ilo_render_emit_rectlist_commands_gen6(render, blitter, session);
index a56eda91a1870f52405925c0d925d29ee419002a..54c0e20da51cd6c4152f7443f4a0cbf1c8495359 100644 (file)
@@ -393,3 +393,72 @@ ilo_render_get_draw_commands_len_gen8(const struct ilo_render *render,
 
    return len;
 }
+
+int
+ilo_render_get_rectlist_commands_len_gen8(const struct ilo_render *render,
+                                          const struct ilo_blitter *blitter)
+{
+   ILO_DEV_ASSERT(render->dev, 8, 8);
+
+   return 64;
+}
+
+void
+ilo_render_emit_rectlist_commands_gen8(struct ilo_render *r,
+                                       const struct ilo_blitter *blitter,
+                                       const struct ilo_render_rectlist_session *session)
+{
+   uint32_t op;
+
+   ILO_DEV_ASSERT(r->dev, 8, 8);
+
+   gen8_wa_pre_depth(r);
+
+   if (blitter->uses & (ILO_BLITTER_USE_FB_DEPTH |
+                        ILO_BLITTER_USE_FB_STENCIL)) {
+      gen6_3DSTATE_DEPTH_BUFFER(r->builder,
+            &blitter->fb.dst.u.zs, true);
+   }
+
+   if (blitter->uses & ILO_BLITTER_USE_FB_DEPTH) {
+      gen6_3DSTATE_HIER_DEPTH_BUFFER(r->builder,
+            &blitter->fb.dst.u.zs);
+   }
+
+   if (blitter->uses & ILO_BLITTER_USE_FB_STENCIL) {
+      gen6_3DSTATE_STENCIL_BUFFER(r->builder,
+            &blitter->fb.dst.u.zs);
+   }
+
+   gen7_3DSTATE_CLEAR_PARAMS(r->builder,
+         blitter->depth_clear_value);
+
+   gen6_3DSTATE_DRAWING_RECTANGLE(r->builder, 0, 0,
+         blitter->fb.width, blitter->fb.height);
+
+   switch (blitter->op) {
+   case ILO_BLITTER_RECTLIST_CLEAR_ZS:
+      op = 0;
+      if (blitter->uses & ILO_BLITTER_USE_FB_DEPTH)
+         op |= GEN8_WM_HZ_DW1_DEPTH_CLEAR;
+      if (blitter->uses & ILO_BLITTER_USE_FB_STENCIL)
+         op |= GEN8_WM_HZ_DW1_STENCIL_CLEAR;
+      break;
+   case ILO_BLITTER_RECTLIST_RESOLVE_Z:
+      op = GEN8_WM_HZ_DW1_DEPTH_RESOLVE;
+      break;
+   case ILO_BLITTER_RECTLIST_RESOLVE_HIZ:
+      op = GEN8_WM_HZ_DW1_HIZ_RESOLVE;
+      break;
+   default:
+      op = 0;
+      break;
+   }
+
+   gen8_3DSTATE_WM_HZ_OP(r->builder, op, blitter->fb.width,
+         blitter->fb.height, blitter->fb.num_samples);
+
+   gen8_pipe_control(r, GEN6_PIPE_CONTROL_WRITE_IMM);
+
+   gen8_disable_3DSTATE_WM_HZ_OP(r->builder);
+}