drivers/gpu/drm/sysfb/drm_sysfb_modeset.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/sysfb/drm_sysfb_modeset.c- Extension
.c- Size
- 18923 bytes
- Lines
- 609
- 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/slab.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_atomic_state_helper.hdrm/drm_damage_helper.hdrm/drm_drv.hdrm/drm_edid.hdrm/drm_fourcc.hdrm/drm_framebuffer.hdrm/drm_gem_framebuffer_helper.hdrm/drm_panic.hdrm/drm_print.hdrm/drm_probe_helper.hdrm_sysfb_helper.h
Detected Declarations
function drm_sysfb_modefunction to_nonalpha_fourccfunction is_listed_fourccfunction drm_sysfb_build_fourcc_listfunction drm_sysfb_plane_state_destroyfunction drm_sysfb_memcpyfunction drm_sysfb_get_blit_funcfunction drm_sysfb_plane_helper_begin_fb_accessfunction drm_sysfb_plane_helper_atomic_checkfunction drm_sysfb_plane_helper_atomic_updatefunction drm_sysfb_plane_helper_atomic_disablefunction drm_sysfb_plane_helper_get_scanout_bufferfunction drm_sysfb_plane_resetfunction drm_sysfb_plane_atomic_destroy_statefunction drm_sysfb_crtc_state_destroyfunction drm_sysfb_crtc_helper_mode_validfunction drm_sysfb_crtc_helper_atomic_checkfunction drm_sysfb_crtc_resetfunction drm_sysfb_crtc_atomic_destroy_statefunction drm_sysfb_get_edid_blockfunction drm_sysfb_connector_helper_get_modesexport drm_sysfb_modeexport drm_sysfb_build_fourcc_listexport drm_sysfb_plane_helper_begin_fb_accessexport drm_sysfb_plane_helper_atomic_checkexport drm_sysfb_plane_helper_atomic_updateexport drm_sysfb_plane_helper_atomic_disableexport drm_sysfb_plane_helper_get_scanout_bufferexport drm_sysfb_plane_resetexport drm_sysfb_plane_atomic_duplicate_stateexport drm_sysfb_plane_atomic_destroy_stateexport drm_sysfb_crtc_helper_mode_validexport drm_sysfb_crtc_helper_atomic_checkexport drm_sysfb_crtc_resetexport drm_sysfb_crtc_atomic_duplicate_stateexport drm_sysfb_crtc_atomic_destroy_stateexport drm_sysfb_connector_helper_get_modes
Annotated Snippet
if (is_listed_fourcc(fourccs_out, fourccs - fourccs_out, fourcc)) {
continue; /* skip duplicate entries */
} else if (fourccs == fourccs_end) {
drm_warn(dev, "Ignoring native format %p4cc\n", &fourcc);
continue; /* end of available output buffer */
}
drm_dbg_kms(dev, "adding native format %p4cc\n", &fourcc);
*fourccs = fourcc;
++fourccs;
}
/*
* The extra formats, emulated by the driver, go second.
*/
for (i = 0; (i < extra_nfourccs) && (fourccs < fourccs_end); ++i) {
u32 fourcc = extra_fourccs[i];
if (is_listed_fourcc(fourccs_out, fourccs - fourccs_out, fourcc)) {
continue; /* skip duplicate and native entries */
} else if (fourccs == fourccs_end) {
drm_warn(dev, "Ignoring emulated format %p4cc\n", &fourcc);
continue; /* end of available output buffer */
}
drm_dbg_kms(dev, "adding emulated format %p4cc\n", &fourcc);
*fourccs = fourcc;
++fourccs;
}
return fourccs - fourccs_out;
}
EXPORT_SYMBOL(drm_sysfb_build_fourcc_list);
static void drm_sysfb_plane_state_destroy(struct drm_sysfb_plane_state *sysfb_plane_state)
{
__drm_gem_destroy_shadow_plane_state(&sysfb_plane_state->base);
kfree(sysfb_plane_state);
}
static void drm_sysfb_memcpy(struct iosys_map *dst, const unsigned int *dst_pitch,
const struct iosys_map *src, const struct drm_framebuffer *fb,
const struct drm_rect *clip, struct drm_format_conv_state *state)
{
drm_fb_memcpy(dst, dst_pitch, src, fb, clip);
}
static drm_sysfb_blit_func drm_sysfb_get_blit_func(u32 dst_format, u32 src_format)
{
if (src_format == dst_format) {
return drm_sysfb_memcpy;
} else if (src_format == DRM_FORMAT_XRGB8888) {
switch (dst_format) {
case DRM_FORMAT_RGB565:
return drm_fb_xrgb8888_to_rgb565;
case DRM_FORMAT_RGB565 | DRM_FORMAT_BIG_ENDIAN:
return drm_fb_xrgb8888_to_rgb565be;
case DRM_FORMAT_XRGB1555:
return drm_fb_xrgb8888_to_xrgb1555;
case DRM_FORMAT_ARGB1555:
return drm_fb_xrgb8888_to_argb1555;
case DRM_FORMAT_RGBA5551:
return drm_fb_xrgb8888_to_rgba5551;
case DRM_FORMAT_RGB888:
return drm_fb_xrgb8888_to_rgb888;
case DRM_FORMAT_BGR888:
return drm_fb_xrgb8888_to_bgr888;
case DRM_FORMAT_ARGB8888:
return drm_fb_xrgb8888_to_argb8888;
case DRM_FORMAT_XBGR8888:
return drm_fb_xrgb8888_to_xbgr8888;
case DRM_FORMAT_ABGR8888:
return drm_fb_xrgb8888_to_abgr8888;
case DRM_FORMAT_XRGB2101010:
return drm_fb_xrgb8888_to_xrgb2101010;
case DRM_FORMAT_ARGB2101010:
return drm_fb_xrgb8888_to_argb2101010;
case DRM_FORMAT_BGRX8888:
return drm_fb_xrgb8888_to_bgrx8888;
case DRM_FORMAT_RGB332:
return drm_fb_xrgb8888_to_rgb332;
}
}
return NULL;
}
Annotation
- Immediate include surface: `linux/export.h`, `linux/slab.h`, `drm/drm_atomic.h`, `drm/drm_atomic_helper.h`, `drm/drm_atomic_state_helper.h`, `drm/drm_damage_helper.h`, `drm/drm_drv.h`, `drm/drm_edid.h`.
- Detected declarations: `function drm_sysfb_mode`, `function to_nonalpha_fourcc`, `function is_listed_fourcc`, `function drm_sysfb_build_fourcc_list`, `function drm_sysfb_plane_state_destroy`, `function drm_sysfb_memcpy`, `function drm_sysfb_get_blit_func`, `function drm_sysfb_plane_helper_begin_fb_access`, `function drm_sysfb_plane_helper_atomic_check`, `function drm_sysfb_plane_helper_atomic_update`.
- 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.