linux/drivers/media/platform/mediatek/mdp3/mtk-mdp3-regs.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2022 MediaTek Inc.
 * Author: Ping-Hsun Wu <[email protected]>
 */

#ifndef __MTK_MDP3_REGS_H__
#define __MTK_MDP3_REGS_H__

#include <linux/videodev2.h>
#include <media/videobuf2-core.h>
#include "mtk-img-ipi.h"

/*
 * MDP native color code
 * Plane count: 1, 2, 3
 * H-subsample: 0, 1, 2
 * V-subsample: 0, 1
 * Color group: 0-RGB, 1-YUV, 2-raw
 */
#define MDP_COLOR(COMPRESS, PACKED, LOOSE, VIDEO, PLANE, HF, VF, BITS, GROUP, SWAP, ID)

#define MDP_COLOR_IS_COMPRESS(c)
#define MDP_COLOR_IS_10BIT_PACKED(c)
#define MDP_COLOR_IS_10BIT_LOOSE(c)
#define MDP_COLOR_IS_10BIT_TILE(c)
#define MDP_COLOR_IS_UFP(c)
#define MDP_COLOR_IS_INTERLACED(c)
#define MDP_COLOR_IS_BLOCK_MODE(c)
#define MDP_COLOR_GET_PLANE_COUNT(c)
#define MDP_COLOR_GET_H_SUBSAMPLE(c)
#define MDP_COLOR_GET_V_SUBSAMPLE(c)
#define MDP_COLOR_BITS_PER_PIXEL(c)
#define MDP_COLOR_GET_GROUP(c)
#define MDP_COLOR_IS_SWAPPED(c)
#define MDP_COLOR_GET_UNIQUE_ID(c)
#define MDP_COLOR_GET_HW_FORMAT(c)

#define MDP_COLOR_IS_RGB(c)
#define MDP_COLOR_IS_YUV(c)

enum mdp_color {};

static inline bool MDP_COLOR_IS_UV_COPLANE(enum mdp_color c)
{}

/* Minimum Y stride that is accepted by MDP HW */
static inline u32 mdp_color_get_min_y_stride(enum mdp_color c, u32 width)
{}

/* Minimum UV stride that is accepted by MDP HW */
static inline u32 mdp_color_get_min_uv_stride(enum mdp_color c, u32 width)
{}

/* Minimum Y plane size that is necessary in buffer */
static inline u32 mdp_color_get_min_y_size(enum mdp_color c,
					   u32 width, u32 height)
{}

/* Minimum UV plane size that is necessary in buffer */
static inline u32 mdp_color_get_min_uv_size(enum mdp_color c,
					    u32 width, u32 height)
{}

/* Combine colorspace, xfer_func, ycbcr_encoding, and quantization */
enum mdp_ycbcr_profile {};

#define MDP_FMT_FLAG_OUTPUT
#define MDP_FMT_FLAG_CAPTURE

struct mdp_format {};

struct mdp_pix_limit {};

struct mdp_limit {};

enum mdp_stream_type {};

struct mdp_crop {};

struct mdp_frame {};

static inline bool mdp_target_is_crop(u32 target)
{}

static inline bool mdp_target_is_compose(u32 target)
{}

#define MDP_MAX_CAPTURES

#define MDP_VPU_INIT
#define MDP_M2M_CTX_ERROR

struct mdp_frameparam {};

struct mdp_dev;

int mdp_enum_fmt_mplane(struct mdp_dev *mdp, struct v4l2_fmtdesc *f);
const struct mdp_format *mdp_try_fmt_mplane(struct mdp_dev *mdp,
					    struct v4l2_format *f,
					    struct mdp_frameparam *param,
					    u32 ctx_id);
enum mdp_ycbcr_profile mdp_map_ycbcr_prof_mplane(struct v4l2_format *f,
						 u32 mdp_color);
int mdp_try_crop(struct mdp_m2m_ctx *ctx, struct v4l2_rect *r,
		 const struct v4l2_selection *s, struct mdp_frame *frame);
int mdp_check_scaling_ratio(const struct v4l2_rect *crop,
			    const struct v4l2_rect *compose, s32 rotation,
	const struct mdp_limit *limit);
bool mdp_check_pp_enable(struct mdp_dev *mdp, struct mdp_frame *frame);
void mdp_set_src_config(struct img_input *in,
			struct mdp_frame *frame, struct vb2_buffer *vb);
void mdp_set_dst_config(struct img_output *out,
			struct mdp_frame *frame, struct vb2_buffer *vb);
int mdp_frameparam_init(struct mdp_dev *mdp, struct mdp_frameparam *param);

#endif  /* __MTK_MDP3_REGS_H__ */