drivers/gpu/drm/vkms/vkms_output.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vkms/vkms_output.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/vkms/vkms_output.c- Extension
.c- Size
- 3531 bytes
- Lines
- 122
- 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.
- 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
vkms_config.hvkms_connector.hvkms_drv.hdrm/drm_managed.hdrm/drm_print.h
Detected Declarations
function vkms_output_initfunction vkms_config_for_each_planefunction vkms_config_for_each_crtcfunction vkms_config_for_each_planefunction vkms_config_plane_for_each_possible_crtcfunction vkms_config_for_each_encoderfunction vkms_config_encoder_for_each_possible_crtcfunction vkms_config_for_each_connectorfunction vkms_config_connector_for_each_possible_encoder
Annotated Snippet
if (IS_ERR(plane_cfg->plane)) {
DRM_DEV_ERROR(dev->dev, "Failed to init vkms plane\n");
return PTR_ERR(plane_cfg->plane);
}
}
vkms_config_for_each_crtc(vkmsdev->config, crtc_cfg) {
struct vkms_config_plane *primary, *cursor;
primary = vkms_config_crtc_primary_plane(vkmsdev->config, crtc_cfg);
cursor = vkms_config_crtc_cursor_plane(vkmsdev->config, crtc_cfg);
crtc_cfg->crtc = vkms_crtc_init(dev, &primary->plane->base,
cursor ? &cursor->plane->base : NULL);
if (IS_ERR(crtc_cfg->crtc)) {
DRM_ERROR("Failed to allocate CRTC\n");
return PTR_ERR(crtc_cfg->crtc);
}
/* Initialize the writeback component */
if (vkms_config_crtc_get_writeback(crtc_cfg)) {
writeback = vkms_enable_writeback_connector(vkmsdev, crtc_cfg->crtc);
if (writeback)
DRM_ERROR("Failed to init writeback connector\n");
}
}
vkms_config_for_each_plane(vkmsdev->config, plane_cfg) {
struct vkms_config_crtc *possible_crtc;
unsigned long idx = 0;
vkms_config_plane_for_each_possible_crtc(plane_cfg, idx, possible_crtc) {
plane_cfg->plane->base.possible_crtcs |=
drm_crtc_mask(&possible_crtc->crtc->crtc);
}
}
vkms_config_for_each_encoder(vkmsdev->config, encoder_cfg) {
struct vkms_config_crtc *possible_crtc;
unsigned long idx = 0;
encoder_cfg->encoder = drmm_kzalloc(dev, sizeof(*encoder_cfg->encoder), GFP_KERNEL);
if (!encoder_cfg->encoder) {
DRM_ERROR("Failed to allocate encoder\n");
return -ENOMEM;
}
ret = drmm_encoder_init(dev, encoder_cfg->encoder, NULL,
DRM_MODE_ENCODER_VIRTUAL, NULL);
if (ret) {
DRM_ERROR("Failed to init encoder\n");
return ret;
}
encoder_cfg->encoder->possible_clones |=
drm_encoder_mask(encoder_cfg->encoder);
vkms_config_encoder_for_each_possible_crtc(encoder_cfg, idx, possible_crtc) {
encoder_cfg->encoder->possible_crtcs |=
drm_crtc_mask(&possible_crtc->crtc->crtc);
if (vkms_config_crtc_get_writeback(possible_crtc)) {
struct drm_encoder *wb_encoder =
&possible_crtc->crtc->wb_encoder;
encoder_cfg->encoder->possible_clones |=
drm_encoder_mask(wb_encoder);
wb_encoder->possible_clones |=
drm_encoder_mask(encoder_cfg->encoder);
}
}
}
vkms_config_for_each_connector(vkmsdev->config, connector_cfg) {
struct vkms_config_encoder *possible_encoder;
unsigned long idx = 0;
connector_cfg->connector = vkms_connector_init(vkmsdev);
if (IS_ERR(connector_cfg->connector)) {
DRM_ERROR("Failed to init connector\n");
return PTR_ERR(connector_cfg->connector);
}
vkms_config_connector_for_each_possible_encoder(connector_cfg,
idx,
possible_encoder) {
ret = drm_connector_attach_encoder(&connector_cfg->connector->base,
possible_encoder->encoder);
if (ret) {
DRM_ERROR("Failed to attach connector to encoder\n");
return ret;
Annotation
- Immediate include surface: `vkms_config.h`, `vkms_connector.h`, `vkms_drv.h`, `drm/drm_managed.h`, `drm/drm_print.h`.
- Detected declarations: `function vkms_output_init`, `function vkms_config_for_each_plane`, `function vkms_config_for_each_crtc`, `function vkms_config_for_each_plane`, `function vkms_config_plane_for_each_possible_crtc`, `function vkms_config_for_each_encoder`, `function vkms_config_encoder_for_each_possible_crtc`, `function vkms_config_for_each_connector`, `function vkms_config_connector_for_each_possible_encoder`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source 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.