From 55d70e0669fd363c434ad781fe66d60095585062 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 10 Nov 2014 13:11:40 +0800 Subject: [PATCH] ilo: remove inlined state functions We had some inlined state functions for dispatching. They were not needed with the new top/bottom split. Signed-off-by: Chia-I Wu --- src/gallium/drivers/ilo/ilo_builder_3d_top.h | 4 +- src/gallium/drivers/ilo/ilo_state_3d.h | 166 +---------------- src/gallium/drivers/ilo/ilo_state_3d_bottom.c | 71 +++++--- src/gallium/drivers/ilo/ilo_state_3d_top.c | 172 ++++++++++++------ 4 files changed, 177 insertions(+), 236 deletions(-) diff --git a/src/gallium/drivers/ilo/ilo_builder_3d_top.h b/src/gallium/drivers/ilo/ilo_builder_3d_top.h index 5c4fbf993ce..697a47769b8 100644 --- a/src/gallium/drivers/ilo/ilo_builder_3d_top.h +++ b/src/gallium/drivers/ilo/ilo_builder_3d_top.h @@ -683,7 +683,7 @@ gen6_3DSTATE_GS(struct ilo_builder *builder, ilo_shader_get_kernel_param(vs, param); /* cannot use VS's CSO */ - ilo_gpe_init_gs_cso_gen6(builder->dev, vs, &cso); + ilo_gpe_init_gs_cso(builder->dev, vs, &cso); dw2 = cso.payload[0]; dw4 = cso.payload[1]; dw5 = cso.payload[2]; @@ -1388,7 +1388,7 @@ gen6_so_SURFACE_STATE(struct ilo_builder *builder, break; } - ilo_gpe_init_view_surface_for_buffer_gen6(builder->dev, buf, bo_offset, + ilo_gpe_init_view_surface_for_buffer(builder->dev, buf, bo_offset, so->buffer_size, struct_size, elem_format, false, true, &surf); return gen6_SURFACE_STATE(builder, &surf, false); diff --git a/src/gallium/drivers/ilo/ilo_state_3d.h b/src/gallium/drivers/ilo/ilo_state_3d.h index c1e54c0c5b9..b83322b2e49 100644 --- a/src/gallium/drivers/ilo/ilo_state_3d.h +++ b/src/gallium/drivers/ilo/ilo_state_3d.h @@ -112,39 +112,9 @@ ilo_gpe_set_scissor_null(const struct ilo_dev_info *dev, struct ilo_scissor_state *scissor); void -ilo_gpe_init_rasterizer_clip(const struct ilo_dev_info *dev, - const struct pipe_rasterizer_state *state, - struct ilo_rasterizer_clip *clip); - -void -ilo_gpe_init_rasterizer_sf(const struct ilo_dev_info *dev, - const struct pipe_rasterizer_state *state, - struct ilo_rasterizer_sf *sf); - -void -ilo_gpe_init_rasterizer_wm_gen6(const struct ilo_dev_info *dev, - const struct pipe_rasterizer_state *state, - struct ilo_rasterizer_wm *wm); - -void -ilo_gpe_init_rasterizer_wm_gen7(const struct ilo_dev_info *dev, - const struct pipe_rasterizer_state *state, - struct ilo_rasterizer_wm *wm); - -static inline void ilo_gpe_init_rasterizer(const struct ilo_dev_info *dev, const struct pipe_rasterizer_state *state, - struct ilo_rasterizer_state *rasterizer) -{ - ilo_gpe_init_rasterizer_clip(dev, state, &rasterizer->clip); - ilo_gpe_init_rasterizer_sf(dev, state, &rasterizer->sf); - - if (ilo_dev_gen(dev) >= ILO_GEN(7)) - ilo_gpe_init_rasterizer_wm_gen7(dev, state, &rasterizer->wm); - else - ilo_gpe_init_rasterizer_wm_gen6(dev, state, &rasterizer->wm); -} - + struct ilo_rasterizer_state *rasterizer); void ilo_gpe_init_dsa(const struct ilo_dev_info *dev, const struct pipe_depth_stencil_alpha_state *state, @@ -161,93 +131,21 @@ ilo_gpe_init_sampler_cso(const struct ilo_dev_info *dev, struct ilo_sampler_cso *sampler); void -ilo_gpe_init_view_surface_null_gen6(const struct ilo_dev_info *dev, - unsigned width, unsigned height, - unsigned depth, unsigned level, - struct ilo_view_surface *surf); - -void -ilo_gpe_init_view_surface_for_buffer_gen6(const struct ilo_dev_info *dev, - const struct ilo_buffer *buf, - unsigned offset, unsigned size, - unsigned struct_size, - enum pipe_format elem_format, - bool is_rt, bool render_cache_rw, - struct ilo_view_surface *surf); - -void -ilo_gpe_init_view_surface_for_texture_gen6(const struct ilo_dev_info *dev, - const struct ilo_texture *tex, - enum pipe_format format, - unsigned first_level, - unsigned num_levels, - unsigned first_layer, - unsigned num_layers, - bool is_rt, - struct ilo_view_surface *surf); - -void -ilo_gpe_init_view_surface_null_gen7(const struct ilo_dev_info *dev, - unsigned width, unsigned height, - unsigned depth, unsigned level, - struct ilo_view_surface *surf); - -void -ilo_gpe_init_view_surface_for_buffer_gen7(const struct ilo_dev_info *dev, - const struct ilo_buffer *buf, - unsigned offset, unsigned size, - unsigned struct_size, - enum pipe_format elem_format, - bool is_rt, bool render_cache_rw, - struct ilo_view_surface *surf); - -void -ilo_gpe_init_view_surface_for_texture_gen7(const struct ilo_dev_info *dev, - const struct ilo_texture *tex, - enum pipe_format format, - unsigned first_level, - unsigned num_levels, - unsigned first_layer, - unsigned num_layers, - bool is_rt, - struct ilo_view_surface *surf); - -static inline void ilo_gpe_init_view_surface_null(const struct ilo_dev_info *dev, unsigned width, unsigned height, unsigned depth, unsigned level, - struct ilo_view_surface *surf) -{ - if (ilo_dev_gen(dev) >= ILO_GEN(7)) { - ilo_gpe_init_view_surface_null_gen7(dev, - width, height, depth, level, surf); - } - else { - ilo_gpe_init_view_surface_null_gen6(dev, - width, height, depth, level, surf); - } -} + struct ilo_view_surface *surf); -static inline void +void ilo_gpe_init_view_surface_for_buffer(const struct ilo_dev_info *dev, const struct ilo_buffer *buf, unsigned offset, unsigned size, unsigned struct_size, enum pipe_format elem_format, bool is_rt, bool render_cache_rw, - struct ilo_view_surface *surf) -{ - if (ilo_dev_gen(dev) >= ILO_GEN(7)) { - ilo_gpe_init_view_surface_for_buffer_gen7(dev, buf, offset, size, - struct_size, elem_format, is_rt, render_cache_rw, surf); - } - else { - ilo_gpe_init_view_surface_for_buffer_gen6(dev, buf, offset, size, - struct_size, elem_format, is_rt, render_cache_rw, surf); - } -} + struct ilo_view_surface *surf); -static inline void +void ilo_gpe_init_view_surface_for_texture(const struct ilo_dev_info *dev, const struct ilo_texture *tex, enum pipe_format format, @@ -256,19 +154,7 @@ ilo_gpe_init_view_surface_for_texture(const struct ilo_dev_info *dev, unsigned first_layer, unsigned num_layers, bool is_rt, - struct ilo_view_surface *surf) -{ - if (ilo_dev_gen(dev) >= ILO_GEN(7)) { - ilo_gpe_init_view_surface_for_texture_gen7(dev, tex, format, - first_level, num_levels, first_layer, num_layers, - is_rt, surf); - } - else { - ilo_gpe_init_view_surface_for_texture_gen6(dev, tex, format, - first_level, num_levels, first_layer, num_layers, - is_rt, surf); - } -} + struct ilo_view_surface *surf); void ilo_gpe_init_zs_surface(const struct ilo_dev_info *dev, @@ -283,50 +169,14 @@ ilo_gpe_init_vs_cso(const struct ilo_dev_info *dev, struct ilo_shader_cso *cso); void -ilo_gpe_init_gs_cso_gen6(const struct ilo_dev_info *dev, - const struct ilo_shader_state *gs, - struct ilo_shader_cso *cso); - -void -ilo_gpe_init_gs_cso_gen7(const struct ilo_dev_info *dev, - const struct ilo_shader_state *gs, - struct ilo_shader_cso *cso); - -static inline void ilo_gpe_init_gs_cso(const struct ilo_dev_info *dev, const struct ilo_shader_state *gs, - struct ilo_shader_cso *cso) -{ - if (ilo_dev_gen(dev) >= ILO_GEN(7)) { - ilo_gpe_init_gs_cso_gen7(dev, gs, cso); - } - else { - ilo_gpe_init_gs_cso_gen6(dev, gs, cso); - } -} - -void -ilo_gpe_init_fs_cso_gen6(const struct ilo_dev_info *dev, - const struct ilo_shader_state *fs, - struct ilo_shader_cso *cso); + struct ilo_shader_cso *cso); void -ilo_gpe_init_fs_cso_gen7(const struct ilo_dev_info *dev, - const struct ilo_shader_state *fs, - struct ilo_shader_cso *cso); - -static inline void ilo_gpe_init_fs_cso(const struct ilo_dev_info *dev, const struct ilo_shader_state *fs, - struct ilo_shader_cso *cso) -{ - if (ilo_dev_gen(dev) >= ILO_GEN(7)) { - ilo_gpe_init_fs_cso_gen7(dev, fs, cso); - } - else { - ilo_gpe_init_fs_cso_gen6(dev, fs, cso); - } -} + struct ilo_shader_cso *cso); void ilo_gpe_set_fb(const struct ilo_dev_info *dev, diff --git a/src/gallium/drivers/ilo/ilo_state_3d_bottom.c b/src/gallium/drivers/ilo/ilo_state_3d_bottom.c index d4b6643f9a8..a390124c2e9 100644 --- a/src/gallium/drivers/ilo/ilo_state_3d_bottom.c +++ b/src/gallium/drivers/ilo/ilo_state_3d_bottom.c @@ -37,10 +37,10 @@ #include "ilo_state.h" #include "ilo_state_3d.h" -void -ilo_gpe_init_rasterizer_clip(const struct ilo_dev_info *dev, - const struct pipe_rasterizer_state *state, - struct ilo_rasterizer_clip *clip) +static void +rasterizer_init_clip(const struct ilo_dev_info *dev, + const struct pipe_rasterizer_state *state, + struct ilo_rasterizer_clip *clip) { uint32_t dw1, dw2, dw3; @@ -125,10 +125,10 @@ ilo_gpe_init_rasterizer_clip(const struct ilo_dev_info *dev, clip->can_enable_guardband = false; } -void -ilo_gpe_init_rasterizer_sf(const struct ilo_dev_info *dev, - const struct pipe_rasterizer_state *state, - struct ilo_rasterizer_sf *sf) +static void +rasterizer_init_sf(const struct ilo_dev_info *dev, + const struct pipe_rasterizer_state *state, + struct ilo_rasterizer_sf *sf) { float offset_const, offset_scale, offset_clamp; int line_width, point_width; @@ -332,10 +332,10 @@ ilo_gpe_init_rasterizer_sf(const struct ilo_dev_info *dev, } } -void -ilo_gpe_init_rasterizer_wm_gen6(const struct ilo_dev_info *dev, - const struct pipe_rasterizer_state *state, - struct ilo_rasterizer_wm *wm) +static void +rasterizer_init_wm_gen6(const struct ilo_dev_info *dev, + const struct pipe_rasterizer_state *state, + struct ilo_rasterizer_wm *wm) { uint32_t dw5, dw6; @@ -380,10 +380,10 @@ ilo_gpe_init_rasterizer_wm_gen6(const struct ilo_dev_info *dev, wm->payload[1] = dw6; } -void -ilo_gpe_init_rasterizer_wm_gen7(const struct ilo_dev_info *dev, - const struct pipe_rasterizer_state *state, - struct ilo_rasterizer_wm *wm) +static void +rasterizer_init_wm_gen7(const struct ilo_dev_info *dev, + const struct pipe_rasterizer_state *state, + struct ilo_rasterizer_wm *wm) { uint32_t dw1, dw2; @@ -428,9 +428,23 @@ ilo_gpe_init_rasterizer_wm_gen7(const struct ilo_dev_info *dev, } void -ilo_gpe_init_fs_cso_gen6(const struct ilo_dev_info *dev, - const struct ilo_shader_state *fs, - struct ilo_shader_cso *cso) +ilo_gpe_init_rasterizer(const struct ilo_dev_info *dev, + const struct pipe_rasterizer_state *state, + struct ilo_rasterizer_state *rasterizer) +{ + rasterizer_init_clip(dev, state, &rasterizer->clip); + rasterizer_init_sf(dev, state, &rasterizer->sf); + + if (ilo_dev_gen(dev) >= ILO_GEN(7)) + rasterizer_init_wm_gen7(dev, state, &rasterizer->wm); + else + rasterizer_init_wm_gen6(dev, state, &rasterizer->wm); +} + +static void +fs_init_cso_gen6(const struct ilo_dev_info *dev, + const struct ilo_shader_state *fs, + struct ilo_shader_cso *cso) { int start_grf, input_count, sampler_count, interps, max_threads; uint32_t dw2, dw4, dw5, dw6; @@ -524,10 +538,10 @@ ilo_gpe_init_fs_cso_gen6(const struct ilo_dev_info *dev, cso->payload[3] = dw6; } -void -ilo_gpe_init_fs_cso_gen7(const struct ilo_dev_info *dev, - const struct ilo_shader_state *fs, - struct ilo_shader_cso *cso) +static void +fs_init_cso_gen7(const struct ilo_dev_info *dev, + const struct ilo_shader_state *fs, + struct ilo_shader_cso *cso) { int start_grf, sampler_count, max_threads; uint32_t dw2, dw4, dw5; @@ -632,6 +646,17 @@ ilo_gpe_init_fs_cso_gen7(const struct ilo_dev_info *dev, cso->payload[3] = wm_dw1; } +void +ilo_gpe_init_fs_cso(const struct ilo_dev_info *dev, + const struct ilo_shader_state *fs, + struct ilo_shader_cso *cso) +{ + if (ilo_dev_gen(dev) >= ILO_GEN(7)) + fs_init_cso_gen7(dev, fs, cso); + else + fs_init_cso_gen6(dev, fs, cso); +} + struct ilo_zs_surface_info { int surface_type; int format; diff --git a/src/gallium/drivers/ilo/ilo_state_3d_top.c b/src/gallium/drivers/ilo/ilo_state_3d_top.c index 3bd70bddbf8..c6190859b3d 100644 --- a/src/gallium/drivers/ilo/ilo_state_3d_top.c +++ b/src/gallium/drivers/ilo/ilo_state_3d_top.c @@ -250,10 +250,10 @@ ilo_gpe_init_vs_cso(const struct ilo_dev_info *dev, cso->payload[2] = dw5; } -void -ilo_gpe_init_gs_cso_gen6(const struct ilo_dev_info *dev, - const struct ilo_shader_state *gs, - struct ilo_shader_cso *cso) +static void +gs_init_cso_gen6(const struct ilo_dev_info *dev, + const struct ilo_shader_state *gs, + struct ilo_shader_cso *cso) { int start_grf, vue_read_len, max_threads; uint32_t dw2, dw4, dw5, dw6; @@ -352,10 +352,10 @@ ilo_gpe_init_gs_cso_gen6(const struct ilo_dev_info *dev, cso->payload[3] = dw6; } -void -ilo_gpe_init_gs_cso_gen7(const struct ilo_dev_info *dev, - const struct ilo_shader_state *gs, - struct ilo_shader_cso *cso) +static void +gs_init_cso_gen7(const struct ilo_dev_info *dev, + const struct ilo_shader_state *gs, + struct ilo_shader_cso *cso) { int start_grf, vue_read_len, sampler_count, max_threads; uint32_t dw2, dw4, dw5; @@ -400,10 +400,21 @@ ilo_gpe_init_gs_cso_gen7(const struct ilo_dev_info *dev, } void -ilo_gpe_init_view_surface_null_gen6(const struct ilo_dev_info *dev, - unsigned width, unsigned height, - unsigned depth, unsigned level, - struct ilo_view_surface *surf) +ilo_gpe_init_gs_cso(const struct ilo_dev_info *dev, + const struct ilo_shader_state *gs, + struct ilo_shader_cso *cso) +{ + if (ilo_dev_gen(dev) >= ILO_GEN(7)) + gs_init_cso_gen7(dev, gs, cso); + else + gs_init_cso_gen6(dev, gs, cso); +} + +static void +view_init_null_gen6(const struct ilo_dev_info *dev, + unsigned width, unsigned height, + unsigned depth, unsigned level, + struct ilo_view_surface *surf) { uint32_t *dw; @@ -455,14 +466,14 @@ ilo_gpe_init_view_surface_null_gen6(const struct ilo_dev_info *dev, surf->bo = NULL; } -void -ilo_gpe_init_view_surface_for_buffer_gen6(const struct ilo_dev_info *dev, - const struct ilo_buffer *buf, - unsigned offset, unsigned size, - unsigned struct_size, - enum pipe_format elem_format, - bool is_rt, bool render_cache_rw, - struct ilo_view_surface *surf) +static void +view_init_for_buffer_gen6(const struct ilo_dev_info *dev, + const struct ilo_buffer *buf, + unsigned offset, unsigned size, + unsigned struct_size, + enum pipe_format elem_format, + bool is_rt, bool render_cache_rw, + struct ilo_view_surface *surf) { const int elem_size = util_format_get_blocksize(elem_format); int width, height, depth, pitch; @@ -549,16 +560,16 @@ ilo_gpe_init_view_surface_for_buffer_gen6(const struct ilo_dev_info *dev, surf->bo = buf->bo; } -void -ilo_gpe_init_view_surface_for_texture_gen6(const struct ilo_dev_info *dev, - const struct ilo_texture *tex, - enum pipe_format format, - unsigned first_level, - unsigned num_levels, - unsigned first_layer, - unsigned num_layers, - bool is_rt, - struct ilo_view_surface *surf) +static void +view_init_for_texture_gen6(const struct ilo_dev_info *dev, + const struct ilo_texture *tex, + enum pipe_format format, + unsigned first_level, + unsigned num_levels, + unsigned first_layer, + unsigned num_layers, + bool is_rt, + struct ilo_view_surface *surf) { int surface_type, surface_format; int width, height, depth, pitch, lod; @@ -715,11 +726,11 @@ ilo_gpe_init_view_surface_for_texture_gen6(const struct ilo_dev_info *dev, surf->bo = tex->bo; } -void -ilo_gpe_init_view_surface_null_gen7(const struct ilo_dev_info *dev, - unsigned width, unsigned height, - unsigned depth, unsigned level, - struct ilo_view_surface *surf) +static void +view_init_null_gen7(const struct ilo_dev_info *dev, + unsigned width, unsigned height, + unsigned depth, unsigned level, + struct ilo_view_surface *surf) { uint32_t *dw; @@ -781,14 +792,14 @@ ilo_gpe_init_view_surface_null_gen7(const struct ilo_dev_info *dev, surf->bo = NULL; } -void -ilo_gpe_init_view_surface_for_buffer_gen7(const struct ilo_dev_info *dev, - const struct ilo_buffer *buf, - unsigned offset, unsigned size, - unsigned struct_size, - enum pipe_format elem_format, - bool is_rt, bool render_cache_rw, - struct ilo_view_surface *surf) +static void +view_init_for_buffer_gen7(const struct ilo_dev_info *dev, + const struct ilo_buffer *buf, + unsigned offset, unsigned size, + unsigned struct_size, + enum pipe_format elem_format, + bool is_rt, bool render_cache_rw, + struct ilo_view_surface *surf) { const bool typed = (elem_format != PIPE_FORMAT_NONE); const bool structured = (!typed && struct_size > 1); @@ -906,16 +917,16 @@ ilo_gpe_init_view_surface_for_buffer_gen7(const struct ilo_dev_info *dev, surf->bo = buf->bo; } -void -ilo_gpe_init_view_surface_for_texture_gen7(const struct ilo_dev_info *dev, - const struct ilo_texture *tex, - enum pipe_format format, - unsigned first_level, - unsigned num_levels, - unsigned first_layer, - unsigned num_layers, - bool is_rt, - struct ilo_view_surface *surf) +static void +view_init_for_texture_gen7(const struct ilo_dev_info *dev, + const struct ilo_texture *tex, + enum pipe_format format, + unsigned first_level, + unsigned num_levels, + unsigned first_layer, + unsigned num_layers, + bool is_rt, + struct ilo_view_surface *surf) { int surface_type, surface_format; int width, height, depth, pitch, lod; @@ -1119,6 +1130,61 @@ ilo_gpe_init_view_surface_for_texture_gen7(const struct ilo_dev_info *dev, surf->bo = tex->bo; } +void +ilo_gpe_init_view_surface_null(const struct ilo_dev_info *dev, + unsigned width, unsigned height, + unsigned depth, unsigned level, + struct ilo_view_surface *surf) +{ + if (ilo_dev_gen(dev) >= ILO_GEN(7)) { + view_init_null_gen7(dev, + width, height, depth, level, surf); + } else { + view_init_null_gen6(dev, + width, height, depth, level, surf); + } +} + +void +ilo_gpe_init_view_surface_for_buffer(const struct ilo_dev_info *dev, + const struct ilo_buffer *buf, + unsigned offset, unsigned size, + unsigned struct_size, + enum pipe_format elem_format, + bool is_rt, bool render_cache_rw, + struct ilo_view_surface *surf) +{ + if (ilo_dev_gen(dev) >= ILO_GEN(7)) { + view_init_for_buffer_gen7(dev, buf, offset, size, + struct_size, elem_format, is_rt, render_cache_rw, surf); + } else { + view_init_for_buffer_gen6(dev, buf, offset, size, + struct_size, elem_format, is_rt, render_cache_rw, surf); + } +} + +void +ilo_gpe_init_view_surface_for_texture(const struct ilo_dev_info *dev, + const struct ilo_texture *tex, + enum pipe_format format, + unsigned first_level, + unsigned num_levels, + unsigned first_layer, + unsigned num_layers, + bool is_rt, + struct ilo_view_surface *surf) +{ + if (ilo_dev_gen(dev) >= ILO_GEN(7)) { + view_init_for_texture_gen7(dev, tex, format, + first_level, num_levels, first_layer, num_layers, + is_rt, surf); + } else { + view_init_for_texture_gen6(dev, tex, format, + first_level, num_levels, first_layer, num_layers, + is_rt, surf); + } +} + static void sampler_init_border_color_gen6(const struct ilo_dev_info *dev, const union pipe_color_union *color, -- 2.30.2