brintos

brintos / linux-shallow public Read only

0
0
Text · 3.0 KiB · cf7a183 Raw
102 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2/*3 * (C) COPYRIGHT 2018 ARM Limited. All rights reserved.4 * Author: James.Qian.Wang <james.qian.wang@arm.com>5 *6 */7 8#ifndef _KOMEDA_FORMAT_CAPS_H_9#define _KOMEDA_FORMAT_CAPS_H_10 11#include <linux/types.h>12#include <uapi/drm/drm_fourcc.h>13#include <drm/drm_fourcc.h>14 15#define AFBC(x)		DRM_FORMAT_MOD_ARM_AFBC(x)16 17/* afbc layerout */18#define AFBC_16x16(x)	AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 | (x))19#define AFBC_32x8(x)	AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_32x8 | (x))20 21/* afbc features */22#define _YTR		AFBC_FORMAT_MOD_YTR23#define _SPLIT		AFBC_FORMAT_MOD_SPLIT24#define _SPARSE		AFBC_FORMAT_MOD_SPARSE25#define _CBR		AFBC_FORMAT_MOD_CBR26#define _TILED		AFBC_FORMAT_MOD_TILED27#define _SC		AFBC_FORMAT_MOD_SC28 29/* layer_type */30#define KOMEDA_FMT_RICH_LAYER		BIT(0)31#define KOMEDA_FMT_SIMPLE_LAYER		BIT(1)32#define KOMEDA_FMT_WB_LAYER		BIT(2)33 34#define AFBC_TH_LAYOUT_ALIGNMENT	835#define AFBC_HEADER_SIZE		1636#define AFBC_SUPERBLK_ALIGNMENT		12837#define AFBC_SUPERBLK_PIXELS		25638#define AFBC_BODY_START_ALIGNMENT	102439#define AFBC_TH_BODY_START_ALIGNMENT	409640 41/**42 * struct komeda_format_caps43 *44 * komeda_format_caps is for describing ARM display specific features and45 * limitations for a specific format, and format_caps will be linked into46 * &komeda_framebuffer like a extension of &drm_format_info.47 *48 * NOTE: one fourcc may has two different format_caps items for fourcc and49 * fourcc+modifier50 *51 * @hw_id: hw format id, hw specific value.52 * @fourcc: drm fourcc format.53 * @supported_layer_types: indicate which layer supports this format54 * @supported_rots: allowed rotations for this format55 * @supported_afbc_layouts: supported afbc layerout56 * @supported_afbc_features: supported afbc features57 */58struct komeda_format_caps {59	u32 hw_id;60	u32 fourcc;61	u32 supported_layer_types;62	u32 supported_rots;63	u32 supported_afbc_layouts;64	u64 supported_afbc_features;65};66 67/**68 * struct komeda_format_caps_table - format_caps mananger69 *70 * @n_formats: the size of format_caps list.71 * @format_caps: format_caps list.72 * @format_mod_supported: Optional. Some HW may have special requirements or73 * limitations which can not be described by format_caps, this func supply HW74 * the ability to do the further HW specific check.75 */76struct komeda_format_caps_table {77	u32 n_formats;78	const struct komeda_format_caps *format_caps;79	bool (*format_mod_supported)(const struct komeda_format_caps *caps,80				     u32 layer_type, u64 modifier, u32 rot);81};82 83extern u64 komeda_supported_modifiers[];84 85const struct komeda_format_caps *86komeda_get_format_caps(struct komeda_format_caps_table *table,87		       u32 fourcc, u64 modifier);88 89u32 komeda_get_afbc_format_bpp(const struct drm_format_info *info,90			       u64 modifier);91 92u32 *komeda_get_layer_fourcc_list(struct komeda_format_caps_table *table,93				  u32 layer_type, u32 *n_fmts);94 95void komeda_put_fourcc_list(u32 *fourcc_list);96 97bool komeda_format_mod_supported(struct komeda_format_caps_table *table,98				 u32 layer_type, u32 fourcc, u64 modifier,99				 u32 rot);100 101#endif102