Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2025 Icenowy Zheng <uwu@icenowy.me>
4 *
5 * Based on vs_dc_hw.h, which is:
6 * Copyright (C) 2023 VeriSilicon Holdings Co., Ltd.
7 */
8
9#ifndef _VS_PLANE_H_
10#define _VS_PLANE_H_
11
12#include <linux/types.h>
13
14#include <drm/drm_device.h>
15#include <drm/drm_framebuffer.h>
16#include <drm/drm_plane.h>
17#include <drm/drm_rect.h>
18
19#define VSDC_MAKE_PLANE_SIZE(w, h) (((w) & 0x7fff) | (((h) & 0x7fff) << 15))
20#define VSDC_MAKE_PLANE_POS(x, y) (((x) & 0x7fff) | (((y) & 0x7fff) << 15))
21
22struct vs_dc;
23
24enum vs_color_format {
25 VSDC_COLOR_FORMAT_X4R4G4B4,
26 VSDC_COLOR_FORMAT_A4R4G4B4,
27 VSDC_COLOR_FORMAT_X1R5G5B5,
28 VSDC_COLOR_FORMAT_A1R5G5B5,
29 VSDC_COLOR_FORMAT_R5G6B5,
30 VSDC_COLOR_FORMAT_X8R8G8B8,
31 VSDC_COLOR_FORMAT_A8R8G8B8,
32 VSDC_COLOR_FORMAT_YUY2,
33 VSDC_COLOR_FORMAT_UYVY,
34 VSDC_COLOR_FORMAT_INDEX8,
35 VSDC_COLOR_FORMAT_MONOCHROME,
36 VSDC_COLOR_FORMAT_YV12 = 0xf,
37 VSDC_COLOR_FORMAT_A8,
38 VSDC_COLOR_FORMAT_NV12,
39 VSDC_COLOR_FORMAT_NV16,
40 VSDC_COLOR_FORMAT_RG16,
41 VSDC_COLOR_FORMAT_R8,
42 VSDC_COLOR_FORMAT_NV12_10BIT,
43 VSDC_COLOR_FORMAT_A2R10G10B10,
44 VSDC_COLOR_FORMAT_NV16_10BIT,
45 VSDC_COLOR_FORMAT_INDEX1,
46 VSDC_COLOR_FORMAT_INDEX2,
47 VSDC_COLOR_FORMAT_INDEX4,
48 VSDC_COLOR_FORMAT_P010,
49 VSDC_COLOR_FORMAT_YUV444,
50 VSDC_COLOR_FORMAT_YUV444_10BIT
51};
52
53enum vs_swizzle {
54 VSDC_SWIZZLE_ARGB,
55 VSDC_SWIZZLE_RGBA,
56 VSDC_SWIZZLE_ABGR,
57 VSDC_SWIZZLE_BGRA,
58};
59
60struct vs_format {
61 enum vs_color_format color;
62 enum vs_swizzle swizzle;
63 bool uv_swizzle;
64};
65
66void drm_format_to_vs_format(u32 drm_format, struct vs_format *vs_format);
67dma_addr_t vs_fb_get_dma_addr(struct drm_framebuffer *fb,
68 const struct drm_rect *src_rect);
69
70struct drm_plane *vs_primary_plane_init(struct drm_device *dev, struct vs_dc *dc);
71
72#endif /* _VS_PLANE_H_ */