Skip to content

Commit 40f62bb

Browse files
committed
Revert "drm/color: un-inline drm_color_lut_extract()"
This reverts commit 2eebe4f, because I screwed up and applied it to the wrong branch. Signed-off-by: Jani Nikula <[email protected]>
1 parent 05c41f9 commit 40f62bb

File tree

2 files changed

+25
-26
lines changed

2 files changed

+25
-26
lines changed

drivers/gpu/drm/drm_color_mgmt.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -87,30 +87,6 @@
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

include/drm/drm_color_mgmt.h

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
#include <linux/ctype.h>
2727

28-
uint32_t drm_color_lut_extract(uint32_t user_input, uint32_t bit_precision);
29-
3028
void 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,
3533
int 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

0 commit comments

Comments
 (0)