xref: /linux/drivers/gpu/drm/amd/display/modules/inc/mod_shared.h (revision 48dea9a700c8728cc31a1dd44588b97578de86ee)
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_FS_V1,
44 	PACKET_TYPE_FS_V2,
45 	PACKET_TYPE_FS_V3,
46 	PACKET_TYPE_VTEM
47 };
48 
49 union lut3d_control_flags {
50 	unsigned int raw;
51 	struct {
52 		unsigned int do_chroma_scale				:1;
53 		unsigned int spec_version				:3;
54 		unsigned int use_zero_display_black			:1;
55 		unsigned int use_zero_source_black			:1;
56 		unsigned int force_display_black			:6;
57 		unsigned int apply_display_gamma			:1;
58 		unsigned int exp_shaper_max				:6;
59 		unsigned int unity_3dlut				:1;
60 		unsigned int bypass_3dlut				:1;
61 		unsigned int use_3dlut					:1;
62 		unsigned int less_than_dcip3				:1;
63 		unsigned int override_lum				:1;
64 		unsigned int use_gamut_map_lib					:1;
65 		unsigned int chromatic_adaptation_src				:1;
66 		unsigned int chromatic_adaptation_dst				:1;
67 		unsigned int do_blender_lut_degamma		:1;
68 		unsigned int reseved					:4;
69 	} bits;
70 };
71 
72 enum tm_show_option_internal {
73 	tm_show_option_internal_single_file		= 0,/*flags2 not in use*/
74 	tm_show_option_internal_duplicate_file,		/*use flags2*/
75 	tm_show_option_internal_duplicate_sidebyside/*use flags2*/
76 };
77 
78 enum lut3d_control_gamut_map {
79 	lut3d_control_gamut_map_none = 0,
80 	lut3d_control_gamut_map_tonemap,
81 	lut3d_control_gamut_map_chto,
82 	lut3d_control_gamut_map_chso,
83 	lut3d_control_gamut_map_chci
84 };
85 
86 enum lut3d_control_rotation_mode {
87 	lut3d_control_rotation_mode_none = 0,
88 	lut3d_control_rotation_mode_hue,
89 	lut3d_control_rotation_mode_cc,
90 	lut3d_control_rotation_mode_hue_cc
91 };
92 
93 struct lut3d_settings {
94 	unsigned char version;
95 	union lut3d_control_flags flags;
96 	union lut3d_control_flags flags2;
97 	enum tm_show_option_internal option;
98 	unsigned int min_lum;/*multiplied by 100*/
99 	unsigned int max_lum;
100 	unsigned int min_lum2;
101 	unsigned int max_lum2;
102 	enum lut3d_control_gamut_map map;
103 	enum lut3d_control_rotation_mode rotation;
104 	enum lut3d_control_gamut_map map2;
105 	enum lut3d_control_rotation_mode rotation2;
106 };
107 
108 #endif /* MOD_SHARED_H_ */
109