drivers/gpu/drm/exynos/exynos_drm_g2d.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/exynos/exynos_drm_g2d.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/exynos/exynos_drm_g2d.c- Extension
.c- Size
- 39925 bytes
- Lines
- 1618
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/refcount.hlinux/clk.hlinux/component.hlinux/delay.hlinux/dma-mapping.hlinux/err.hlinux/interrupt.hlinux/io.hlinux/kernel.hlinux/of.hlinux/platform_device.hlinux/pm_runtime.hlinux/slab.hlinux/uaccess.hlinux/workqueue.hdrm/drm_device.hdrm/drm_file.hdrm/drm_print.hdrm/exynos_drm.hexynos_drm_drv.hexynos_drm_g2d.hexynos_drm_gem.h
Detected Declarations
struct g2d_cmdliststruct g2d_buf_descstruct g2d_buf_infostruct drm_exynos_pending_g2d_eventstruct g2d_cmdlist_userptrstruct g2d_cmdlist_nodestruct g2d_runqueue_nodestruct g2d_dataenum g2d_reg_typeenum g2d_flag_bitsfunction g2d_hw_resetfunction g2d_init_cmdlistfunction g2d_fini_cmdlistfunction g2d_put_cmdlistfunction g2d_add_cmdlist_to_inusefunction g2d_userptr_put_dma_addrfunction g2d_userptr_free_allfunction g2d_get_reg_typefunction g2d_get_buf_bppfunction g2d_check_buf_desc_is_validfunction g2d_map_cmdlist_gemfunction g2d_unmap_cmdlist_gemfunction g2d_dma_startfunction g2d_free_runqueue_nodefunction g2d_remove_runqueue_nodesfunction list_for_each_entry_safefunction g2d_runqueue_workerfunction g2d_finish_eventfunction g2d_irq_handlerfunction g2d_wait_finishfunction g2d_check_reg_offsetfunction exynos_g2d_get_ver_ioctlfunction exynos_g2d_set_cmdlist_ioctlfunction exynos_g2d_exec_ioctlfunction g2d_openfunction g2d_closefunction g2d_bindfunction g2d_unbindfunction g2d_probefunction g2d_removefunction g2d_suspendfunction g2d_resumefunction g2d_runtime_suspendfunction g2d_runtime_resume
Annotated Snippet
struct g2d_cmdlist {
u32 head;
unsigned long data[G2D_CMDLIST_DATA_NUM];
u32 last; /* last data offset */
};
/*
* A structure of buffer description
*
* @format: color format
* @stride: buffer stride/pitch in bytes
* @left_x: the x coordinates of left top corner
* @top_y: the y coordinates of left top corner
* @right_x: the x coordinates of right bottom corner
* @bottom_y: the y coordinates of right bottom corner
*
*/
struct g2d_buf_desc {
unsigned int format;
unsigned int stride;
unsigned int left_x;
unsigned int top_y;
unsigned int right_x;
unsigned int bottom_y;
};
/*
* A structure of buffer information
*
* @map_nr: manages the number of mapped buffers
* @reg_types: stores regitster type in the order of requested command
* @handles: stores buffer handle in its reg_type position
* @types: stores buffer type in its reg_type position
* @descs: stores buffer description in its reg_type position
*
*/
struct g2d_buf_info {
unsigned int map_nr;
enum g2d_reg_type reg_types[MAX_REG_TYPE_NR];
void *obj[MAX_REG_TYPE_NR];
unsigned int types[MAX_REG_TYPE_NR];
struct g2d_buf_desc descs[MAX_REG_TYPE_NR];
};
struct drm_exynos_pending_g2d_event {
struct drm_pending_event base;
struct drm_exynos_g2d_event event;
};
struct g2d_cmdlist_userptr {
struct list_head list;
dma_addr_t dma_addr;
unsigned long userptr;
unsigned long size;
struct page **pages;
unsigned int npages;
struct sg_table *sgt;
refcount_t refcount;
bool in_pool;
bool out_of_list;
};
struct g2d_cmdlist_node {
struct list_head list;
struct g2d_cmdlist *cmdlist;
dma_addr_t dma_addr;
struct g2d_buf_info buf_info;
struct drm_exynos_pending_g2d_event *event;
};
struct g2d_runqueue_node {
struct list_head list;
struct list_head run_cmdlist;
struct list_head event_list;
struct drm_file *filp;
pid_t pid;
struct completion complete;
int async;
};
struct g2d_data {
struct device *dev;
void *dma_priv;
struct clk *gate_clk;
void __iomem *regs;
int irq;
struct workqueue_struct *g2d_workq;
struct work_struct runqueue_work;
struct drm_device *drm_dev;
unsigned long flags;
Annotation
- Immediate include surface: `linux/refcount.h`, `linux/clk.h`, `linux/component.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/err.h`, `linux/interrupt.h`, `linux/io.h`.
- Detected declarations: `struct g2d_cmdlist`, `struct g2d_buf_desc`, `struct g2d_buf_info`, `struct drm_exynos_pending_g2d_event`, `struct g2d_cmdlist_userptr`, `struct g2d_cmdlist_node`, `struct g2d_runqueue_node`, `struct g2d_data`, `enum g2d_reg_type`, `enum g2d_flag_bits`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.