diff options
-rw-r--r-- | src/gallium/drivers/ilo/Makefile.sources | 6 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/core/ilo_state_3d.h (renamed from src/gallium/drivers/ilo/ilo_state_3d.h) | 263 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c (renamed from src/gallium/drivers/ilo/ilo_state_3d_bottom.c) | 8 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/core/ilo_state_3d_top.c (renamed from src/gallium/drivers/ilo/ilo_state_3d_top.c) | 8 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_blitter_rectlist.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_builder_3d_top.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_shader.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_state.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_state.h | 257 |
9 files changed, 274 insertions, 276 deletions
diff --git a/src/gallium/drivers/ilo/Makefile.sources b/src/gallium/drivers/ilo/Makefile.sources index fbb33b4e10a..1743f7c7659 100644 --- a/src/gallium/drivers/ilo/Makefile.sources +++ b/src/gallium/drivers/ilo/Makefile.sources @@ -10,6 +10,9 @@ C_SOURCES := \ core/ilo_fence.h \ core/ilo_image.c \ core/ilo_image.h \ + core/ilo_state_3d.h \ + core/ilo_state_3d_bottom.c \ + core/ilo_state_3d_top.c \ core/intel_winsys.h \ ilo_blit.c \ ilo_blit.h \ @@ -57,9 +60,6 @@ C_SOURCES := \ ilo_shader.h \ ilo_state.c \ ilo_state.h \ - ilo_state_3d.h \ - ilo_state_3d_bottom.c \ - ilo_state_3d_top.c \ ilo_transfer.c \ ilo_transfer.h \ ilo_video.c \ diff --git a/src/gallium/drivers/ilo/ilo_state_3d.h b/src/gallium/drivers/ilo/core/ilo_state_3d.h index b504390d04b..e772f21605c 100644 --- a/src/gallium/drivers/ilo/ilo_state_3d.h +++ b/src/gallium/drivers/ilo/core/ilo_state_3d.h @@ -29,10 +29,267 @@ #define ILO_STATE_3D_H #include "genhw/genhw.h" -#include "core/intel_winsys.h" +#include "pipe/p_state.h" -#include "ilo_common.h" -#include "ilo_state.h" +#include "ilo_core.h" +#include "ilo_dev.h" + +/** + * \see brw_context.h + */ +#define ILO_MAX_DRAW_BUFFERS 8 +#define ILO_MAX_CONST_BUFFERS (1 + 12) +#define ILO_MAX_SAMPLER_VIEWS 16 +#define ILO_MAX_SAMPLERS 16 +#define ILO_MAX_SO_BINDINGS 64 +#define ILO_MAX_SO_BUFFERS 4 +#define ILO_MAX_VIEWPORTS 1 + +#define ILO_MAX_SURFACES 256 + +struct intel_bo; +struct ilo_buffer; +struct ilo_shader_state; +struct ilo_texture; + +struct ilo_vb_state { + struct pipe_vertex_buffer states[PIPE_MAX_ATTRIBS]; + uint32_t enabled_mask; +}; + +struct ilo_ib_state { + struct pipe_resource *buffer; + const void *user_buffer; + unsigned offset; + unsigned index_size; + + /* these are not valid until the state is finalized */ + struct pipe_resource *hw_resource; + unsigned hw_index_size; + /* an offset to be added to pipe_draw_info::start */ + int64_t draw_start_offset; +}; + +struct ilo_ve_cso { + /* VERTEX_ELEMENT_STATE */ + uint32_t payload[2]; +}; + +struct ilo_ve_state { + struct ilo_ve_cso cso[PIPE_MAX_ATTRIBS]; + unsigned count; + + unsigned instance_divisors[PIPE_MAX_ATTRIBS]; + unsigned vb_mapping[PIPE_MAX_ATTRIBS]; + unsigned vb_count; + + /* these are not valid until the state is finalized */ + struct ilo_ve_cso edgeflag_cso; + bool last_cso_edgeflag; + + struct ilo_ve_cso nosrc_cso; + bool prepend_nosrc_cso; +}; + +struct ilo_so_state { + struct pipe_stream_output_target *states[ILO_MAX_SO_BUFFERS]; + unsigned count; + unsigned append_bitmask; + + bool enabled; +}; + +struct ilo_viewport_cso { + /* matrix form */ + float m00, m11, m22, m30, m31, m32; + + /* guardband in NDC space */ + float min_gbx, min_gby, max_gbx, max_gby; + + /* viewport in screen space */ + float min_x, min_y, min_z; + float max_x, max_y, max_z; +}; + +struct ilo_viewport_state { + struct ilo_viewport_cso cso[ILO_MAX_VIEWPORTS]; + unsigned count; + + struct pipe_viewport_state viewport0; +}; + +struct ilo_scissor_state { + /* SCISSOR_RECT */ + uint32_t payload[ILO_MAX_VIEWPORTS * 2]; + + struct pipe_scissor_state scissor0; +}; + +struct ilo_rasterizer_clip { + /* 3DSTATE_CLIP */ + uint32_t payload[3]; + + uint32_t can_enable_guardband; +}; + +struct ilo_rasterizer_sf { + /* 3DSTATE_SF */ + uint32_t payload[3]; + uint32_t dw_msaa; + + /* Global Depth Offset Constant/Scale/Clamp */ + uint32_t dw_depth_offset_const; + uint32_t dw_depth_offset_scale; + uint32_t dw_depth_offset_clamp; + + /* Gen8+ 3DSTATE_RASTER */ + uint32_t dw_raster; +}; + +struct ilo_rasterizer_wm { + /* 3DSTATE_WM */ + uint32_t payload[2]; + uint32_t dw_msaa_rast; + uint32_t dw_msaa_disp; +}; + +struct ilo_rasterizer_state { + struct pipe_rasterizer_state state; + + struct ilo_rasterizer_clip clip; + struct ilo_rasterizer_sf sf; + struct ilo_rasterizer_wm wm; +}; + +struct ilo_dsa_state { + /* DEPTH_STENCIL_STATE or Gen8+ 3DSTATE_WM_DEPTH_STENCIL */ + uint32_t payload[3]; + + uint32_t dw_blend_alpha; + uint32_t dw_ps_blend_alpha; + ubyte alpha_ref; +}; + +struct ilo_blend_cso { + /* BLEND_STATE */ + uint32_t payload[2]; + + uint32_t dw_blend; + uint32_t dw_blend_dst_alpha_forced_one; +}; + +struct ilo_blend_state { + struct ilo_blend_cso cso[ILO_MAX_DRAW_BUFFERS]; + + bool dual_blend; + bool alpha_to_coverage; + + uint32_t dw_shared; + uint32_t dw_alpha_mod; + uint32_t dw_logicop; + + /* a part of 3DSTATE_PS_BLEND */ + uint32_t dw_ps_blend; + uint32_t dw_ps_blend_dst_alpha_forced_one; +}; + +struct ilo_sampler_cso { + /* SAMPLER_STATE and SAMPLER_BORDER_COLOR_STATE */ + uint32_t payload[15]; + + uint32_t dw_filter; + uint32_t dw_filter_aniso; + uint32_t dw_wrap; + uint32_t dw_wrap_1d; + uint32_t dw_wrap_cube; + + bool anisotropic; + bool saturate_r; + bool saturate_s; + bool saturate_t; +}; + +struct ilo_sampler_state { + const struct ilo_sampler_cso *cso[ILO_MAX_SAMPLERS]; +}; + +struct ilo_view_surface { + /* SURFACE_STATE */ + uint32_t payload[13]; + struct intel_bo *bo; + + uint32_t scanout; +}; + +struct ilo_view_cso { + struct pipe_sampler_view base; + + struct ilo_view_surface surface; +}; + +struct ilo_view_state { + struct pipe_sampler_view *states[ILO_MAX_SAMPLER_VIEWS]; + unsigned count; +}; + +struct ilo_cbuf_cso { + struct pipe_resource *resource; + struct ilo_view_surface surface; + + /* + * this CSO is not so constant because user buffer needs to be uploaded in + * finalize_constant_buffers() + */ + const void *user_buffer; + unsigned user_buffer_size; +}; + +struct ilo_cbuf_state { + struct ilo_cbuf_cso cso[ILO_MAX_CONST_BUFFERS]; + uint32_t enabled_mask; +}; + +struct ilo_resource_state { + struct pipe_surface *states[PIPE_MAX_SHADER_RESOURCES]; + unsigned count; +}; + +struct ilo_surface_cso { + struct pipe_surface base; + + bool is_rt; + union { + struct ilo_view_surface rt; + struct ilo_zs_surface { + uint32_t payload[12]; + uint32_t dw_aligned_8x4; + + struct intel_bo *bo; + struct intel_bo *hiz_bo; + struct intel_bo *separate_s8_bo; + } zs; + } u; +}; + +struct ilo_fb_state { + struct pipe_framebuffer_state state; + + struct ilo_view_surface null_rt; + struct ilo_zs_surface null_zs; + + struct ilo_fb_blend_caps { + bool can_logicop; + bool can_blend; + bool can_alpha_test; + bool dst_alpha_forced_one; + } blend_caps[PIPE_MAX_COLOR_BUFS]; + + unsigned num_samples; +}; + +struct ilo_shader_cso { + uint32_t payload[5]; +}; /** * Translate a pipe texture target to the matching hardware surface type. diff --git a/src/gallium/drivers/ilo/ilo_state_3d_bottom.c b/src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c index 13c1a7feead..291c86b3406 100644 --- a/src/gallium/drivers/ilo/ilo_state_3d_bottom.c +++ b/src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c @@ -26,16 +26,14 @@ */ #include "genhw/genhw.h" -#include "core/ilo_format.h" #include "util/u_dual_blend.h" #include "util/u_framebuffer.h" #include "util/u_half.h" -#include "ilo_context.h" -#include "ilo_resource.h" -#include "ilo_shader.h" -#include "ilo_state.h" +#include "ilo_format.h" #include "ilo_state_3d.h" +#include "../ilo_resource.h" +#include "../ilo_shader.h" static void rasterizer_init_clip(const struct ilo_dev *dev, diff --git a/src/gallium/drivers/ilo/ilo_state_3d_top.c b/src/gallium/drivers/ilo/core/ilo_state_3d_top.c index f022972414e..004656f8461 100644 --- a/src/gallium/drivers/ilo/ilo_state_3d_top.c +++ b/src/gallium/drivers/ilo/core/ilo_state_3d_top.c @@ -26,17 +26,15 @@ */ #include "genhw/genhw.h" -#include "core/ilo_format.h" #include "util/u_dual_blend.h" #include "util/u_framebuffer.h" #include "util/u_half.h" #include "util/u_resource.h" -#include "ilo_context.h" -#include "ilo_resource.h" -#include "ilo_shader.h" -#include "ilo_state.h" +#include "ilo_format.h" #include "ilo_state_3d.h" +#include "../ilo_resource.h" +#include "../ilo_shader.h" static void ve_init_cso(const struct ilo_dev *dev, diff --git a/src/gallium/drivers/ilo/ilo_blitter_rectlist.c b/src/gallium/drivers/ilo/ilo_blitter_rectlist.c index 3383eaf247a..02051299675 100644 --- a/src/gallium/drivers/ilo/ilo_blitter_rectlist.c +++ b/src/gallium/drivers/ilo/ilo_blitter_rectlist.c @@ -25,12 +25,12 @@ * Chia-I Wu <[email protected]> */ +#include "core/ilo_state_3d.h" #include "util/u_draw.h" #include "util/u_pack_color.h" #include "ilo_draw.h" #include "ilo_state.h" -#include "ilo_state_3d.h" #include "ilo_blit.h" #include "ilo_blitter.h" diff --git a/src/gallium/drivers/ilo/ilo_builder_3d_top.h b/src/gallium/drivers/ilo/ilo_builder_3d_top.h index 9fa53050dff..bc6925db217 100644 --- a/src/gallium/drivers/ilo/ilo_builder_3d_top.h +++ b/src/gallium/drivers/ilo/ilo_builder_3d_top.h @@ -29,13 +29,13 @@ #define ILO_BUILDER_3D_TOP_H #include "genhw/genhw.h" +#include "core/ilo_state_3d.h" #include "core/intel_winsys.h" #include "ilo_common.h" #include "ilo_resource.h" #include "ilo_shader.h" #include "ilo_state.h" -#include "ilo_state_3d.h" #include "ilo_builder.h" static inline void diff --git a/src/gallium/drivers/ilo/ilo_shader.c b/src/gallium/drivers/ilo/ilo_shader.c index 788a85887dd..8a2926c1945 100644 --- a/src/gallium/drivers/ilo/ilo_shader.c +++ b/src/gallium/drivers/ilo/ilo_shader.c @@ -27,12 +27,12 @@ #include "genhw/genhw.h" /* for SBE setup */ #include "tgsi/tgsi_parse.h" +#include "core/ilo_state_3d.h" #include "core/intel_winsys.h" #include "shader/ilo_shader_internal.h" #include "ilo_builder.h" #include "ilo_state.h" -#include "ilo_state_3d.h" #include "ilo_shader.h" struct ilo_shader_cache { diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c index 175e7c659d4..45f85e79f4b 100644 --- a/src/gallium/drivers/ilo/ilo_state.c +++ b/src/gallium/drivers/ilo/ilo_state.c @@ -25,6 +25,7 @@ * Chia-I Wu <[email protected]> */ +#include "core/ilo_state_3d.h" #include "util/u_dynarray.h" #include "util/u_helpers.h" #include "util/u_upload_mgr.h" @@ -33,7 +34,6 @@ #include "ilo_resource.h" #include "ilo_shader.h" #include "ilo_state.h" -#include "ilo_state_3d.h" static void finalize_shader_states(struct ilo_state_vector *vec) diff --git a/src/gallium/drivers/ilo/ilo_state.h b/src/gallium/drivers/ilo/ilo_state.h index 78f2053b07c..fd0a3156ebc 100644 --- a/src/gallium/drivers/ilo/ilo_state.h +++ b/src/gallium/drivers/ilo/ilo_state.h @@ -28,25 +28,13 @@ #ifndef ILO_STATE_H #define ILO_STATE_H +#include "core/ilo_state_3d.h" #include "pipe/p_state.h" #include "util/u_dynarray.h" #include "ilo_common.h" /** - * \see brw_context.h - */ -#define ILO_MAX_DRAW_BUFFERS 8 -#define ILO_MAX_CONST_BUFFERS (1 + 12) -#define ILO_MAX_SAMPLER_VIEWS 16 -#define ILO_MAX_SAMPLERS 16 -#define ILO_MAX_SO_BINDINGS 64 -#define ILO_MAX_SO_BUFFERS 4 -#define ILO_MAX_VIEWPORTS 1 - -#define ILO_MAX_SURFACES 256 - -/** * States that we track. * * XXX Do we want to count each sampler or vertex buffer as a state? If that @@ -131,246 +119,7 @@ enum ilo_dirty_flags { ILO_DIRTY_ALL = 0xffffffff, }; -struct intel_bo; -struct ilo_buffer; struct ilo_context; -struct ilo_shader_state; -struct ilo_texture; - -struct ilo_vb_state { - struct pipe_vertex_buffer states[PIPE_MAX_ATTRIBS]; - uint32_t enabled_mask; -}; - -struct ilo_ib_state { - struct pipe_resource *buffer; - const void *user_buffer; - unsigned offset; - unsigned index_size; - - /* these are not valid until the state is finalized */ - struct pipe_resource *hw_resource; - unsigned hw_index_size; - /* an offset to be added to pipe_draw_info::start */ - int64_t draw_start_offset; -}; - -struct ilo_ve_cso { - /* VERTEX_ELEMENT_STATE */ - uint32_t payload[2]; -}; - -struct ilo_ve_state { - struct ilo_ve_cso cso[PIPE_MAX_ATTRIBS]; - unsigned count; - - unsigned instance_divisors[PIPE_MAX_ATTRIBS]; - unsigned vb_mapping[PIPE_MAX_ATTRIBS]; - unsigned vb_count; - - /* these are not valid until the state is finalized */ - struct ilo_ve_cso edgeflag_cso; - bool last_cso_edgeflag; - - struct ilo_ve_cso nosrc_cso; - bool prepend_nosrc_cso; -}; - -struct ilo_so_state { - struct pipe_stream_output_target *states[ILO_MAX_SO_BUFFERS]; - unsigned count; - unsigned append_bitmask; - - bool enabled; -}; - -struct ilo_viewport_cso { - /* matrix form */ - float m00, m11, m22, m30, m31, m32; - - /* guardband in NDC space */ - float min_gbx, min_gby, max_gbx, max_gby; - - /* viewport in screen space */ - float min_x, min_y, min_z; - float max_x, max_y, max_z; -}; - -struct ilo_viewport_state { - struct ilo_viewport_cso cso[ILO_MAX_VIEWPORTS]; - unsigned count; - - struct pipe_viewport_state viewport0; -}; - -struct ilo_scissor_state { - /* SCISSOR_RECT */ - uint32_t payload[ILO_MAX_VIEWPORTS * 2]; - - struct pipe_scissor_state scissor0; -}; - -struct ilo_rasterizer_clip { - /* 3DSTATE_CLIP */ - uint32_t payload[3]; - - uint32_t can_enable_guardband; -}; - -struct ilo_rasterizer_sf { - /* 3DSTATE_SF */ - uint32_t payload[3]; - uint32_t dw_msaa; - - /* Global Depth Offset Constant/Scale/Clamp */ - uint32_t dw_depth_offset_const; - uint32_t dw_depth_offset_scale; - uint32_t dw_depth_offset_clamp; - - /* Gen8+ 3DSTATE_RASTER */ - uint32_t dw_raster; -}; - -struct ilo_rasterizer_wm { - /* 3DSTATE_WM */ - uint32_t payload[2]; - uint32_t dw_msaa_rast; - uint32_t dw_msaa_disp; -}; - -struct ilo_rasterizer_state { - struct pipe_rasterizer_state state; - - struct ilo_rasterizer_clip clip; - struct ilo_rasterizer_sf sf; - struct ilo_rasterizer_wm wm; -}; - -struct ilo_dsa_state { - /* DEPTH_STENCIL_STATE or Gen8+ 3DSTATE_WM_DEPTH_STENCIL */ - uint32_t payload[3]; - - uint32_t dw_blend_alpha; - uint32_t dw_ps_blend_alpha; - ubyte alpha_ref; -}; - -struct ilo_blend_cso { - /* BLEND_STATE */ - uint32_t payload[2]; - - uint32_t dw_blend; - uint32_t dw_blend_dst_alpha_forced_one; -}; - -struct ilo_blend_state { - struct ilo_blend_cso cso[ILO_MAX_DRAW_BUFFERS]; - - bool dual_blend; - bool alpha_to_coverage; - - uint32_t dw_shared; - uint32_t dw_alpha_mod; - uint32_t dw_logicop; - - /* a part of 3DSTATE_PS_BLEND */ - uint32_t dw_ps_blend; - uint32_t dw_ps_blend_dst_alpha_forced_one; -}; - -struct ilo_sampler_cso { - /* SAMPLER_STATE and SAMPLER_BORDER_COLOR_STATE */ - uint32_t payload[15]; - - uint32_t dw_filter; - uint32_t dw_filter_aniso; - uint32_t dw_wrap; - uint32_t dw_wrap_1d; - uint32_t dw_wrap_cube; - - bool anisotropic; - bool saturate_r; - bool saturate_s; - bool saturate_t; -}; - -struct ilo_sampler_state { - const struct ilo_sampler_cso *cso[ILO_MAX_SAMPLERS]; -}; - -struct ilo_view_surface { - /* SURFACE_STATE */ - uint32_t payload[13]; - struct intel_bo *bo; - - uint32_t scanout; -}; - -struct ilo_view_cso { - struct pipe_sampler_view base; - - struct ilo_view_surface surface; -}; - -struct ilo_view_state { - struct pipe_sampler_view *states[ILO_MAX_SAMPLER_VIEWS]; - unsigned count; -}; - -struct ilo_cbuf_cso { - struct pipe_resource *resource; - struct ilo_view_surface surface; - - /* - * this CSO is not so constant because user buffer needs to be uploaded in - * finalize_constant_buffers() - */ - const void *user_buffer; - unsigned user_buffer_size; -}; - -struct ilo_cbuf_state { - struct ilo_cbuf_cso cso[ILO_MAX_CONST_BUFFERS]; - uint32_t enabled_mask; -}; - -struct ilo_resource_state { - struct pipe_surface *states[PIPE_MAX_SHADER_RESOURCES]; - unsigned count; -}; - -struct ilo_surface_cso { - struct pipe_surface base; - - bool is_rt; - union { - struct ilo_view_surface rt; - struct ilo_zs_surface { - uint32_t payload[12]; - uint32_t dw_aligned_8x4; - - struct intel_bo *bo; - struct intel_bo *hiz_bo; - struct intel_bo *separate_s8_bo; - } zs; - } u; -}; - -struct ilo_fb_state { - struct pipe_framebuffer_state state; - - struct ilo_view_surface null_rt; - struct ilo_zs_surface null_zs; - - struct ilo_fb_blend_caps { - bool can_logicop; - bool can_blend; - bool can_alpha_test; - bool dst_alpha_forced_one; - } blend_caps[PIPE_MAX_COLOR_BUFS]; - - unsigned num_samples; -}; struct ilo_global_binding_cso { struct pipe_resource *resource; @@ -396,10 +145,6 @@ struct ilo_global_binding { unsigned count; }; -struct ilo_shader_cso { - uint32_t payload[5]; -}; - struct ilo_state_vector { const struct pipe_draw_info *draw; |