drivers/gpu/drm/i915/gt/intel_lrc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/intel_lrc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/intel_lrc.c- Extension
.c- Size
- 46345 bytes
- Lines
- 1976
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
drm/drm_print.hgem/i915_gem_lmem.hgen8_engine_cs.hi915_drv.hi915_perf.hi915_reg.hintel_context.hintel_engine.hintel_engine_regs.hintel_gpu_commands.hintel_gt.hintel_gt_regs.hintel_lrc.hintel_lrc_reg.hintel_ring.hshmem_utils.hselftest_lrc.c
Detected Declarations
struct lrifunction lrc_ring_mi_modefunction lrc_ring_bb_offsetfunction lrc_ring_gpr0function lrc_ring_wa_bb_per_ctxfunction lrc_ring_indirect_ptrfunction lrc_ring_indirect_offsetfunction lrc_ring_cmd_buf_cctlfunction lrc_ring_indirect_offset_defaultfunction lrc_setup_bb_per_ctxfunction lrc_setup_indirect_ctxfunction ctx_needs_runalonefunction init_common_regsfunction init_wa_bb_regsfunction init_ppgtt_regsfunction __reset_stop_ringfunction __lrc_init_regsfunction lrc_init_regsfunction lrc_reset_regsfunction set_redzonefunction check_redzonefunction context_wa_bb_offsetfunction lrc_init_statefunction lrc_indirect_bbfunction __lrc_alloc_statefunction pinned_timelinefunction lrc_allocfunction lrc_resetfunction lrc_pre_pinfunction lrc_pinfunction lrc_unpinfunction lrc_post_unpinfunction lrc_finifunction lrc_destroyfunction gen12_emit_timestamp_wafunction gen12_emit_restore_scratchfunction gen12_emit_cmd_buf_wafunction dg2_emit_draw_watermark_settingfunction gen12_invalidate_state_cachefunction gen12_emit_indirect_ctx_rcsfunction gen12_emit_indirect_ctx_xcsfunction xehp_emit_per_ctx_bbfunction setup_per_ctx_bbfunction setup_indirect_ctx_bbfunction lrc_descriptorfunction lrc_update_regsfunction lrc_update_offsetsfunction lrc_check_regs
Annotated Snippet
struct lri {
i915_reg_t reg;
u32 value;
};
static u32 *emit_lri(u32 *batch, const struct lri *lri, unsigned int count)
{
GEM_BUG_ON(!count || count > 63);
*batch++ = MI_LOAD_REGISTER_IMM(count);
do {
*batch++ = i915_mmio_reg_offset(lri->reg);
*batch++ = lri->value;
} while (lri++, --count);
*batch++ = MI_NOOP;
return batch;
}
static u32 *gen9_init_indirectctx_bb(struct intel_engine_cs *engine, u32 *batch)
{
static const struct lri lri[] = {
/* WaDisableGatherAtSetShaderCommonSlice:skl,bxt,kbl,glk */
{
COMMON_SLICE_CHICKEN2,
REG_MASKED_FIELD_DISABLE(GEN9_DISABLE_GATHER_AT_SET_SHADER_COMMON_SLICE),
},
/* BSpec: 11391 */
{
FF_SLICE_CHICKEN,
REG_MASKED_FIELD_ENABLE(FF_SLICE_CHICKEN_CL_PROVOKING_VERTEX_FIX),
},
/* BSpec: 11299 */
{
_3D_CHICKEN3,
REG_MASKED_FIELD_ENABLE(_3D_CHICKEN_SF_PROVOKING_VERTEX_FIX),
}
};
*batch++ = MI_ARB_ON_OFF | MI_ARB_DISABLE;
/* WaFlushCoherentL3CacheLinesAtContextSwitch:skl,bxt,glk */
batch = gen8_emit_flush_coherentl3_wa(engine, batch);
/* WaClearSlmSpaceAtContextSwitch:skl,bxt,kbl,glk,cfl */
batch = gen8_emit_pipe_control(batch,
PIPE_CONTROL_FLUSH_L3 |
PIPE_CONTROL_STORE_DATA_INDEX |
PIPE_CONTROL_CS_STALL |
PIPE_CONTROL_QW_WRITE,
LRC_PPHWSP_SCRATCH_ADDR);
batch = emit_lri(batch, lri, ARRAY_SIZE(lri));
/* WaMediaPoolStateCmdInWABB:bxt,glk */
if (HAS_POOLED_EU(engine->i915)) {
/*
* EU pool configuration is setup along with golden context
* during context initialization. This value depends on
* device type (2x6 or 3x6) and needs to be updated based
* on which subslice is disabled especially for 2x6
* devices, however it is safe to load default
* configuration of 3x6 device instead of masking off
* corresponding bits because HW ignores bits of a disabled
* subslice and drops down to appropriate config. Please
* see render_state_setup() in i915_gem_render_state.c for
* possible configurations, to avoid duplication they are
* not shown here again.
*/
*batch++ = GEN9_MEDIA_POOL_STATE;
*batch++ = GEN9_MEDIA_POOL_ENABLE;
*batch++ = 0x00777000;
*batch++ = 0;
*batch++ = 0;
*batch++ = 0;
}
*batch++ = MI_ARB_ON_OFF | MI_ARB_ENABLE;
/* Pad to end of cacheline */
while ((unsigned long)batch % CACHELINE_BYTES)
*batch++ = MI_NOOP;
return batch;
}
#define CTX_WA_BB_SIZE (PAGE_SIZE)
Annotation
- Immediate include surface: `drm/drm_print.h`, `gem/i915_gem_lmem.h`, `gen8_engine_cs.h`, `i915_drv.h`, `i915_perf.h`, `i915_reg.h`, `intel_context.h`, `intel_engine.h`.
- Detected declarations: `struct lri`, `function lrc_ring_mi_mode`, `function lrc_ring_bb_offset`, `function lrc_ring_gpr0`, `function lrc_ring_wa_bb_per_ctx`, `function lrc_ring_indirect_ptr`, `function lrc_ring_indirect_offset`, `function lrc_ring_cmd_buf_cctl`, `function lrc_ring_indirect_offset_default`, `function lrc_setup_bb_per_ctx`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.