i915: Remove most of the code under gen >= 4 checks.
[mesa.git] / src / mesa / drivers / dri / i965 / gen6_blorp.cpp
1 /*
2 * Copyright © 2011 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24 #include <assert.h>
25
26 #include "intel_batchbuffer.h"
27 #include "intel_fbo.h"
28 #include "intel_mipmap_tree.h"
29
30 #include "brw_context.h"
31 #include "brw_defines.h"
32 #include "brw_state.h"
33
34 #include "brw_blorp.h"
35 #include "gen6_blorp.h"
36
37 /**
38 * \name Constants for BLORP VBO
39 * \{
40 */
41 #define GEN6_BLORP_NUM_VERTICES 3
42 #define GEN6_BLORP_NUM_VUE_ELEMS 8
43 #define GEN6_BLORP_VBO_SIZE (GEN6_BLORP_NUM_VERTICES \
44 * GEN6_BLORP_NUM_VUE_ELEMS \
45 * sizeof(float))
46 /** \} */
47
48 void
49 gen6_blorp_emit_batch_head(struct brw_context *brw,
50 const brw_blorp_params *params)
51 {
52 struct gl_context *ctx = &brw->intel.ctx;
53
54 /* To ensure that the batch contains only the resolve, flush the batch
55 * before beginning and after finishing emitting the resolve packets.
56 */
57 intel_flush(ctx);
58 }
59
60
61 /**
62 * CMD_STATE_BASE_ADDRESS
63 *
64 * From the Sandy Bridge PRM, Volume 1, Part 1, Table STATE_BASE_ADDRESS:
65 * The following commands must be reissued following any change to the
66 * base addresses:
67 * 3DSTATE_CC_POINTERS
68 * 3DSTATE_BINDING_TABLE_POINTERS
69 * 3DSTATE_SAMPLER_STATE_POINTERS
70 * 3DSTATE_VIEWPORT_STATE_POINTERS
71 * MEDIA_STATE_POINTERS
72 */
73 void
74 gen6_blorp_emit_state_base_address(struct brw_context *brw,
75 const brw_blorp_params *params)
76 {
77 struct intel_context *intel = &brw->intel;
78
79 BEGIN_BATCH(10);
80 OUT_BATCH(CMD_STATE_BASE_ADDRESS << 16 | (10 - 2));
81 OUT_BATCH(1); /* GeneralStateBaseAddressModifyEnable */
82 /* SurfaceStateBaseAddress */
83 OUT_RELOC(intel->batch.bo, I915_GEM_DOMAIN_SAMPLER, 0, 1);
84 /* DynamicStateBaseAddress */
85 OUT_RELOC(intel->batch.bo, (I915_GEM_DOMAIN_RENDER |
86 I915_GEM_DOMAIN_INSTRUCTION), 0, 1);
87 OUT_BATCH(1); /* IndirectObjectBaseAddress */
88 if (params->use_wm_prog) {
89 OUT_RELOC(brw->cache.bo, I915_GEM_DOMAIN_INSTRUCTION, 0,
90 1); /* Instruction base address: shader kernels */
91 } else {
92 OUT_BATCH(1); /* InstructionBaseAddress */
93 }
94 OUT_BATCH(1); /* GeneralStateUpperBound */
95 /* Dynamic state upper bound. Although the documentation says that
96 * programming it to zero will cause it to be ignored, that is a lie.
97 * If this isn't programmed to a real bound, the sampler border color
98 * pointer is rejected, causing border color to mysteriously fail.
99 */
100 OUT_BATCH(0xfffff001);
101 OUT_BATCH(1); /* IndirectObjectUpperBound*/
102 OUT_BATCH(1); /* InstructionAccessUpperBound */
103 ADVANCE_BATCH();
104 }
105
106
107 void
108 gen6_blorp_emit_vertices(struct brw_context *brw,
109 const brw_blorp_params *params)
110 {
111 struct intel_context *intel = &brw->intel;
112 uint32_t vertex_offset;
113
114 /* Setup VBO for the rectangle primitive..
115 *
116 * A rectangle primitive (3DPRIM_RECTLIST) consists of only three
117 * vertices. The vertices reside in screen space with DirectX coordinates
118 * (that is, (0, 0) is the upper left corner).
119 *
120 * v2 ------ implied
121 * | |
122 * | |
123 * v0 ----- v1
124 *
125 * Since the VS is disabled, the clipper loads each VUE directly from
126 * the URB. This is controlled by the 3DSTATE_VERTEX_BUFFERS and
127 * 3DSTATE_VERTEX_ELEMENTS packets below. The VUE contents are as follows:
128 * dw0: Reserved, MBZ.
129 * dw1: Render Target Array Index. The HiZ op does not use indexed
130 * vertices, so set the dword to 0.
131 * dw2: Viewport Index. The HiZ op disables viewport mapping and
132 * scissoring, so set the dword to 0.
133 * dw3: Point Width: The HiZ op does not emit the POINTLIST primitive, so
134 * set the dword to 0.
135 * dw4: Vertex Position X.
136 * dw5: Vertex Position Y.
137 * dw6: Vertex Position Z.
138 * dw7: Vertex Position W.
139 *
140 * For details, see the Sandybridge PRM, Volume 2, Part 1, Section 1.5.1
141 * "Vertex URB Entry (VUE) Formats".
142 */
143 {
144 float *vertex_data;
145
146 const float vertices[GEN6_BLORP_VBO_SIZE] = {
147 /* v0 */ 0, 0, 0, 0, (float) params->x0, (float) params->y1, 0, 1,
148 /* v1 */ 0, 0, 0, 0, (float) params->x1, (float) params->y1, 0, 1,
149 /* v2 */ 0, 0, 0, 0, (float) params->x0, (float) params->y0, 0, 1,
150 };
151
152 vertex_data = (float *) brw_state_batch(brw, AUB_TRACE_VERTEX_BUFFER,
153 GEN6_BLORP_VBO_SIZE, 32,
154 &vertex_offset);
155 memcpy(vertex_data, vertices, GEN6_BLORP_VBO_SIZE);
156 }
157
158 /* 3DSTATE_VERTEX_BUFFERS */
159 {
160 const int num_buffers = 1;
161 const int batch_length = 1 + 4 * num_buffers;
162
163 uint32_t dw0 = GEN6_VB0_ACCESS_VERTEXDATA |
164 (GEN6_BLORP_NUM_VUE_ELEMS * sizeof(float)) << BRW_VB0_PITCH_SHIFT;
165
166 if (intel->gen >= 7)
167 dw0 |= GEN7_VB0_ADDRESS_MODIFYENABLE;
168
169 BEGIN_BATCH(batch_length);
170 OUT_BATCH((_3DSTATE_VERTEX_BUFFERS << 16) | (batch_length - 2));
171 OUT_BATCH(dw0);
172 /* start address */
173 OUT_RELOC(intel->batch.bo, I915_GEM_DOMAIN_VERTEX, 0,
174 vertex_offset);
175 /* end address */
176 OUT_RELOC(intel->batch.bo, I915_GEM_DOMAIN_VERTEX, 0,
177 vertex_offset + GEN6_BLORP_VBO_SIZE - 1);
178 OUT_BATCH(0);
179 ADVANCE_BATCH();
180 }
181
182 /* 3DSTATE_VERTEX_ELEMENTS
183 *
184 * Fetch dwords 0 - 7 from each VUE. See the comments above where
185 * the vertex_bo is filled with data.
186 */
187 {
188 const int num_elements = 2;
189 const int batch_length = 1 + 2 * num_elements;
190
191 BEGIN_BATCH(batch_length);
192 OUT_BATCH((_3DSTATE_VERTEX_ELEMENTS << 16) | (batch_length - 2));
193 /* Element 0 */
194 OUT_BATCH(GEN6_VE0_VALID |
195 BRW_SURFACEFORMAT_R32G32B32A32_FLOAT << BRW_VE0_FORMAT_SHIFT |
196 0 << BRW_VE0_SRC_OFFSET_SHIFT);
197 OUT_BATCH(BRW_VE1_COMPONENT_STORE_SRC << BRW_VE1_COMPONENT_0_SHIFT |
198 BRW_VE1_COMPONENT_STORE_SRC << BRW_VE1_COMPONENT_1_SHIFT |
199 BRW_VE1_COMPONENT_STORE_SRC << BRW_VE1_COMPONENT_2_SHIFT |
200 BRW_VE1_COMPONENT_STORE_SRC << BRW_VE1_COMPONENT_3_SHIFT);
201 /* Element 1 */
202 OUT_BATCH(GEN6_VE0_VALID |
203 BRW_SURFACEFORMAT_R32G32B32A32_FLOAT << BRW_VE0_FORMAT_SHIFT |
204 16 << BRW_VE0_SRC_OFFSET_SHIFT);
205 OUT_BATCH(BRW_VE1_COMPONENT_STORE_SRC << BRW_VE1_COMPONENT_0_SHIFT |
206 BRW_VE1_COMPONENT_STORE_SRC << BRW_VE1_COMPONENT_1_SHIFT |
207 BRW_VE1_COMPONENT_STORE_SRC << BRW_VE1_COMPONENT_2_SHIFT |
208 BRW_VE1_COMPONENT_STORE_SRC << BRW_VE1_COMPONENT_3_SHIFT);
209 ADVANCE_BATCH();
210 }
211 }
212
213
214 /* 3DSTATE_URB
215 *
216 * Assign the entire URB to the VS. Even though the VS disabled, URB space
217 * is still needed because the clipper loads the VUE's from the URB. From
218 * the Sandybridge PRM, Volume 2, Part 1, Section 3DSTATE,
219 * Dword 1.15:0 "VS Number of URB Entries":
220 * This field is always used (even if VS Function Enable is DISABLED).
221 *
222 * The warning below appears in the PRM (Section 3DSTATE_URB), but we can
223 * safely ignore it because this batch contains only one draw call.
224 * Because of URB corruption caused by allocating a previous GS unit
225 * URB entry to the VS unit, software is required to send a “GS NULL
226 * Fence” (Send URB fence with VS URB size == 1 and GS URB size == 0)
227 * plus a dummy DRAW call before any case where VS will be taking over
228 * GS URB space.
229 */
230 static void
231 gen6_blorp_emit_urb_config(struct brw_context *brw,
232 const brw_blorp_params *params)
233 {
234 struct intel_context *intel = &brw->intel;
235
236 BEGIN_BATCH(3);
237 OUT_BATCH(_3DSTATE_URB << 16 | (3 - 2));
238 OUT_BATCH(brw->urb.max_vs_entries << GEN6_URB_VS_ENTRIES_SHIFT);
239 OUT_BATCH(0);
240 ADVANCE_BATCH();
241 }
242
243
244 /* BLEND_STATE */
245 uint32_t
246 gen6_blorp_emit_blend_state(struct brw_context *brw,
247 const brw_blorp_params *params)
248 {
249 uint32_t cc_blend_state_offset;
250
251 struct gen6_blend_state *blend = (struct gen6_blend_state *)
252 brw_state_batch(brw, AUB_TRACE_BLEND_STATE,
253 sizeof(struct gen6_blend_state), 64,
254 &cc_blend_state_offset);
255
256 memset(blend, 0, sizeof(*blend));
257
258 blend->blend1.pre_blend_clamp_enable = 1;
259 blend->blend1.post_blend_clamp_enable = 1;
260 blend->blend1.clamp_range = BRW_RENDERTARGET_CLAMPRANGE_FORMAT;
261
262 blend->blend1.write_disable_r = params->color_write_disable[0];
263 blend->blend1.write_disable_g = params->color_write_disable[1];
264 blend->blend1.write_disable_b = params->color_write_disable[2];
265 blend->blend1.write_disable_a = params->color_write_disable[3];
266
267 /* When blitting from an XRGB source to a ARGB destination, we need to
268 * interpret the missing channel as 1.0. Blending can do that for us:
269 * we simply use the RGB values from the fragment shader ("source RGB"),
270 * but smash the alpha channel to 1.
271 */
272 if (params->src.mt &&
273 _mesa_get_format_bits(params->dst.mt->format, GL_ALPHA_BITS) > 0 &&
274 _mesa_get_format_bits(params->src.mt->format, GL_ALPHA_BITS) == 0) {
275 blend->blend0.blend_enable = 1;
276 blend->blend0.ia_blend_enable = 1;
277
278 blend->blend0.blend_func = BRW_BLENDFUNCTION_ADD;
279 blend->blend0.ia_blend_func = BRW_BLENDFUNCTION_ADD;
280
281 blend->blend0.source_blend_factor = BRW_BLENDFACTOR_SRC_COLOR;
282 blend->blend0.dest_blend_factor = BRW_BLENDFACTOR_ZERO;
283 blend->blend0.ia_source_blend_factor = BRW_BLENDFACTOR_ONE;
284 blend->blend0.ia_dest_blend_factor = BRW_BLENDFACTOR_ZERO;
285 }
286
287 return cc_blend_state_offset;
288 }
289
290
291 /* CC_STATE */
292 uint32_t
293 gen6_blorp_emit_cc_state(struct brw_context *brw,
294 const brw_blorp_params *params)
295 {
296 uint32_t cc_state_offset;
297
298 struct gen6_color_calc_state *cc = (struct gen6_color_calc_state *)
299 brw_state_batch(brw, AUB_TRACE_CC_STATE,
300 sizeof(gen6_color_calc_state), 64,
301 &cc_state_offset);
302 memset(cc, 0, sizeof(*cc));
303
304 return cc_state_offset;
305 }
306
307
308 /**
309 * \param out_offset is relative to
310 * CMD_STATE_BASE_ADDRESS.DynamicStateBaseAddress.
311 */
312 uint32_t
313 gen6_blorp_emit_depth_stencil_state(struct brw_context *brw,
314 const brw_blorp_params *params)
315 {
316 uint32_t depthstencil_offset;
317
318 struct gen6_depth_stencil_state *state;
319 state = (struct gen6_depth_stencil_state *)
320 brw_state_batch(brw, AUB_TRACE_DEPTH_STENCIL_STATE,
321 sizeof(*state), 64,
322 &depthstencil_offset);
323 memset(state, 0, sizeof(*state));
324
325 /* See the following sections of the Sandy Bridge PRM, Volume 1, Part2:
326 * - 7.5.3.1 Depth Buffer Clear
327 * - 7.5.3.2 Depth Buffer Resolve
328 * - 7.5.3.3 Hierarchical Depth Buffer Resolve
329 */
330 state->ds2.depth_write_enable = 1;
331 if (params->hiz_op == GEN6_HIZ_OP_DEPTH_RESOLVE) {
332 state->ds2.depth_test_enable = 1;
333 state->ds2.depth_test_func = COMPAREFUNC_NEVER;
334 }
335
336 return depthstencil_offset;
337 }
338
339
340 /* 3DSTATE_CC_STATE_POINTERS
341 *
342 * The pointer offsets are relative to
343 * CMD_STATE_BASE_ADDRESS.DynamicStateBaseAddress.
344 *
345 * The HiZ op doesn't use BLEND_STATE or COLOR_CALC_STATE.
346 */
347 static void
348 gen6_blorp_emit_cc_state_pointers(struct brw_context *brw,
349 const brw_blorp_params *params,
350 uint32_t cc_blend_state_offset,
351 uint32_t depthstencil_offset,
352 uint32_t cc_state_offset)
353 {
354 struct intel_context *intel = &brw->intel;
355
356 BEGIN_BATCH(4);
357 OUT_BATCH(_3DSTATE_CC_STATE_POINTERS << 16 | (4 - 2));
358 OUT_BATCH(cc_blend_state_offset | 1); /* BLEND_STATE offset */
359 OUT_BATCH(depthstencil_offset | 1); /* DEPTH_STENCIL_STATE offset */
360 OUT_BATCH(cc_state_offset | 1); /* COLOR_CALC_STATE offset */
361 ADVANCE_BATCH();
362 }
363
364
365 /* WM push constants */
366 uint32_t
367 gen6_blorp_emit_wm_constants(struct brw_context *brw,
368 const brw_blorp_params *params)
369 {
370 uint32_t wm_push_const_offset;
371
372 void *constants = brw_state_batch(brw, AUB_TRACE_WM_CONSTANTS,
373 sizeof(params->wm_push_consts),
374 32, &wm_push_const_offset);
375 memcpy(constants, &params->wm_push_consts,
376 sizeof(params->wm_push_consts));
377
378 return wm_push_const_offset;
379 }
380
381
382 /* SURFACE_STATE for renderbuffer or texture surface (see
383 * brw_update_renderbuffer_surface and brw_update_texture_surface)
384 */
385 static uint32_t
386 gen6_blorp_emit_surface_state(struct brw_context *brw,
387 const brw_blorp_params *params,
388 const brw_blorp_surface_info *surface,
389 uint32_t read_domains, uint32_t write_domain)
390 {
391 uint32_t wm_surf_offset;
392 uint32_t width = surface->width;
393 uint32_t height = surface->height;
394 if (surface->num_samples > 1) {
395 /* Since gen6 uses INTEL_MSAA_LAYOUT_IMS, width and height are measured
396 * in samples. But SURFACE_STATE wants them in pixels, so we need to
397 * divide them each by 2.
398 */
399 width /= 2;
400 height /= 2;
401 }
402 struct intel_region *region = surface->mt->region;
403 uint32_t tile_x, tile_y;
404
405 uint32_t *surf = (uint32_t *)
406 brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, 6 * 4, 32,
407 &wm_surf_offset);
408
409 surf[0] = (BRW_SURFACE_2D << BRW_SURFACE_TYPE_SHIFT |
410 BRW_SURFACE_MIPMAPLAYOUT_BELOW << BRW_SURFACE_MIPLAYOUT_SHIFT |
411 BRW_SURFACE_CUBEFACE_ENABLES |
412 surface->brw_surfaceformat << BRW_SURFACE_FORMAT_SHIFT);
413
414 /* reloc */
415 surf[1] = (surface->compute_tile_offsets(&tile_x, &tile_y) +
416 region->bo->offset);
417
418 surf[2] = (0 << BRW_SURFACE_LOD_SHIFT |
419 (width - 1) << BRW_SURFACE_WIDTH_SHIFT |
420 (height - 1) << BRW_SURFACE_HEIGHT_SHIFT);
421
422 uint32_t tiling = surface->map_stencil_as_y_tiled
423 ? BRW_SURFACE_TILED | BRW_SURFACE_TILED_Y
424 : brw_get_surface_tiling_bits(region->tiling);
425 uint32_t pitch_bytes = region->pitch;
426 if (surface->map_stencil_as_y_tiled)
427 pitch_bytes *= 2;
428 surf[3] = (tiling |
429 0 << BRW_SURFACE_DEPTH_SHIFT |
430 (pitch_bytes - 1) << BRW_SURFACE_PITCH_SHIFT);
431
432 surf[4] = brw_get_surface_num_multisamples(surface->num_samples);
433
434 /* Note that the low bits of these fields are missing, so
435 * there's the possibility of getting in trouble.
436 */
437 assert(tile_x % 4 == 0);
438 assert(tile_y % 2 == 0);
439 surf[5] = ((tile_x / 4) << BRW_SURFACE_X_OFFSET_SHIFT |
440 (tile_y / 2) << BRW_SURFACE_Y_OFFSET_SHIFT |
441 (surface->mt->align_h == 4 ?
442 BRW_SURFACE_VERTICAL_ALIGN_ENABLE : 0));
443
444 /* Emit relocation to surface contents */
445 drm_intel_bo_emit_reloc(brw->intel.batch.bo,
446 wm_surf_offset + 4,
447 region->bo,
448 surf[1] - region->bo->offset,
449 read_domains, write_domain);
450
451 return wm_surf_offset;
452 }
453
454
455 /* BINDING_TABLE. See brw_wm_binding_table(). */
456 uint32_t
457 gen6_blorp_emit_binding_table(struct brw_context *brw,
458 const brw_blorp_params *params,
459 uint32_t wm_surf_offset_renderbuffer,
460 uint32_t wm_surf_offset_texture)
461 {
462 uint32_t wm_bind_bo_offset;
463 uint32_t *bind = (uint32_t *)
464 brw_state_batch(brw, AUB_TRACE_BINDING_TABLE,
465 sizeof(uint32_t) *
466 BRW_BLORP_NUM_BINDING_TABLE_ENTRIES,
467 32, /* alignment */
468 &wm_bind_bo_offset);
469 bind[BRW_BLORP_RENDERBUFFER_BINDING_TABLE_INDEX] =
470 wm_surf_offset_renderbuffer;
471 bind[BRW_BLORP_TEXTURE_BINDING_TABLE_INDEX] = wm_surf_offset_texture;
472
473 return wm_bind_bo_offset;
474 }
475
476
477 /**
478 * SAMPLER_STATE. See brw_update_sampler_state().
479 */
480 static uint32_t
481 gen6_blorp_emit_sampler_state(struct brw_context *brw,
482 const brw_blorp_params *params)
483 {
484 uint32_t sampler_offset;
485
486 struct brw_sampler_state *sampler = (struct brw_sampler_state *)
487 brw_state_batch(brw, AUB_TRACE_SAMPLER_STATE,
488 sizeof(struct brw_sampler_state),
489 32, &sampler_offset);
490 memset(sampler, 0, sizeof(*sampler));
491
492 sampler->ss0.min_filter = BRW_MAPFILTER_LINEAR;
493 sampler->ss0.mip_filter = BRW_MIPFILTER_NONE;
494 sampler->ss0.mag_filter = BRW_MAPFILTER_LINEAR;
495
496 sampler->ss1.r_wrap_mode = BRW_TEXCOORDMODE_CLAMP;
497 sampler->ss1.s_wrap_mode = BRW_TEXCOORDMODE_CLAMP;
498 sampler->ss1.t_wrap_mode = BRW_TEXCOORDMODE_CLAMP;
499
500 sampler->ss0.min_mag_neq = 1;
501
502 /* Set LOD bias:
503 */
504 sampler->ss0.lod_bias = 0;
505
506 sampler->ss0.lod_preclamp = 1; /* OpenGL mode */
507 sampler->ss0.default_color_mode = 0; /* OpenGL/DX10 mode */
508
509 /* Set BaseMipLevel, MaxLOD, MinLOD:
510 *
511 * XXX: I don't think that using firstLevel, lastLevel works,
512 * because we always setup the surface state as if firstLevel ==
513 * level zero. Probably have to subtract firstLevel from each of
514 * these:
515 */
516 sampler->ss0.base_level = U_FIXED(0, 1);
517
518 sampler->ss1.max_lod = U_FIXED(0, 6);
519 sampler->ss1.min_lod = U_FIXED(0, 6);
520
521 sampler->ss3.non_normalized_coord = 1;
522
523 sampler->ss3.address_round |= BRW_ADDRESS_ROUNDING_ENABLE_U_MIN |
524 BRW_ADDRESS_ROUNDING_ENABLE_V_MIN |
525 BRW_ADDRESS_ROUNDING_ENABLE_R_MIN;
526 sampler->ss3.address_round |= BRW_ADDRESS_ROUNDING_ENABLE_U_MAG |
527 BRW_ADDRESS_ROUNDING_ENABLE_V_MAG |
528 BRW_ADDRESS_ROUNDING_ENABLE_R_MAG;
529
530 return sampler_offset;
531 }
532
533
534 /**
535 * 3DSTATE_SAMPLER_STATE_POINTERS. See upload_sampler_state_pointers().
536 */
537 static void
538 gen6_blorp_emit_sampler_state_pointers(struct brw_context *brw,
539 const brw_blorp_params *params,
540 uint32_t sampler_offset)
541 {
542 struct intel_context *intel = &brw->intel;
543
544 BEGIN_BATCH(4);
545 OUT_BATCH(_3DSTATE_SAMPLER_STATE_POINTERS << 16 |
546 VS_SAMPLER_STATE_CHANGE |
547 GS_SAMPLER_STATE_CHANGE |
548 PS_SAMPLER_STATE_CHANGE |
549 (4 - 2));
550 OUT_BATCH(0); /* VS */
551 OUT_BATCH(0); /* GS */
552 OUT_BATCH(sampler_offset);
553 ADVANCE_BATCH();
554 }
555
556
557 /* 3DSTATE_VS
558 *
559 * Disable vertex shader.
560 */
561 void
562 gen6_blorp_emit_vs_disable(struct brw_context *brw,
563 const brw_blorp_params *params)
564 {
565 struct intel_context *intel = &brw->intel;
566
567 if (intel->gen == 6) {
568 /* From the BSpec, Volume 2a, Part 3 "Vertex Shader", Section
569 * 3DSTATE_VS, Dword 5.0 "VS Function Enable":
570 *
571 * [DevSNB] A pipeline flush must be programmed prior to a
572 * 3DSTATE_VS command that causes the VS Function Enable to
573 * toggle. Pipeline flush can be executed by sending a PIPE_CONTROL
574 * command with CS stall bit set and a post sync operation.
575 */
576 intel_emit_post_sync_nonzero_flush(intel);
577 }
578
579 /* Disable the push constant buffers. */
580 BEGIN_BATCH(5);
581 OUT_BATCH(_3DSTATE_CONSTANT_VS << 16 | (5 - 2));
582 OUT_BATCH(0);
583 OUT_BATCH(0);
584 OUT_BATCH(0);
585 OUT_BATCH(0);
586 ADVANCE_BATCH();
587
588 BEGIN_BATCH(6);
589 OUT_BATCH(_3DSTATE_VS << 16 | (6 - 2));
590 OUT_BATCH(0);
591 OUT_BATCH(0);
592 OUT_BATCH(0);
593 OUT_BATCH(0);
594 OUT_BATCH(0);
595 ADVANCE_BATCH();
596 }
597
598
599 /* 3DSTATE_GS
600 *
601 * Disable the geometry shader.
602 */
603 void
604 gen6_blorp_emit_gs_disable(struct brw_context *brw,
605 const brw_blorp_params *params)
606 {
607 struct intel_context *intel = &brw->intel;
608
609 /* Disable all the constant buffers. */
610 BEGIN_BATCH(5);
611 OUT_BATCH(_3DSTATE_CONSTANT_GS << 16 | (5 - 2));
612 OUT_BATCH(0);
613 OUT_BATCH(0);
614 OUT_BATCH(0);
615 OUT_BATCH(0);
616 ADVANCE_BATCH();
617
618 BEGIN_BATCH(7);
619 OUT_BATCH(_3DSTATE_GS << 16 | (7 - 2));
620 OUT_BATCH(0);
621 OUT_BATCH(0);
622 OUT_BATCH(0);
623 OUT_BATCH(0);
624 OUT_BATCH(0);
625 OUT_BATCH(0);
626 ADVANCE_BATCH();
627 }
628
629
630 /* 3DSTATE_CLIP
631 *
632 * Disable the clipper.
633 *
634 * The BLORP op emits a rectangle primitive, which requires clipping to
635 * be disabled. From page 10 of the Sandy Bridge PRM Volume 2 Part 1
636 * Section 1.3 "3D Primitives Overview":
637 * RECTLIST:
638 * Either the CLIP unit should be DISABLED, or the CLIP unit's Clip
639 * Mode should be set to a value other than CLIPMODE_NORMAL.
640 *
641 * Also disable perspective divide. This doesn't change the clipper's
642 * output, but does spare a few electrons.
643 */
644 void
645 gen6_blorp_emit_clip_disable(struct brw_context *brw,
646 const brw_blorp_params *params)
647 {
648 struct intel_context *intel = &brw->intel;
649
650 BEGIN_BATCH(4);
651 OUT_BATCH(_3DSTATE_CLIP << 16 | (4 - 2));
652 OUT_BATCH(0);
653 OUT_BATCH(GEN6_CLIP_PERSPECTIVE_DIVIDE_DISABLE);
654 OUT_BATCH(0);
655 ADVANCE_BATCH();
656 }
657
658
659 /* 3DSTATE_SF
660 *
661 * Disable ViewportTransformEnable (dw2.1)
662 *
663 * From the SandyBridge PRM, Volume 2, Part 1, Section 1.3, "3D
664 * Primitives Overview":
665 * RECTLIST: Viewport Mapping must be DISABLED (as is typical with the
666 * use of screen- space coordinates).
667 *
668 * A solid rectangle must be rendered, so set FrontFaceFillMode (dw2.4:3)
669 * and BackFaceFillMode (dw2.5:6) to SOLID(0).
670 *
671 * From the Sandy Bridge PRM, Volume 2, Part 1, Section
672 * 6.4.1.1 3DSTATE_SF, Field FrontFaceFillMode:
673 * SOLID: Any triangle or rectangle object found to be front-facing
674 * is rendered as a solid object. This setting is required when
675 * (rendering rectangle (RECTLIST) objects.
676 */
677 static void
678 gen6_blorp_emit_sf_config(struct brw_context *brw,
679 const brw_blorp_params *params)
680 {
681 struct intel_context *intel = &brw->intel;
682
683 BEGIN_BATCH(20);
684 OUT_BATCH(_3DSTATE_SF << 16 | (20 - 2));
685 OUT_BATCH((1 - 1) << GEN6_SF_NUM_OUTPUTS_SHIFT | /* only position */
686 1 << GEN6_SF_URB_ENTRY_READ_LENGTH_SHIFT |
687 0 << GEN6_SF_URB_ENTRY_READ_OFFSET_SHIFT);
688 OUT_BATCH(0); /* dw2 */
689 OUT_BATCH(params->num_samples > 1 ? GEN6_SF_MSRAST_ON_PATTERN : 0);
690 for (int i = 0; i < 16; ++i)
691 OUT_BATCH(0);
692 ADVANCE_BATCH();
693 }
694
695
696 /**
697 * Enable or disable thread dispatch and set the HiZ op appropriately.
698 */
699 static void
700 gen6_blorp_emit_wm_config(struct brw_context *brw,
701 const brw_blorp_params *params,
702 uint32_t prog_offset,
703 brw_blorp_prog_data *prog_data)
704 {
705 struct intel_context *intel = &brw->intel;
706 uint32_t dw2, dw4, dw5, dw6;
707
708 /* Even when thread dispatch is disabled, max threads (dw5.25:31) must be
709 * nonzero to prevent the GPU from hanging. See the valid ranges in the
710 * BSpec, Volume 2a.11 Windower, Section 3DSTATE_WM, Dword 5.25:31
711 * "Maximum Number Of Threads".
712 *
713 * To be safe (and to minimize extraneous code) we go ahead and fully
714 * configure the WM state whether or not there is a WM program.
715 */
716
717 dw2 = dw4 = dw5 = dw6 = 0;
718 switch (params->hiz_op) {
719 case GEN6_HIZ_OP_DEPTH_CLEAR:
720 dw4 |= GEN6_WM_DEPTH_CLEAR;
721 break;
722 case GEN6_HIZ_OP_DEPTH_RESOLVE:
723 dw4 |= GEN6_WM_DEPTH_RESOLVE;
724 break;
725 case GEN6_HIZ_OP_HIZ_RESOLVE:
726 dw4 |= GEN6_WM_HIERARCHICAL_DEPTH_RESOLVE;
727 break;
728 case GEN6_HIZ_OP_NONE:
729 break;
730 default:
731 assert(0);
732 break;
733 }
734 dw5 |= GEN6_WM_LINE_AA_WIDTH_1_0;
735 dw5 |= GEN6_WM_LINE_END_CAP_AA_WIDTH_0_5;
736 dw5 |= (brw->max_wm_threads - 1) << GEN6_WM_MAX_THREADS_SHIFT;
737 dw6 |= 0 << GEN6_WM_BARYCENTRIC_INTERPOLATION_MODE_SHIFT; /* No interp */
738 dw6 |= 0 << GEN6_WM_NUM_SF_OUTPUTS_SHIFT; /* No inputs from SF */
739 if (params->use_wm_prog) {
740 dw2 |= 1 << GEN6_WM_SAMPLER_COUNT_SHIFT; /* Up to 4 samplers */
741 dw4 |= prog_data->first_curbe_grf << GEN6_WM_DISPATCH_START_GRF_SHIFT_0;
742 dw5 |= GEN6_WM_16_DISPATCH_ENABLE;
743 dw5 |= GEN6_WM_KILL_ENABLE; /* TODO: temporarily smash on */
744 dw5 |= GEN6_WM_DISPATCH_ENABLE; /* We are rendering */
745 }
746
747 if (params->num_samples > 1) {
748 dw6 |= GEN6_WM_MSRAST_ON_PATTERN;
749 if (prog_data && prog_data->persample_msaa_dispatch)
750 dw6 |= GEN6_WM_MSDISPMODE_PERSAMPLE;
751 else
752 dw6 |= GEN6_WM_MSDISPMODE_PERPIXEL;
753 } else {
754 dw6 |= GEN6_WM_MSRAST_OFF_PIXEL;
755 dw6 |= GEN6_WM_MSDISPMODE_PERSAMPLE;
756 }
757
758 BEGIN_BATCH(9);
759 OUT_BATCH(_3DSTATE_WM << 16 | (9 - 2));
760 OUT_BATCH(params->use_wm_prog ? prog_offset : 0);
761 OUT_BATCH(dw2);
762 OUT_BATCH(0); /* No scratch needed */
763 OUT_BATCH(dw4);
764 OUT_BATCH(dw5);
765 OUT_BATCH(dw6);
766 OUT_BATCH(0); /* No other programs */
767 OUT_BATCH(0); /* No other programs */
768 ADVANCE_BATCH();
769 }
770
771
772 static void
773 gen6_blorp_emit_constant_ps(struct brw_context *brw,
774 const brw_blorp_params *params,
775 uint32_t wm_push_const_offset)
776 {
777 struct intel_context *intel = &brw->intel;
778
779 /* Make sure the push constants fill an exact integer number of
780 * registers.
781 */
782 assert(sizeof(brw_blorp_wm_push_constants) % 32 == 0);
783
784 /* There must be at least one register worth of push constant data. */
785 assert(BRW_BLORP_NUM_PUSH_CONST_REGS > 0);
786
787 /* Enable push constant buffer 0. */
788 BEGIN_BATCH(5);
789 OUT_BATCH(_3DSTATE_CONSTANT_PS << 16 |
790 GEN6_CONSTANT_BUFFER_0_ENABLE |
791 (5 - 2));
792 OUT_BATCH(wm_push_const_offset + (BRW_BLORP_NUM_PUSH_CONST_REGS - 1));
793 OUT_BATCH(0);
794 OUT_BATCH(0);
795 OUT_BATCH(0);
796 ADVANCE_BATCH();
797 }
798
799 static void
800 gen6_blorp_emit_constant_ps_disable(struct brw_context *brw,
801 const brw_blorp_params *params)
802 {
803 struct intel_context *intel = &brw->intel;
804
805 /* Disable the push constant buffers. */
806 BEGIN_BATCH(5);
807 OUT_BATCH(_3DSTATE_CONSTANT_PS << 16 | (5 - 2));
808 OUT_BATCH(0);
809 OUT_BATCH(0);
810 OUT_BATCH(0);
811 OUT_BATCH(0);
812 ADVANCE_BATCH();
813 }
814
815 /**
816 * 3DSTATE_BINDING_TABLE_POINTERS
817 */
818 static void
819 gen6_blorp_emit_binding_table_pointers(struct brw_context *brw,
820 const brw_blorp_params *params,
821 uint32_t wm_bind_bo_offset)
822 {
823 struct intel_context *intel = &brw->intel;
824
825 BEGIN_BATCH(4);
826 OUT_BATCH(_3DSTATE_BINDING_TABLE_POINTERS << 16 |
827 GEN6_BINDING_TABLE_MODIFY_PS |
828 (4 - 2));
829 OUT_BATCH(0); /* vs -- ignored */
830 OUT_BATCH(0); /* gs -- ignored */
831 OUT_BATCH(wm_bind_bo_offset); /* wm/ps */
832 ADVANCE_BATCH();
833 }
834
835
836 static void
837 gen6_blorp_emit_depth_stencil_config(struct brw_context *brw,
838 const brw_blorp_params *params)
839 {
840 struct intel_context *intel = &brw->intel;
841 struct gl_context *ctx = &intel->ctx;
842 uint32_t draw_x = params->depth.x_offset;
843 uint32_t draw_y = params->depth.y_offset;
844 uint32_t tile_mask_x, tile_mask_y;
845
846 brw_get_depthstencil_tile_masks(params->depth.mt,
847 params->depth.level,
848 params->depth.layer,
849 NULL,
850 &tile_mask_x, &tile_mask_y);
851
852 /* 3DSTATE_DEPTH_BUFFER */
853 {
854 uint32_t tile_x = draw_x & tile_mask_x;
855 uint32_t tile_y = draw_y & tile_mask_y;
856 uint32_t offset =
857 intel_region_get_aligned_offset(params->depth.mt->region,
858 draw_x & ~tile_mask_x,
859 draw_y & ~tile_mask_y, false);
860
861 /* According to the Sandy Bridge PRM, volume 2 part 1, pp326-327
862 * (3DSTATE_DEPTH_BUFFER dw5), in the documentation for "Depth
863 * Coordinate Offset X/Y":
864 *
865 * "The 3 LSBs of both offsets must be zero to ensure correct
866 * alignment"
867 *
868 * We have no guarantee that tile_x and tile_y are correctly aligned,
869 * since they are determined by the mipmap layout, which is only aligned
870 * to multiples of 4.
871 *
872 * So, to avoid hanging the GPU, just smash the low order 3 bits of
873 * tile_x and tile_y to 0. This is a temporary workaround until we come
874 * up with a better solution.
875 */
876 WARN_ONCE((tile_x & 7) || (tile_y & 7),
877 "Depth/stencil buffer needs alignment to 8-pixel boundaries.\n"
878 "Truncating offset, bad rendering may occur.\n");
879 tile_x &= ~7;
880 tile_y &= ~7;
881
882 intel_emit_post_sync_nonzero_flush(intel);
883 intel_emit_depth_stall_flushes(intel);
884
885 BEGIN_BATCH(7);
886 OUT_BATCH(_3DSTATE_DEPTH_BUFFER << 16 | (7 - 2));
887 OUT_BATCH((params->depth.mt->region->pitch - 1) |
888 params->depth_format << 18 |
889 1 << 21 | /* separate stencil enable */
890 1 << 22 | /* hiz enable */
891 BRW_TILEWALK_YMAJOR << 26 |
892 1 << 27 | /* y-tiled */
893 BRW_SURFACE_2D << 29);
894 OUT_RELOC(params->depth.mt->region->bo,
895 I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
896 offset);
897 OUT_BATCH(BRW_SURFACE_MIPMAPLAYOUT_BELOW << 1 |
898 (params->depth.width + tile_x - 1) << 6 |
899 (params->depth.height + tile_y - 1) << 19);
900 OUT_BATCH(0);
901 OUT_BATCH(tile_x |
902 tile_y << 16);
903 OUT_BATCH(0);
904 ADVANCE_BATCH();
905 }
906
907 /* 3DSTATE_HIER_DEPTH_BUFFER */
908 {
909 struct intel_region *hiz_region = params->depth.mt->hiz_mt->region;
910 uint32_t hiz_offset =
911 intel_region_get_aligned_offset(hiz_region,
912 draw_x & ~tile_mask_x,
913 (draw_y & ~tile_mask_y) / 2, false);
914
915 BEGIN_BATCH(3);
916 OUT_BATCH((_3DSTATE_HIER_DEPTH_BUFFER << 16) | (3 - 2));
917 OUT_BATCH(hiz_region->pitch - 1);
918 OUT_RELOC(hiz_region->bo,
919 I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
920 hiz_offset);
921 ADVANCE_BATCH();
922 }
923
924 /* 3DSTATE_STENCIL_BUFFER */
925 {
926 BEGIN_BATCH(3);
927 OUT_BATCH((_3DSTATE_STENCIL_BUFFER << 16) | (3 - 2));
928 OUT_BATCH(0);
929 OUT_BATCH(0);
930 ADVANCE_BATCH();
931 }
932 }
933
934
935 static void
936 gen6_blorp_emit_depth_disable(struct brw_context *brw,
937 const brw_blorp_params *params)
938 {
939 struct intel_context *intel = &brw->intel;
940
941 BEGIN_BATCH(7);
942 OUT_BATCH(_3DSTATE_DEPTH_BUFFER << 16 | (7 - 2));
943 OUT_BATCH((BRW_DEPTHFORMAT_D32_FLOAT << 18) |
944 (BRW_SURFACE_NULL << 29));
945 OUT_BATCH(0);
946 OUT_BATCH(0);
947 OUT_BATCH(0);
948 OUT_BATCH(0);
949 OUT_BATCH(0);
950 ADVANCE_BATCH();
951 }
952
953
954 /* 3DSTATE_CLEAR_PARAMS
955 *
956 * From the Sandybridge PRM, Volume 2, Part 1, Section 3DSTATE_CLEAR_PARAMS:
957 * [DevSNB] 3DSTATE_CLEAR_PARAMS packet must follow the DEPTH_BUFFER_STATE
958 * packet when HiZ is enabled and the DEPTH_BUFFER_STATE changes.
959 */
960 static void
961 gen6_blorp_emit_clear_params(struct brw_context *brw,
962 const brw_blorp_params *params)
963 {
964 struct intel_context *intel = &brw->intel;
965
966 BEGIN_BATCH(2);
967 OUT_BATCH(_3DSTATE_CLEAR_PARAMS << 16 |
968 GEN5_DEPTH_CLEAR_VALID |
969 (2 - 2));
970 OUT_BATCH(params->depth.mt ? params->depth.mt->depth_clear_value : 0);
971 ADVANCE_BATCH();
972 }
973
974
975 /* 3DSTATE_DRAWING_RECTANGLE */
976 void
977 gen6_blorp_emit_drawing_rectangle(struct brw_context *brw,
978 const brw_blorp_params *params)
979 {
980 struct intel_context *intel = &brw->intel;
981
982 BEGIN_BATCH(4);
983 OUT_BATCH(_3DSTATE_DRAWING_RECTANGLE << 16 | (4 - 2));
984 OUT_BATCH(0);
985 OUT_BATCH(((params->x1 - 1) & 0xffff) |
986 ((params->y1 - 1) << 16));
987 OUT_BATCH(0);
988 ADVANCE_BATCH();
989 }
990
991 /* 3DSTATE_VIEWPORT_STATE_POINTERS */
992 void
993 gen6_blorp_emit_viewport_state(struct brw_context *brw,
994 const brw_blorp_params *params)
995 {
996 struct intel_context *intel = &brw->intel;
997 struct brw_cc_viewport *ccv;
998 uint32_t cc_vp_offset;
999
1000 ccv = (struct brw_cc_viewport *)brw_state_batch(brw, AUB_TRACE_CC_VP_STATE,
1001 sizeof(*ccv), 32,
1002 &cc_vp_offset);
1003
1004 ccv->min_depth = 0.0;
1005 ccv->max_depth = 1.0;
1006
1007 BEGIN_BATCH(4);
1008 OUT_BATCH(_3DSTATE_VIEWPORT_STATE_POINTERS << 16 | (4 - 2) |
1009 GEN6_CC_VIEWPORT_MODIFY);
1010 OUT_BATCH(0); /* clip VP */
1011 OUT_BATCH(0); /* SF VP */
1012 OUT_BATCH(cc_vp_offset);
1013 ADVANCE_BATCH();
1014 }
1015
1016
1017 /* 3DPRIMITIVE */
1018 static void
1019 gen6_blorp_emit_primitive(struct brw_context *brw,
1020 const brw_blorp_params *params)
1021 {
1022 struct intel_context *intel = &brw->intel;
1023
1024 BEGIN_BATCH(6);
1025 OUT_BATCH(CMD_3D_PRIM << 16 | (6 - 2) |
1026 _3DPRIM_RECTLIST << GEN4_3DPRIM_TOPOLOGY_TYPE_SHIFT |
1027 GEN4_3DPRIM_VERTEXBUFFER_ACCESS_SEQUENTIAL);
1028 OUT_BATCH(3); /* vertex count per instance */
1029 OUT_BATCH(0);
1030 OUT_BATCH(1); /* instance count */
1031 OUT_BATCH(0);
1032 OUT_BATCH(0);
1033 ADVANCE_BATCH();
1034 }
1035
1036
1037 /**
1038 * \brief Execute a blit or render pass operation.
1039 *
1040 * To execute the operation, this function manually constructs and emits a
1041 * batch to draw a rectangle primitive. The batchbuffer is flushed before
1042 * constructing and after emitting the batch.
1043 *
1044 * This function alters no GL state.
1045 */
1046 void
1047 gen6_blorp_exec(struct intel_context *intel,
1048 const brw_blorp_params *params)
1049 {
1050 struct gl_context *ctx = &intel->ctx;
1051 struct brw_context *brw = brw_context(ctx);
1052 brw_blorp_prog_data *prog_data = NULL;
1053 uint32_t cc_blend_state_offset = 0;
1054 uint32_t cc_state_offset = 0;
1055 uint32_t depthstencil_offset;
1056 uint32_t wm_push_const_offset = 0;
1057 uint32_t wm_bind_bo_offset = 0;
1058
1059 uint32_t prog_offset = params->get_wm_prog(brw, &prog_data);
1060 gen6_blorp_emit_batch_head(brw, params);
1061 gen6_emit_3dstate_multisample(brw, params->num_samples);
1062 gen6_emit_3dstate_sample_mask(brw, params->num_samples, 1.0, false, ~0u);
1063 gen6_blorp_emit_state_base_address(brw, params);
1064 gen6_blorp_emit_vertices(brw, params);
1065 gen6_blorp_emit_urb_config(brw, params);
1066 if (params->use_wm_prog) {
1067 cc_blend_state_offset = gen6_blorp_emit_blend_state(brw, params);
1068 cc_state_offset = gen6_blorp_emit_cc_state(brw, params);
1069 }
1070 depthstencil_offset = gen6_blorp_emit_depth_stencil_state(brw, params);
1071 gen6_blorp_emit_cc_state_pointers(brw, params, cc_blend_state_offset,
1072 depthstencil_offset, cc_state_offset);
1073 if (params->use_wm_prog) {
1074 uint32_t wm_surf_offset_renderbuffer;
1075 uint32_t wm_surf_offset_texture = 0;
1076 uint32_t sampler_offset;
1077 wm_push_const_offset = gen6_blorp_emit_wm_constants(brw, params);
1078 intel_miptree_used_for_rendering(params->dst.mt);
1079 wm_surf_offset_renderbuffer =
1080 gen6_blorp_emit_surface_state(brw, params, &params->dst,
1081 I915_GEM_DOMAIN_RENDER,
1082 I915_GEM_DOMAIN_RENDER);
1083 if (params->src.mt) {
1084 wm_surf_offset_texture =
1085 gen6_blorp_emit_surface_state(brw, params, &params->src,
1086 I915_GEM_DOMAIN_SAMPLER, 0);
1087 }
1088 wm_bind_bo_offset =
1089 gen6_blorp_emit_binding_table(brw, params,
1090 wm_surf_offset_renderbuffer,
1091 wm_surf_offset_texture);
1092 sampler_offset = gen6_blorp_emit_sampler_state(brw, params);
1093 gen6_blorp_emit_sampler_state_pointers(brw, params, sampler_offset);
1094 }
1095 gen6_blorp_emit_vs_disable(brw, params);
1096 gen6_blorp_emit_gs_disable(brw, params);
1097 gen6_blorp_emit_clip_disable(brw, params);
1098 gen6_blorp_emit_sf_config(brw, params);
1099 if (params->use_wm_prog)
1100 gen6_blorp_emit_constant_ps(brw, params, wm_push_const_offset);
1101 else
1102 gen6_blorp_emit_constant_ps_disable(brw, params);
1103 gen6_blorp_emit_wm_config(brw, params, prog_offset, prog_data);
1104 if (params->use_wm_prog)
1105 gen6_blorp_emit_binding_table_pointers(brw, params, wm_bind_bo_offset);
1106 gen6_blorp_emit_viewport_state(brw, params);
1107
1108 if (params->depth.mt)
1109 gen6_blorp_emit_depth_stencil_config(brw, params);
1110 else
1111 gen6_blorp_emit_depth_disable(brw, params);
1112 gen6_blorp_emit_clear_params(brw, params);
1113 gen6_blorp_emit_drawing_rectangle(brw, params);
1114 gen6_blorp_emit_primitive(brw, params);
1115 }
1116