drm/color: un-inline drm_color_lut_extract()
Subsystems (2)
PATCH 1/1 drm/color: un-inline drm_color_lut_extract()
The function is not that big, but it's also not used for anything performance critical. Make it a normal function.
As a side effect, this apparently makes sparse smarter about what it's doing, and gets rid of the warning:
./include/drm/drm_color_mgmt.h:53:28: warning: shift too big (4294967295) for type unsigned long ./include/drm/drm_color_mgmt.h:53:28: warning: cast truncates bits from constant value (8000000000000000 becomes 0)
--- drivers/gpu/drm/drm_color_mgmt.c | 24 ++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 27 ++------------------------- 2 files changed, 26 insertions(+), 25 deletions(-)
drivers/gpu/drm/drm_color_mgmt.c +24 -0
@@ -88,6 +88,30 @@*/ /** +* drm_color_lut_extract - clamp&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_crtc_enable_color_mgmt - enable color management properties * @crtc: DRM CRTC * @degamma_lut_size: the size of the degamma lut (before CSC)
include/drm/drm_color_mgmt.h +2 -25
@@ -25,6 +25,8 @@#include <linux/ctype.h> +uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision); + void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, uint degamma_lut_size, bool has_ctm,
@@ -33,29 +35,4 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); -/** -* drm_color_lut_extract - clamp&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. -*/ -static inline 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); -} - -#endif
Signature · 6 lines
2.1.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 8 lines · Jani Nikula
The function is not that big, but it's also not used for anything performance critical. Make it a normal function.
As a side effect, this apparently makes sparse smarter about what it's doing, and gets rid of the warning:
./include/drm/drm_color_mgmt.h:53:28: warning: shift too big (4294967295) for type unsigned long./include/drm/drm_color_mgmt.h:53:28: warning: cast truncates bits from constant value (8000000000000000 becomes 0)
Not really clear to me what's going on, but if it helps ...
Quoted 2 lines
Cc Lionel Landwerlin <[email protected]>Signed-off-by Jani Nikula <[email protected]>
Quoted 90 lines
--- drivers/gpu/drm/drm_color_mgmt.c | 24 ++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 27 ++------------------------- 2 files changed, 26 insertions(+), 25 deletions(-)drivers/gpu/drm/drm_color_mgmt.c +24
-0@@ -88,6 +88,30 @@*/ /** +* drm_color_lut_extract - clamp&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_crtc_enable_color_mgmt - enable color management properties * @crtc: DRM CRTC * @degamma_lut_size: the size of the degamma lut (before CSC) include/drm/drm_color_mgmt.h +2
-25@@ -25,6 +25,8 @@#include <linux/ctype.h> +uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision); + void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, uint degamma_lut_size, bool has_ctm,@@ -33,29 +35,4 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); -/** -* drm_color_lut_extract - clamp&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. -*/ -static inline 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); -} - -#endif Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 11 lines · Daniel Vetter
Quoted 8 lines · Jani Nikula
The function is not that big, but it's also not used for anything performance critical. Make it a normal function.
As a side effect, this apparently makes sparse smarter about what it's doing, and gets rid of the warning:
./include/drm/drm_color_mgmt.h:53:28: warning: shift too big (4294967295) for type unsigned long./include/drm/drm_color_mgmt.h:53:28: warning: cast truncates bits from constant value (8000000000000000 becomes 0)Not really clear to me what's going on, but if it helps ...
Apparently sparse is clever enough to notice bit_precision < 16 when this is a regular function, but not when it's an inline function. The second warning we could get rid of just by changing s/1UL/1U/.
BR,
Jani.
Quoted 96 lines
Quoted 3 lines
Cc Lionel Landwerlin <[email protected]>Signed-off-by Jani Nikula <[email protected]>Reviewed-by Daniel Vetter <[email protected]>Quoted 90 lines
--- drivers/gpu/drm/drm_color_mgmt.c | 24 ++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 27 ++------------------------- 2 files changed, 26 insertions(+), 25 deletions(-)drivers/gpu/drm/drm_color_mgmt.c +24
-0@@ -88,6 +88,30 @@*/ /** +* drm_color_lut_extract - clamp&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_crtc_enable_color_mgmt - enable color management properties * @crtc: DRM CRTC * @degamma_lut_size: the size of the degamma lut (before CSC) include/drm/drm_color_mgmt.h +2
-25@@ -25,6 +25,8 @@#include <linux/ctype.h> +uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision); + void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, uint degamma_lut_size, bool has_ctm,@@ -33,29 +35,4 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); -/** -* drm_color_lut_extract - clamp&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. -*/ -static inline 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); -} - -#endif Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/color: un-inline drm_color_lut_extract()
In reply to Jani Nikula== Series Details ==
== Series Details ==
Series: drm/color: un-inline drm_color_lut_extract()
URL : https://patchwork.freedesktop.org/series/18391/
State : failure
== Summary ==
Series 18391v1 drm/color: un-inline drm_color_lut_extract()
https://patchwork.freedesktop.org/api/1.0/series/18391/revisions/1/mbox/
Test gem_sync:
Subgroup basic-store-all:
pass -> FAIL (fi-ivb-3770)fi-bdw-5557u total:246 pass:232 dwarn:0 dfail:0 fail:0 skip:14 fi-bsw-n3050 total:246 pass:207 dwarn:0 dfail:0 fail:0 skip:39 fi-bxt-j4205 total:246 pass:224 dwarn:0 dfail:0 fail:0 skip:22 fi-bxt-t5700 total:79 pass:66 dwarn:0 dfail:0 fail:0 skip:12 fi-byt-j1900 total:246 pass:219 dwarn:0 dfail:0 fail:0 skip:27 fi-byt-n2820 total:246 pass:215 dwarn:0 dfail:0 fail:0 skip:31 fi-hsw-4770 total:246 pass:227 dwarn:0 dfail:0 fail:0 skip:19 fi-hsw-4770r total:246 pass:227 dwarn:0 dfail:0 fail:0 skip:19 fi-ivb-3520m total:246 pass:225 dwarn:0 dfail:0 fail:0 skip:21 fi-ivb-3770 total:246 pass:224 dwarn:0 dfail:0 fail:1 skip:21 fi-kbl-7500u total:246 pass:225 dwarn:0 dfail:0 fail:0 skip:21 fi-skl-6260u total:246 pass:233 dwarn:0 dfail:0 fail:0 skip:13 fi-skl-6700hq total:246 pass:226 dwarn:0 dfail:0 fail:0 skip:20 fi-skl-6700k total:246 pass:222 dwarn:3 dfail:0 fail:0 skip:21 fi-skl-6770hq total:246 pass:233 dwarn:0 dfail:0 fail:0 skip:13 fi-snb-2520m total:246 pass:215 dwarn:0 dfail:0 fail:0 skip:31 fi-snb-2600 total:246 pass:214 dwarn:0 dfail:0 fail:0 skip:32
3599f990bcb8b72f9ae062a97140439ab9df22b7 drm-tip: 2017y-01m-23d-09h-16m-39s UTC integration manifest f61931a drm/color: un-inline drm_color_lut_extract()
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3579/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Hi Jani,
Looks good to me :
Quoted 84 lines · Jani Nikula
The function is not that big, but it's also not used for anything performance critical. Make it a normal function.
As a side effect, this apparently makes sparse smarter about what it's doing, and gets rid of the warning:
./include/drm/drm_color_mgmt.h:53:28: warning: shift too big (4294967295) for type unsigned long./include/drm/drm_color_mgmt.h:53:28: warning: cast truncates bits from constant value (8000000000000000 becomes 0)Cc Lionel Landwerlin <[email protected]>Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/drm_color_mgmt.c | 24 ++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 27 ++------------------------- 2 files changed, 26 insertions(+), 25 deletions(-)drivers/gpu/drm/drm_color_mgmt.c +24
-0@@ -88,6 +88,30 @@*/ /** +* drm_color_lut_extract - clamp&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_crtc_enable_color_mgmt - enable color management properties * @crtc: DRM CRTC * @degamma_lut_size: the size of the degamma lut (before CSC) include/drm/drm_color_mgmt.h +2
-16@@ -25,6 +25,8 @@#include <linux/ctype.h> +uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision); + void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, uint degamma_lut_size, bool has_ctm,@@ -33,29 +35,4 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); -/** -* drm_color_lut_extract - clamp&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. -*/ -static inline 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. */
include/drm/drm_color_mgmt.h void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, · line 38
Quoted 10 lines
include/drm/drm_color_mgmt.h +0
-9-if (bit_precision <16 ) { - val +=1UL << (16 - bit_precision -1 ); - val >>=16 - bit_precision; - } - - return clamp_val(val, 0, max); -} - -#endif
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 5 lines · Lionel Landwerlin
Hi Jani,
Looks good to me :
Reviewed-by Lionel Landwerlin <[email protected]>
Thanks for the reviews, pushed... to drm-intel-next-queued instead of drm-misc-next. /o\
Dave, Daniel, please advise, shall I revert or shall we let this flow in via drm-intel?
Sorry for the mess.
BR,
Jani.
Quoted 98 lines · Jani Nikula
Quoted 94 lines
The function is not that big, but it's also not used for anything performance critical. Make it a normal function.
As a side effect, this apparently makes sparse smarter about what it's doing, and gets rid of the warning:
./include/drm/drm_color_mgmt.h:53:28: warning: shift too big (4294967295) for type unsigned long./include/drm/drm_color_mgmt.h:53:28: warning: cast truncates bits from constant value (8000000000000000 becomes 0)Cc Lionel Landwerlin <[email protected]>Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/drm_color_mgmt.c | 24 ++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 27 ++------------------------- 2 files changed, 26 insertions(+), 25 deletions(-)drivers/gpu/drm/drm_color_mgmt.c +24
-0@@ -88,6 +88,30 @@*/ /** +* drm_color_lut_extract - clamp&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_crtc_enable_color_mgmt - enable color management properties * @crtc: DRM CRTC * @degamma_lut_size: the size of the degamma lut (before CSC) include/drm/drm_color_mgmt.h +2
-25@@ -25,6 +25,8 @@#include <linux/ctype.h> +uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision); + void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, uint degamma_lut_size, bool has_ctm,@@ -33,29 +35,4 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); -/** -* drm_color_lut_extract - clamp&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. -*/ -static inline 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); -} - -#endif
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 7 lines · Jani Nikula
Quoted 5 lines · Lionel Landwerlin
Hi Jani,
Looks good to me :
Reviewed-by Lionel Landwerlin <[email protected]>
Quoted 7 lines
Thanks for the reviews, pushed... to drm-intel-next-queued instead of drm-misc-next. /o\
Dave, Daniel, please advise, shall I revert or shall we let this flow in via drm-intel?
Sorry for the mess.
Reverted, there was a conflict in the docs updates as well so this is easier. I'll post a rebase version of the patch.
BR,
Jani.
Quoted 104 lines
BR,
Jani.Quoted 98 lines · Jani Nikula
Quoted 94 lines
The function is not that big, but it's also not used for anything performance critical. Make it a normal function.
As a side effect, this apparently makes sparse smarter about what it's doing, and gets rid of the warning:
./include/drm/drm_color_mgmt.h:53:28: warning: shift too big (4294967295) for type unsigned long./include/drm/drm_color_mgmt.h:53:28: warning: cast truncates bits from constant value (8000000000000000 becomes 0)Cc Lionel Landwerlin <[email protected]>Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/drm_color_mgmt.c | 24 ++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 27 ++------------------------- 2 files changed, 26 insertions(+), 25 deletions(-)drivers/gpu/drm/drm_color_mgmt.c +24
-0@@ -88,6 +88,30 @@*/ /** +* drm_color_lut_extract - clamp&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_crtc_enable_color_mgmt - enable color management properties * @crtc: DRM CRTC * @degamma_lut_size: the size of the degamma lut (before CSC) include/drm/drm_color_mgmt.h +2
-25@@ -25,6 +25,8 @@#include <linux/ctype.h> +uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision); + void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, uint degamma_lut_size, bool has_ctm,@@ -33,29 +35,4 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); -/** -* drm_color_lut_extract - clamp&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. -*/ -static inline 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); -} - -#endif
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/1 drm/color: un-inline drm_color_lut_extract()
The function is not that big, but it's also not used for anything performance critical. Make it a normal function.
As a side effect, this apparently makes sparse smarter about what it's doing, and gets rid of the warning:
./include/drm/drm_color_mgmt.h:53:28: warning: shift too big (4294967295) for type unsigned long ./include/drm/drm_color_mgmt.h:53:28: warning: cast truncates bits from constant value (8000000000000000 becomes 0)
v2: rebased
--- drivers/gpu/drm/drm_color_mgmt.c | 24 ++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 27 ++------------------------- 2 files changed, 26 insertions(+), 25 deletions(-)
drivers/gpu/drm/drm_color_mgmt.c +24 -0
@@ -88,6 +88,30 @@*/ /** +* 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_crtc_enable_color_mgmt - enable color management properties * @crtc: DRM CRTC * @degamma_lut_size: the size of the degamma lut (before CSC)
include/drm/drm_color_mgmt.h +2 -25
@@ -25,6 +25,8 @@#include <linux/ctype.h> +uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision); + void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, uint degamma_lut_size, bool has_ctm,
@@ -33,29 +35,4 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); -/** -* 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. -*/ -static inline 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); -} - -#endif
Signature · 6 lines
2.1.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · Jani Nikula
The function is not that big, but it's also not used for anything performance critical. Make it a normal function.
As a side effect, this apparently makes sparse smarter about what it's doing, and gets rid of the warning:
./include/drm/drm_color_mgmt.h:53:28: warning: shift too big (4294967295) for type unsigned long./include/drm/drm_color_mgmt.h:53:28: warning: cast truncates bits from constant value (8000000000000000 becomes 0)
Quoted 6 lines
v2: rebased
Cc Lionel Landwerlin <[email protected]>Reviewed-by Daniel Vetter <[email protected]>Reviewed-by Lionel Landwerlin <[email protected]>Signed-off-by Jani Nikula <[email protected]>
This time, pushed to drm-misc-next. Thanks for the review.
BR,
Jani.
Quoted 83 lines
--- drivers/gpu/drm/drm_color_mgmt.c | 24 ++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 27 ++------------------------- 2 files changed, 26 insertions(+), 25 deletions(-)drivers/gpu/drm/drm_color_mgmt.c +24
-0@@ -88,6 +88,30 @@*/ /** +* 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_crtc_enable_color_mgmt - enable color management properties * @crtc: DRM CRTC * @degamma_lut_size: the size of the degamma lut (before CSC) include/drm/drm_color_mgmt.h +2
-25@@ -25,6 +25,8 @@#include <linux/ctype.h> +uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision); + void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, uint degamma_lut_size, bool has_ctm,@@ -33,29 +35,4 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); -/** -* 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. -*/ -static inline 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); -} - -#endif
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/color: un-inline drm_color_lut_extract() (rev2)
In reply to Jani Nikula== Series Details ==
== Series Details ==
Series: drm/color: un-inline drm_color_lut_extract() (rev2)
URL : https://patchwork.freedesktop.org/series/18391/
State : success
== Summary ==
Series 18391v2 drm/color: un-inline drm_color_lut_extract()
https://patchwork.freedesktop.org/api/1.0/series/18391/revisions/2/mbox/
Test kms_pipe_crc_basic:
Subgroup nonblocking-crc-pipe-b-frame-sequence:
dmesg-warn -> PASS (fi-snb-2520m)fi-bdw-5557u total:246 pass:232 dwarn:0 dfail:0 fail:0 skip:14 fi-bsw-n3050 total:246 pass:207 dwarn:0 dfail:0 fail:0 skip:39 fi-bxt-j4205 total:246 pass:224 dwarn:0 dfail:0 fail:0 skip:22 fi-bxt-t5700 total:78 pass:65 dwarn:0 dfail:0 fail:0 skip:12 fi-byt-j1900 total:246 pass:219 dwarn:0 dfail:0 fail:0 skip:27 fi-byt-n2820 total:246 pass:215 dwarn:0 dfail:0 fail:0 skip:31 fi-hsw-4770 total:246 pass:227 dwarn:0 dfail:0 fail:0 skip:19 fi-hsw-4770r total:246 pass:227 dwarn:0 dfail:0 fail:0 skip:19 fi-ivb-3520m total:246 pass:225 dwarn:0 dfail:0 fail:0 skip:21 fi-ivb-3770 total:246 pass:225 dwarn:0 dfail:0 fail:0 skip:21 fi-kbl-7500u total:246 pass:223 dwarn:0 dfail:0 fail:2 skip:21 fi-skl-6260u total:246 pass:233 dwarn:0 dfail:0 fail:0 skip:13 fi-skl-6700hq total:246 pass:226 dwarn:0 dfail:0 fail:0 skip:20 fi-skl-6700k total:246 pass:221 dwarn:4 dfail:0 fail:0 skip:21 fi-snb-2520m total:246 pass:215 dwarn:0 dfail:0 fail:0 skip:31 fi-snb-2600 total:246 pass:214 dwarn:0 dfail:0 fail:0 skip:32
dc47d8d6ed4ea669aeccad104fde843fe039b9a5 drm-tip: 2017y-01m-30d-09h-12m-47s UTC integration manifest 79458e2 drm/color: un-inline drm_color_lut_extract()
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3634/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx