From dcb5bad3a3a8ff116c32ecb01827ea8461fa2baa Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 18 Jun 2015 22:47:20 +0800 Subject: [PATCH] ilo: move gen6_so_SURFACE_STATE() out of core It does not belong to core. --- .../drivers/ilo/core/ilo_builder_3d_top.h | 52 ------------------ src/gallium/drivers/ilo/ilo_render_surface.c | 53 +++++++++++++++++++ 2 files changed, 53 insertions(+), 52 deletions(-) diff --git a/src/gallium/drivers/ilo/core/ilo_builder_3d_top.h b/src/gallium/drivers/ilo/core/ilo_builder_3d_top.h index 398586bbad8..a8873ed5e2f 100644 --- a/src/gallium/drivers/ilo/core/ilo_builder_3d_top.h +++ b/src/gallium/drivers/ilo/core/ilo_builder_3d_top.h @@ -1316,58 +1316,6 @@ gen6_SURFACE_STATE(struct ilo_builder *builder, return state_offset; } -static inline uint32_t -gen6_so_SURFACE_STATE(struct ilo_builder *builder, - const struct pipe_stream_output_target *so, - const struct pipe_stream_output_info *so_info, - int so_index) -{ - struct ilo_buffer *buf = ilo_buffer(so->buffer); - struct ilo_state_surface_buffer_info info; - struct ilo_state_surface surf; - - ILO_DEV_ASSERT(builder->dev, 6, 6); - - memset(&info, 0, sizeof(info)); - info.buf = buf; - info.access = ILO_STATE_SURFACE_ACCESS_DP_SVB; - - switch (so_info->output[so_index].num_components) { - case 1: - info.format = GEN6_FORMAT_R32_FLOAT; - info.format_size = 4; - break; - case 2: - info.format = GEN6_FORMAT_R32G32_FLOAT; - info.format_size = 8; - break; - case 3: - info.format = GEN6_FORMAT_R32G32B32_FLOAT; - info.format_size = 12; - break; - case 4: - info.format = GEN6_FORMAT_R32G32B32A32_FLOAT; - info.format_size = 16; - break; - default: - assert(!"unexpected SO components length"); - info.format = GEN6_FORMAT_R32_FLOAT; - info.format_size = 4; - break; - } - - info.struct_size = - so_info->stride[so_info->output[so_index].output_buffer] * 4; - info.offset = so->buffer_offset + so_info->output[so_index].dst_offset * 4; - info.size = so->buffer_size - so_info->output[so_index].dst_offset * 4; - - memset(&surf, 0, sizeof(surf)); - ilo_state_surface_init_for_buffer(&surf, builder->dev, &info); - surf.bo = info.buf->bo; - - return gen6_SURFACE_STATE(builder, &surf); -} - static inline uint32_t gen6_SAMPLER_STATE(struct ilo_builder *builder, const struct ilo_state_sampler *samplers, diff --git a/src/gallium/drivers/ilo/ilo_render_surface.c b/src/gallium/drivers/ilo/ilo_render_surface.c index bbdd5fe7a0a..ad053564294 100644 --- a/src/gallium/drivers/ilo/ilo_render_surface.c +++ b/src/gallium/drivers/ilo/ilo_render_surface.c @@ -29,12 +29,65 @@ #include "ilo_common.h" #include "ilo_blitter.h" +#include "ilo_resource.h" #include "ilo_shader.h" #include "ilo_state.h" #include "ilo_render_gen.h" #define DIRTY(state) (session->pipe_dirty & ILO_DIRTY_ ## state) +static inline uint32_t +gen6_so_SURFACE_STATE(struct ilo_builder *builder, + const struct pipe_stream_output_target *so, + const struct pipe_stream_output_info *so_info, + int so_index) +{ + struct ilo_buffer *buf = ilo_buffer(so->buffer); + struct ilo_state_surface_buffer_info info; + struct ilo_state_surface surf; + + ILO_DEV_ASSERT(builder->dev, 6, 6); + + memset(&info, 0, sizeof(info)); + info.buf = buf; + info.access = ILO_STATE_SURFACE_ACCESS_DP_SVB; + + switch (so_info->output[so_index].num_components) { + case 1: + info.format = GEN6_FORMAT_R32_FLOAT; + info.format_size = 4; + break; + case 2: + info.format = GEN6_FORMAT_R32G32_FLOAT; + info.format_size = 8; + break; + case 3: + info.format = GEN6_FORMAT_R32G32B32_FLOAT; + info.format_size = 12; + break; + case 4: + info.format = GEN6_FORMAT_R32G32B32A32_FLOAT; + info.format_size = 16; + break; + default: + assert(!"unexpected SO components length"); + info.format = GEN6_FORMAT_R32_FLOAT; + info.format_size = 4; + break; + } + + info.struct_size = + so_info->stride[so_info->output[so_index].output_buffer] * 4; + info.offset = so->buffer_offset + so_info->output[so_index].dst_offset * 4; + info.size = so->buffer_size - so_info->output[so_index].dst_offset * 4; + + memset(&surf, 0, sizeof(surf)); + ilo_state_surface_init_for_buffer(&surf, builder->dev, &info); + surf.bo = info.buf->bo; + + return gen6_SURFACE_STATE(builder, &surf); +} + static void gen6_emit_draw_surface_rt(struct ilo_render *r, const struct ilo_state_vector *vec, -- 2.30.2