ilo: merge ilo_gpe.h to ilo_state*.h
authorChia-I Wu <olvaffe@gmail.com>
Fri, 19 Sep 2014 16:34:47 +0000 (00:34 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Sat, 20 Sep 2014 02:13:53 +0000 (10:13 +0800)
Move the #define's and struct's to ilo_state.h.  Move the inline functions and
function declarations to ilo_state_gen.h.

13 files changed:
src/gallium/drivers/ilo/Makefile.sources
src/gallium/drivers/ilo/ilo_3d_pipeline.h
src/gallium/drivers/ilo/ilo_blit.h
src/gallium/drivers/ilo/ilo_blitter.h
src/gallium/drivers/ilo/ilo_blitter_rectlist.c
src/gallium/drivers/ilo/ilo_builder_3d_top.h
src/gallium/drivers/ilo/ilo_context.h
src/gallium/drivers/ilo/ilo_gpe.h [deleted file]
src/gallium/drivers/ilo/ilo_shader.c
src/gallium/drivers/ilo/ilo_state.c
src/gallium/drivers/ilo/ilo_state.h
src/gallium/drivers/ilo/ilo_state_gen.h
src/gallium/drivers/ilo/ilo_state_gen7.c

index de3bb67cd72d70db9e70144c82a429e123e27ea9..f88e0d56d599e33826b96a43228b4a5faa313a21 100644 (file)
@@ -31,7 +31,6 @@ C_SOURCES := \
        ilo_cp.h \
        ilo_format.c \
        ilo_format.h \
-       ilo_gpe.h \
        ilo_gpgpu.c \
        ilo_gpgpu.h \
        ilo_layout.c \
index d5771c49641583219afc02b8e2e35c5a99ba7e08..5c41b0bb32bcc11f2804294dcf38dda26e45cc55 100644 (file)
@@ -29,7 +29,7 @@
 #define ILO_3D_PIPELINE_H
 
 #include "ilo_common.h"
-#include "ilo_gpe.h"
+#include "ilo_state.h"
 
 struct intel_bo;
 struct ilo_blitter;
index 1e954083983f79eea47457ccceeb9cdfa9d29106..fe228f879b9518a6ae1f357f783bdb6aba1711d8 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "ilo_common.h"
 #include "ilo_context.h"
-#include "ilo_gpe.h"
+#include "ilo_state.h"
 #include "ilo_resource.h"
 
 struct ilo_context;
index c2c86c04e90b2c542e11e6cec98c43c13e91a940..9ace52d3071016cf5335688b6f1b52b3bf150b69 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "ilo_common.h"
 #include "ilo_context.h"
-#include "ilo_gpe.h"
+#include "ilo_state.h"
 
 enum ilo_blitter_uses {
    ILO_BLITTER_USE_DSA           = 1 << 0,
index a243507e8441c7ae80282de02ba5dd9dfb098206..ced28518ebdc57a1475d896525afbfaa47c26819 100644 (file)
@@ -31,9 +31,9 @@
 #include "ilo_3d.h"
 #include "ilo_3d_pipeline.h"
 #include "ilo_builder_3d_top.h" /* for ve_init_cso_with_components() */
+#include "ilo_state.h"
 #include "ilo_state_gen.h" /* for zs_align_surface() */
 #include "ilo_blit.h"
-#include "ilo_gpe.h"
 #include "ilo_blitter.h"
 
 /**
index 8bce317bc3302ffa8a895c227834608b76639031..4b08b829141eb4d5929513cb500ef1440684fea2 100644 (file)
 #include "intel_winsys.h"
 
 #include "ilo_common.h"
-#include "ilo_gpe.h"
 #include "ilo_resource.h"
 #include "ilo_shader.h"
+#include "ilo_state.h"
+#include "ilo_state_gen.h"
 #include "ilo_builder.h"
 
 static inline void
index d3c74a4db1bd8f0674730b267a0fe64a10810e00..d9607a51052f1cbe1fd1e1ca8672abdcbd05a15f 100644 (file)
@@ -31,8 +31,8 @@
 #include "pipe/p_context.h"
 #include "util/u_slab.h"
 
-#include "ilo_gpe.h"
 #include "ilo_common.h"
+#include "ilo_state.h"
 
 struct pipe_draw_info;
 struct u_upload_mgr;
diff --git a/src/gallium/drivers/ilo/ilo_gpe.h b/src/gallium/drivers/ilo/ilo_gpe.h
deleted file mode 100644 (file)
index f3d1bb5..0000000
+++ /dev/null
@@ -1,535 +0,0 @@
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 2013 LunarG, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- *    Chia-I Wu <olv@lunarg.com>
- */
-
-#ifndef ILO_GPE_H
-#define ILO_GPE_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_VS_SURFACES        (ILO_MAX_CONST_BUFFERS + ILO_MAX_SAMPLER_VIEWS)
-#define ILO_VS_CONST_SURFACE(i)    (i)
-#define ILO_VS_TEXTURE_SURFACE(i)  (ILO_MAX_CONST_BUFFERS  + i)
-
-#define ILO_MAX_GS_SURFACES        (ILO_MAX_SO_BINDINGS)
-#define ILO_GS_SO_SURFACE(i)       (i)
-
-#define ILO_MAX_WM_SURFACES        (ILO_MAX_DRAW_BUFFERS + ILO_MAX_CONST_BUFFERS + ILO_MAX_SAMPLER_VIEWS)
-#define ILO_WM_DRAW_SURFACE(i)     (i)
-#define ILO_WM_CONST_SURFACE(i)    (ILO_MAX_DRAW_BUFFERS + i)
-#define ILO_WM_TEXTURE_SURFACE(i)  (ILO_MAX_DRAW_BUFFERS + ILO_MAX_CONST_BUFFERS  + i)
-
-struct ilo_buffer;
-struct ilo_texture;
-struct ilo_shader_state;
-
-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;
-};
-
-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[6];
-   uint32_t dw_msaa;
-};
-
-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 */
-   uint32_t payload[3];
-
-   uint32_t dw_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;
-
-   uint32_t dw_logicop;
-   uint32_t dw_alpha_mod;
-};
-
-struct ilo_blend_state {
-   struct ilo_blend_cso cso[ILO_MAX_DRAW_BUFFERS];
-
-   bool independent_blend_enable;
-   bool dual_blend;
-   bool alpha_to_coverage;
-};
-
-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];
-   unsigned count;
-};
-
-struct ilo_view_surface {
-   /* SURFACE_STATE */
-   uint32_t payload[8];
-   struct intel_bo *bo;
-};
-
-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[10];
-         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;
-
-   unsigned num_samples;
-};
-
-struct ilo_global_binding {
-   /*
-    * XXX These should not be treated as real resources (and there could be
-    * thousands of them).  They should be treated as regions in GLOBAL
-    * resource, which is the only real resource.
-    *
-    * That is, a resource here should instead be
-    *
-    *   struct ilo_global_region {
-    *     struct pipe_resource base;
-    *     int offset;
-    *     int size;
-    *   };
-    *
-    * and it describes the region [offset, offset + size) in GLOBAL
-    * resource.
-    */
-   struct pipe_resource *resources[PIPE_MAX_SHADER_RESOURCES];
-   uint32_t *handles[PIPE_MAX_SHADER_RESOURCES];
-   unsigned count;
-};
-
-struct ilo_shader_cso {
-   uint32_t payload[5];
-};
-
-void
-ilo_gpe_init_ve(const struct ilo_dev_info *dev,
-                unsigned num_states,
-                const struct pipe_vertex_element *states,
-                struct ilo_ve_state *ve);
-
-void
-ilo_gpe_set_viewport_cso(const struct ilo_dev_info *dev,
-                         const struct pipe_viewport_state *state,
-                         struct ilo_viewport_cso *vp);
-
-void
-ilo_gpe_set_scissor(const struct ilo_dev_info *dev,
-                    unsigned start_slot,
-                    unsigned num_states,
-                    const struct pipe_scissor_state *states,
-                    struct ilo_scissor_state *scissor);
-
-void
-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);
-}
-
-void
-ilo_gpe_init_dsa(const struct ilo_dev_info *dev,
-                 const struct pipe_depth_stencil_alpha_state *state,
-                 struct ilo_dsa_state *dsa);
-
-void
-ilo_gpe_init_blend(const struct ilo_dev_info *dev,
-                   const struct pipe_blend_state *state,
-                   struct ilo_blend_state *blend);
-
-void
-ilo_gpe_init_sampler_cso(const struct ilo_dev_info *dev,
-                         const struct pipe_sampler_state *state,
-                         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);
-   }
-}
-
-static inline 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);
-   }
-}
-
-static inline 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)) {
-      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);
-   }
-}
-
-void
-ilo_gpe_init_zs_surface(const struct ilo_dev_info *dev,
-                        const struct ilo_texture *tex,
-                        enum pipe_format format, unsigned level,
-                        unsigned first_layer, unsigned num_layers,
-                        struct ilo_zs_surface *zs);
-
-void
-ilo_gpe_init_vs_cso(const struct ilo_dev_info *dev,
-                    const struct ilo_shader_state *vs,
-                    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);
-
-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);
-   }
-}
-
-void
-ilo_gpe_set_fb(const struct ilo_dev_info *dev,
-               const struct pipe_framebuffer_state *state,
-               struct ilo_fb_state *fb);
-
-#endif /* ILO_GPE_H */
index cbc0fa39aeb6f64bd6bd4a5ddd458e1c60571ebb..d2cacf36f1b91894da6af84e632e1f66a5bc461c 100644 (file)
@@ -32,6 +32,7 @@
 #include "shader/ilo_shader_internal.h"
 #include "ilo_builder.h"
 #include "ilo_state.h"
+#include "ilo_state_gen.h"
 #include "ilo_shader.h"
 
 struct ilo_shader_cache {
index df36de8a766ac9a77133e9aa7bef38ed12283a56..1e427edc231cb741a625f1033f5da1f305ca5479 100644 (file)
@@ -32,6 +32,7 @@
 #include "ilo_resource.h"
 #include "ilo_shader.h"
 #include "ilo_state.h"
+#include "ilo_state_gen.h"
 
 static void
 finalize_shader_states(struct ilo_context *ilo)
index 588a1b9660a0e19c5aa9639dbca8766fb997572f..a14c3fbb28e21c2f886d2583dbf6ecfa59c6a9df 100644 (file)
 
 #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_VS_SURFACES        (ILO_MAX_CONST_BUFFERS + ILO_MAX_SAMPLER_VIEWS)
+#define ILO_VS_CONST_SURFACE(i)    (i)
+#define ILO_VS_TEXTURE_SURFACE(i)  (ILO_MAX_CONST_BUFFERS  + i)
+
+#define ILO_MAX_GS_SURFACES        (ILO_MAX_SO_BINDINGS)
+#define ILO_GS_SO_SURFACE(i)       (i)
+
+#define ILO_MAX_WM_SURFACES        (ILO_MAX_DRAW_BUFFERS + ILO_MAX_CONST_BUFFERS + ILO_MAX_SAMPLER_VIEWS)
+#define ILO_WM_DRAW_SURFACE(i)     (i)
+#define ILO_WM_CONST_SURFACE(i)    (ILO_MAX_DRAW_BUFFERS + i)
+#define ILO_WM_TEXTURE_SURFACE(i)  (ILO_MAX_DRAW_BUFFERS + ILO_MAX_CONST_BUFFERS  + i)
+
 /**
  * States that we track.
  *
@@ -117,7 +140,242 @@ enum ilo_dirty_flags {
 
 struct pipe_draw_info;
 struct pipe_resource;
+
+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;
+};
+
+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[6];
+   uint32_t dw_msaa;
+};
+
+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 */
+   uint32_t payload[3];
+
+   uint32_t dw_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;
+
+   uint32_t dw_logicop;
+   uint32_t dw_alpha_mod;
+};
+
+struct ilo_blend_state {
+   struct ilo_blend_cso cso[ILO_MAX_DRAW_BUFFERS];
+
+   bool independent_blend_enable;
+   bool dual_blend;
+   bool alpha_to_coverage;
+};
+
+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];
+   unsigned count;
+};
+
+struct ilo_view_surface {
+   /* SURFACE_STATE */
+   uint32_t payload[8];
+   struct intel_bo *bo;
+};
+
+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[10];
+         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;
+
+   unsigned num_samples;
+};
+
+struct ilo_global_binding {
+   /*
+    * XXX These should not be treated as real resources (and there could be
+    * thousands of them).  They should be treated as regions in GLOBAL
+    * resource, which is the only real resource.
+    *
+    * That is, a resource here should instead be
+    *
+    *   struct ilo_global_region {
+    *     struct pipe_resource base;
+    *     int offset;
+    *     int size;
+    *   };
+    *
+    * and it describes the region [offset, offset + size) in GLOBAL
+    * resource.
+    */
+   struct pipe_resource *resources[PIPE_MAX_SHADER_RESOURCES];
+   uint32_t *handles[PIPE_MAX_SHADER_RESOURCES];
+   unsigned count;
+};
+
+struct ilo_shader_cso {
+   uint32_t payload[5];
+};
 
 void
 ilo_init_state_functions(struct ilo_context *ilo);
index 33b762835f1327ced774a88e1f7031255725aaa6..9e4f0ebaafd363000a678d0dc3550f0a86551e04 100644 (file)
@@ -32,7 +32,7 @@
 #include "intel_winsys.h"
 
 #include "ilo_common.h"
-#include "ilo_gpe.h"
+#include "ilo_state.h"
 
 /**
  * Translate winsys tiling to hardware tiling.
@@ -115,4 +115,248 @@ zs_align_surface(const struct ilo_dev_info *dev,
    zs->payload[2] = dw3;
 }
 
+void
+ilo_gpe_init_ve(const struct ilo_dev_info *dev,
+                unsigned num_states,
+                const struct pipe_vertex_element *states,
+                struct ilo_ve_state *ve);
+
+void
+ilo_gpe_set_viewport_cso(const struct ilo_dev_info *dev,
+                         const struct pipe_viewport_state *state,
+                         struct ilo_viewport_cso *vp);
+
+void
+ilo_gpe_set_scissor(const struct ilo_dev_info *dev,
+                    unsigned start_slot,
+                    unsigned num_states,
+                    const struct pipe_scissor_state *states,
+                    struct ilo_scissor_state *scissor);
+
+void
+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);
+}
+
+void
+ilo_gpe_init_dsa(const struct ilo_dev_info *dev,
+                 const struct pipe_depth_stencil_alpha_state *state,
+                 struct ilo_dsa_state *dsa);
+
+void
+ilo_gpe_init_blend(const struct ilo_dev_info *dev,
+                   const struct pipe_blend_state *state,
+                   struct ilo_blend_state *blend);
+
+void
+ilo_gpe_init_sampler_cso(const struct ilo_dev_info *dev,
+                         const struct pipe_sampler_state *state,
+                         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);
+   }
+}
+
+static inline 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);
+   }
+}
+
+static inline 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)) {
+      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);
+   }
+}
+
+void
+ilo_gpe_init_zs_surface(const struct ilo_dev_info *dev,
+                        const struct ilo_texture *tex,
+                        enum pipe_format format, unsigned level,
+                        unsigned first_layer, unsigned num_layers,
+                        struct ilo_zs_surface *zs);
+
+void
+ilo_gpe_init_vs_cso(const struct ilo_dev_info *dev,
+                    const struct ilo_shader_state *vs,
+                    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);
+
+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);
+   }
+}
+
+void
+ilo_gpe_set_fb(const struct ilo_dev_info *dev,
+               const struct pipe_framebuffer_state *state,
+               struct ilo_fb_state *fb);
+
 #endif /* ILO_STATE_GEN_H */
index 3814de02e9c005f693ae61ca6d0bb09ac42aa66a..53c3aebc634792ea22096791f37b2fbddea04634 100644 (file)
@@ -31,8 +31,8 @@
 #include "ilo_format.h"
 #include "ilo_resource.h"
 #include "ilo_shader.h"
+#include "ilo_state.h"
 #include "ilo_state_gen.h"
-#include "ilo_gpe.h"
 
 void
 ilo_gpe_init_gs_cso_gen7(const struct ilo_dev_info *dev,