drivers/gpu/drm/loongson/lsdc_plane.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/loongson/lsdc_plane.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/loongson/lsdc_plane.c- Extension
.c- Size
- 22215 bytes
- Lines
- 795
- 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/delay.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_framebuffer.hdrm/drm_gem_atomic_helper.hdrm/drm_print.hlsdc_drv.hlsdc_regs.hlsdc_ttm.h
Detected Declarations
function lsdc_get_fb_offsetfunction lsdc_fb_base_addrfunction lsdc_primary_atomic_checkfunction lsdc_primary_atomic_updatefunction lsdc_primary_atomic_disablefunction lsdc_plane_prepare_fbfunction lsdc_plane_cleanup_fbfunction lsdc_cursor_plane_atomic_async_checkfunction lsdc_cursor_plane_atomic_async_updatefunction ls7a1000_cursor_plane_atomic_checkfunction ls7a1000_cursor_plane_atomic_updatefunction ls7a1000_cursor_plane_atomic_disablefunction ls7a2000_cursor_plane_atomic_checkfunction ls7a2000_cursor_plane_atomic_updatefunction ls7a2000_cursor_plane_atomic_disablefunction lsdc_plane_atomic_print_statefunction lsdc_primary0_update_fb_addrfunction lsdc_primary0_update_fb_stridefunction lsdc_primary0_update_fb_formatfunction lsdc_primary1_update_fb_addrfunction lsdc_primary1_update_fb_stridefunction lsdc_primary1_update_fb_formatfunction lsdc_cursor0_update_bo_addrfunction lsdc_cursor0_update_positionfunction lsdc_cursor0_update_cfgfunction lsdc_cursor1_update_bo_addrfunction lsdc_cursor1_update_positionfunction lsdc_cursor1_update_cfgfunction lsdc_cursor1_update_bo_addr_quirkfunction lsdc_cursor1_update_position_quirkfunction lsdc_cursor1_update_cfg_quirkfunction lsdc_primary_plane_initfunction ls7a1000_cursor_plane_initfunction ls7a2000_cursor_plane_init
Annotated Snippet
switch (new_state->crtc_w) {
case 64:
cursor_size = CURSOR_SIZE_64X64;
break;
case 32:
cursor_size = CURSOR_SIZE_32X32;
break;
default:
cursor_size = CURSOR_SIZE_32X32;
break;
}
ops->update_position(cursor, new_state->crtc_x, new_state->crtc_y);
ops->update_cfg(cursor, cursor_size, CURSOR_FORMAT_ARGB8888);
if (!old_fb || old_fb != new_fb)
ops->update_bo_addr(cursor, lsdc_fb_base_addr(new_fb));
}
}
/* ls7a1000 cursor plane helpers */
static int ls7a1000_cursor_plane_atomic_check(struct drm_plane *plane,
struct drm_atomic_commit *state)
{
struct drm_plane_state *new_plane_state;
struct drm_crtc_state *new_crtc_state;
struct drm_crtc *crtc;
new_plane_state = drm_atomic_get_new_plane_state(state, plane);
crtc = new_plane_state->crtc;
if (!crtc) {
drm_dbg(plane->dev, "%s is not bind to a crtc\n", plane->name);
return 0;
}
if (new_plane_state->crtc_w != 32 || new_plane_state->crtc_h != 32) {
drm_dbg(plane->dev, "unsupported cursor size: %ux%u\n",
new_plane_state->crtc_w, new_plane_state->crtc_h);
return -EINVAL;
}
new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
return drm_atomic_helper_check_plane_state(new_plane_state,
new_crtc_state,
DRM_PLANE_NO_SCALING,
DRM_PLANE_NO_SCALING,
true, true);
}
static void ls7a1000_cursor_plane_atomic_update(struct drm_plane *plane,
struct drm_atomic_commit *state)
{
struct lsdc_cursor *cursor = to_lsdc_cursor(plane);
struct drm_plane_state *old_plane_state = drm_atomic_get_old_plane_state(state, plane);
struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state, plane);
struct drm_framebuffer *new_fb = new_plane_state->fb;
struct drm_framebuffer *old_fb = old_plane_state->fb;
const struct lsdc_cursor_plane_ops *ops = cursor->ops;
u64 addr = lsdc_fb_base_addr(new_fb);
if (!new_plane_state->visible)
return;
ops->update_position(cursor, new_plane_state->crtc_x, new_plane_state->crtc_y);
if (!old_fb || old_fb != new_fb)
ops->update_bo_addr(cursor, addr);
ops->update_cfg(cursor, CURSOR_SIZE_32X32, CURSOR_FORMAT_ARGB8888);
}
static void ls7a1000_cursor_plane_atomic_disable(struct drm_plane *plane,
struct drm_atomic_commit *state)
{
struct lsdc_cursor *cursor = to_lsdc_cursor(plane);
const struct lsdc_cursor_plane_ops *ops = cursor->ops;
ops->update_cfg(cursor, CURSOR_SIZE_32X32, CURSOR_FORMAT_DISABLE);
}
static const struct drm_plane_helper_funcs ls7a1000_cursor_plane_helper_funcs = {
.prepare_fb = lsdc_plane_prepare_fb,
.cleanup_fb = lsdc_plane_cleanup_fb,
.atomic_check = ls7a1000_cursor_plane_atomic_check,
.atomic_update = ls7a1000_cursor_plane_atomic_update,
.atomic_disable = ls7a1000_cursor_plane_atomic_disable,
Annotation
- Immediate include surface: `linux/delay.h`, `drm/drm_atomic.h`, `drm/drm_atomic_helper.h`, `drm/drm_framebuffer.h`, `drm/drm_gem_atomic_helper.h`, `drm/drm_print.h`, `lsdc_drv.h`, `lsdc_regs.h`.
- Detected declarations: `function lsdc_get_fb_offset`, `function lsdc_fb_base_addr`, `function lsdc_primary_atomic_check`, `function lsdc_primary_atomic_update`, `function lsdc_primary_atomic_disable`, `function lsdc_plane_prepare_fb`, `function lsdc_plane_cleanup_fb`, `function lsdc_cursor_plane_atomic_async_check`, `function lsdc_cursor_plane_atomic_async_update`, `function ls7a1000_cursor_plane_atomic_check`.
- 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.