drivers/media/platform/amlogic/meson-ge2d/ge2d.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/amlogic/meson-ge2d/ge2d.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/amlogic/meson-ge2d/ge2d.c- Extension
.c- Size
- 26768 bytes
- Lines
- 1056
- Domain
- Driver Families
- Bucket
- drivers/media
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/clk.hlinux/delay.hlinux/bitfield.hlinux/interrupt.hlinux/module.hlinux/of.hlinux/reset.hlinux/sched.hlinux/slab.hlinux/timer.hlinux/regmap.hlinux/platform_device.hmedia/v4l2-device.hmedia/v4l2-event.hmedia/v4l2-ioctl.hmedia/v4l2-mem2mem.hmedia/v4l2-ctrls.hmedia/videobuf2-v4l2.hmedia/videobuf2-dma-contig.hge2d-regs.h
Detected Declarations
struct ge2d_fmtstruct ge2d_framestruct ge2d_ctxstruct meson_ge2dfunction ge2d_hw_startfunction device_runfunction ge2d_isrfunction ge2d_queue_setupfunction ge2d_buf_preparefunction ge2d_buf_queuefunction ge2d_start_streamingfunction ge2d_stop_streamingfunction queue_initfunction vidioc_querycapfunction vidioc_enum_fmtfunction vidioc_g_selectionfunction vidioc_s_selectionfunction vidioc_setup_cap_fmtfunction vidioc_try_fmt_capfunction vidioc_s_fmt_capfunction vidioc_g_fmtfunction vidioc_try_fmt_outfunction vidioc_s_fmt_outfunction ge2d_s_ctrlfunction ge2d_setup_ctrlsfunction ge2d_openfunction ge2d_releasefunction ge2d_probefunction ge2d_remove
Annotated Snippet
struct ge2d_fmt {
u32 fourcc;
bool alpha;
bool le;
unsigned int depth;
unsigned int hw_fmt;
unsigned int hw_map;
};
struct ge2d_frame {
struct vb2_v4l2_buffer *buf;
/* Image Format */
struct v4l2_pix_format pix_fmt;
/* Crop */
struct v4l2_rect crop;
/* Image format */
const struct ge2d_fmt *fmt;
};
struct ge2d_ctx {
struct v4l2_fh fh;
struct meson_ge2d *ge2d;
struct ge2d_frame in;
struct ge2d_frame out;
struct v4l2_ctrl_handler ctrl_handler;
unsigned long sequence_out, sequence_cap;
/* Control values */
u32 hflip;
u32 vflip;
u32 xy_swap;
};
static inline struct ge2d_ctx *file_to_ge2d_ctx(struct file *filp)
{
return container_of(file_to_v4l2_fh(filp), struct ge2d_ctx, fh);
}
struct meson_ge2d {
struct v4l2_device v4l2_dev;
struct v4l2_m2m_dev *m2m_dev;
struct video_device *vfd;
struct device *dev;
struct regmap *map;
struct clk *clk;
/* vb2 queue lock */
struct mutex mutex;
struct ge2d_ctx *curr;
};
#define FMT(_fourcc, _alpha, _depth, _map) \
{ \
.fourcc = _fourcc, \
.alpha = (_alpha), \
.depth = (_depth), \
.hw_fmt = GE2D_FORMAT_ ## _depth ## BIT, \
.hw_map = GE2D_COLOR_MAP_ ## _map, \
}
/* TOFIX Handle the YUV input formats */
static const struct ge2d_fmt formats[] = {
/* FOURCC Alpha HW FMT HW MAP */
FMT(V4L2_PIX_FMT_XRGB32, false, 32, BGRA8888),
FMT(V4L2_PIX_FMT_RGB32, true, 32, BGRA8888),
FMT(V4L2_PIX_FMT_ARGB32, true, 32, BGRA8888),
FMT(V4L2_PIX_FMT_RGBX32, false, 32, ABGR8888),
FMT(V4L2_PIX_FMT_RGBA32, true, 32, ABGR8888),
FMT(V4L2_PIX_FMT_BGRX32, false, 32, RGBA8888),
FMT(V4L2_PIX_FMT_BGRA32, true, 32, RGBA8888),
FMT(V4L2_PIX_FMT_BGR32, true, 32, ARGB8888),
FMT(V4L2_PIX_FMT_ABGR32, true, 32, ARGB8888),
FMT(V4L2_PIX_FMT_XBGR32, false, 32, ARGB8888),
FMT(V4L2_PIX_FMT_RGB24, false, 24, BGR888),
FMT(V4L2_PIX_FMT_BGR24, false, 24, RGB888),
FMT(V4L2_PIX_FMT_XRGB555X, false, 16, ARGB1555),
FMT(V4L2_PIX_FMT_ARGB555X, true, 16, ARGB1555),
FMT(V4L2_PIX_FMT_RGB565, false, 16, RGB565),
FMT(V4L2_PIX_FMT_RGBX444, false, 16, RGBA4444),
FMT(V4L2_PIX_FMT_RGBA444, true, 16, RGBA4444),
FMT(V4L2_PIX_FMT_XRGB444, false, 16, ARGB4444),
FMT(V4L2_PIX_FMT_ARGB444, true, 16, ARGB4444),
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/bitfield.h`, `linux/interrupt.h`, `linux/module.h`, `linux/of.h`, `linux/reset.h`, `linux/sched.h`.
- Detected declarations: `struct ge2d_fmt`, `struct ge2d_frame`, `struct ge2d_ctx`, `struct meson_ge2d`, `function ge2d_hw_start`, `function device_run`, `function ge2d_isr`, `function ge2d_queue_setup`, `function ge2d_buf_prepare`, `function ge2d_buf_queue`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.