drivers/gpu/drm/sysfb/vesadrm.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/sysfb/vesadrm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/sysfb/vesadrm.c- Extension
.c- Size
- 17919 bytes
- Lines
- 680
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/aperture.hlinux/ioport.hlinux/limits.hlinux/platform_device.hlinux/sysfb.hlinux/pm.hdrm/clients/drm_client_setup.hdrm/drm_atomic.hdrm/drm_atomic_state_helper.hdrm/drm_color_mgmt.hdrm/drm_connector.hdrm/drm_damage_helper.hdrm/drm_device.hdrm/drm_drv.hdrm/drm_edid.hdrm/drm_fbdev_shmem.hdrm/drm_framebuffer.hdrm/drm_gem_atomic_helper.hdrm/drm_gem_framebuffer_helper.hdrm/drm_gem_shmem_helper.hdrm/drm_managed.hdrm/drm_modeset_helper.hdrm/drm_modeset_helper_vtables.hdrm/drm_print.hdrm/drm_probe_helper.hvideo/pixel_format.hvideo/vga.hdrm_sysfb_helper.h
Detected Declarations
struct vesadrm_devicefunction vesadrm_vga_cmap_writefunction vesadrm_pmi_cmap_writefunction vesadrm_set_color_lutfunction vesadrm_fill_gamma_lutfunction vesadrm_load_gamma_lutfunction vesadrm_fill_palette_lutfunction vesadrm_load_palette_lutfunction vesadrm_primary_plane_helper_atomic_checkfunction vesadrm_crtc_helper_atomic_flushfunction vesadrm_pm_suspendfunction vesadrm_pm_resumefunction vesadrm_probefunction vesadrm_remove
Annotated Snippet
struct vesadrm_device {
struct drm_sysfb_device sysfb;
#if defined(CONFIG_X86_32)
/* VESA Protected Mode interface */
struct {
const u8 *PrimaryPalette;
} pmi;
#endif
void (*cmap_write)(struct vesadrm_device *vesa, unsigned int index,
u16 red, u16 green, u16 blue);
/* modesetting */
u32 formats[DRM_SYSFB_PLANE_NFORMATS(1)];
struct drm_plane primary_plane;
struct drm_crtc crtc;
struct drm_encoder encoder;
struct drm_connector connector;
};
static struct vesadrm_device *to_vesadrm_device(struct drm_device *dev)
{
return container_of(to_drm_sysfb_device(dev), struct vesadrm_device, sysfb);
}
/*
* Color LUT
*/
static void vesadrm_vga_cmap_write(struct vesadrm_device *vesa, unsigned int index,
u16 red, u16 green, u16 blue)
{
u8 i8 = index;
u8 r8 = red >> 8;
u8 g8 = green >> 8;
u8 b8 = blue >> 8;
outb_p(i8, VGA_PEL_IW);
outb_p(r8, VGA_PEL_D);
outb_p(g8, VGA_PEL_D);
outb_p(b8, VGA_PEL_D);
}
#if defined(CONFIG_X86_32)
static void vesadrm_pmi_cmap_write(struct vesadrm_device *vesa, unsigned int index,
u16 red, u16 green, u16 blue)
{
u32 i32 = index;
struct {
u8 b8;
u8 g8;
u8 r8;
u8 x8;
} PaletteEntry = {
blue >> 8,
green >> 8,
red >> 8,
0x00,
};
__asm__ __volatile__ (
"call *(%%esi)"
: /* no return value */
: "a" (0x4f09),
"b" (0),
"c" (1),
"d" (i32),
"D" (&PaletteEntry),
"S" (&vesa->pmi.PrimaryPalette));
}
#endif
static void vesadrm_set_color_lut(struct drm_crtc *crtc, unsigned int index,
u16 red, u16 green, u16 blue)
{
struct drm_device *dev = crtc->dev;
struct vesadrm_device *vesa = to_vesadrm_device(dev);
u8 i8 = index & 0xff;
if (drm_WARN_ON_ONCE(dev, index != i8))
return; /* driver bug */
vesa->cmap_write(vesa, i8, red, green, blue);
}
static void vesadrm_fill_gamma_lut(struct vesadrm_device *vesa,
const struct drm_format_info *format)
{
struct drm_device *dev = &vesa->sysfb.dev;
Annotation
- Immediate include surface: `linux/aperture.h`, `linux/ioport.h`, `linux/limits.h`, `linux/platform_device.h`, `linux/sysfb.h`, `linux/pm.h`, `drm/clients/drm_client_setup.h`, `drm/drm_atomic.h`.
- Detected declarations: `struct vesadrm_device`, `function vesadrm_vga_cmap_write`, `function vesadrm_pmi_cmap_write`, `function vesadrm_set_color_lut`, `function vesadrm_fill_gamma_lut`, `function vesadrm_load_gamma_lut`, `function vesadrm_fill_palette_lut`, `function vesadrm_load_palette_lut`, `function vesadrm_primary_plane_helper_atomic_check`, `function vesadrm_crtc_helper_atomic_flush`.
- 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.