drivers/gpu/drm/verisilicon/vs_plane.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/verisilicon/vs_plane.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/verisilicon/vs_plane.c- Extension
.c- Size
- 4325 bytes
- Lines
- 175
- 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
linux/errno.hlinux/printk.hdrm/drm_atomic_state_helper.hdrm/drm_fb_dma_helper.hdrm/drm_fourcc.hdrm/drm_gem_dma_helper.hdrm/drm_print.hvs_plane.h
Detected Declarations
function Copyrightfunction vs_fb_get_dma_addrfunction vs_plane_destroy_statefunction vs_plane_reset
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2025 Icenowy Zheng <uwu@icenowy.me>
*/
#include <linux/errno.h>
#include <linux/printk.h>
#include <drm/drm_atomic_state_helper.h>
#include <drm/drm_fb_dma_helper.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_gem_dma_helper.h>
#include <drm/drm_print.h>
#include "vs_plane.h"
int drm_format_to_vs_format(u32 drm_format, struct vs_format *vs_format)
{
switch (drm_format) {
case DRM_FORMAT_XRGB4444:
case DRM_FORMAT_RGBX4444:
case DRM_FORMAT_XBGR4444:
case DRM_FORMAT_BGRX4444:
vs_format->color = VSDC_COLOR_FORMAT_X4R4G4B4;
break;
case DRM_FORMAT_ARGB4444:
case DRM_FORMAT_RGBA4444:
case DRM_FORMAT_ABGR4444:
case DRM_FORMAT_BGRA4444:
vs_format->color = VSDC_COLOR_FORMAT_A4R4G4B4;
break;
case DRM_FORMAT_XRGB1555:
case DRM_FORMAT_RGBX5551:
case DRM_FORMAT_XBGR1555:
case DRM_FORMAT_BGRX5551:
vs_format->color = VSDC_COLOR_FORMAT_X1R5G5B5;
break;
case DRM_FORMAT_ARGB1555:
case DRM_FORMAT_RGBA5551:
case DRM_FORMAT_ABGR1555:
case DRM_FORMAT_BGRA5551:
vs_format->color = VSDC_COLOR_FORMAT_A1R5G5B5;
break;
case DRM_FORMAT_RGB565:
case DRM_FORMAT_BGR565:
vs_format->color = VSDC_COLOR_FORMAT_R5G6B5;
break;
case DRM_FORMAT_XRGB8888:
case DRM_FORMAT_RGBX8888:
case DRM_FORMAT_XBGR8888:
case DRM_FORMAT_BGRX8888:
vs_format->color = VSDC_COLOR_FORMAT_X8R8G8B8;
break;
case DRM_FORMAT_ARGB8888:
case DRM_FORMAT_RGBA8888:
case DRM_FORMAT_ABGR8888:
case DRM_FORMAT_BGRA8888:
vs_format->color = VSDC_COLOR_FORMAT_A8R8G8B8;
break;
case DRM_FORMAT_ARGB2101010:
case DRM_FORMAT_RGBA1010102:
case DRM_FORMAT_ABGR2101010:
case DRM_FORMAT_BGRA1010102:
vs_format->color = VSDC_COLOR_FORMAT_A2R10G10B10;
break;
default:
return -EINVAL;
}
switch (drm_format) {
case DRM_FORMAT_RGBX4444:
case DRM_FORMAT_RGBA4444:
case DRM_FORMAT_RGBX5551:
case DRM_FORMAT_RGBA5551:
case DRM_FORMAT_RGBX8888:
case DRM_FORMAT_RGBA8888:
case DRM_FORMAT_RGBA1010102:
vs_format->swizzle = VSDC_SWIZZLE_RGBA;
break;
case DRM_FORMAT_XBGR4444:
case DRM_FORMAT_ABGR4444:
case DRM_FORMAT_XBGR1555:
case DRM_FORMAT_ABGR1555:
case DRM_FORMAT_BGR565:
case DRM_FORMAT_XBGR8888:
case DRM_FORMAT_ABGR8888:
case DRM_FORMAT_ABGR2101010:
vs_format->swizzle = VSDC_SWIZZLE_ABGR;
break;
case DRM_FORMAT_BGRX4444:
Annotation
- Immediate include surface: `linux/errno.h`, `linux/printk.h`, `drm/drm_atomic_state_helper.h`, `drm/drm_fb_dma_helper.h`, `drm/drm_fourcc.h`, `drm/drm_gem_dma_helper.h`, `drm/drm_print.h`, `vs_plane.h`.
- Detected declarations: `function Copyright`, `function vs_fb_get_dma_addr`, `function vs_plane_destroy_state`, `function vs_plane_reset`.
- 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.