1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
4 * Copyright (C) 2013 Red Hat
8 #ifndef __MSM_FORMAT_H__
9 #define __MSM_FORMAT_H__
11 #include "mdp_common.xml.h"
13 enum msm_format_flags {
14 MSM_FORMAT_FLAG_YUV_BIT,
15 MSM_FORMAT_FLAG_DX_BIT,
16 MSM_FORMAT_FLAG_COMPRESSED_BIT,
17 MSM_FORMAT_FLAG_UNPACK_TIGHT_BIT,
18 MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB_BIT,
21 #define MSM_FORMAT_FLAG_YUV BIT(MSM_FORMAT_FLAG_YUV_BIT)
22 #define MSM_FORMAT_FLAG_DX BIT(MSM_FORMAT_FLAG_DX_BIT)
23 #define MSM_FORMAT_FLAG_COMPRESSED BIT(MSM_FORMAT_FLAG_COMPRESSED_BIT)
24 #define MSM_FORMAT_FLAG_UNPACK_TIGHT BIT(MSM_FORMAT_FLAG_UNPACK_TIGHT_BIT)
25 #define MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB BIT(MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB_BIT)
28 * DPU HW,Component order color map
38 * struct msm_format: defines the format configuration
39 * @pixel_format: format fourcc
40 * @element: element color ordering
41 * @fetch_type: how the color components are packed in pixel format
42 * @chroma_sample: chroma sub-samplng type
43 * @alpha_enable: whether the format has an alpha channel
44 * @unpack_count: number of the components to unpack
45 * @bpp: bytes per pixel
46 * @flags: usage bit flags
47 * @num_planes: number of planes (including meta data planes)
48 * @fetch_mode: linear, tiled, or ubwc hw fetch behavior
49 * @tile_height: format tile height
52 uint32_t pixel_format;
53 enum mdp_bpc bpc_g_y, bpc_b_cb, bpc_r_cr;
54 enum mdp_bpc_alpha bpc_a;
56 enum mdp_fetch_type fetch_type;
57 enum mdp_chroma_samp_type chroma_sample;
63 enum mdp_fetch_mode fetch_mode;
67 #define MSM_FORMAT_IS_YUV(X) ((X)->flags & MSM_FORMAT_FLAG_YUV)
68 #define MSM_FORMAT_IS_DX(X) ((X)->flags & MSM_FORMAT_FLAG_DX)
69 #define MSM_FORMAT_IS_LINEAR(X) ((X)->fetch_mode == MDP_FETCH_LINEAR)
70 #define MSM_FORMAT_IS_TILE(X) \
71 (((X)->fetch_mode == MDP_FETCH_UBWC) && \
72 !((X)->flags & MSM_FORMAT_FLAG_COMPRESSED))
73 #define MSM_FORMAT_IS_UBWC(X) \
74 (((X)->fetch_mode == MDP_FETCH_UBWC) && \
75 ((X)->flags & MSM_FORMAT_FLAG_COMPRESSED))