From: Chia-I Wu Date: Thu, 25 Sep 2014 04:02:33 +0000 (+0800) Subject: ilo: make ilo_render_emit_rectlist() direct X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a05ce904aabcc3733df1338472348c636fce2341;p=mesa.git ilo: make ilo_render_emit_rectlist() direct Remove emit_rectlist() and ILO_RENDER_RECTLIST indirections. Signed-off-by: Chia-I Wu --- diff --git a/src/gallium/drivers/ilo/ilo_draw.c b/src/gallium/drivers/ilo/ilo_draw.c index 9e38796b54e..8e01f6d3d6f 100644 --- a/src/gallium/drivers/ilo/ilo_draw.c +++ b/src/gallium/drivers/ilo/ilo_draw.c @@ -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)) { diff --git a/src/gallium/drivers/ilo/ilo_render.c b/src/gallium/drivers/ilo/ilo_render.c index b9ea32c5fb9..4f78cf59ead 100644 --- a/src/gallium/drivers/ilo/ilo_render.c +++ b/src/gallium/drivers/ilo/ilo_render.c @@ -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); +} diff --git a/src/gallium/drivers/ilo/ilo_render.h b/src/gallium/drivers/ilo/ilo_render.h index 42c7015d4b4..dd4c3c0f95a 100644 --- a/src/gallium/drivers/ilo/ilo_render.h +++ b/src/gallium/drivers/ilo/ilo_render.h @@ -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 */ diff --git a/src/gallium/drivers/ilo/ilo_render_gen.h b/src/gallium/drivers/ilo/ilo_render_gen.h index 00ae4f7e51d..80e51cab31d 100644 --- a/src/gallium/drivers/ilo/ilo_render_gen.h +++ b/src/gallium/drivers/ilo/ilo_render_gen.h @@ -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); diff --git a/src/gallium/drivers/ilo/ilo_render_gen6.c b/src/gallium/drivers/ilo/ilo_render_gen6.c index d0809759111..2173746c83b 100644 --- a/src/gallium/drivers/ilo/ilo_render_gen6.c +++ b/src/gallium/drivers/ilo/ilo_render_gen6.c @@ -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; } diff --git a/src/gallium/drivers/ilo/ilo_render_gen7.c b/src/gallium/drivers/ilo/ilo_render_gen7.c index 7d708c109ed..3ec24c823c3 100644 --- a/src/gallium/drivers/ilo/ilo_render_gen7.c +++ b/src/gallium/drivers/ilo/ilo_render_gen7.c @@ -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; }