drivers/gpu/drm/renesas/rcar-du/rcar_du_vsp.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/renesas/rcar-du/rcar_du_vsp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/renesas/rcar-du/rcar_du_vsp.c- Extension
.c- Size
- 13868 bytes
- Lines
- 554
- 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.
- 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
drm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_blend.hdrm/drm_crtc.hdrm/drm_fb_dma_helper.hdrm/drm_fourcc.hdrm/drm_framebuffer.hdrm/drm_gem_atomic_helper.hdrm/drm_gem_dma_helper.hdrm/drm_managed.hdrm/drm_vblank.hlinux/bitops.hlinux/device.hlinux/dma-mapping.hlinux/of_platform.hlinux/platform_device.hlinux/scatterlist.hlinux/slab.hlinux/videodev2.hmedia/vsp1.hrcar_du_drv.hrcar_du_kms.hrcar_du_vsp.hrcar_du_writeback.h
Detected Declarations
function Copyrightfunction rcar_du_vsp_enablefunction rcar_du_vsp_disablefunction rcar_du_vsp_atomic_beginfunction rcar_du_vsp_atomic_flushfunction rcar_du_vsp_state_get_formatfunction rcar_du_vsp_plane_setupfunction rcar_du_vsp_map_fbfunction rcar_du_vsp_plane_prepare_fbfunction rcar_du_vsp_unmap_fbfunction rcar_du_vsp_plane_cleanup_fbfunction rcar_du_vsp_plane_atomic_checkfunction rcar_du_vsp_plane_atomic_updatefunction rcar_du_vsp_plane_atomic_duplicate_statefunction rcar_du_vsp_plane_atomic_destroy_statefunction rcar_du_vsp_plane_resetfunction rcar_du_vsp_cleanupfunction rcar_du_vsp_init
Annotated Snippet
switch (fourcc) {
case DRM_FORMAT_ARGB1555:
fourcc = DRM_FORMAT_XRGB1555;
break;
case DRM_FORMAT_ARGB4444:
fourcc = DRM_FORMAT_XRGB4444;
break;
case DRM_FORMAT_ARGB8888:
fourcc = DRM_FORMAT_XRGB8888;
break;
case DRM_FORMAT_ABGR8888:
fourcc = DRM_FORMAT_XBGR8888;
break;
case DRM_FORMAT_BGRA8888:
fourcc = DRM_FORMAT_BGRX8888;
break;
case DRM_FORMAT_RGBA1010102:
fourcc = DRM_FORMAT_RGBX1010102;
break;
}
}
return fourcc;
}
static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane)
{
struct rcar_du_vsp_plane_state *state =
to_rcar_vsp_plane_state(plane->plane.state);
struct rcar_du_crtc *crtc = to_rcar_crtc(state->state.crtc);
struct drm_framebuffer *fb = plane->plane.state->fb;
const struct rcar_du_format_info *format;
struct vsp1_du_atomic_config cfg = {
.pixelformat = 0,
.pitch = fb->pitches[0],
.alpha = state->state.alpha >> 8,
.zpos = state->state.zpos,
};
u32 fourcc = rcar_du_vsp_state_get_format(state);
unsigned int i;
cfg.src.left = state->state.src.x1 >> 16;
cfg.src.top = state->state.src.y1 >> 16;
cfg.src.width = drm_rect_width(&state->state.src) >> 16;
cfg.src.height = drm_rect_height(&state->state.src) >> 16;
cfg.dst.left = state->state.dst.x1;
cfg.dst.top = state->state.dst.y1;
cfg.dst.width = drm_rect_width(&state->state.dst);
cfg.dst.height = drm_rect_height(&state->state.dst);
for (i = 0; i < state->format->planes; ++i)
cfg.mem[i] = sg_dma_address(state->sg_tables[i].sgl)
+ fb->offsets[i];
format = rcar_du_format_info(fourcc);
cfg.pixelformat = format->v4l2;
cfg.premult = state->state.pixel_blend_mode == DRM_MODE_BLEND_PREMULTI;
vsp1_du_atomic_update(plane->vsp->vsp, crtc->vsp_pipe,
plane->index, &cfg);
}
int rcar_du_vsp_map_fb(struct rcar_du_vsp *vsp, struct drm_framebuffer *fb,
struct sg_table sg_tables[3])
{
struct rcar_du_device *rcdu = vsp->dev;
unsigned int i, j;
int ret;
for (i = 0; i < fb->format->num_planes; ++i) {
struct drm_gem_dma_object *gem = drm_fb_dma_get_gem_obj(fb, i);
struct sg_table *sgt = &sg_tables[i];
if (gem->sgt) {
struct scatterlist *src;
struct scatterlist *dst;
/*
* If the GEM buffer has a scatter gather table, it has
* been imported from a dma-buf and has no physical
* address as it might not be physically contiguous.
* Copy the original scatter gather table to map it to
* the VSP.
Annotation
- Immediate include surface: `drm/drm_atomic.h`, `drm/drm_atomic_helper.h`, `drm/drm_blend.h`, `drm/drm_crtc.h`, `drm/drm_fb_dma_helper.h`, `drm/drm_fourcc.h`, `drm/drm_framebuffer.h`, `drm/drm_gem_atomic_helper.h`.
- Detected declarations: `function Copyright`, `function rcar_du_vsp_enable`, `function rcar_du_vsp_disable`, `function rcar_du_vsp_atomic_begin`, `function rcar_du_vsp_atomic_flush`, `function rcar_du_vsp_state_get_format`, `function rcar_du_vsp_plane_setup`, `function rcar_du_vsp_map_fb`, `function rcar_du_vsp_plane_prepare_fb`, `function rcar_du_vsp_unmap_fb`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source 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.