drivers/gpu/drm/msm/msm_drv.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/msm_drv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/msm/msm_drv.c- Extension
.c- Size
- 28317 bytes
- Lines
- 1161
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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.
- 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/dma-mapping.hlinux/fault-inject.hlinux/debugfs.hlinux/of_address.hlinux/uaccess.hdrm/drm_drv.hdrm/drm_file.hdrm/drm_ioctl.hdrm/drm_of.hmsm_drv.hmsm_debugfs.hmsm_gem.hmsm_gpu.hmsm_kms.h
Detected Declarations
function msm_gpu_no_componentsfunction msm_drm_uninitfunction msm_drm_initfunction load_gpufunction context_initfunction msm_openfunction context_closefunction msm_postclosefunction msm_ioctl_get_paramfunction msm_ioctl_set_paramfunction msm_ioctl_gem_newfunction to_ktimefunction msm_ioctl_gem_cpu_prepfunction msm_ioctl_gem_cpu_finifunction msm_ioctl_gem_info_iovafunction msm_ioctl_gem_info_set_iovafunction msm_ioctl_gem_info_set_metadatafunction msm_ioctl_gem_info_get_metadatafunction msm_ioctl_gem_infofunction wait_fencefunction msm_ioctl_wait_fencefunction msm_ioctl_gem_madvisefunction msm_ioctl_submitqueue_newfunction msm_ioctl_submitqueue_queryfunction msm_ioctl_submitqueue_closefunction msm_show_fdinfofunction add_mdp_componentsfunction for_each_endpoint_of_nodefunction msm_disp_drv_should_bindfunction msm_disp_drv_should_bindfunction add_gpu_componentsfunction msm_drm_bindfunction msm_drm_unbindfunction msm_drv_probefunction msm_gpu_probefunction msm_gpu_removefunction msm_drm_registerfunction msm_drm_unregistermodule init msm_drm_register
Annotated Snippet
static const struct file_operations fops = {
.owner = THIS_MODULE,
DRM_GEM_FOPS,
.show_fdinfo = drm_show_fdinfo,
};
#define DRIVER_FEATURES_GPU ( \
DRIVER_GEM | \
DRIVER_GEM_GPUVA | \
DRIVER_RENDER | \
DRIVER_SYNCOBJ | \
DRIVER_SYNCOBJ_TIMELINE | \
0 )
#define DRIVER_FEATURES_KMS ( \
DRIVER_GEM | \
DRIVER_GEM_GPUVA | \
DRIVER_ATOMIC | \
DRIVER_MODESET | \
0 )
static const struct drm_driver msm_driver = {
.driver_features = DRIVER_FEATURES_GPU | DRIVER_FEATURES_KMS,
.open = msm_open,
.postclose = msm_postclose,
.dumb_create = msm_gem_dumb_create,
.dumb_map_offset = drm_gem_dumb_map_offset,
.gem_prime_import = msm_gem_prime_import,
.gem_prime_import_sg_table = msm_gem_prime_import_sg_table,
#ifdef CONFIG_DEBUG_FS
.debugfs_init = msm_debugfs_init,
#endif
MSM_FBDEV_DRIVER_OPS,
.show_fdinfo = msm_show_fdinfo,
.ioctls = msm_ioctls,
.num_ioctls = ARRAY_SIZE(msm_ioctls),
.fops = &fops,
.name = "msm",
.desc = "MSM Snapdragon DRM",
.major = MSM_VERSION_MAJOR,
.minor = MSM_VERSION_MINOR,
.patchlevel = MSM_VERSION_PATCHLEVEL,
};
static const struct drm_driver msm_kms_driver = {
.driver_features = DRIVER_FEATURES_KMS,
.open = msm_open,
.postclose = msm_postclose,
.dumb_create = msm_gem_dumb_create,
.dumb_map_offset = drm_gem_dumb_map_offset,
.gem_prime_import_sg_table = msm_gem_prime_import_sg_table,
#ifdef CONFIG_DEBUG_FS
.debugfs_init = msm_debugfs_init,
#endif
MSM_FBDEV_DRIVER_OPS,
.show_fdinfo = msm_show_fdinfo,
.fops = &fops,
.name = "msm-kms",
.desc = "MSM Snapdragon DRM",
.major = MSM_VERSION_MAJOR,
.minor = MSM_VERSION_MINOR,
.patchlevel = MSM_VERSION_PATCHLEVEL,
};
static const struct drm_driver msm_gpu_driver = {
.driver_features = DRIVER_FEATURES_GPU,
.open = msm_open,
.postclose = msm_postclose,
.gem_prime_import_sg_table = msm_gem_prime_import_sg_table,
#ifdef CONFIG_DEBUG_FS
.debugfs_init = msm_debugfs_init,
#endif
.show_fdinfo = msm_show_fdinfo,
.ioctls = msm_ioctls,
.num_ioctls = ARRAY_SIZE(msm_ioctls),
.fops = &fops,
.name = "msm",
.desc = "MSM Snapdragon DRM",
.major = MSM_VERSION_MAJOR,
.minor = MSM_VERSION_MINOR,
.patchlevel = MSM_VERSION_PATCHLEVEL,
};
/*
* Componentized driver support:
*/
/*
* Identify what components need to be added by parsing what remote-endpoints
* our MDP output ports are connected to. In the case of LVDS on MDP4, there
Annotation
- Immediate include surface: `linux/dma-mapping.h`, `linux/fault-inject.h`, `linux/debugfs.h`, `linux/of_address.h`, `linux/uaccess.h`, `drm/drm_drv.h`, `drm/drm_file.h`, `drm/drm_ioctl.h`.
- Detected declarations: `function msm_gpu_no_components`, `function msm_drm_uninit`, `function msm_drm_init`, `function load_gpu`, `function context_init`, `function msm_open`, `function context_close`, `function msm_postclose`, `function msm_ioctl_get_param`, `function msm_ioctl_set_param`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: pattern 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.
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.