linux/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * (C) COPYRIGHT 2018 ARM Limited. All rights reserved.
 * Author: James.Qian.Wang <[email protected]>
 *
 */

#ifndef _KOMEDA_FORMAT_CAPS_H_
#define _KOMEDA_FORMAT_CAPS_H_

#include <linux/types.h>
#include <uapi/drm/drm_fourcc.h>
#include <drm/drm_fourcc.h>

#define AFBC(x)

/* afbc layerout */
#define AFBC_16x16(x)
#define AFBC_32x8(x)

/* afbc features */
#define _YTR
#define _SPLIT
#define _SPARSE
#define _CBR
#define _TILED
#define _SC

/* layer_type */
#define KOMEDA_FMT_RICH_LAYER
#define KOMEDA_FMT_SIMPLE_LAYER
#define KOMEDA_FMT_WB_LAYER

#define AFBC_TH_LAYOUT_ALIGNMENT
#define AFBC_HEADER_SIZE
#define AFBC_SUPERBLK_ALIGNMENT
#define AFBC_SUPERBLK_PIXELS
#define AFBC_BODY_START_ALIGNMENT
#define AFBC_TH_BODY_START_ALIGNMENT

/**
 * struct komeda_format_caps
 *
 * komeda_format_caps is for describing ARM display specific features and
 * limitations for a specific format, and format_caps will be linked into
 * &komeda_framebuffer like a extension of &drm_format_info.
 *
 * NOTE: one fourcc may has two different format_caps items for fourcc and
 * fourcc+modifier
 *
 * @hw_id: hw format id, hw specific value.
 * @fourcc: drm fourcc format.
 * @supported_layer_types: indicate which layer supports this format
 * @supported_rots: allowed rotations for this format
 * @supported_afbc_layouts: supported afbc layerout
 * @supported_afbc_features: supported afbc features
 */
struct komeda_format_caps {};

/**
 * struct komeda_format_caps_table - format_caps mananger
 *
 * @n_formats: the size of format_caps list.
 * @format_caps: format_caps list.
 * @format_mod_supported: Optional. Some HW may have special requirements or
 * limitations which can not be described by format_caps, this func supply HW
 * the ability to do the further HW specific check.
 */
struct komeda_format_caps_table {};

extern u64 komeda_supported_modifiers[];

const struct komeda_format_caps *
komeda_get_format_caps(struct komeda_format_caps_table *table,
		       u32 fourcc, u64 modifier);

u32 komeda_get_afbc_format_bpp(const struct drm_format_info *info,
			       u64 modifier);

u32 *komeda_get_layer_fourcc_list(struct komeda_format_caps_table *table,
				  u32 layer_type, u32 *n_fmts);

void komeda_put_fourcc_list(u32 *fourcc_list);

bool komeda_format_mod_supported(struct komeda_format_caps_table *table,
				 u32 layer_type, u32 fourcc, u64 modifier,
				 u32 rot);

#endif