drivers/video/fbdev/omap2/omapfb/omapfb-main.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/omap2/omapfb/omapfb-main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/omap2/omapfb/omapfb-main.c- Extension
.c- Size
- 59598 bytes
- Lines
- 2642
- Domain
- Driver Families
- Bucket
- drivers/video
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/module.hlinux/delay.hlinux/slab.hlinux/fb.hlinux/dma-mapping.hlinux/vmalloc.hlinux/device.hlinux/platform_device.hlinux/omapfb.hvideo/omapfb_dss.hvideo/omapvrfb.homapfb.h
Detected Declarations
function draw_pixelfunction fill_fbfunction omapfb_get_vrfb_offsetfunction omapfb_get_region_rot_paddrfunction omapfb_get_region_paddrfunction cmp_componentfunction cmp_var_to_colormodefunction assign_colormode_to_varfunction fb_mode_to_dss_modefunction check_fb_res_boundsfunction shrink_heightfunction shrink_widthfunction check_vrfb_fb_sizefunction check_fb_sizefunction setup_vrfb_rotationfunction dss_mode_to_fb_modefunction set_fb_fixfunction check_fb_varfunction omapfb_openfunction omapfb_releasefunction calc_rotation_offset_dmafunction calc_rotation_offset_vrfbfunction omapfb_calc_addrfunction omapfb_setup_overlayfunction omapfb_apply_changesfunction omapfb_check_varfunction omapfb_set_parfunction omapfb_pan_displayfunction mmap_user_openfunction mmap_user_closefunction omapfb_mmapfunction _setcolregfunction omapfb_setcolregfunction omapfb_setcmapfunction omapfb_blankfunction omapfb_writefunction omapfb_free_fbmemfunction clear_fb_infofunction omapfb_free_all_fbmemfunction omapfb_alloc_fbmemfunction omapfb_alloc_fbmem_displayfunction omapfb_parse_vram_paramfunction omapfb_allocate_all_fbsfunction omapfb_clear_fbfunction omapfb_realloc_fbmemfunction omapfb_auto_update_workfunction omapfb_start_auto_updatefunction omapfb_stop_auto_update
Annotated Snippet
else if (x > 20 && y > 20 && x < w - 20 && y < h - 20) {
int t = x * 3 / w;
unsigned r = 0, g = 0, b = 0;
unsigned c;
if (var->bits_per_pixel == 16) {
if (t == 0)
b = (y % 32) * 256 / 32;
else if (t == 1)
g = (y % 64) * 256 / 64;
else if (t == 2)
r = (y % 32) * 256 / 32;
} else {
if (t == 0)
b = (y % 256);
else if (t == 1)
g = (y % 256);
else if (t == 2)
r = (y % 256);
}
c = (r << 16) | (g << 8) | (b << 0);
draw_pixel(fbi, x, y, c);
} else {
draw_pixel(fbi, x, y, 0);
}
}
}
}
#endif
static unsigned omapfb_get_vrfb_offset(const struct omapfb_info *ofbi, int rot)
{
const struct vrfb *vrfb = &ofbi->region->vrfb;
unsigned offset;
switch (rot) {
case FB_ROTATE_UR:
offset = 0;
break;
case FB_ROTATE_CW:
offset = vrfb->yoffset;
break;
case FB_ROTATE_UD:
offset = vrfb->yoffset * OMAP_VRFB_LINE_LEN + vrfb->xoffset;
break;
case FB_ROTATE_CCW:
offset = vrfb->xoffset * OMAP_VRFB_LINE_LEN;
break;
default:
BUG();
return 0;
}
offset *= vrfb->bytespp;
return offset;
}
static u32 omapfb_get_region_rot_paddr(const struct omapfb_info *ofbi, int rot)
{
if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
return ofbi->region->vrfb.paddr[rot]
+ omapfb_get_vrfb_offset(ofbi, rot);
} else {
return ofbi->region->paddr;
}
}
static u32 omapfb_get_region_paddr(const struct omapfb_info *ofbi)
{
if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
return ofbi->region->vrfb.paddr[0];
else
return ofbi->region->paddr;
}
static void __iomem *omapfb_get_region_vaddr(const struct omapfb_info *ofbi)
{
if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
return ofbi->region->vrfb.vaddr[0];
else
return ofbi->region->vaddr;
}
static struct omapfb_colormode omapfb_colormodes[] = {
{
.dssmode = OMAP_DSS_COLOR_UYVY,
.bits_per_pixel = 16,
.nonstd = OMAPFB_COLOR_YUV422,
}, {
.dssmode = OMAP_DSS_COLOR_YUV2,
Annotation
- Immediate include surface: `linux/module.h`, `linux/delay.h`, `linux/slab.h`, `linux/fb.h`, `linux/dma-mapping.h`, `linux/vmalloc.h`, `linux/device.h`, `linux/platform_device.h`.
- Detected declarations: `function draw_pixel`, `function fill_fb`, `function omapfb_get_vrfb_offset`, `function omapfb_get_region_rot_paddr`, `function omapfb_get_region_paddr`, `function cmp_component`, `function cmp_var_to_colormode`, `function assign_colormode_to_var`, `function fb_mode_to_dss_mode`, `function check_fb_res_bounds`.
- Atlas domain: Driver Families / drivers/video.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.