aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_color_mgmt.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2019-11-08 15:56:54 +0200
committerVille Syrjälä <ville.syrjala@linux.intel.com>2019-11-29 21:29:17 +0200
commit65b2f7c43c6f087784db309e8a75bae3d2266520 (patch)
treeaba0d0936f2fca09745b8642a7260da083d1e095 /drivers/gpu/drm/drm_color_mgmt.c
parentdrm/todo: Add entry for fb funcs related cleanups (diff)
downloadlinux-dev-65b2f7c43c6f087784db309e8a75bae3d2266520.tar.xz
linux-dev-65b2f7c43c6f087784db309e8a75bae3d2266520.zip
drm: Inline drm_color_lut_extract()
This thing can get called several thousand times per LUT so seems like we want to inline it to: - avoid the function call overhead - allow constant folding A quick synthetic test (w/o any hardware interaction) with a ridiculously large LUT size shows about 50% reduction in runtime on my HSW and BSW boxes. Slightly less with more reasonable LUT size but still easily measurable in tens of microseconds. v2: Include drm_color_mgmt.h in the .rst (Daniel) Cc: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20191108135654.12907-1-ville.syrjala@linux.intel.com
Diffstat (limited to 'drivers/gpu/drm/drm_color_mgmt.c')
-rw-r--r--drivers/gpu/drm/drm_color_mgmt.c24
1 files changed, 0 insertions, 24 deletions
diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c
index ba71e3b827f1..c93123ff7c21 100644
--- a/drivers/gpu/drm/drm_color_mgmt.c
+++ b/drivers/gpu/drm/drm_color_mgmt.c
@@ -109,30 +109,6 @@
*/
/**
- * drm_color_lut_extract - clamp and round LUT entries
- * @user_input: input value
- * @bit_precision: number of bits the hw LUT supports
- *
- * Extract a degamma/gamma LUT value provided by user (in the form of
- * &drm_color_lut entries) and round it to the precision supported by the
- * hardware.
- */
-uint32_t drm_color_lut_extract(uint32_t user_input, uint32_t bit_precision)
-{
- uint32_t val = user_input;
- uint32_t max = 0xffff >> (16 - bit_precision);
-
- /* Round only if we're not using full precision. */
- if (bit_precision < 16) {
- val += 1UL << (16 - bit_precision - 1);
- val >>= 16 - bit_precision;
- }
-
- return clamp_val(val, 0, max);
-}
-EXPORT_SYMBOL(drm_color_lut_extract);
-
-/**
* drm_color_ctm_s31_32_to_qm_n
*
* @user_input: input value