drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c- Extension
.c- Size
- 30809 bytes
- Lines
- 1041
- 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_atomic.hdrm/drm_blend.hdrm/drm_damage_helper.hdrm/drm_fourcc.hdrm/drm_framebuffer.hdrm/drm_gem_atomic_helper.hdrm/drm_print.hmdp5_kms.h
Detected Declarations
struct mdp5_planestruct pixel_extstruct phase_stepfunction plane_enabledfunction mdp5_plane_install_propertiesfunction mdp5_plane_atomic_print_statefunction mdp5_plane_resetfunction mdp5_plane_duplicate_statefunction mdp5_plane_destroy_statefunction mdp5_plane_prepare_fbfunction mdp5_plane_cleanup_fbfunction mdp5_plane_atomic_check_with_statefunction mdp5_plane_atomic_checkfunction mdp5_plane_atomic_updatefunction mdp5_plane_atomic_async_checkfunction mdp5_plane_atomic_async_updatefunction set_scanout_lockedfunction csc_disablefunction csc_enablefunction calc_phase_stepfunction calc_scalex_stepsfunction calc_scaley_stepsfunction get_scale_configfunction calc_pixel_extfunction mdp5_write_pixel_extfunction mdp5_hwpipe_mode_setfunction mdp5_plane_mode_setfunction mdp5_plane_pipefunction mdp5_plane_right_pipefunction mdp5_plane_get_flush
Annotated Snippet
struct mdp5_plane {
struct drm_plane base;
};
#define to_mdp5_plane(x) container_of(x, struct mdp5_plane, base)
static int mdp5_plane_mode_set(struct drm_plane *plane,
struct drm_crtc *crtc, struct drm_framebuffer *fb,
struct drm_rect *src, struct drm_rect *dest);
static struct mdp5_kms *get_kms(struct drm_plane *plane)
{
struct msm_drm_private *priv = plane->dev->dev_private;
return to_mdp5_kms(to_mdp_kms(priv->kms));
}
static bool plane_enabled(struct drm_plane_state *state)
{
return state->visible;
}
/* helper to install properties which are common to planes and crtcs */
static void mdp5_plane_install_properties(struct drm_plane *plane,
struct drm_mode_object *obj)
{
unsigned int zpos;
drm_plane_create_rotation_property(plane,
DRM_MODE_ROTATE_0,
DRM_MODE_ROTATE_0 |
DRM_MODE_ROTATE_180 |
DRM_MODE_REFLECT_X |
DRM_MODE_REFLECT_Y);
drm_plane_create_alpha_property(plane);
drm_plane_create_blend_mode_property(plane,
BIT(DRM_MODE_BLEND_PIXEL_NONE) |
BIT(DRM_MODE_BLEND_PREMULTI) |
BIT(DRM_MODE_BLEND_COVERAGE));
if (plane->type == DRM_PLANE_TYPE_PRIMARY)
zpos = STAGE_BASE;
else
zpos = STAGE0 + drm_plane_index(plane);
drm_plane_create_zpos_property(plane, zpos, 1, 255);
}
static void
mdp5_plane_atomic_print_state(struct drm_printer *p,
const struct drm_plane_state *state)
{
struct mdp5_plane_state *pstate = to_mdp5_plane_state(state);
struct mdp5_kms *mdp5_kms = get_kms(state->plane);
drm_printf(p, "\thwpipe=%s\n", pstate->hwpipe ?
pstate->hwpipe->name : "(null)");
if (mdp5_kms->caps & MDP_CAP_SRC_SPLIT)
drm_printf(p, "\tright-hwpipe=%s\n",
pstate->r_hwpipe ? pstate->r_hwpipe->name :
"(null)");
drm_printf(p, "\tblend_mode=%u\n", pstate->base.pixel_blend_mode);
drm_printf(p, "\tzpos=%u\n", pstate->base.zpos);
drm_printf(p, "\tnormalized_zpos=%u\n", pstate->base.normalized_zpos);
drm_printf(p, "\talpha=%u\n", pstate->base.alpha);
drm_printf(p, "\tstage=%s\n", stage2name(pstate->stage));
}
static void mdp5_plane_reset(struct drm_plane *plane)
{
struct mdp5_plane_state *mdp5_state;
if (plane->state)
__drm_atomic_helper_plane_destroy_state(plane->state);
kfree(to_mdp5_plane_state(plane->state));
plane->state = NULL;
mdp5_state = kzalloc_obj(*mdp5_state);
if (!mdp5_state)
return;
__drm_atomic_helper_plane_reset(plane, &mdp5_state->base);
}
static struct drm_plane_state *
mdp5_plane_duplicate_state(struct drm_plane *plane)
{
struct mdp5_plane_state *mdp5_state;
if (WARN_ON(!plane->state))
return NULL;
mdp5_state = kmemdup(to_mdp5_plane_state(plane->state),
sizeof(*mdp5_state), GFP_KERNEL);
Annotation
- Immediate include surface: `drm/drm_atomic.h`, `drm/drm_blend.h`, `drm/drm_damage_helper.h`, `drm/drm_fourcc.h`, `drm/drm_framebuffer.h`, `drm/drm_gem_atomic_helper.h`, `drm/drm_print.h`, `mdp5_kms.h`.
- Detected declarations: `struct mdp5_plane`, `struct pixel_ext`, `struct phase_step`, `function plane_enabled`, `function mdp5_plane_install_properties`, `function mdp5_plane_atomic_print_state`, `function mdp5_plane_reset`, `function mdp5_plane_duplicate_state`, `function mdp5_plane_destroy_state`, `function mdp5_plane_prepare_fb`.
- 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.