OSDN Git Service

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