drivers/gpu/drm/i915/i915_overlay.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/i915_overlay.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/i915_overlay.c- Extension
.c- Size
- 12408 bytes
- Lines
- 524
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
drm/drm_print.hdrm/intel/display_parent_interface.hdrm/intel/intel_gmd_interrupt_regs.hdrm/intel/pci_config.hgem/i915_gem_internal.hgem/i915_gem_object_frontbuffer.hgem/i915_gem_pm.hgt/intel_gpu_commands.hgt/intel_ring.hi915_drv.hi915_overlay.hi915_reg.hdisplay/intel_frontbuffer.h
Detected Declarations
struct i915_overlayfunction i830_overlay_clock_gatingfunction alloc_requestfunction i915_overlay_is_activefunction i915_overlay_onfunction i915_overlay_flip_preparefunction i915_overlay_continuefunction i915_overlay_release_old_vmafunction i915_overlay_release_old_vid_tailfunction i915_overlay_off_tailfunction i915_overlay_last_flip_retirefunction i915_overlay_offfunction i915_overlay_recover_from_interruptfunction intel_overlay_function i915_overlay_resetfunction i915_overlay_unpin_fbfunction i915_overlay_obj_lookupfunction get_registersfunction i915_overlay_cleanup
Annotated Snippet
struct i915_overlay {
struct drm_i915_private *i915;
struct intel_context *context;
struct i915_vma *vma;
struct i915_vma *old_vma;
struct i915_frontbuffer *frontbuffer;
/* register access */
struct drm_i915_gem_object *reg_bo;
void __iomem *regs;
u32 flip_addr;
u32 frontbuffer_bits;
/* flip handling */
struct i915_active last_flip;
void (*flip_complete)(struct i915_overlay *overlay);
};
static void i830_overlay_clock_gating(struct drm_i915_private *i915,
bool enable)
{
struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
u8 val;
/*
* WA_OVERLAY_CLKGATE:alm
*
* FIXME should perhaps be done on the display side?
*/
if (enable)
intel_uncore_write(&i915->uncore, DSPCLK_GATE_D, 0);
else
intel_uncore_write(&i915->uncore, DSPCLK_GATE_D, OVRUNIT_CLOCK_GATE_DISABLE);
/* WA_DISABLE_L2CACHE_CLOCK_GATING:alm */
pci_bus_read_config_byte(pdev->bus,
PCI_DEVFN(0, 0), I830_CLOCK_GATE, &val);
if (enable)
val &= ~I830_L2_CACHE_CLOCK_GATE_DISABLE;
else
val |= I830_L2_CACHE_CLOCK_GATE_DISABLE;
pci_bus_write_config_byte(pdev->bus,
PCI_DEVFN(0, 0), I830_CLOCK_GATE, val);
}
static struct i915_request *
alloc_request(struct i915_overlay *overlay, void (*fn)(struct i915_overlay *))
{
struct i915_request *rq;
int err;
overlay->flip_complete = fn;
rq = i915_request_create(overlay->context);
if (IS_ERR(rq))
return rq;
err = i915_active_add_request(&overlay->last_flip, rq);
if (err) {
i915_request_add(rq);
return ERR_PTR(err);
}
return rq;
}
static bool i915_overlay_is_active(struct drm_device *drm)
{
struct drm_i915_private *i915 = to_i915(drm);
struct i915_overlay *overlay = i915->overlay;
return overlay->frontbuffer_bits;
}
/* overlay needs to be disable in OCMD reg */
static int i915_overlay_on(struct drm_device *drm,
u32 frontbuffer_bits)
{
struct drm_i915_private *i915 = to_i915(drm);
struct i915_overlay *overlay = i915->overlay;
struct i915_request *rq;
u32 *cs;
drm_WARN_ON(drm, i915_overlay_is_active(drm));
rq = alloc_request(overlay, NULL);
if (IS_ERR(rq))
return PTR_ERR(rq);
cs = intel_ring_begin(rq, 4);
if (IS_ERR(cs)) {
i915_request_add(rq);
Annotation
- Immediate include surface: `drm/drm_print.h`, `drm/intel/display_parent_interface.h`, `drm/intel/intel_gmd_interrupt_regs.h`, `drm/intel/pci_config.h`, `gem/i915_gem_internal.h`, `gem/i915_gem_object_frontbuffer.h`, `gem/i915_gem_pm.h`, `gt/intel_gpu_commands.h`.
- Detected declarations: `struct i915_overlay`, `function i830_overlay_clock_gating`, `function alloc_request`, `function i915_overlay_is_active`, `function i915_overlay_on`, `function i915_overlay_flip_prepare`, `function i915_overlay_continue`, `function i915_overlay_release_old_vma`, `function i915_overlay_release_old_vid_tail`, `function i915_overlay_off_tail`.
- 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.