Skip to content

Commit 306bb61

Browse files
icklerodrigovivi
authored andcommitted
drm/i915/gt: Expose more parameters for emitting writes into the ring
Add another lower level to emit_ggtt_write so that the GGTT nature of the write is not hardcoded into the emitter. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20201102221057.29626-1-chris@chris-wilson.co.uk (cherry picked from commit 2739d8cfc50aafff49d599cc0a5bc855445e99a7) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent d9a57c8 commit 306bb61

1 file changed

Lines changed: 35 additions & 20 deletions

File tree

drivers/gpu/drm/i915/gt/intel_engine.h

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -245,36 +245,53 @@ static inline u32 *gen12_emit_pipe_control(u32 *batch, u32 flags0, u32 flags1, u
245245
}
246246

247247
static inline u32 *
248-
__gen8_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags0, u32 flags1)
248+
__gen8_emit_write_rcs(u32 *cs, u32 value, u32 offset, u32 flags0, u32 flags1)
249249
{
250-
/* We're using qword write, offset should be aligned to 8 bytes. */
251-
GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8));
252-
253-
/* w/a for post sync ops following a GPGPU operation we
254-
* need a prior CS_STALL, which is emitted by the flush
255-
* following the batch.
256-
*/
257250
*cs++ = GFX_OP_PIPE_CONTROL(6) | flags0;
258-
*cs++ = flags1 | PIPE_CONTROL_QW_WRITE | PIPE_CONTROL_GLOBAL_GTT_IVB;
259-
*cs++ = gtt_offset;
251+
*cs++ = flags1 | PIPE_CONTROL_QW_WRITE;
252+
*cs++ = offset;
260253
*cs++ = 0;
261254
*cs++ = value;
262-
/* We're thrashing one dword of HWS. */
263-
*cs++ = 0;
255+
*cs++ = 0; /* We're thrashing one extra dword. */
264256

265257
return cs;
266258
}
267259

268260
static inline u32*
269261
gen8_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags)
270262
{
271-
return __gen8_emit_ggtt_write_rcs(cs, value, gtt_offset, 0, flags);
263+
/* We're using qword write, offset should be aligned to 8 bytes. */
264+
GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8));
265+
266+
return __gen8_emit_write_rcs(cs,
267+
value,
268+
gtt_offset,
269+
0,
270+
flags | PIPE_CONTROL_GLOBAL_GTT_IVB);
272271
}
273272

274273
static inline u32*
275274
gen12_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags0, u32 flags1)
276275
{
277-
return __gen8_emit_ggtt_write_rcs(cs, value, gtt_offset, flags0, flags1);
276+
/* We're using qword write, offset should be aligned to 8 bytes. */
277+
GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8));
278+
279+
return __gen8_emit_write_rcs(cs,
280+
value,
281+
gtt_offset,
282+
flags0,
283+
flags1 | PIPE_CONTROL_GLOBAL_GTT_IVB);
284+
}
285+
286+
static inline u32 *
287+
__gen8_emit_flush_dw(u32 *cs, u32 value, u32 gtt_offset, u32 flags)
288+
{
289+
*cs++ = (MI_FLUSH_DW + 1) | flags;
290+
*cs++ = gtt_offset;
291+
*cs++ = 0;
292+
*cs++ = value;
293+
294+
return cs;
278295
}
279296

280297
static inline u32 *
@@ -285,12 +302,10 @@ gen8_emit_ggtt_write(u32 *cs, u32 value, u32 gtt_offset, u32 flags)
285302
/* Offset should be aligned to 8 bytes for both (QW/DW) write types */
286303
GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8));
287304

288-
*cs++ = (MI_FLUSH_DW + 1) | MI_FLUSH_DW_OP_STOREDW | flags;
289-
*cs++ = gtt_offset | MI_FLUSH_DW_USE_GTT;
290-
*cs++ = 0;
291-
*cs++ = value;
292-
293-
return cs;
305+
return __gen8_emit_flush_dw(cs,
306+
value,
307+
gtt_offset | MI_FLUSH_DW_USE_GTT,
308+
flags | MI_FLUSH_DW_OP_STOREDW);
294309
}
295310

296311
static inline void __intel_engine_reset(struct intel_engine_cs *engine,

0 commit comments

Comments
 (0)