Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Mesa 3-D graphics library
  3.  *
  4.  * Copyright (C) 2012-2013 LunarG, Inc.
  5.  *
  6.  * Permission is hereby granted, free of charge, to any person obtaining a
  7.  * copy of this software and associated documentation files (the "Software"),
  8.  * to deal in the Software without restriction, including without limitation
  9.  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10.  * and/or sell copies of the Software, and to permit persons to whom the
  11.  * Software is furnished to do so, subject to the following conditions:
  12.  *
  13.  * The above copyright notice and this permission notice shall be included
  14.  * in all copies or substantial portions of the Software.
  15.  *
  16.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17.  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  19.  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20.  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  21.  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  22.  * DEALINGS IN THE SOFTWARE.
  23.  *
  24.  * Authors:
  25.  *    Chia-I Wu <olv@lunarg.com>
  26.  */
  27.  
  28. #ifndef ILO_GPE_GEN6_H
  29. #define ILO_GPE_GEN6_H
  30.  
  31. #include "ilo_common.h"
  32. #include "ilo_gpe.h"
  33.  
  34. #define ILO_GPE_VALID_GEN(dev, min_gen, max_gen) \
  35.    assert((dev)->gen >= ILO_GEN(min_gen) && (dev)->gen <= ILO_GEN(max_gen))
  36.  
  37. #define ILO_GPE_CMD(pipeline, op, subop) \
  38.    (0x3 << 29 | (pipeline) << 27 | (op) << 24 | (subop) << 16)
  39.  
  40. /**
  41.  * Commands that GEN6 GPE could emit.
  42.  */
  43. enum ilo_gpe_gen6_command {
  44.    ILO_GPE_GEN6_STATE_BASE_ADDRESS,                  /* (0x0, 0x1, 0x01) */
  45.    ILO_GPE_GEN6_STATE_SIP,                           /* (0x0, 0x1, 0x02) */
  46.    ILO_GPE_GEN6_3DSTATE_VF_STATISTICS,               /* (0x1, 0x0, 0x0b) */
  47.    ILO_GPE_GEN6_PIPELINE_SELECT,                     /* (0x1, 0x1, 0x04) */
  48.    ILO_GPE_GEN6_MEDIA_VFE_STATE,                     /* (0x2, 0x0, 0x00) */
  49.    ILO_GPE_GEN6_MEDIA_CURBE_LOAD,                    /* (0x2, 0x0, 0x01) */
  50.    ILO_GPE_GEN6_MEDIA_INTERFACE_DESCRIPTOR_LOAD,     /* (0x2, 0x0, 0x02) */
  51.    ILO_GPE_GEN6_MEDIA_GATEWAY_STATE,                 /* (0x2, 0x0, 0x03) */
  52.    ILO_GPE_GEN6_MEDIA_STATE_FLUSH,                   /* (0x2, 0x0, 0x04) */
  53.    ILO_GPE_GEN6_MEDIA_OBJECT_WALKER,                 /* (0x2, 0x1, 0x03) */
  54.    ILO_GPE_GEN6_3DSTATE_BINDING_TABLE_POINTERS,      /* (0x3, 0x0, 0x01) */
  55.    ILO_GPE_GEN6_3DSTATE_SAMPLER_STATE_POINTERS,      /* (0x3, 0x0, 0x02) */
  56.    ILO_GPE_GEN6_3DSTATE_URB,                         /* (0x3, 0x0, 0x05) */
  57.    ILO_GPE_GEN6_3DSTATE_VERTEX_BUFFERS,              /* (0x3, 0x0, 0x08) */
  58.    ILO_GPE_GEN6_3DSTATE_VERTEX_ELEMENTS,             /* (0x3, 0x0, 0x09) */
  59.    ILO_GPE_GEN6_3DSTATE_INDEX_BUFFER,                /* (0x3, 0x0, 0x0a) */
  60.    ILO_GPE_GEN6_3DSTATE_VIEWPORT_STATE_POINTERS,     /* (0x3, 0x0, 0x0d) */
  61.    ILO_GPE_GEN6_3DSTATE_CC_STATE_POINTERS,           /* (0x3, 0x0, 0x0e) */
  62.    ILO_GPE_GEN6_3DSTATE_SCISSOR_STATE_POINTERS,      /* (0x3, 0x0, 0x0f) */
  63.    ILO_GPE_GEN6_3DSTATE_VS,                          /* (0x3, 0x0, 0x10) */
  64.    ILO_GPE_GEN6_3DSTATE_GS,                          /* (0x3, 0x0, 0x11) */
  65.    ILO_GPE_GEN6_3DSTATE_CLIP,                        /* (0x3, 0x0, 0x12) */
  66.    ILO_GPE_GEN6_3DSTATE_SF,                          /* (0x3, 0x0, 0x13) */
  67.    ILO_GPE_GEN6_3DSTATE_WM,                          /* (0x3, 0x0, 0x14) */
  68.    ILO_GPE_GEN6_3DSTATE_CONSTANT_VS,                 /* (0x3, 0x0, 0x15) */
  69.    ILO_GPE_GEN6_3DSTATE_CONSTANT_GS,                 /* (0x3, 0x0, 0x16) */
  70.    ILO_GPE_GEN6_3DSTATE_CONSTANT_PS,                 /* (0x3, 0x0, 0x17) */
  71.    ILO_GPE_GEN6_3DSTATE_SAMPLE_MASK,                 /* (0x3, 0x0, 0x18) */
  72.    ILO_GPE_GEN6_3DSTATE_DRAWING_RECTANGLE,           /* (0x3, 0x1, 0x00) */
  73.    ILO_GPE_GEN6_3DSTATE_DEPTH_BUFFER,                /* (0x3, 0x1, 0x05) */
  74.    ILO_GPE_GEN6_3DSTATE_POLY_STIPPLE_OFFSET,         /* (0x3, 0x1, 0x06) */
  75.    ILO_GPE_GEN6_3DSTATE_POLY_STIPPLE_PATTERN,        /* (0x3, 0x1, 0x07) */
  76.    ILO_GPE_GEN6_3DSTATE_LINE_STIPPLE,                /* (0x3, 0x1, 0x08) */
  77.    ILO_GPE_GEN6_3DSTATE_AA_LINE_PARAMETERS,          /* (0x3, 0x1, 0x0a) */
  78.    ILO_GPE_GEN6_3DSTATE_GS_SVB_INDEX,                /* (0x3, 0x1, 0x0b) */
  79.    ILO_GPE_GEN6_3DSTATE_MULTISAMPLE,                 /* (0x3, 0x1, 0x0d) */
  80.    ILO_GPE_GEN6_3DSTATE_STENCIL_BUFFER,              /* (0x3, 0x1, 0x0e) */
  81.    ILO_GPE_GEN6_3DSTATE_HIER_DEPTH_BUFFER,           /* (0x3, 0x1, 0x0f) */
  82.    ILO_GPE_GEN6_3DSTATE_CLEAR_PARAMS,                /* (0x3, 0x1, 0x10) */
  83.    ILO_GPE_GEN6_PIPE_CONTROL,                        /* (0x3, 0x2, 0x00) */
  84.    ILO_GPE_GEN6_3DPRIMITIVE,                         /* (0x3, 0x3, 0x00) */
  85.  
  86.    ILO_GPE_GEN6_COMMAND_COUNT,
  87. };
  88.  
  89. /**
  90.  * Indirect states that GEN6 GPE could emit.
  91.  */
  92. enum ilo_gpe_gen6_state {
  93.    ILO_GPE_GEN6_INTERFACE_DESCRIPTOR_DATA,
  94.    ILO_GPE_GEN6_SF_VIEWPORT,
  95.    ILO_GPE_GEN6_CLIP_VIEWPORT,
  96.    ILO_GPE_GEN6_CC_VIEWPORT,
  97.    ILO_GPE_GEN6_COLOR_CALC_STATE,
  98.    ILO_GPE_GEN6_BLEND_STATE,
  99.    ILO_GPE_GEN6_DEPTH_STENCIL_STATE,
  100.    ILO_GPE_GEN6_SCISSOR_RECT,
  101.    ILO_GPE_GEN6_BINDING_TABLE_STATE,
  102.    ILO_GPE_GEN6_SURFACE_STATE,
  103.    ILO_GPE_GEN6_SAMPLER_STATE,
  104.    ILO_GPE_GEN6_SAMPLER_BORDER_COLOR_STATE,
  105.    ILO_GPE_GEN6_PUSH_CONSTANT_BUFFER,
  106.  
  107.    ILO_GPE_GEN6_STATE_COUNT,
  108. };
  109.  
  110. enum intel_tiling_mode;
  111.  
  112. struct intel_bo;
  113. struct ilo_cp;
  114. struct ilo_texture;
  115. struct ilo_shader;
  116.  
  117. typedef void
  118. (*ilo_gpe_gen6_STATE_BASE_ADDRESS)(const struct ilo_dev_info *dev,
  119.                                    struct intel_bo *general_state_bo,
  120.                                    struct intel_bo *surface_state_bo,
  121.                                    struct intel_bo *dynamic_state_bo,
  122.                                    struct intel_bo *indirect_object_bo,
  123.                                    struct intel_bo *instruction_bo,
  124.                                    uint32_t general_state_size,
  125.                                    uint32_t dynamic_state_size,
  126.                                    uint32_t indirect_object_size,
  127.                                    uint32_t instruction_size,
  128.                                    struct ilo_cp *cp);
  129.  
  130. typedef void
  131. (*ilo_gpe_gen6_STATE_SIP)(const struct ilo_dev_info *dev,
  132.                           uint32_t sip,
  133.                           struct ilo_cp *cp);
  134.  
  135. typedef void
  136. (*ilo_gpe_gen6_3DSTATE_VF_STATISTICS)(const struct ilo_dev_info *dev,
  137.                                       bool enable,
  138.                                       struct ilo_cp *cp);
  139.  
  140. typedef void
  141. (*ilo_gpe_gen6_PIPELINE_SELECT)(const struct ilo_dev_info *dev,
  142.                                 int pipeline,
  143.                                 struct ilo_cp *cp);
  144.  
  145. typedef void
  146. (*ilo_gpe_gen6_MEDIA_VFE_STATE)(const struct ilo_dev_info *dev,
  147.                                 int max_threads, int num_urb_entries,
  148.                                 int urb_entry_size,
  149.                                 struct ilo_cp *cp);
  150.  
  151. typedef void
  152. (*ilo_gpe_gen6_MEDIA_CURBE_LOAD)(const struct ilo_dev_info *dev,
  153.                                  uint32_t buf, int size,
  154.                                  struct ilo_cp *cp);
  155.  
  156. typedef void
  157. (*ilo_gpe_gen6_MEDIA_INTERFACE_DESCRIPTOR_LOAD)(const struct ilo_dev_info *dev,
  158.                                                 uint32_t offset, int num_ids,
  159.                                                 struct ilo_cp *cp);
  160.  
  161. typedef void
  162. (*ilo_gpe_gen6_MEDIA_GATEWAY_STATE)(const struct ilo_dev_info *dev,
  163.                                     int id, int byte, int thread_count,
  164.                                     struct ilo_cp *cp);
  165.  
  166. typedef void
  167. (*ilo_gpe_gen6_MEDIA_STATE_FLUSH)(const struct ilo_dev_info *dev,
  168.                                   int thread_count_water_mark,
  169.                                   int barrier_mask,
  170.                                   struct ilo_cp *cp);
  171.  
  172. typedef void
  173. (*ilo_gpe_gen6_MEDIA_OBJECT_WALKER)(const struct ilo_dev_info *dev,
  174.                                     struct ilo_cp *cp);
  175.  
  176. typedef void
  177. (*ilo_gpe_gen6_3DSTATE_BINDING_TABLE_POINTERS)(const struct ilo_dev_info *dev,
  178.                                                uint32_t vs_binding_table,
  179.                                                uint32_t gs_binding_table,
  180.                                                uint32_t ps_binding_table,
  181.                                                struct ilo_cp *cp);
  182.  
  183. typedef void
  184. (*ilo_gpe_gen6_3DSTATE_SAMPLER_STATE_POINTERS)(const struct ilo_dev_info *dev,
  185.                                                uint32_t vs_sampler_state,
  186.                                                uint32_t gs_sampler_state,
  187.                                                uint32_t ps_sampler_state,
  188.                                                struct ilo_cp *cp);
  189.  
  190. typedef void
  191. (*ilo_gpe_gen6_3DSTATE_URB)(const struct ilo_dev_info *dev,
  192.                             int vs_total_size, int gs_total_size,
  193.                             int vs_entry_size, int gs_entry_size,
  194.                             struct ilo_cp *cp);
  195.  
  196. typedef void
  197. (*ilo_gpe_gen6_3DSTATE_VERTEX_BUFFERS)(const struct ilo_dev_info *dev,
  198.                                        const struct pipe_vertex_buffer *vbuffers,
  199.                                        uint64_t vbuffer_mask,
  200.                                        const struct ilo_ve_state *ve,
  201.                                        struct ilo_cp *cp);
  202.  
  203. typedef void
  204. (*ilo_gpe_gen6_3DSTATE_VERTEX_ELEMENTS)(const struct ilo_dev_info *dev,
  205.                                         const struct ilo_ve_state *ve,
  206.                                         bool last_velement_edgeflag,
  207.                                         bool prepend_generated_ids,
  208.                                         struct ilo_cp *cp);
  209.  
  210. typedef void
  211. (*ilo_gpe_gen6_3DSTATE_INDEX_BUFFER)(const struct ilo_dev_info *dev,
  212.                                      const struct ilo_ib_state *ib,
  213.                                      bool enable_cut_index,
  214.                                      struct ilo_cp *cp);
  215.  
  216. typedef void
  217. (*ilo_gpe_gen6_3DSTATE_VIEWPORT_STATE_POINTERS)(const struct ilo_dev_info *dev,
  218.                                                 uint32_t clip_viewport,
  219.                                                 uint32_t sf_viewport,
  220.                                                 uint32_t cc_viewport,
  221.                                                 struct ilo_cp *cp);
  222.  
  223. typedef void
  224. (*ilo_gpe_gen6_3DSTATE_CC_STATE_POINTERS)(const struct ilo_dev_info *dev,
  225.                                           uint32_t blend_state,
  226.                                           uint32_t depth_stencil_state,
  227.                                           uint32_t color_calc_state,
  228.                                           struct ilo_cp *cp);
  229.  
  230. typedef void
  231. (*ilo_gpe_gen6_3DSTATE_SCISSOR_STATE_POINTERS)(const struct ilo_dev_info *dev,
  232.                                                uint32_t scissor_rect,
  233.                                                struct ilo_cp *cp);
  234.  
  235.  
  236. typedef void
  237. (*ilo_gpe_gen6_3DSTATE_VS)(const struct ilo_dev_info *dev,
  238.                            const struct ilo_shader_state *vs,
  239.                            int num_samplers,
  240.                            struct ilo_cp *cp);
  241.  
  242. typedef void
  243. (*ilo_gpe_gen6_3DSTATE_GS)(const struct ilo_dev_info *dev,
  244.                            const struct ilo_shader_state *gs,
  245.                            const struct ilo_shader_state *vs,
  246.                            int verts_per_prim,
  247.                            struct ilo_cp *cp);
  248.  
  249. typedef void
  250. (*ilo_gpe_gen6_3DSTATE_CLIP)(const struct ilo_dev_info *dev,
  251.                              const struct ilo_rasterizer_state *rasterizer,
  252.                              const struct ilo_shader_state *fs,
  253.                              bool enable_guardband,
  254.                              int num_viewports,
  255.                              struct ilo_cp *cp);
  256.  
  257. typedef void
  258. (*ilo_gpe_gen6_3DSTATE_SF)(const struct ilo_dev_info *dev,
  259.                            const struct ilo_rasterizer_state *rasterizer,
  260.                            const struct ilo_shader_state *fs,
  261.                            const struct ilo_shader_state *last_sh,
  262.                            struct ilo_cp *cp);
  263.  
  264. typedef void
  265. (*ilo_gpe_gen6_3DSTATE_WM)(const struct ilo_dev_info *dev,
  266.                            const struct ilo_shader_state *fs,
  267.                            int num_samplers,
  268.                            const struct ilo_rasterizer_state *rasterizer,
  269.                            bool dual_blend, bool cc_may_kill,
  270.                            struct ilo_cp *cp);
  271.  
  272. typedef void
  273. (*ilo_gpe_gen6_3DSTATE_CONSTANT_VS)(const struct ilo_dev_info *dev,
  274.                                     const uint32_t *bufs, const int *sizes,
  275.                                     int num_bufs,
  276.                                     struct ilo_cp *cp);
  277.  
  278. typedef void
  279. (*ilo_gpe_gen6_3DSTATE_CONSTANT_GS)(const struct ilo_dev_info *dev,
  280.                                     const uint32_t *bufs, const int *sizes,
  281.                                     int num_bufs,
  282.                                     struct ilo_cp *cp);
  283.  
  284. typedef void
  285. (*ilo_gpe_gen6_3DSTATE_CONSTANT_PS)(const struct ilo_dev_info *dev,
  286.                                     const uint32_t *bufs, const int *sizes,
  287.                                     int num_bufs,
  288.                                     struct ilo_cp *cp);
  289.  
  290. typedef void
  291. (*ilo_gpe_gen6_3DSTATE_SAMPLE_MASK)(const struct ilo_dev_info *dev,
  292.                                     unsigned sample_mask,
  293.                                     struct ilo_cp *cp);
  294.  
  295. typedef void
  296. (*ilo_gpe_gen6_3DSTATE_DRAWING_RECTANGLE)(const struct ilo_dev_info *dev,
  297.                                           unsigned x, unsigned y,
  298.                                           unsigned width, unsigned height,
  299.                                           struct ilo_cp *cp);
  300.  
  301. typedef void
  302. (*ilo_gpe_gen6_3DSTATE_DEPTH_BUFFER)(const struct ilo_dev_info *dev,
  303.                                      const struct ilo_zs_surface *zs,
  304.                                      struct ilo_cp *cp);
  305.  
  306. typedef void
  307. (*ilo_gpe_gen6_3DSTATE_POLY_STIPPLE_OFFSET)(const struct ilo_dev_info *dev,
  308.                                             int x_offset, int y_offset,
  309.                                             struct ilo_cp *cp);
  310.  
  311. typedef void
  312. (*ilo_gpe_gen6_3DSTATE_POLY_STIPPLE_PATTERN)(const struct ilo_dev_info *dev,
  313.                                              const struct pipe_poly_stipple *pattern,
  314.                                              struct ilo_cp *cp);
  315.  
  316. typedef void
  317. (*ilo_gpe_gen6_3DSTATE_LINE_STIPPLE)(const struct ilo_dev_info *dev,
  318.                                      unsigned pattern, unsigned factor,
  319.                                      struct ilo_cp *cp);
  320.  
  321. typedef void
  322. (*ilo_gpe_gen6_3DSTATE_AA_LINE_PARAMETERS)(const struct ilo_dev_info *dev,
  323.                                            struct ilo_cp *cp);
  324.  
  325. typedef void
  326. (*ilo_gpe_gen6_3DSTATE_GS_SVB_INDEX)(const struct ilo_dev_info *dev,
  327.                                      int index, unsigned svbi,
  328.                                      unsigned max_svbi,
  329.                                      bool load_vertex_count,
  330.                                      struct ilo_cp *cp);
  331.  
  332.  
  333. typedef void
  334. (*ilo_gpe_gen6_3DSTATE_MULTISAMPLE)(const struct ilo_dev_info *dev,
  335.                                     int num_samples,
  336.                                     const uint32_t *packed_sample_pos,
  337.                                     bool pixel_location_center,
  338.                                     struct ilo_cp *cp);
  339.  
  340. typedef void
  341. (*ilo_gpe_gen6_3DSTATE_STENCIL_BUFFER)(const struct ilo_dev_info *dev,
  342.                                        const struct ilo_zs_surface *zs,
  343.                                        struct ilo_cp *cp);
  344.  
  345. typedef void
  346. (*ilo_gpe_gen6_3DSTATE_HIER_DEPTH_BUFFER)(const struct ilo_dev_info *dev,
  347.                                           const struct ilo_zs_surface *zs,
  348.                                           struct ilo_cp *cp);
  349.  
  350. typedef void
  351. (*ilo_gpe_gen6_3DSTATE_CLEAR_PARAMS)(const struct ilo_dev_info *dev,
  352.                                      uint32_t clear_val,
  353.                                      struct ilo_cp *cp);
  354.  
  355. typedef void
  356. (*ilo_gpe_gen6_PIPE_CONTROL)(const struct ilo_dev_info *dev,
  357.                              uint32_t dw1,
  358.                              struct intel_bo *bo, uint32_t bo_offset,
  359.                              bool write_qword,
  360.                              struct ilo_cp *cp);
  361.  
  362. typedef void
  363. (*ilo_gpe_gen6_3DPRIMITIVE)(const struct ilo_dev_info *dev,
  364.                             const struct pipe_draw_info *info,
  365.                             const struct ilo_ib_state *ib,
  366.                             bool rectlist,
  367.                             struct ilo_cp *cp);
  368.  
  369. typedef uint32_t
  370. (*ilo_gpe_gen6_INTERFACE_DESCRIPTOR_DATA)(const struct ilo_dev_info *dev,
  371.                                           const struct ilo_shader_state **cs,
  372.                                           uint32_t *sampler_state,
  373.                                           int *num_samplers,
  374.                                           uint32_t *binding_table_state,
  375.                                           int *num_surfaces,
  376.                                           int num_ids,
  377.                                           struct ilo_cp *cp);
  378. typedef uint32_t
  379. (*ilo_gpe_gen6_SF_VIEWPORT)(const struct ilo_dev_info *dev,
  380.                             const struct ilo_viewport_cso *viewports,
  381.                             unsigned num_viewports,
  382.                             struct ilo_cp *cp);
  383.  
  384. typedef uint32_t
  385. (*ilo_gpe_gen6_CLIP_VIEWPORT)(const struct ilo_dev_info *dev,
  386.                               const struct ilo_viewport_cso *viewports,
  387.                               unsigned num_viewports,
  388.                               struct ilo_cp *cp);
  389.  
  390. typedef uint32_t
  391. (*ilo_gpe_gen6_CC_VIEWPORT)(const struct ilo_dev_info *dev,
  392.                             const struct ilo_viewport_cso *viewports,
  393.                             unsigned num_viewports,
  394.                             struct ilo_cp *cp);
  395.  
  396. typedef uint32_t
  397. (*ilo_gpe_gen6_COLOR_CALC_STATE)(const struct ilo_dev_info *dev,
  398.                                  const struct pipe_stencil_ref *stencil_ref,
  399.                                  float alpha_ref,
  400.                                  const struct pipe_blend_color *blend_color,
  401.                                  struct ilo_cp *cp);
  402.  
  403. typedef uint32_t
  404. (*ilo_gpe_gen6_BLEND_STATE)(const struct ilo_dev_info *dev,
  405.                             const struct ilo_blend_state *blend,
  406.                             const struct ilo_fb_state *fb,
  407.                             const struct pipe_alpha_state *alpha,
  408.                             struct ilo_cp *cp);
  409.  
  410. typedef uint32_t
  411. (*ilo_gpe_gen6_DEPTH_STENCIL_STATE)(const struct ilo_dev_info *dev,
  412.                                     const struct ilo_dsa_state *dsa,
  413.                                     struct ilo_cp *cp);
  414.  
  415. typedef uint32_t
  416. (*ilo_gpe_gen6_SCISSOR_RECT)(const struct ilo_dev_info *dev,
  417.                              const struct ilo_scissor_state *scissor,
  418.                              unsigned num_viewports,
  419.                              struct ilo_cp *cp);
  420.  
  421. typedef uint32_t
  422. (*ilo_gpe_gen6_BINDING_TABLE_STATE)(const struct ilo_dev_info *dev,
  423.                                     uint32_t *surface_states,
  424.                                     int num_surface_states,
  425.                                     struct ilo_cp *cp);
  426.  
  427. typedef uint32_t
  428. (*ilo_gpe_gen6_SURFACE_STATE)(const struct ilo_dev_info *dev,
  429.                               const struct ilo_view_surface *surface,
  430.                               bool for_render,
  431.                               struct ilo_cp *cp);
  432.  
  433. typedef uint32_t
  434. (*ilo_gpe_gen6_so_SURFACE_STATE)(const struct ilo_dev_info *dev,
  435.                                  const struct pipe_stream_output_target *so,
  436.                                  const struct pipe_stream_output_info *so_info,
  437.                                  int so_index,
  438.                                  struct ilo_cp *cp);
  439.  
  440. typedef uint32_t
  441. (*ilo_gpe_gen6_SAMPLER_STATE)(const struct ilo_dev_info *dev,
  442.                               const struct ilo_sampler_cso * const *samplers,
  443.                               const struct pipe_sampler_view * const *views,
  444.                               const uint32_t *sampler_border_colors,
  445.                               int num_samplers,
  446.                               struct ilo_cp *cp);
  447.  
  448. typedef uint32_t
  449. (*ilo_gpe_gen6_SAMPLER_BORDER_COLOR_STATE)(const struct ilo_dev_info *dev,
  450.                                            const struct ilo_sampler_cso *sampler,
  451.                                            struct ilo_cp *cp);
  452.  
  453. typedef uint32_t
  454. (*ilo_gpe_gen6_push_constant_buffer)(const struct ilo_dev_info *dev,
  455.                                      int size, void **pcb,
  456.                                      struct ilo_cp *cp);
  457.  
  458. /**
  459.  * GEN6 graphics processing engine
  460.  *
  461.  * This is a low-level interface.  It does not handle the interdependencies
  462.  * between states.
  463.  */
  464. struct ilo_gpe_gen6 {
  465.    int (*estimate_command_size)(const struct ilo_dev_info *dev,
  466.                                 enum ilo_gpe_gen6_command cmd,
  467.                                 int arg);
  468.  
  469.    int (*estimate_state_size)(const struct ilo_dev_info *dev,
  470.                               enum ilo_gpe_gen6_state state,
  471.                               int arg);
  472.  
  473. #define GEN6_EMIT(name) ilo_gpe_gen6_ ## name emit_ ## name
  474.    GEN6_EMIT(STATE_BASE_ADDRESS);
  475.    GEN6_EMIT(STATE_SIP);
  476.    GEN6_EMIT(3DSTATE_VF_STATISTICS);
  477.    GEN6_EMIT(PIPELINE_SELECT);
  478.    GEN6_EMIT(MEDIA_VFE_STATE);
  479.    GEN6_EMIT(MEDIA_CURBE_LOAD);
  480.    GEN6_EMIT(MEDIA_INTERFACE_DESCRIPTOR_LOAD);
  481.    GEN6_EMIT(MEDIA_GATEWAY_STATE);
  482.    GEN6_EMIT(MEDIA_STATE_FLUSH);
  483.    GEN6_EMIT(MEDIA_OBJECT_WALKER);
  484.    GEN6_EMIT(3DSTATE_BINDING_TABLE_POINTERS);
  485.    GEN6_EMIT(3DSTATE_SAMPLER_STATE_POINTERS);
  486.    GEN6_EMIT(3DSTATE_URB);
  487.    GEN6_EMIT(3DSTATE_VERTEX_BUFFERS);
  488.    GEN6_EMIT(3DSTATE_VERTEX_ELEMENTS);
  489.    GEN6_EMIT(3DSTATE_INDEX_BUFFER);
  490.    GEN6_EMIT(3DSTATE_VIEWPORT_STATE_POINTERS);
  491.    GEN6_EMIT(3DSTATE_CC_STATE_POINTERS);
  492.    GEN6_EMIT(3DSTATE_SCISSOR_STATE_POINTERS);
  493.    GEN6_EMIT(3DSTATE_VS);
  494.    GEN6_EMIT(3DSTATE_GS);
  495.    GEN6_EMIT(3DSTATE_CLIP);
  496.    GEN6_EMIT(3DSTATE_SF);
  497.    GEN6_EMIT(3DSTATE_WM);
  498.    GEN6_EMIT(3DSTATE_CONSTANT_VS);
  499.    GEN6_EMIT(3DSTATE_CONSTANT_GS);
  500.    GEN6_EMIT(3DSTATE_CONSTANT_PS);
  501.    GEN6_EMIT(3DSTATE_SAMPLE_MASK);
  502.    GEN6_EMIT(3DSTATE_DRAWING_RECTANGLE);
  503.    GEN6_EMIT(3DSTATE_DEPTH_BUFFER);
  504.    GEN6_EMIT(3DSTATE_POLY_STIPPLE_OFFSET);
  505.    GEN6_EMIT(3DSTATE_POLY_STIPPLE_PATTERN);
  506.    GEN6_EMIT(3DSTATE_LINE_STIPPLE);
  507.    GEN6_EMIT(3DSTATE_AA_LINE_PARAMETERS);
  508.    GEN6_EMIT(3DSTATE_GS_SVB_INDEX);
  509.    GEN6_EMIT(3DSTATE_MULTISAMPLE);
  510.    GEN6_EMIT(3DSTATE_STENCIL_BUFFER);
  511.    GEN6_EMIT(3DSTATE_HIER_DEPTH_BUFFER);
  512.    GEN6_EMIT(3DSTATE_CLEAR_PARAMS);
  513.    GEN6_EMIT(PIPE_CONTROL);
  514.    GEN6_EMIT(3DPRIMITIVE);
  515.    GEN6_EMIT(INTERFACE_DESCRIPTOR_DATA);
  516.    GEN6_EMIT(SF_VIEWPORT);
  517.    GEN6_EMIT(CLIP_VIEWPORT);
  518.    GEN6_EMIT(CC_VIEWPORT);
  519.    GEN6_EMIT(COLOR_CALC_STATE);
  520.    GEN6_EMIT(BLEND_STATE);
  521.    GEN6_EMIT(DEPTH_STENCIL_STATE);
  522.    GEN6_EMIT(SCISSOR_RECT);
  523.    GEN6_EMIT(BINDING_TABLE_STATE);
  524.    GEN6_EMIT(SURFACE_STATE);
  525.    GEN6_EMIT(so_SURFACE_STATE);
  526.    GEN6_EMIT(SAMPLER_STATE);
  527.    GEN6_EMIT(SAMPLER_BORDER_COLOR_STATE);
  528.    GEN6_EMIT(push_constant_buffer);
  529. #undef GEN6_EMIT
  530. };
  531.  
  532. const struct ilo_gpe_gen6 *
  533. ilo_gpe_gen6_get(void);
  534.  
  535. /* Below are helpers for other GENs */
  536.  
  537. int
  538. ilo_gpe_gen6_translate_winsys_tiling(enum intel_tiling_mode tiling);
  539.  
  540. int
  541. ilo_gpe_gen6_translate_pipe_prim(unsigned prim);
  542.  
  543. int
  544. ilo_gpe_gen6_translate_texture(enum pipe_texture_target target);
  545.  
  546. void
  547. ilo_gpe_gen6_fill_3dstate_sf_raster(const struct ilo_dev_info *dev,
  548.                                     const struct ilo_rasterizer_state *rasterizer,
  549.                                     int num_samples,
  550.                                     enum pipe_format depth_format,
  551.                                     uint32_t *payload, unsigned payload_len);
  552.  
  553. void
  554. ilo_gpe_gen6_fill_3dstate_sf_sbe(const struct ilo_dev_info *dev,
  555.                                  const struct ilo_rasterizer_state *rasterizer,
  556.                                  const struct ilo_shader_state *fs,
  557.                                  const struct ilo_shader_state *last_sh,
  558.                                  uint32_t *dw, int num_dwords);
  559.  
  560. #endif /* ILO_GPE_GEN6_H */
  561.