drivers/gpu/drm/meson/meson_plane.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/meson/meson_plane.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/meson/meson_plane.c- Extension
.c- Size
- 17244 bytes
- Lines
- 573
- 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
linux/bitfield.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_blend.hdrm/drm_device.hdrm/drm_fb_dma_helper.hdrm/drm_fourcc.hdrm/drm_framebuffer.hdrm/drm_gem_atomic_helper.hdrm/drm_gem_dma_helper.hdrm/drm_print.hmeson_plane.hmeson_registers.hmeson_viu.hmeson_osd_afbcd.h
Detected Declarations
struct meson_planefunction meson_plane_atomic_checkfunction fixed16_to_intfunction meson_g12a_afbcd_line_stridefunction meson_plane_atomic_updatefunction INTERLACE_SEL_ODDfunction meson_plane_atomic_disablefunction meson_plane_format_mod_supportedfunction meson_plane_create
Annotated Snippet
struct meson_plane {
struct drm_plane base;
struct meson_drm *priv;
bool enabled;
};
#define to_meson_plane(x) container_of(x, struct meson_plane, base)
#define FRAC_16_16(mult, div) (((mult) << 16) / (div))
static int meson_plane_atomic_check(struct drm_plane *plane,
struct drm_atomic_commit *state)
{
struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
plane);
struct drm_crtc_state *crtc_state;
if (!new_plane_state->crtc)
return 0;
crtc_state = drm_atomic_get_crtc_state(state,
new_plane_state->crtc);
if (IS_ERR(crtc_state))
return PTR_ERR(crtc_state);
/*
* Only allow :
* - Upscaling up to 5x, vertical and horizontal
* - Final coordinates must match crtc size
*/
return drm_atomic_helper_check_plane_state(new_plane_state,
crtc_state,
FRAC_16_16(1, 5),
DRM_PLANE_NO_SCALING,
false, true);
}
#define MESON_MOD_AFBC_VALID_BITS (AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 | \
AFBC_FORMAT_MOD_BLOCK_SIZE_32x8 | \
AFBC_FORMAT_MOD_YTR | \
AFBC_FORMAT_MOD_SPARSE | \
AFBC_FORMAT_MOD_SPLIT)
/* Takes a fixed 16.16 number and converts it to integer. */
static inline int64_t fixed16_to_int(int64_t value)
{
return value >> 16;
}
static u32 meson_g12a_afbcd_line_stride(struct meson_drm *priv)
{
u32 line_stride = 0;
switch (priv->afbcd.format) {
case DRM_FORMAT_RGB565:
line_stride = ((priv->viu.osd1_width << 4) + 127) >> 7;
break;
case DRM_FORMAT_RGB888:
case DRM_FORMAT_XRGB8888:
case DRM_FORMAT_ARGB8888:
case DRM_FORMAT_XBGR8888:
case DRM_FORMAT_ABGR8888:
line_stride = ((priv->viu.osd1_width << 5) + 127) >> 7;
break;
}
return ((line_stride + 1) >> 1) << 1;
}
static void meson_plane_atomic_update(struct drm_plane *plane,
struct drm_atomic_commit *state)
{
struct meson_plane *meson_plane = to_meson_plane(plane);
struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state,
plane);
struct drm_rect dest = drm_plane_state_dest(new_state);
struct meson_drm *priv = meson_plane->priv;
struct drm_framebuffer *fb = new_state->fb;
struct drm_gem_dma_object *gem;
unsigned long flags;
int vsc_ini_rcv_num, vsc_ini_rpt_p0_num;
int vsc_bot_rcv_num, vsc_bot_rpt_p0_num;
int hsc_ini_rcv_num, hsc_ini_rpt_p0_num;
int hf_phase_step, vf_phase_step;
int src_w, src_h, dst_w, dst_h;
int bot_ini_phase;
int hf_bank_len;
int vf_bank_len;
u8 canvas_id_osd1;
/*
Annotation
- Immediate include surface: `linux/bitfield.h`, `drm/drm_atomic.h`, `drm/drm_atomic_helper.h`, `drm/drm_blend.h`, `drm/drm_device.h`, `drm/drm_fb_dma_helper.h`, `drm/drm_fourcc.h`, `drm/drm_framebuffer.h`.
- Detected declarations: `struct meson_plane`, `function meson_plane_atomic_check`, `function fixed16_to_int`, `function meson_g12a_afbcd_line_stride`, `function meson_plane_atomic_update`, `function INTERLACE_SEL_ODD`, `function meson_plane_atomic_disable`, `function meson_plane_format_mod_supported`, `function meson_plane_create`.
- 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.