drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c- Extension
.c- Size
- 18711 bytes
- Lines
- 916
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/fb.hlinux/device.hlinux/uaccess.hlinux/platform_device.hlinux/mm.hlinux/omapfb.hlinux/vmalloc.hlinux/sizes.hvideo/omapfb_dss.hvideo/omapvrfb.homapfb.h
Detected Declarations
function Copyrightfunction omapfb_setup_planefunction omapfb_query_planefunction omapfb_setup_memfunction omapfb_query_memfunction omapfb_update_windowfunction omapfb_set_update_modefunction omapfb_get_update_modefunction _omapfb_set_color_keyfunction omapfb_set_color_keyfunction omapfb_get_color_keyfunction omapfb_memory_readfunction omapfb_get_ovl_colormodefunction omapfb_wait_for_gofunction omapfb_ioctl
Annotated Snippet
if (ovl->is_enabled(ovl)) {
r = -EBUSY;
goto out;
}
}
}
r = omapfb_realloc_fbmem(fbi, size, mi->type);
if (r) {
dev_err(fbdev->dev, "realloc fbmem failed\n");
goto out;
}
out:
atomic_dec(&rg->lock_count);
up_write(&rg->lock);
return r;
}
static int omapfb_query_mem(struct fb_info *fbi, struct omapfb_mem_info *mi)
{
struct omapfb_info *ofbi = FB2OFB(fbi);
struct omapfb2_mem_region *rg;
rg = omapfb_get_mem_region(ofbi->region);
memset(mi, 0, sizeof(*mi));
mi->size = rg->size;
mi->type = rg->type;
omapfb_put_mem_region(rg);
return 0;
}
static int omapfb_update_window(struct fb_info *fbi,
u32 x, u32 y, u32 w, u32 h)
{
struct omap_dss_device *display = fb2display(fbi);
u16 dw, dh;
if (!display)
return 0;
if (w == 0 || h == 0)
return 0;
display->driver->get_resolution(display, &dw, &dh);
if (x + w > dw || y + h > dh)
return -EINVAL;
return display->driver->update(display, x, y, w, h);
}
int omapfb_set_update_mode(struct fb_info *fbi,
enum omapfb_update_mode mode)
{
struct omap_dss_device *display = fb2display(fbi);
struct omapfb_info *ofbi = FB2OFB(fbi);
struct omapfb2_device *fbdev = ofbi->fbdev;
struct omapfb_display_data *d;
int r;
if (!display)
return -EINVAL;
if (mode != OMAPFB_AUTO_UPDATE && mode != OMAPFB_MANUAL_UPDATE)
return -EINVAL;
omapfb_lock(fbdev);
d = get_display_data(fbdev, display);
if (d->update_mode == mode) {
omapfb_unlock(fbdev);
return 0;
}
r = 0;
if (display->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) {
if (mode == OMAPFB_AUTO_UPDATE)
omapfb_start_auto_update(fbdev, display);
else /* MANUAL_UPDATE */
omapfb_stop_auto_update(fbdev, display);
d->update_mode = mode;
} else { /* AUTO_UPDATE */
Annotation
- Immediate include surface: `linux/fb.h`, `linux/device.h`, `linux/uaccess.h`, `linux/platform_device.h`, `linux/mm.h`, `linux/omapfb.h`, `linux/vmalloc.h`, `linux/sizes.h`.
- Detected declarations: `function Copyright`, `function omapfb_setup_plane`, `function omapfb_query_plane`, `function omapfb_setup_mem`, `function omapfb_query_mem`, `function omapfb_update_window`, `function omapfb_set_update_mode`, `function omapfb_get_update_mode`, `function _omapfb_set_color_key`, `function omapfb_set_color_key`.
- Atlas domain: Driver Families / drivers/video.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.