drivers/gpu/drm/i915/display/intel_cursor.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/display/intel_cursor.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/display/intel_cursor.c- Extension
.c- Size
- 32749 bytes
- Lines
- 1116
- 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
linux/kernel.hdrm/drm_atomic_helper.hdrm/drm_atomic_uapi.hdrm/drm_blend.hdrm/drm_damage_helper.hdrm/drm_fourcc.hdrm/drm_print.hdrm/drm_vblank.hintel_atomic.hintel_cursor.hintel_cursor_regs.hintel_de.hintel_display.hintel_display_types.hintel_display_utils.hintel_display_wa.hintel_fb.hintel_frontbuffer.hintel_plane.hintel_psr.hintel_psr_regs.hintel_vblank.hskl_watermark.h
Detected Declarations
function intel_cursor_surf_offsetfunction intel_cursor_positionfunction intel_cursor_size_okfunction intel_cursor_check_surfacefunction intel_check_cursorfunction i845_cursor_max_stridefunction i845_cursor_min_alignmentfunction i845_cursor_ctl_crtcfunction i845_cursor_ctlfunction i845_cursor_size_okfunction i845_check_cursorfunction i845_cursor_update_armfunction i845_cursor_disable_armfunction i845_cursor_get_hw_statefunction i9xx_cursor_max_stridefunction i830_cursor_min_alignmentfunction i85x_cursor_min_alignmentfunction i9xx_cursor_min_alignmentfunction i9xx_cursor_ctl_crtcfunction i9xx_cursor_ctlfunction i9xx_cursor_size_okfunction i9xx_check_cursorfunction pipefunction i9xx_cursor_disable_sel_fetch_armfunction wa_16021440873function i9xx_cursor_update_sel_fetch_armfunction skl_cursor_ddb_reg_valfunction skl_cursor_wm_reg_valfunction skl_write_cursor_wmfunction i9xx_cursor_update_armfunction i9xx_cursor_disable_armfunction i9xx_cursor_get_hw_statefunction g4x_cursor_capture_errorfunction i9xx_cursor_capture_errorfunction intel_cursor_format_mod_supportedfunction intel_cursor_unpin_workfunction intel_legacy_cursor_updatefunction intel_cursor_add_size_hints_propertyfunction intel_cursor_plane_createfunction intel_cursor_mode_config_init
Annotated Snippet
drm_rect_width(&plane_state->uapi.dst) * fb->format->cpp[0]) {
drm_dbg_kms(display->drm,
"[PLANE:%d:%s] invalid cursor stride (%u) (cursor width %d)\n",
plane->base.base.id, plane->base.name,
fb->pitches[0], drm_rect_width(&plane_state->uapi.dst));
return -EINVAL;
}
/*
* There's something wrong with the cursor on CHV pipe C.
* If it straddles the left edge of the screen then
* moving it away from the edge or disabling it often
* results in a pipe underrun, and often that can lead to
* dead pipe (constant underrun reported, and it scans
* out just a solid color). To recover from that, the
* display power well must be turned off and on again.
* Refuse the put the cursor into that compromised position.
*/
if (display->platform.cherryview && pipe == PIPE_C &&
plane_state->uapi.visible && plane_state->uapi.dst.x1 < 0) {
drm_dbg_kms(display->drm,
"[PLANE:%d:%s] cursor not allowed to straddle the left screen edge\n",
plane->base.base.id, plane->base.name);
return -EINVAL;
}
plane_state->ctl = i9xx_cursor_ctl(plane_state);
return 0;
}
static void i9xx_cursor_disable_sel_fetch_arm(struct intel_dsb *dsb,
struct intel_plane *plane,
const struct intel_crtc_state *crtc_state)
{
struct intel_display *display = to_intel_display(plane);
enum pipe pipe = plane->pipe;
if (!crtc_state->enable_psr2_sel_fetch)
return;
intel_de_write_dsb(display, dsb, SEL_FETCH_CUR_CTL(pipe), 0);
}
static void wa_16021440873(struct intel_dsb *dsb,
struct intel_plane *plane,
const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state)
{
struct intel_display *display = to_intel_display(plane);
u32 ctl = plane_state->ctl;
int et_y_position = drm_rect_height(&crtc_state->pipe_src) + 1;
enum pipe pipe = plane->pipe;
ctl &= ~MCURSOR_MODE_MASK;
ctl |= MCURSOR_MODE_64_2B;
intel_de_write_dsb(display, dsb, SEL_FETCH_CUR_CTL(pipe), ctl);
intel_de_write_dsb(display, dsb, CURPOS_ERLY_TPT(display, pipe),
CURSOR_POS_Y(et_y_position));
}
static void i9xx_cursor_update_sel_fetch_arm(struct intel_dsb *dsb,
struct intel_plane *plane,
const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state)
{
struct intel_display *display = to_intel_display(plane);
enum pipe pipe = plane->pipe;
if (!crtc_state->enable_psr2_sel_fetch)
return;
if (drm_rect_height(&plane_state->psr2_sel_fetch_area) > 0) {
if (crtc_state->enable_psr2_su_region_et) {
u32 val = intel_cursor_position(crtc_state, plane_state,
true);
intel_de_write_dsb(display, dsb, CURPOS_ERLY_TPT(display, pipe), val);
}
intel_de_write_dsb(display, dsb, SEL_FETCH_CUR_CTL(pipe), plane_state->ctl);
} else {
/* Wa_16021440873 */
if (crtc_state->enable_psr2_su_region_et)
wa_16021440873(dsb, plane, crtc_state, plane_state);
else
i9xx_cursor_disable_sel_fetch_arm(dsb, plane, crtc_state);
}
Annotation
- Immediate include surface: `linux/kernel.h`, `drm/drm_atomic_helper.h`, `drm/drm_atomic_uapi.h`, `drm/drm_blend.h`, `drm/drm_damage_helper.h`, `drm/drm_fourcc.h`, `drm/drm_print.h`, `drm/drm_vblank.h`.
- Detected declarations: `function intel_cursor_surf_offset`, `function intel_cursor_position`, `function intel_cursor_size_ok`, `function intel_cursor_check_surface`, `function intel_check_cursor`, `function i845_cursor_max_stride`, `function i845_cursor_min_alignment`, `function i845_cursor_ctl_crtc`, `function i845_cursor_ctl`, `function i845_cursor_size_ok`.
- 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.