drivers/gpu/drm/omapdrm/omap_fbdev.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/omapdrm/omap_fbdev.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/omapdrm/omap_fbdev.c- Extension
.c- Size
- 7705 bytes
- Lines
- 295
- 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.
- 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.hdrm/clients/drm_client_setup.hdrm/drm_drv.hdrm/drm_crtc_helper.hdrm/drm_fb_helper.hdrm/drm_file.hdrm/drm_fourcc.hdrm/drm_framebuffer.hdrm/drm_gem_framebuffer_helper.hdrm/drm_managed.hdrm/drm_print.hdrm/drm_util.homap_drv.homap_fbdev.h
Detected Declarations
struct omap_fbdevfunction pan_workerfunction omap_fbdev_pan_displayfunction omap_fbdev_fb_mmapfunction omap_fbdev_fb_destroyfunction omap_fbdev_dirtyfunction omap_fbdev_driver_fbdev_probefunction omap_fbdev_setup
Annotated Snippet
struct omap_fbdev {
struct drm_device *dev;
bool ywrap_enabled;
/* for deferred dmm roll when getting called in atomic ctx */
struct work_struct work;
};
static struct drm_fb_helper *get_fb(struct fb_info *fbi);
static void pan_worker(struct work_struct *work)
{
struct omap_fbdev *fbdev = container_of(work, struct omap_fbdev, work);
struct drm_fb_helper *helper = fbdev->dev->fb_helper;
struct fb_info *fbi = helper->info;
struct drm_gem_object *bo = drm_gem_fb_get_obj(helper->fb, 0);
int npages;
/* DMM roll shifts in 4K pages: */
npages = fbi->fix.line_length >> PAGE_SHIFT;
omap_gem_roll(bo, fbi->var.yoffset * npages);
}
FB_GEN_DEFAULT_DEFERRED_DMAMEM_OPS(omap_fbdev,
drm_fb_helper_damage_range,
drm_fb_helper_damage_area)
static int omap_fbdev_pan_display(struct fb_var_screeninfo *var, struct fb_info *fbi)
{
struct drm_fb_helper *helper = get_fb(fbi);
struct omap_drm_private *priv;
struct omap_fbdev *fbdev;
if (!helper)
goto fallback;
priv = helper->dev->dev_private;
fbdev = priv->fbdev;
if (!fbdev->ywrap_enabled)
goto fallback;
if (drm_can_sleep())
pan_worker(&fbdev->work);
else
queue_work(priv->wq, &fbdev->work);
return 0;
fallback:
return drm_fb_helper_pan_display(var, fbi);
}
static int omap_fbdev_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
return fb_deferred_io_mmap(info, vma);
}
static void omap_fbdev_fb_destroy(struct fb_info *info)
{
struct drm_fb_helper *helper = info->par;
struct drm_framebuffer *fb = helper->fb;
struct drm_gem_object *bo = drm_gem_fb_get_obj(fb, 0);
DBG();
fb_deferred_io_cleanup(info);
drm_fb_helper_fini(helper);
omap_gem_unpin(bo);
drm_framebuffer_remove(fb);
drm_client_release(&helper->client);
}
/*
* For now, we cannot use FB_DEFAULT_DEFERRED_OPS and fb_deferred_io_mmap()
* because we use write-combine.
*/
static const struct fb_ops omap_fb_ops = {
.owner = THIS_MODULE,
__FB_DEFAULT_DEFERRED_OPS_RDWR(omap_fbdev),
.fb_check_var = drm_fb_helper_check_var,
.fb_set_par = drm_fb_helper_set_par,
.fb_setcmap = drm_fb_helper_setcmap,
.fb_blank = drm_fb_helper_blank,
.fb_pan_display = omap_fbdev_pan_display,
__FB_DEFAULT_DEFERRED_OPS_DRAW(omap_fbdev),
Annotation
- Immediate include surface: `linux/fb.h`, `drm/clients/drm_client_setup.h`, `drm/drm_drv.h`, `drm/drm_crtc_helper.h`, `drm/drm_fb_helper.h`, `drm/drm_file.h`, `drm/drm_fourcc.h`, `drm/drm_framebuffer.h`.
- Detected declarations: `struct omap_fbdev`, `function pan_worker`, `function omap_fbdev_pan_display`, `function omap_fbdev_fb_mmap`, `function omap_fbdev_fb_destroy`, `function omap_fbdev_dirty`, `function omap_fbdev_driver_fbdev_probe`, `function omap_fbdev_setup`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.