drivers/gpu/drm/ast/ast_mode.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/ast/ast_mode.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/ast/ast_mode.c- Extension
.c- Size
- 32616 bytes
- Lines
- 1079
- 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.
- 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/delay.hlinux/pci.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_color_mgmt.hdrm/drm_crtc.hdrm/drm_damage_helper.hdrm/drm_format_helper.hdrm/drm_fourcc.hdrm/drm_gem_atomic_helper.hdrm/drm_gem_framebuffer_helper.hdrm/drm_gem_shmem_helper.hdrm/drm_managed.hdrm/drm_panic.hdrm/drm_print.hdrm/drm_probe_helper.hast_drv.hast_tables.hast_vbios.h
Detected Declarations
function Copyrightfunction ast_fb_vram_sizefunction ast_set_gamma_lutfunction ast_crtc_fill_gammafunction ast_crtc_load_gammafunction ast_set_vbios_color_regfunction ast_set_vbios_mode_regfunction ast_set_std_regfunction ast_set_crtc_regfunction ast_set_offset_regfunction ast_set_dclk_regfunction ast_set_color_regfunction ast_set_crtthd_regfunction ast_set_sync_regfunction ast_set_start_address_crt1function ast_wait_for_vretracefunction ast_plane_initfunction ast_primary_plane_helper_atomic_checkfunction ast_handle_damagefunction ast_primary_plane_helper_atomic_updatefunction drm_atomic_for_each_plane_damagefunction ast_primary_plane_helper_atomic_enablefunction ast_primary_plane_helper_atomic_disablefunction ast_primary_plane_initfunction ast_crtc_helper_mode_validfunction ast_crtc_helper_mode_set_nofbfunction ast_crtc_helper_atomic_checkfunction ast_crtc_helper_atomic_flushfunction ast_crtc_helper_atomic_enablefunction ast_crtc_helper_atomic_disablefunction ast_crtc_resetfunction ast_crtc_atomic_duplicate_statefunction ast_crtc_atomic_destroy_statefunction ast_crtc_initfunction ast_mode_config_helper_atomic_commit_tailfunction ast_mode_config_mode_validfunction ast_mode_config_init
Annotated Snippet
drm_atomic_for_each_plane_damage(&iter, &damage) {
ast_handle_damage(ast_plane, shadow_plane_state->data, fb, &damage,
&shadow_plane_state->fmtcnv_state);
}
drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE);
}
/*
* Some BMCs stop scanning out the video signal after the driver
* reprogrammed the offset. This stalls display output for several
* seconds and makes the display unusable. Therefore only update
* the offset if it changes.
*/
if (!old_fb || old_fb->pitches[0] != fb->pitches[0])
ast_set_offset_reg(ast, fb);
}
static void ast_primary_plane_helper_atomic_enable(struct drm_plane *plane,
struct drm_atomic_commit *state)
{
struct ast_device *ast = to_ast_device(plane->dev);
struct ast_plane *ast_plane = to_ast_plane(plane);
/*
* Some BMCs stop scanning out the video signal after the driver
* reprogrammed the scanout address. This stalls display
* output for several seconds and makes the display unusable.
* Therefore only reprogram the address after enabling the plane.
*/
ast_set_start_address_crt1(ast, (u32)ast_plane->offset);
}
static void ast_primary_plane_helper_atomic_disable(struct drm_plane *plane,
struct drm_atomic_commit *state)
{
/*
* Keep this empty function to avoid calling
* atomic_update when disabling the plane.
*/
}
static int ast_primary_plane_helper_get_scanout_buffer(struct drm_plane *plane,
struct drm_scanout_buffer *sb)
{
struct ast_plane *ast_plane = to_ast_plane(plane);
if (plane->state && plane->state->fb) {
sb->format = plane->state->fb->format;
sb->width = plane->state->fb->width;
sb->height = plane->state->fb->height;
sb->pitch[0] = plane->state->fb->pitches[0];
iosys_map_set_vaddr_iomem(&sb->map[0], ast_plane_vaddr(ast_plane));
return 0;
}
return -ENODEV;
}
static const struct drm_plane_helper_funcs ast_primary_plane_helper_funcs = {
DRM_GEM_SHADOW_PLANE_HELPER_FUNCS,
.atomic_check = ast_primary_plane_helper_atomic_check,
.atomic_update = ast_primary_plane_helper_atomic_update,
.atomic_enable = ast_primary_plane_helper_atomic_enable,
.atomic_disable = ast_primary_plane_helper_atomic_disable,
.get_scanout_buffer = ast_primary_plane_helper_get_scanout_buffer,
};
static const struct drm_plane_funcs ast_primary_plane_funcs = {
.update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane,
.destroy = drm_plane_cleanup,
DRM_GEM_SHADOW_PLANE_FUNCS,
};
static int ast_primary_plane_init(struct ast_device *ast)
{
struct drm_device *dev = &ast->base;
struct ast_plane *ast_primary_plane = &ast->primary_plane;
struct drm_plane *primary_plane = &ast_primary_plane->base;
u64 offset = ast_fb_vram_offset();
unsigned long size = ast_fb_vram_size(ast);
int ret;
ret = ast_plane_init(dev, ast_primary_plane, offset, size,
0x01, &ast_primary_plane_funcs,
ast_primary_plane_formats, ARRAY_SIZE(ast_primary_plane_formats),
NULL, DRM_PLANE_TYPE_PRIMARY);
if (ret) {
drm_err(dev, "ast_plane_init() failed: %d\n", ret);
return ret;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/pci.h`, `drm/drm_atomic.h`, `drm/drm_atomic_helper.h`, `drm/drm_color_mgmt.h`, `drm/drm_crtc.h`, `drm/drm_damage_helper.h`, `drm/drm_format_helper.h`.
- Detected declarations: `function Copyright`, `function ast_fb_vram_size`, `function ast_set_gamma_lut`, `function ast_crtc_fill_gamma`, `function ast_crtc_load_gamma`, `function ast_set_vbios_color_reg`, `function ast_set_vbios_mode_reg`, `function ast_set_std_reg`, `function ast_set_crtc_reg`, `function ast_set_offset_reg`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- 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.