drivers/gpu/drm/vkms/vkms_config.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vkms/vkms_config.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/vkms/vkms_config.c- Extension
.c- Size
- 17964 bytes
- Lines
- 650
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/slab.hdrm/drm_print.hdrm/drm_debugfs.hkunit/visibility.hvkms_config.h
Detected Declarations
function vkms_config_destroyfunction valid_plane_numberfunction valid_planes_for_crtcfunction vkms_config_for_each_planefunction vkms_config_plane_for_each_possible_crtcfunction valid_plane_possible_crtcsfunction vkms_config_for_each_planefunction valid_crtc_numberfunction valid_encoder_numberfunction valid_encoder_possible_crtcsfunction vkms_config_for_each_encoderfunction vkms_config_for_each_crtcfunction vkms_config_for_each_encoderfunction vkms_config_encoder_for_each_possible_crtcfunction valid_connector_numberfunction valid_connector_possible_encodersfunction vkms_config_for_each_connectorfunction vkms_config_is_validfunction vkms_config_for_each_crtcfunction vkms_config_showfunction vkms_config_for_each_planefunction vkms_config_for_each_crtcfunction vkms_config_for_each_connectorfunction vkms_config_register_debugfsfunction vkms_config_destroy_planefunction vkms_config_plane_attach_crtcfunction vkms_config_plane_for_each_possible_crtcfunction vkms_config_plane_detach_crtcfunction vkms_config_plane_for_each_possible_crtcfunction vkms_config_destroy_crtcfunction vkms_config_crtc_get_planefunction vkms_config_for_each_planefunction vkms_config_plane_for_each_possible_crtcfunction vkms_config_destroy_encoderfunction vkms_config_encoder_attach_crtcfunction vkms_config_encoder_for_each_possible_crtcfunction vkms_config_encoder_detach_crtcfunction vkms_config_encoder_for_each_possible_crtcfunction vkms_config_destroy_connectorfunction vkms_config_connector_attach_encoderfunction vkms_config_connector_for_each_possible_encoderfunction vkms_config_connector_detach_encoderfunction vkms_config_connector_for_each_possible_encoder
Annotated Snippet
vkms_config_plane_for_each_possible_crtc(plane_cfg, idx, possible_crtc) {
if (possible_crtc != crtc_cfg)
continue;
if (type == DRM_PLANE_TYPE_PRIMARY) {
if (has_primary_plane) {
drm_info(dev, "Multiple primary planes\n");
return false;
}
has_primary_plane = true;
} else if (type == DRM_PLANE_TYPE_CURSOR) {
if (has_cursor_plane) {
drm_info(dev, "Multiple cursor planes\n");
return false;
}
has_cursor_plane = true;
}
}
}
if (!has_primary_plane) {
drm_info(dev, "Primary plane not found\n");
return false;
}
return true;
}
static bool valid_plane_possible_crtcs(const struct vkms_config *config)
{
struct drm_device *dev = config->dev ? &config->dev->drm : NULL;
struct vkms_config_plane *plane_cfg;
vkms_config_for_each_plane(config, plane_cfg) {
if (xa_empty(&plane_cfg->possible_crtcs)) {
drm_info(dev, "All planes must have at least one possible CRTC\n");
return false;
}
}
return true;
}
static bool valid_crtc_number(const struct vkms_config *config)
{
struct drm_device *dev = config->dev ? &config->dev->drm : NULL;
size_t n_crtcs;
n_crtcs = list_count_nodes((struct list_head *)&config->crtcs);
if (n_crtcs <= 0 || n_crtcs >= 32) {
drm_info(dev, "The number of CRTCs must be between 1 and 31\n");
return false;
}
return true;
}
static bool valid_encoder_number(const struct vkms_config *config)
{
struct drm_device *dev = config->dev ? &config->dev->drm : NULL;
size_t n_encoders;
n_encoders = list_count_nodes((struct list_head *)&config->encoders);
if (n_encoders <= 0 || n_encoders >= 32) {
drm_info(dev, "The number of encoders must be between 1 and 31\n");
return false;
}
return true;
}
static bool valid_encoder_possible_crtcs(const struct vkms_config *config)
{
struct drm_device *dev = config->dev ? &config->dev->drm : NULL;
struct vkms_config_crtc *crtc_cfg;
struct vkms_config_encoder *encoder_cfg;
vkms_config_for_each_encoder(config, encoder_cfg) {
if (xa_empty(&encoder_cfg->possible_crtcs)) {
drm_info(dev, "All encoders must have at least one possible CRTC\n");
return false;
}
}
vkms_config_for_each_crtc(config, crtc_cfg) {
bool crtc_has_encoder = false;
vkms_config_for_each_encoder(config, encoder_cfg) {
Annotation
- Immediate include surface: `linux/slab.h`, `drm/drm_print.h`, `drm/drm_debugfs.h`, `kunit/visibility.h`, `vkms_config.h`.
- Detected declarations: `function vkms_config_destroy`, `function valid_plane_number`, `function valid_planes_for_crtc`, `function vkms_config_for_each_plane`, `function vkms_config_plane_for_each_possible_crtc`, `function valid_plane_possible_crtcs`, `function vkms_config_for_each_plane`, `function valid_crtc_number`, `function valid_encoder_number`, `function valid_encoder_possible_crtcs`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration implementation candidate.
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.