mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-29 20:58:57 -04:00
Verisilicon display controllers support hardware cursors per output port. Add support for them as cursor planes. Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Link: https://patch.msgid.link/20260506175610.2542888-3-zhengxingda@iscas.ac.cn
90 lines
2.3 KiB
C
90 lines
2.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2025 Icenowy Zheng <uwu@icenowy.me>
|
|
*
|
|
* Based on vs_dc_hw.h, which is:
|
|
* Copyright (C) 2023 VeriSilicon Holdings Co., Ltd.
|
|
*/
|
|
|
|
#ifndef _VS_PLANE_H_
|
|
#define _VS_PLANE_H_
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <drm/drm_device.h>
|
|
#include <drm/drm_framebuffer.h>
|
|
#include <drm/drm_plane.h>
|
|
#include <drm/drm_rect.h>
|
|
|
|
#define VSDC_MAKE_PLANE_SIZE(w, h) (((w) & 0x7fff) | (((h) & 0x7fff) << 15))
|
|
#define VSDC_MAKE_PLANE_POS(x, y) (((x) & 0x7fff) | (((y) & 0x7fff) << 15))
|
|
|
|
struct vs_dc;
|
|
|
|
enum vs_color_format {
|
|
VSDC_COLOR_FORMAT_X4R4G4B4,
|
|
VSDC_COLOR_FORMAT_A4R4G4B4,
|
|
VSDC_COLOR_FORMAT_X1R5G5B5,
|
|
VSDC_COLOR_FORMAT_A1R5G5B5,
|
|
VSDC_COLOR_FORMAT_R5G6B5,
|
|
VSDC_COLOR_FORMAT_X8R8G8B8,
|
|
VSDC_COLOR_FORMAT_A8R8G8B8,
|
|
VSDC_COLOR_FORMAT_YUY2,
|
|
VSDC_COLOR_FORMAT_UYVY,
|
|
VSDC_COLOR_FORMAT_INDEX8,
|
|
VSDC_COLOR_FORMAT_MONOCHROME,
|
|
VSDC_COLOR_FORMAT_YV12 = 0xf,
|
|
VSDC_COLOR_FORMAT_A8,
|
|
VSDC_COLOR_FORMAT_NV12,
|
|
VSDC_COLOR_FORMAT_NV16,
|
|
VSDC_COLOR_FORMAT_RG16,
|
|
VSDC_COLOR_FORMAT_R8,
|
|
VSDC_COLOR_FORMAT_NV12_10BIT,
|
|
VSDC_COLOR_FORMAT_A2R10G10B10,
|
|
VSDC_COLOR_FORMAT_NV16_10BIT,
|
|
VSDC_COLOR_FORMAT_INDEX1,
|
|
VSDC_COLOR_FORMAT_INDEX2,
|
|
VSDC_COLOR_FORMAT_INDEX4,
|
|
VSDC_COLOR_FORMAT_P010,
|
|
VSDC_COLOR_FORMAT_YUV444,
|
|
VSDC_COLOR_FORMAT_YUV444_10BIT
|
|
};
|
|
|
|
enum vs_swizzle {
|
|
VSDC_SWIZZLE_ARGB,
|
|
VSDC_SWIZZLE_RGBA,
|
|
VSDC_SWIZZLE_ABGR,
|
|
VSDC_SWIZZLE_BGRA,
|
|
};
|
|
|
|
struct vs_format {
|
|
enum vs_color_format color;
|
|
enum vs_swizzle swizzle;
|
|
bool uv_swizzle;
|
|
};
|
|
|
|
struct vs_plane_state {
|
|
struct drm_plane_state base;
|
|
|
|
struct vs_format format;
|
|
};
|
|
|
|
static inline struct vs_plane_state *to_vs_plane_state(struct drm_plane_state *state)
|
|
{
|
|
return container_of(state, struct vs_plane_state, base);
|
|
}
|
|
|
|
int drm_format_to_vs_format(u32 drm_format, struct vs_format *vs_format);
|
|
dma_addr_t vs_fb_get_dma_addr(struct drm_framebuffer *fb,
|
|
const struct drm_rect *src_rect);
|
|
|
|
struct drm_plane_state *vs_plane_duplicate_state(struct drm_plane *plane);
|
|
void vs_plane_destroy_state(struct drm_plane *plane,
|
|
struct drm_plane_state *state);
|
|
void vs_plane_reset(struct drm_plane *plane);
|
|
|
|
struct drm_plane *vs_primary_plane_init(struct drm_device *dev, struct vs_dc *dc);
|
|
struct drm_plane *vs_cursor_plane_init(struct drm_device *dev, struct vs_dc *dc);
|
|
|
|
#endif /* _VS_PLANE_H_ */
|