drivers/gpu/drm/mgag200/mgag200_mode.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/mgag200/mgag200_mode.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/mgag200/mgag200_mode.c- Extension
.c- Size
- 22861 bytes
- Lines
- 832
- 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/iosys-map.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_color_mgmt.hdrm/drm_damage_helper.hdrm/drm_edid.hdrm/drm_format_helper.hdrm/drm_fourcc.hdrm/drm_framebuffer.hdrm/drm_gem_atomic_helper.hdrm/drm_gem_framebuffer_helper.hdrm/drm_panic.hdrm/drm_print.hmgag200_ddc.hmgag200_drv.h
Detected Declarations
function mgag200_set_gamma_lutfunction mgag200_crtc_fill_gammafunction mgag200_crtc_load_gammafunction mga_wait_vsyncfunction mga_wait_busyfunction _pixels_function mgag200_set_datasizfunction mgag200_init_registersfunction mgag200_set_mode_regsfunction mgag200_set_offsetfunction mgag200_set_format_regsfunction mgag200_enable_displayfunction mgag200_disable_displayfunction mgag200_handle_damagefunction mgag200_primary_plane_helper_atomic_checkfunction mgag200_primary_plane_helper_atomic_updatefunction mgag200_primary_plane_helper_atomic_enablefunction mgag200_primary_plane_helper_atomic_disablefunction mgag200_primary_plane_helper_get_scanout_bufferfunction mgag200_crtc_helper_mode_validfunction mgag200_crtc_helper_atomic_checkfunction mgag200_crtc_helper_atomic_flushfunction mgag200_crtc_helper_atomic_enablefunction mgag200_crtc_helper_atomic_disablefunction mgag200_crtc_resetfunction mgag200_crtc_atomic_destroy_statefunction mgag200_mode_config_helper_atomic_commit_tailfunction mgag200_calculate_mode_bandwidthfunction mgag200_mode_config_mode_validfunction mgag200_mode_config_init
Annotated Snippet
if (funcs->pixpllc_atomic_check) {
ret = funcs->pixpllc_atomic_check(crtc, new_state);
if (ret)
return ret;
}
}
if (new_crtc_state->color_mgmt_changed && new_gamma_lut) {
if (new_gamma_lut->length != MGAG200_LUT_SIZE * sizeof(struct drm_color_lut)) {
drm_dbg(dev, "Wrong size for gamma_lut %zu\n", new_gamma_lut->length);
return -EINVAL;
}
}
return 0;
}
void mgag200_crtc_helper_atomic_flush(struct drm_crtc *crtc, struct drm_atomic_commit *old_state)
{
struct drm_crtc_state *crtc_state = crtc->state;
struct mgag200_crtc_state *mgag200_crtc_state = to_mgag200_crtc_state(crtc_state);
struct drm_device *dev = crtc->dev;
struct mga_device *mdev = to_mga_device(dev);
if (crtc_state->enable && crtc_state->color_mgmt_changed) {
const struct drm_format_info *format = mgag200_crtc_state->format;
if (crtc_state->gamma_lut)
mgag200_crtc_load_gamma(mdev, format, crtc_state->gamma_lut->data);
else
mgag200_crtc_fill_gamma(mdev, format);
}
}
void mgag200_crtc_helper_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_commit *old_state)
{
struct drm_device *dev = crtc->dev;
struct mga_device *mdev = to_mga_device(dev);
const struct mgag200_device_funcs *funcs = mdev->funcs;
struct drm_crtc_state *crtc_state = crtc->state;
struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode;
struct mgag200_crtc_state *mgag200_crtc_state = to_mgag200_crtc_state(crtc_state);
const struct drm_format_info *format = mgag200_crtc_state->format;
mgag200_set_format_regs(mdev, format);
mgag200_set_mode_regs(mdev, adjusted_mode, mgag200_crtc_state->set_vidrst);
if (funcs->pixpllc_atomic_update)
funcs->pixpllc_atomic_update(crtc, old_state);
if (crtc_state->gamma_lut)
mgag200_crtc_load_gamma(mdev, format, crtc_state->gamma_lut->data);
else
mgag200_crtc_fill_gamma(mdev, format);
mgag200_enable_display(mdev);
}
void mgag200_crtc_helper_atomic_disable(struct drm_crtc *crtc, struct drm_atomic_commit *old_state)
{
struct mga_device *mdev = to_mga_device(crtc->dev);
mgag200_disable_display(mdev);
}
void mgag200_crtc_reset(struct drm_crtc *crtc)
{
struct mgag200_crtc_state *mgag200_crtc_state;
if (crtc->state)
crtc->funcs->atomic_destroy_state(crtc, crtc->state);
mgag200_crtc_state = kzalloc_obj(*mgag200_crtc_state);
if (mgag200_crtc_state)
__drm_atomic_helper_crtc_reset(crtc, &mgag200_crtc_state->base);
else
__drm_atomic_helper_crtc_reset(crtc, NULL);
}
struct drm_crtc_state *mgag200_crtc_atomic_duplicate_state(struct drm_crtc *crtc)
{
struct drm_crtc_state *crtc_state = crtc->state;
struct mgag200_crtc_state *mgag200_crtc_state = to_mgag200_crtc_state(crtc_state);
struct mgag200_crtc_state *new_mgag200_crtc_state;
if (!crtc_state)
return NULL;
new_mgag200_crtc_state = kzalloc_obj(*new_mgag200_crtc_state);
if (!new_mgag200_crtc_state)
Annotation
- Immediate include surface: `linux/delay.h`, `linux/iosys-map.h`, `drm/drm_atomic.h`, `drm/drm_atomic_helper.h`, `drm/drm_color_mgmt.h`, `drm/drm_damage_helper.h`, `drm/drm_edid.h`, `drm/drm_format_helper.h`.
- Detected declarations: `function mgag200_set_gamma_lut`, `function mgag200_crtc_fill_gamma`, `function mgag200_crtc_load_gamma`, `function mga_wait_vsync`, `function mga_wait_busy`, `function _pixels_`, `function mgag200_set_datasiz`, `function mgag200_init_registers`, `function mgag200_set_mode_regs`, `function mgag200_set_offset`.
- 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.