summaryrefstree
path: root/kernel/drivers/video/fbdev/exynos/dpu20/hdr_metadata.h
blob: 3f499c711baf6e3d983d632866327aee26e01e3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com
 *
 * Header file for Exynos HDR metadata
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
*/

#ifndef VENDOR_VIDEO_API_H_
#define VENDOR_VIDEO_API_H_

#include <linux/types.h>

enum exynos_video_info_type {
	VIDEO_INFO_TYPE_INVALID			= 0,
	VIDEO_INFO_TYPE_HDR_STATIC		= 0x1 << 0,
	VIDEO_INFO_TYPE_COLOR_ASPECTS		= 0x1 << 1,
	VIDEO_INFO_TYPE_INTERLACED		= 0x1 << 2,
	VIDEO_INFO_TYPE_YSUM_DATA		= 0x1 << 3,
	VIDEO_INFO_TYPE_HDR_DYNAMIC		= 0x1 << 4,
	VIDEO_INFO_TYPE_CHECK_PIXEL_FORMAT	= 0x1 << 5,
	VIDEO_INFO_TYPE_GDC_OTF			= 0x1 << 6,
	VIDEO_INFO_TYPE_ROI_INFO		= 0x1 << 7,
};

struct exynos_video_ysum_data {
	unsigned int high;
	unsigned int low;
};

struct exynos_color_aspects {
	int mrange;
	int mprimaries;
	int mtransfer;
	int mmatrix_coeffs;
};

struct exynos_primaries {
	unsigned int x;
	unsigned int y;
};

struct exynos_type1 {
	struct exynos_primaries	mr;
	struct exynos_primaries	mg;
	struct exynos_primaries	mb;
	struct exynos_primaries	mw;
	unsigned int mmax_display_luminance;
	unsigned int mmin_display_luminance;
	unsigned int mmax_content_light_level;
	unsigned int mmax_frame_average_light_level;
};

struct exynos_hdr_static_info {
	int mid;
	union {
		struct exynos_type1 stype1;
	};
};

#define MAX_ROIINFO_SIZE 32400
struct exynos_video_roi_data {
	int n_upper_qp_offset;
	int n_lower_qp_offset;
	int b_use_roi_info;
	int n_roi_mb_info_size;
	char p_roi_mb_info[MAX_ROIINFO_SIZE];
};

struct exynos_video_dec_data {
	int ninterlaced_type;
};

struct exynos_video_enc_data {
	struct exynos_video_ysum_data sysum_data;
	unsigned long long p_roi_data;	/* for fixing byte alignemnt on 64x32 problem */
	int n_use_gdc_otf;
	int n_is_gdc_otf;
};

struct exynoshdrdynamicinfo {
    unsigned int valid;

    struct {
        unsigned char  country_code;
        unsigned short provider_code;
        unsigned short provider_oriented_code;

        unsigned char  application_identifier;
        unsigned short application_version;

        unsigned int  display_maximum_luminance;

        unsigned int maxscl[3];

        unsigned char num_maxrgb_percentiles;
        unsigned char maxrgb_percentages[15];
        unsigned int  maxrgb_percentiles[15];

        struct tone_mapping {
            unsigned short  tone_mapping_flag;
            unsigned short  knee_point_x;
            unsigned short  knee_point_y;
            unsigned short  num_bezier_curve_anchors;
            unsigned short  bezier_curve_anchors[15];
        } tone;
    } data;

    unsigned int reserved[42];
};

struct exynos_video_meta {
	enum exynos_video_info_type etype;
	/* common */
	struct exynos_hdr_static_info shdr_static_info;
	struct exynos_color_aspects	scolor_aspects;
	union {
		struct exynos_video_dec_data dec;
		struct exynos_video_enc_data enc;
	} data;
	struct exynoshdrdynamicinfo shdrdynamicinfo;
};

#endif /* VENDOR_VIDEO_API_H_ */