From 9ab4fc4e632c6ff67d44879b39bb52f231b618e9 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 11 Feb 2015 14:21:42 +0800 Subject: [PATCH] ilo: update rectlist command emission for Gen8 --- src/gallium/drivers/ilo/ilo_render.c | 4 +- src/gallium/drivers/ilo/ilo_render_dynamic.c | 9 ++- src/gallium/drivers/ilo/ilo_render_gen.h | 18 ++++- src/gallium/drivers/ilo/ilo_render_gen8.c | 69 ++++++++++++++++++++ 4 files changed, 93 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/ilo/ilo_render.c b/src/gallium/drivers/ilo/ilo_render.c index 8fadf010572..48191cb24d5 100644 --- a/src/gallium/drivers/ilo/ilo_render.c +++ b/src/gallium/drivers/ilo/ilo_render.c @@ -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); diff --git a/src/gallium/drivers/ilo/ilo_render_dynamic.c b/src/gallium/drivers/ilo/ilo_render_dynamic.c index a42f65d6a72..24a3825ebbb 100644 --- a/src/gallium/drivers/ilo/ilo_render_dynamic.c +++ b/src/gallium/drivers/ilo/ilo_render_dynamic.c @@ -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, diff --git a/src/gallium/drivers/ilo/ilo_render_gen.h b/src/gallium/drivers/ilo/ilo_render_gen.h index a0952f90849..012c3d7daeb 100644 --- a/src/gallium/drivers/ilo/ilo_render_gen.h +++ b/src/gallium/drivers/ilo/ilo_render_gen.h @@ -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); diff --git a/src/gallium/drivers/ilo/ilo_render_gen8.c b/src/gallium/drivers/ilo/ilo_render_gen8.c index a56eda91a18..54c0e20da51 100644 --- a/src/gallium/drivers/ilo/ilo_render_gen8.c +++ b/src/gallium/drivers/ilo/ilo_render_gen8.c @@ -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); +} -- 2.30.2