drivers/gpu/drm/drm_fbdev_dma.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/drm_fbdev_dma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/drm_fbdev_dma.c- Extension
.c- Size
- 8573 bytes
- Lines
- 324
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/export.hlinux/fb.hlinux/vmalloc.hdrm/drm_drv.hdrm/drm_fbdev_dma.hdrm/drm_fb_dma_helper.hdrm/drm_fb_helper.hdrm/drm_framebuffer.hdrm/drm_gem_dma_helper.hdrm/drm_print.h
Detected Declarations
function drm_fbdev_dma_fb_openfunction drm_fbdev_dma_fb_releasefunction drm_fbdev_dma_fb_mmapfunction drm_fbdev_dma_fb_destroyfunction drm_fbdev_dma_shadowed_fb_destroyfunction drm_fbdev_dma_damage_blit_realfunction drm_fbdev_dma_damage_blitfunction drm_fbdev_dma_helper_fb_dirtyfunction drm_fbdev_dma_driver_fbdev_probe_tailfunction drm_fbdev_dma_driver_fbdev_probe_tail_shadowedfunction drm_fbdev_dma_driver_fbdev_probeexport drm_fbdev_dma_driver_fbdev_probe
Annotated Snippet
// SPDX-License-Identifier: MIT
#include <linux/export.h>
#include <linux/fb.h>
#include <linux/vmalloc.h>
#include <drm/drm_drv.h>
#include <drm/drm_fbdev_dma.h>
#include <drm/drm_fb_dma_helper.h>
#include <drm/drm_fb_helper.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_gem_dma_helper.h>
#include <drm/drm_print.h>
/*
* struct fb_ops
*/
static int drm_fbdev_dma_fb_open(struct fb_info *info, int user)
{
struct drm_fb_helper *fb_helper = info->par;
/* No need to take a ref for fbcon because it unbinds on unregister */
if (user && !try_module_get(fb_helper->dev->driver->fops->owner))
return -ENODEV;
return 0;
}
static int drm_fbdev_dma_fb_release(struct fb_info *info, int user)
{
struct drm_fb_helper *fb_helper = info->par;
if (user)
module_put(fb_helper->dev->driver->fops->owner);
return 0;
}
static int drm_fbdev_dma_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
struct drm_fb_helper *fb_helper = info->par;
return drm_gem_prime_mmap(fb_helper->buffer->gem, vma);
}
static void drm_fbdev_dma_fb_destroy(struct fb_info *info)
{
struct drm_fb_helper *fb_helper = info->par;
if (!fb_helper->dev)
return;
if (info->fbdefio)
fb_deferred_io_cleanup(info);
drm_fb_helper_fini(fb_helper);
drm_client_buffer_vunmap(fb_helper->buffer);
drm_client_buffer_delete(fb_helper->buffer);
drm_client_release(&fb_helper->client);
}
static const struct fb_ops drm_fbdev_dma_fb_ops = {
.owner = THIS_MODULE,
.fb_open = drm_fbdev_dma_fb_open,
.fb_release = drm_fbdev_dma_fb_release,
__FB_DEFAULT_DMAMEM_OPS_RDWR,
DRM_FB_HELPER_DEFAULT_OPS,
__FB_DEFAULT_DMAMEM_OPS_DRAW,
.fb_mmap = drm_fbdev_dma_fb_mmap,
.fb_destroy = drm_fbdev_dma_fb_destroy,
};
FB_GEN_DEFAULT_DEFERRED_DMAMEM_OPS(drm_fbdev_dma_shadowed,
drm_fb_helper_damage_range,
drm_fb_helper_damage_area);
static void drm_fbdev_dma_shadowed_fb_destroy(struct fb_info *info)
{
struct drm_fb_helper *fb_helper = info->par;
void *shadow = info->screen_buffer;
if (!fb_helper->dev)
return;
if (info->fbdefio)
fb_deferred_io_cleanup(info);
drm_fb_helper_fini(fb_helper);
vfree(shadow);
Annotation
- Immediate include surface: `linux/export.h`, `linux/fb.h`, `linux/vmalloc.h`, `drm/drm_drv.h`, `drm/drm_fbdev_dma.h`, `drm/drm_fb_dma_helper.h`, `drm/drm_fb_helper.h`, `drm/drm_framebuffer.h`.
- Detected declarations: `function drm_fbdev_dma_fb_open`, `function drm_fbdev_dma_fb_release`, `function drm_fbdev_dma_fb_mmap`, `function drm_fbdev_dma_fb_destroy`, `function drm_fbdev_dma_shadowed_fb_destroy`, `function drm_fbdev_dma_damage_blit_real`, `function drm_fbdev_dma_damage_blit`, `function drm_fbdev_dma_helper_fb_dirty`, `function drm_fbdev_dma_driver_fbdev_probe_tail`, `function drm_fbdev_dma_driver_fbdev_probe_tail_shadowed`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration 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.