1 /*
2  * Allwinner SoCs display driver.
3  *
4  * Copyright (C) 2016 Allwinner.
5  *
6  * This file is licensed under the terms of the GNU General Public
7  * License version 2.  This program is licensed "as is" without any
8  * warranty of any kind, whether express or implied.
9  */
10 #ifndef __SUNXI_METADATA_H__
11 #define __SUNXI_METADATA_H__
12 
13 enum {
14     /* hdr static metadata is available */
15     SUNXI_METADATA_FLAG_HDR_SATIC_METADATA   = 0x00000001,
16     /* hdr dynamic metadata is available */
17     SUNXI_METADATA_FLAG_HDR_DYNAMIC_METADATA = 0x00000002,
18 
19     /* afbc header data is available */
20     SUNXI_METADATA_FLAG_AFBC_HEADER          = 0x00000010,
21 };
22 
23 struct afbc_header {
24     u32 signature;
25     u16 filehdr_size;
26     u16 version;
27     u32 body_size;
28     u8 ncomponents;
29     u8 header_layout;
30     u8 yuv_transform;
31     u8 block_split;
32     u8 inputbits[4];
33     u16 block_width;
34     u16 block_height;
35     u16 width;
36     u16 height;
37     u8  left_crop;
38     u8  top_crop;
39     u16 block_layout;
40 };
41 
42 struct display_master_data {
43     /* display primaries */
44     u16 display_primaries_x[3];
45     u16 display_primaries_y[3];
46 
47     /* white_point */
48     u16 white_point_x;
49     u16 white_point_y;
50 
51     /* max/min display mastering luminance */
52     u32 max_display_mastering_luminance;
53     u32 min_display_mastering_luminance;
54 };
55 
56 /* static metadata type 1 */
57 struct hdr_static_metadata {
58     struct display_master_data disp_master;
59 
60     u16 maximum_content_light_level;
61     u16 maximum_frame_average_light_level;
62 };
63 
64 /* sunxi video metadata for ve and de */
65 struct sunxi_metadata {
66     struct hdr_static_metadata hdr_smetada;
67     struct afbc_header afbc_head;
68 };
69 
70 #endif /* #ifndef __SUNXI_METADATA_H__ */
71