drivers/gpu/drm/i915/gt/gen7_renderclear.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/gen7_renderclear.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/gen7_renderclear.c- Extension
.c- Size
- 10746 bytes
- Lines
- 455
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
gen7_renderclear.hi915_drv.hintel_gpu_commands.hintel_gt_regs.hivb_clear_kernel.chsw_clear_kernel.c
Detected Declarations
struct cb_kernelstruct batch_chunkstruct batch_valsfunction num_primitivesfunction batch_get_defaultsfunction batch_initfunction batch_offsetfunction batch_addrfunction batch_addfunction gen7_fill_surface_statefunction gen7_fill_binding_tablefunction gen7_fill_kernel_datafunction gen7_fill_interface_descriptorfunction gen7_emit_state_base_addressfunction gen7_emit_vfe_statefunction gen7_emit_interface_descriptor_loadfunction gen7_emit_media_objectfunction gen7_emit_pipeline_flushfunction gen7_emit_pipeline_invalidatefunction emit_batchfunction gen7_setup_clear_gpr_bb
Annotated Snippet
struct cb_kernel {
const void *data;
u32 size;
};
#define CB_KERNEL(name) { .data = (name), .size = sizeof(name) }
#include "ivb_clear_kernel.c"
static const struct cb_kernel cb_kernel_ivb = CB_KERNEL(ivb_clear_kernel);
#include "hsw_clear_kernel.c"
static const struct cb_kernel cb_kernel_hsw = CB_KERNEL(hsw_clear_kernel);
struct batch_chunk {
struct i915_vma *vma;
u32 offset;
u32 *start;
u32 *end;
u32 max_items;
};
struct batch_vals {
u32 max_threads;
u32 state_start;
u32 surface_start;
u32 surface_height;
u32 surface_width;
u32 size;
};
static int num_primitives(const struct batch_vals *bv)
{
/*
* We need to saturate the GPU with work in order to dispatch
* a shader on every HW thread, and clear the thread-local registers.
* In short, we have to dispatch work faster than the shaders can
* run in order to fill the EU and occupy each HW thread.
*/
return bv->max_threads;
}
static void
batch_get_defaults(struct drm_i915_private *i915, struct batch_vals *bv)
{
if (IS_HASWELL(i915)) {
switch (INTEL_INFO(i915)->gt) {
default:
case 1:
bv->max_threads = 70;
break;
case 2:
bv->max_threads = 140;
break;
case 3:
bv->max_threads = 280;
break;
}
bv->surface_height = 16 * 16;
bv->surface_width = 32 * 2 * 16;
} else {
switch (INTEL_INFO(i915)->gt) {
default:
case 1: /* including vlv */
bv->max_threads = 36;
break;
case 2:
bv->max_threads = 128;
break;
}
bv->surface_height = 16 * 8;
bv->surface_width = 32 * 16;
}
bv->state_start = round_up(SZ_1K + num_primitives(bv) * 64, SZ_4K);
bv->surface_start = bv->state_start + SZ_4K;
bv->size = bv->surface_start + bv->surface_height * bv->surface_width;
}
static void batch_init(struct batch_chunk *bc,
struct i915_vma *vma,
u32 *start, u32 offset, u32 max_bytes)
{
bc->vma = vma;
bc->offset = offset;
bc->start = start + bc->offset / sizeof(*bc->start);
bc->end = bc->start;
bc->max_items = max_bytes / sizeof(*bc->start);
}
static u32 batch_offset(const struct batch_chunk *bc, u32 *cs)
{
Annotation
- Immediate include surface: `gen7_renderclear.h`, `i915_drv.h`, `intel_gpu_commands.h`, `intel_gt_regs.h`, `ivb_clear_kernel.c`, `hsw_clear_kernel.c`.
- Detected declarations: `struct cb_kernel`, `struct batch_chunk`, `struct batch_vals`, `function num_primitives`, `function batch_get_defaults`, `function batch_init`, `function batch_offset`, `function batch_addr`, `function batch_add`, `function gen7_fill_surface_state`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.