@@ -918,12 +918,10 @@ gen8_emit_flush_coherentl3_wa(struct intel_engine_cs *engine, u32 *batch)
918
918
* batch ++ = i915_mmio_reg_offset (GEN8_L3SQCREG4 );
919
919
* batch ++ = 0x40400000 | GEN8_LQSC_FLUSH_COHERENT_LINES ;
920
920
921
- * batch ++ = GFX_OP_PIPE_CONTROL (6 );
922
- * batch ++ = PIPE_CONTROL_CS_STALL | PIPE_CONTROL_DC_FLUSH_ENABLE ;
923
- * batch ++ = 0 ;
924
- * batch ++ = 0 ;
925
- * batch ++ = 0 ;
926
- * batch ++ = 0 ;
921
+ batch = gen8_emit_pipe_control (batch ,
922
+ PIPE_CONTROL_CS_STALL |
923
+ PIPE_CONTROL_DC_FLUSH_ENABLE ,
924
+ 0 );
927
925
928
926
* batch ++ = MI_LOAD_REGISTER_MEM_GEN8 | MI_SRM_LRM_GLOBAL_GTT ;
929
927
* batch ++ = i915_mmio_reg_offset (GEN8_L3SQCREG4 );
@@ -957,15 +955,15 @@ static u32 *gen8_init_indirectctx_bb(struct intel_engine_cs *engine, u32 *batch)
957
955
if (IS_BROADWELL (engine -> i915 ))
958
956
batch = gen8_emit_flush_coherentl3_wa (engine , batch );
959
957
960
- * batch ++ = GFX_OP_PIPE_CONTROL (6 );
961
- * batch ++ = PIPE_CONTROL_FLUSH_L3 | PIPE_CONTROL_GLOBAL_GTT_IVB |
962
- PIPE_CONTROL_CS_STALL | PIPE_CONTROL_QW_WRITE ;
963
958
/* WaClearSlmSpaceAtContextSwitch:bdw,chv */
964
959
/* Actual scratch location is at 128 bytes offset */
965
- * batch ++ = i915_ggtt_offset (engine -> scratch ) + 2 * CACHELINE_BYTES ;
966
- * batch ++ = 0 ;
967
- * batch ++ = 0 ;
968
- * batch ++ = 0 ;
960
+ batch = gen8_emit_pipe_control (batch ,
961
+ PIPE_CONTROL_FLUSH_L3 |
962
+ PIPE_CONTROL_GLOBAL_GTT_IVB |
963
+ PIPE_CONTROL_CS_STALL |
964
+ PIPE_CONTROL_QW_WRITE ,
965
+ i915_ggtt_offset (engine -> scratch ) +
966
+ 2 * CACHELINE_BYTES );
969
967
970
968
/* Pad to end of cacheline */
971
969
while ((unsigned long )batch % CACHELINE_BYTES )
@@ -1013,14 +1011,13 @@ static u32 *gen9_init_indirectctx_bb(struct intel_engine_cs *engine, u32 *batch)
1013
1011
/* WaClearSlmSpaceAtContextSwitch:kbl */
1014
1012
/* Actual scratch location is at 128 bytes offset */
1015
1013
if (IS_KBL_REVID (engine -> i915 , 0 , KBL_REVID_A0 )) {
1016
- * batch ++ = GFX_OP_PIPE_CONTROL (6 );
1017
- * batch ++ = PIPE_CONTROL_FLUSH_L3 | PIPE_CONTROL_GLOBAL_GTT_IVB |
1018
- PIPE_CONTROL_CS_STALL | PIPE_CONTROL_QW_WRITE ;
1019
- * batch ++ = i915_ggtt_offset (engine -> scratch ) +
1020
- 2 * CACHELINE_BYTES ;
1021
- * batch ++ = 0 ;
1022
- * batch ++ = 0 ;
1023
- * batch ++ = 0 ;
1014
+ batch = gen8_emit_pipe_control (batch ,
1015
+ PIPE_CONTROL_FLUSH_L3 |
1016
+ PIPE_CONTROL_GLOBAL_GTT_IVB |
1017
+ PIPE_CONTROL_CS_STALL |
1018
+ PIPE_CONTROL_QW_WRITE ,
1019
+ i915_ggtt_offset (engine -> scratch )
1020
+ + 2 * CACHELINE_BYTES );
1024
1021
}
1025
1022
1026
1023
/* WaMediaPoolStateCmdInWABB:bxt,glk */
@@ -1456,39 +1453,17 @@ static int gen8_emit_flush_render(struct drm_i915_gem_request *request,
1456
1453
if (IS_ERR (cs ))
1457
1454
return PTR_ERR (cs );
1458
1455
1459
- if (vf_flush_wa ) {
1460
- * cs ++ = GFX_OP_PIPE_CONTROL (6 );
1461
- * cs ++ = 0 ;
1462
- * cs ++ = 0 ;
1463
- * cs ++ = 0 ;
1464
- * cs ++ = 0 ;
1465
- * cs ++ = 0 ;
1466
- }
1456
+ if (vf_flush_wa )
1457
+ cs = gen8_emit_pipe_control (cs , 0 , 0 );
1467
1458
1468
- if (dc_flush_wa ) {
1469
- * cs ++ = GFX_OP_PIPE_CONTROL (6 );
1470
- * cs ++ = PIPE_CONTROL_DC_FLUSH_ENABLE ;
1471
- * cs ++ = 0 ;
1472
- * cs ++ = 0 ;
1473
- * cs ++ = 0 ;
1474
- * cs ++ = 0 ;
1475
- }
1459
+ if (dc_flush_wa )
1460
+ cs = gen8_emit_pipe_control (cs , PIPE_CONTROL_DC_FLUSH_ENABLE ,
1461
+ 0 );
1476
1462
1477
- * cs ++ = GFX_OP_PIPE_CONTROL (6 );
1478
- * cs ++ = flags ;
1479
- * cs ++ = scratch_addr ;
1480
- * cs ++ = 0 ;
1481
- * cs ++ = 0 ;
1482
- * cs ++ = 0 ;
1463
+ cs = gen8_emit_pipe_control (cs , flags , scratch_addr );
1483
1464
1484
- if (dc_flush_wa ) {
1485
- * cs ++ = GFX_OP_PIPE_CONTROL (6 );
1486
- * cs ++ = PIPE_CONTROL_CS_STALL ;
1487
- * cs ++ = 0 ;
1488
- * cs ++ = 0 ;
1489
- * cs ++ = 0 ;
1490
- * cs ++ = 0 ;
1491
- }
1465
+ if (dc_flush_wa )
1466
+ cs = gen8_emit_pipe_control (cs , PIPE_CONTROL_CS_STALL , 0 );
1492
1467
1493
1468
intel_ring_advance (request , cs );
1494
1469
0 commit comments