1 /*
2  * Copyright 2016 Advanced Micro Devices, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * Authors: AMD
23  *
24  */
25 
26 #ifndef MOD_SHARED_H_
27 #define MOD_SHARED_H_
28 
29 enum color_transfer_func {
30 	TRANSFER_FUNC_UNKNOWN,
31 	TRANSFER_FUNC_SRGB,
32 	TRANSFER_FUNC_BT709,
33 	TRANSFER_FUNC_PQ2084,
34 	TRANSFER_FUNC_PQ2084_INTERIM,
35 	TRANSFER_FUNC_LINEAR_0_1,
36 	TRANSFER_FUNC_LINEAR_0_125,
37 	TRANSFER_FUNC_GAMMA_22,
38 	TRANSFER_FUNC_GAMMA_26
39 };
40 
41 enum vrr_packet_type {
42 	PACKET_TYPE_VRR,
43 	PACKET_TYPE_FS1,
44 	PACKET_TYPE_FS2,
45 	PACKET_TYPE_VTEM
46 };
47 
48 union lut3d_control_flags {
49 	unsigned int raw;
50 	struct {
51 		unsigned int do_chroma_scale				:1;
52 		unsigned int spec_version				:3;
53 		unsigned int use_zero_display_black			:1;
54 		unsigned int use_zero_source_black			:1;
55 		unsigned int force_display_black			:6;
56 		unsigned int apply_display_gamma			:1;
57 		unsigned int exp_shaper_max				:6;
58 		unsigned int unity_3dlut				:1;
59 		unsigned int bypass_3dlut				:1;
60 		unsigned int use_3dlut					:1;
61 		unsigned int less_than_dcip3				:1;
62 		unsigned int override_lum				:1;
63 		unsigned int use_gamut_map_lib					:1;
64 		unsigned int chromatic_adaptation_src				:1;
65 		unsigned int chromatic_adaptation_dst				:1;
66 		unsigned int do_blender_lut_degamma		:1;
67 		unsigned int reseved					:4;
68 	} bits;
69 };
70 
71 enum tm_show_option_internal {
72 	tm_show_option_internal_single_file		= 0,/*flags2 not in use*/
73 	tm_show_option_internal_duplicate_file,		/*use flags2*/
74 	tm_show_option_internal_duplicate_sidebyside/*use flags2*/
75 };
76 
77 enum lut3d_control_gamut_map {
78 	lut3d_control_gamut_map_none = 0,
79 	lut3d_control_gamut_map_tonemap,
80 	lut3d_control_gamut_map_chto,
81 	lut3d_control_gamut_map_chso,
82 	lut3d_control_gamut_map_chci
83 };
84 
85 enum lut3d_control_rotation_mode {
86 	lut3d_control_rotation_mode_none = 0,
87 	lut3d_control_rotation_mode_hue,
88 	lut3d_control_rotation_mode_cc,
89 	lut3d_control_rotation_mode_hue_cc
90 };
91 
92 struct lut3d_settings {
93 	unsigned char version;
94 	union lut3d_control_flags flags;
95 	union lut3d_control_flags flags2;
96 	enum tm_show_option_internal option;
97 	unsigned int min_lum;/*multiplied by 100*/
98 	unsigned int max_lum;
99 	unsigned int min_lum2;
100 	unsigned int max_lum2;
101 	enum lut3d_control_gamut_map map;
102 	enum lut3d_control_rotation_mode rotation;
103 	enum lut3d_control_gamut_map map2;
104 	enum lut3d_control_rotation_mode rotation2;
105 };
106 
107 #endif /* MOD_SHARED_H_ */
108