drivers/gpu/drm/drm_plane_helper.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/drm_plane_helper.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/drm_plane_helper.c- Extension
.c- Size
- 8561 bytes
- Lines
- 282
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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
linux/export.hlinux/list.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_atomic_uapi.hdrm/drm_device.hdrm/drm_drv.hdrm/drm_encoder.hdrm/drm_plane_helper.hdrm/drm_print.hdrm/drm_rect.h
Detected Declarations
function Copyrightfunction drm_plane_helper_check_updatefunction drm_plane_helper_update_primaryfunction drm_plane_helper_disable_primaryfunction drm_plane_helper_destroyexport drm_plane_helper_update_primaryexport drm_plane_helper_disable_primaryexport drm_plane_helper_destroy
Annotated Snippet
if (connector->encoder && connector->encoder->crtc == crtc) {
if (connector_list != NULL && count < num_connectors)
*(connector_list++) = connector;
count++;
}
}
drm_connector_list_iter_end(&conn_iter);
return count;
}
static int drm_plane_helper_check_update(struct drm_plane *plane,
struct drm_crtc *crtc,
struct drm_framebuffer *fb,
struct drm_rect *src,
struct drm_rect *dst,
unsigned int rotation,
int min_scale,
int max_scale,
bool can_position,
bool can_update_disabled,
bool *visible)
{
struct drm_plane_state plane_state = {
.plane = plane,
.crtc = crtc,
.fb = fb,
.src_x = src->x1,
.src_y = src->y1,
.src_w = drm_rect_width(src),
.src_h = drm_rect_height(src),
.crtc_x = dst->x1,
.crtc_y = dst->y1,
.crtc_w = drm_rect_width(dst),
.crtc_h = drm_rect_height(dst),
.rotation = rotation,
};
struct drm_crtc_state crtc_state = {
.crtc = crtc,
.enable = crtc->enabled,
.mode = crtc->mode,
};
int ret;
ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
min_scale, max_scale,
can_position,
can_update_disabled);
if (ret)
return ret;
*src = plane_state.src;
*dst = plane_state.dst;
*visible = plane_state.visible;
return 0;
}
/**
* drm_plane_helper_update_primary - Helper for updating primary planes
* @plane: plane to update
* @crtc: the plane's new CRTC
* @fb: the plane's new framebuffer
* @crtc_x: x coordinate within CRTC
* @crtc_y: y coordinate within CRTC
* @crtc_w: width coordinate within CRTC
* @crtc_h: height coordinate within CRTC
* @src_x: x coordinate within source
* @src_y: y coordinate within source
* @src_w: width coordinate within source
* @src_h: height coordinate within source
* @ctx: modeset locking context
*
* This helper validates the given parameters and updates the primary plane.
*
* This function is only useful for non-atomic modesetting. Don't use
* it in new drivers.
*
* Returns:
* Zero on success, or an errno code otherwise.
*/
int drm_plane_helper_update_primary(struct drm_plane *plane, struct drm_crtc *crtc,
struct drm_framebuffer *fb,
int crtc_x, int crtc_y,
unsigned int crtc_w, unsigned int crtc_h,
uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h,
struct drm_modeset_acquire_ctx *ctx)
{
Annotation
- Immediate include surface: `linux/export.h`, `linux/list.h`, `drm/drm_atomic.h`, `drm/drm_atomic_helper.h`, `drm/drm_atomic_uapi.h`, `drm/drm_device.h`, `drm/drm_drv.h`, `drm/drm_encoder.h`.
- Detected declarations: `function Copyright`, `function drm_plane_helper_check_update`, `function drm_plane_helper_update_primary`, `function drm_plane_helper_disable_primary`, `function drm_plane_helper_destroy`, `export drm_plane_helper_update_primary`, `export drm_plane_helper_disable_primary`, `export drm_plane_helper_destroy`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration 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.