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