drivers/gpu/drm/msm/msm_fbdev.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/msm_fbdev.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/msm/msm_fbdev.c- Extension
.c- Size
- 3915 bytes
- Lines
- 156
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fb.hdrm/drm_drv.hdrm/drm_crtc_helper.hdrm/drm_fb_helper.hdrm/drm_fourcc.hdrm/drm_framebuffer.hdrm/drm_prime.hmsm_drv.hmsm_gem.hmsm_kms.h
Detected Declarations
function msm_fbdev_mmapfunction msm_fbdev_fb_destroyfunction msm_fbdev_fb_dirtyfunction msm_fbdev_driver_fbdev_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2013 Red Hat
* Author: Rob Clark <robdclark@gmail.com>
*/
#include <linux/fb.h>
#include <drm/drm_drv.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_fb_helper.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_prime.h>
#include "msm_drv.h"
#include "msm_gem.h"
#include "msm_kms.h"
static bool fbdev = true;
MODULE_PARM_DESC(fbdev, "Enable fbdev compat layer");
module_param(fbdev, bool, 0600);
/*
* fbdev funcs, to implement legacy fbdev interface on top of drm driver
*/
FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(msm_fbdev,
drm_fb_helper_damage_range,
drm_fb_helper_damage_area)
static int msm_fbdev_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
struct drm_fb_helper *helper = (struct drm_fb_helper *)info->par;
struct drm_gem_object *bo = msm_framebuffer_bo(helper->fb, 0);
return drm_gem_prime_mmap(bo, vma);
}
static void msm_fbdev_fb_destroy(struct fb_info *info)
{
struct drm_fb_helper *helper = (struct drm_fb_helper *)info->par;
struct drm_framebuffer *fb = helper->fb;
struct drm_gem_object *bo = msm_framebuffer_bo(fb, 0);
DBG();
drm_fb_helper_fini(helper);
/* this will free the backing object */
msm_gem_put_vaddr(bo);
drm_framebuffer_remove(fb);
drm_client_release(&helper->client);
}
static const struct fb_ops msm_fb_ops = {
.owner = THIS_MODULE,
__FB_DEFAULT_DEFERRED_OPS_RDWR(msm_fbdev),
DRM_FB_HELPER_DEFAULT_OPS,
__FB_DEFAULT_DEFERRED_OPS_DRAW(msm_fbdev),
.fb_mmap = msm_fbdev_mmap,
.fb_destroy = msm_fbdev_fb_destroy,
};
static int msm_fbdev_fb_dirty(struct drm_fb_helper *helper,
struct drm_clip_rect *clip)
{
struct drm_device *dev = helper->dev;
int ret;
/* Call damage handlers only if necessary */
if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
return 0;
if (helper->fb->funcs->dirty) {
ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
if (drm_WARN_ONCE(dev, ret, "Dirty helper failed: ret=%d\n", ret))
return ret;
}
return 0;
}
static const struct drm_fb_helper_funcs msm_fbdev_helper_funcs = {
.fb_dirty = msm_fbdev_fb_dirty,
};
int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
struct drm_fb_helper_surface_size *sizes)
Annotation
- Immediate include surface: `linux/fb.h`, `drm/drm_drv.h`, `drm/drm_crtc_helper.h`, `drm/drm_fb_helper.h`, `drm/drm_fourcc.h`, `drm/drm_framebuffer.h`, `drm/drm_prime.h`, `msm_drv.h`.
- Detected declarations: `function msm_fbdev_mmap`, `function msm_fbdev_fb_destroy`, `function msm_fbdev_fb_dirty`, `function msm_fbdev_driver_fbdev_probe`.
- 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.