File tree Expand file tree Collapse file tree 2 files changed +25
-26
lines changed Expand file tree Collapse file tree 2 files changed +25
-26
lines changed Original file line number Diff line number Diff line change 8787 * "GAMMA_LUT" property above.
8888 */
8989
90- /**
91- * drm_color_lut_extract - clamp&round LUT entries
92- * @user_input: input value
93- * @bit_precision: number of bits the hw LUT supports
94- *
95- * Extract a degamma/gamma LUT value provided by user (in the form of
96- * &drm_color_lut entries) and round it to the precision supported by the
97- * hardware.
98- */
99- uint32_t drm_color_lut_extract (uint32_t user_input , uint32_t bit_precision )
100- {
101- uint32_t val = user_input ;
102- uint32_t max = 0xffff >> (16 - bit_precision );
103-
104- /* Round only if we're not using full precision. */
105- if (bit_precision < 16 ) {
106- val += 1UL << (16 - bit_precision - 1 );
107- val >>= 16 - bit_precision ;
108- }
109-
110- return clamp_val (val , 0 , max );
111- }
112- EXPORT_SYMBOL (drm_color_lut_extract );
113-
11490/**
11591 * drm_crtc_enable_color_mgmt - enable color management properties
11692 * @crtc: DRM CRTC
Original file line number Diff line number Diff line change 2525
2626#include <linux/ctype.h>
2727
28- uint32_t drm_color_lut_extract (uint32_t user_input , uint32_t bit_precision );
29-
3028void drm_crtc_enable_color_mgmt (struct drm_crtc * crtc ,
3129 uint degamma_lut_size ,
3230 bool has_ctm ,
@@ -35,4 +33,29 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,
3533int drm_mode_crtc_set_gamma_size (struct drm_crtc * crtc ,
3634 int gamma_size );
3735
36+ /**
37+ * drm_color_lut_extract - clamp&round LUT entries
38+ * @user_input: input value
39+ * @bit_precision: number of bits the hw LUT supports
40+ *
41+ * Extract a degamma/gamma LUT value provided by user (in the form of
42+ * &drm_color_lut entries) and round it to the precision supported by the
43+ * hardware.
44+ */
45+ static inline uint32_t drm_color_lut_extract (uint32_t user_input ,
46+ uint32_t bit_precision )
47+ {
48+ uint32_t val = user_input ;
49+ uint32_t max = 0xffff >> (16 - bit_precision );
50+
51+ /* Round only if we're not using full precision. */
52+ if (bit_precision < 16 ) {
53+ val += 1UL << (16 - bit_precision - 1 );
54+ val >>= 16 - bit_precision ;
55+ }
56+
57+ return clamp_val (val , 0 , max );
58+ }
59+
60+
3861#endif
You can’t perform that action at this time.
0 commit comments