drm: fix and cleanup legacy gamma support
Subsystems (23)
v2 cover drm: fix and cleanup legacy gamma support
Hi,
This is v2 of the series.
The first patch fixes legacy gamma table for HW which have a degamma lut block before CTM block, but no gamma lut after the CTM. This will allow us to add CTM support to omapdrm, which only has "pre-gamma" i.e. de-gamma table.
The second one cleans up the legacy gamma support a bit by handling legacy gamma for modern drivers in the drm core.
Changes in v2:
- Use bitfields for has_gamma_prop and has_degamma_prop
- Drop use_degamma variable
- Also fix gamma/degamma handling in setcmap_atomic, which I had missed earlier.
- Fix comments that were still referring to drm_atomic_helper_legacy_gamma_set
- Drop drm_atomic_helper_legacy_gamma_set use from intel_display.c which I had missed earlier.
- Move the declaration of the new functions to drm_crtc_internal.h
I didn't add Laurent's RBs as I felt the changes were too big to keep the RB.
Ville has a WIP branch at
git://github.com/vsyrjala/linux.git fb_helper_c8_lut_4
which does more extensive cleanups to the gamma handling. That work is slightly overlapping with this series, but afaics the concepts do not conflict as such (but the code changes do conflict).
Tomi
Tomi Valkeinen (2):
drm: add legacy support for using degamma for gamma
drm: automatic legacy gamma support
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 - .../gpu/drm/arm/display/komeda/komeda_crtc.c | 1 - drivers/gpu/drm/arm/malidp_crtc.c | 1 - drivers/gpu/drm/armada/armada_crtc.c | 1 - drivers/gpu/drm/ast/ast_mode.c | 1 - .../gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 1 - drivers/gpu/drm/drm_atomic_helper.c | 70 ---------- drivers/gpu/drm/drm_color_mgmt.c | 122 ++++++++++++++++-- drivers/gpu/drm/drm_crtc_internal.h | 6 + drivers/gpu/drm/drm_fb_helper.c | 21 +-- drivers/gpu/drm/i915/display/intel_display.c | 1 - drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 2 - drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 1 - drivers/gpu/drm/nouveau/dispnv50/head.c | 2 - drivers/gpu/drm/omapdrm/omap_crtc.c | 1 - drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 1 - drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 1 - drivers/gpu/drm/stm/ltdc.c | 1 - drivers/gpu/drm/vc4/vc4_crtc.c | 1 - drivers/gpu/drm/vc4/vc4_txp.c | 1 - include/drm/drm_atomic_helper.h | 4 - include/drm/drm_crtc.h | 3 + 22 files changed, 135 insertions(+), 109 deletions(-)
Signature · 7 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 1/2 drm: add legacy support for using degamma for gamma
We currently have drm_atomic_helper_legacy_gamma_set() helper which can be used to handle legacy gamma-set ioctl. drm_atomic_helper_legacy_gamma_set() sets GAMMA_LUT, and clears CTM and DEGAMMA_LUT. This works fine on HW where we have either:
degamma -> ctm -> gamma -> out
or
ctm -> gamma -> out
However, if the HW has gamma table before ctm, the atomic property should be DEGAMMA_LUT, and thus we have:
degamma -> ctm -> out
This is fine for userspace which sets gamma table using the properties, as the userspace can check for the existence of gamma & degamma, but the legacy gamma-set ioctl does not work.
This patch fixes the issue by changing drm_atomic_helper_legacy_gamma_set() so that GAMMA_LUT will be used if it exists, and DEGAMMA_LUT will be used as a fallback.
--- drivers/gpu/drm/drm_atomic_helper.c | 15 ++++++++++++--- drivers/gpu/drm/drm_color_mgmt.c | 4 ++++ drivers/gpu/drm/drm_fb_helper.c | 8 ++++++-- include/drm/drm_crtc.h | 3 +++ 4 files changed, 25 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +12 -3
@@ -3512,6 +3512,10 @@ EXPORT_SYMBOL(drm_atomic_helper_page_flip_target);* that support color management through the DEGAMMA_LUT/GAMMA_LUT * properties. See drm_crtc_enable_color_mgmt() and the containing chapter for * how the atomic color management and gamma tables work. +* +* This function uses the GAMMA_LUT or DEGAMMA_LUT property for the gamma table. +* GAMMA_LUT property is used if it exists, and DEGAMMA_LUT property is used as +* a fallback. */ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue,
@@ -3526,6 +3530,9 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc,int i, ret =0 ;bool replaced; +if (!crtc->has_gamma_prop && !crtc->has_degamma_prop) +return -ENODEV ; + state =drm_atomic_state_alloc (crtc->dev);if (!state)return -ENOMEM ;
@@ -3554,10 +3561,12 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, goto fail; } -/* Reset DEGAMMA_LUT and CTM properties. */ - replaced =drm_property_replace_blob (&crtc_state->degamma_lut,NULL ); +/* Set GAMMA/DEGAMMA_LUT and reset DEGAMMA/GAMMA_LUT and CTM */ + replaced =drm_property_replace_blob (&crtc_state->degamma_lut, + crtc->has_gamma_prop ?NULL : blob); replaced |=drm_property_replace_blob (&crtc_state->ctm,NULL ); - replaced |=drm_property_replace_blob (&crtc_state->gamma_lut, blob); + replaced |=drm_property_replace_blob (&crtc_state->gamma_lut, + crtc->has_gamma_prop ? blob :NULL ); crtc_state->color_mgmt_changed |= replaced; ret =drm_atomic_commit (state);
drivers/gpu/drm/drm_color_mgmt.c +4 -0
@@ -176,6 +176,8 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, degamma_lut_size); } + crtc->has_degamma_prop = !!degamma_lut_size; +if (has_ctm)drm_object_attach_property (&crtc->base, config->ctm_property,0 );
@@ -187,6 +189,8 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, config->gamma_lut_size_property, gamma_lut_size); } + + crtc->has_gamma_prop = !!gamma_lut_size; }EXPORT_SYMBOL (drm_crtc_enable_color_mgmt);
drivers/gpu/drm/drm_fb_helper.c +6 -2
@@ -1001,6 +1001,9 @@ static int setcmap_atomic(struct fb_cmap *cmap, struct fb_info *info)drm_client_for_each_modeset (modeset, &fb_helper->client) { crtc = modeset->crtc; +if (!crtc->has_gamma_prop && !crtc->has_degamma_prop) +continue ; +if (!gamma_lut) gamma_lut =setcmap_new_gamma_lut (crtc, cmap);if (IS_ERR (gamma_lut)) {
@@ -1015,11 +1018,12 @@ static int setcmap_atomic(struct fb_cmap *cmap, struct fb_info *info) goto out_state; } +/* Set GAMMA/DEGAMMA_LUT and reset DEGAMMA/GAMMA_LUT and CTM */ replaced =drm_property_replace_blob (&crtc_state->degamma_lut, -NULL ); + crtc->has_gamma_prop ?NULL : gamma_lut); replaced |=drm_property_replace_blob (&crtc_state->ctm,NULL ); replaced |=drm_property_replace_blob (&crtc_state->gamma_lut, - gamma_lut); + crtc->has_gamma_prop ? gamma_lut :NULL ); crtc_state->color_mgmt_changed |= replaced; }
include/drm/drm_crtc.h +3 -0
@@ -1084,6 +1084,9 @@ struct drm_crtc {*/ uint16_t *gamma_store; + bool has_gamma_prop : 1; + bool has_degamma_prop : 1; +/** @helper_private: mid-layer private data */ const struct drm_crtc_helper_funcs *helper_private;
Signature · 7 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 1/2] drm: add legacy support for using degamma for gamma
Hi Tomi,
Thank you for the patch.
Quoted 20 lines · Tomi Valkeinen
We currently have
drm_atomic_helper_legacy_gamma_set()helper which can be used to handle legacy gamma-set ioctl.drm_atomic_helper_legacy_gamma_set()setsGAMMA_LUT, and clears CTM andDEGAMMA_LUT. This works fine on HW where we have either:degamma -> ctm -> gamma -> out
or
ctm -> gamma -> out
However, if the HW has gamma table before ctm, the atomic property should be
DEGAMMA_LUT, and thus we have:degamma -> ctm -> out
This is fine for userspace which sets gamma table using the properties, as the userspace can check for the existence of gamma & degamma, but the legacy gamma-set ioctl does not work.
Quoted 5 lines
This patch fixes the issue by changing
drm_atomic_helper_legacy_gamma_set()so thatGAMMA_LUTwill be used if it exists, andDEGAMMA_LUTwill be used as a fallback.Signed-off-by Tomi Valkeinen <[email protected]>
Quoted 113 lines
--- drivers/gpu/drm/drm_atomic_helper.c | 15 ++++++++++++--- drivers/gpu/drm/drm_color_mgmt.c | 4 ++++ drivers/gpu/drm/drm_fb_helper.c | 8 ++++++-- include/drm/drm_crtc.h | 3 +++ 4 files changed, 25 insertions(+), 5 deletions(-)drivers/gpu/drm/drm_atomic_helper.c +12
-3@@ -3512,6 +3512,10 @@ EXPORT_SYMBOL(drm_atomic_helper_page_flip_target);* that support color management through the DEGAMMA_LUT/GAMMA_LUT * properties. See drm_crtc_enable_color_mgmt() and the containing chapter for * how the atomic color management and gamma tables work. +* +* This function uses the GAMMA_LUT or DEGAMMA_LUT property for the gamma table. +* GAMMA_LUT property is used if it exists, and DEGAMMA_LUT property is used as +* a fallback. */ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue,@@ -3526,6 +3530,9 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc,int i, ret =0 ;bool replaced; +if (!crtc->has_gamma_prop && !crtc->has_degamma_prop) +return -ENODEV ; + state =drm_atomic_state_alloc (crtc->dev);if (!state)return -ENOMEM ;@@ -3554,10 +3561,12 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, goto fail; } -/* Reset DEGAMMA_LUT and CTM properties. */ - replaced =drm_property_replace_blob (&crtc_state->degamma_lut,NULL ); +/* Set GAMMA/DEGAMMA_LUT and reset DEGAMMA/GAMMA_LUT and CTM */ + replaced =drm_property_replace_blob (&crtc_state->degamma_lut, + crtc->has_gamma_prop ?NULL : blob); replaced |=drm_property_replace_blob (&crtc_state->ctm,NULL ); - replaced |=drm_property_replace_blob (&crtc_state->gamma_lut, blob); + replaced |=drm_property_replace_blob (&crtc_state->gamma_lut, + crtc->has_gamma_prop ? blob :NULL ); crtc_state->color_mgmt_changed |= replaced; ret =drm_atomic_commit (state);drivers/gpu/drm/drm_color_mgmt.c +4
-0@@ -176,6 +176,8 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, degamma_lut_size); } + crtc->has_degamma_prop = !!degamma_lut_size; +if (has_ctm)drm_object_attach_property (&crtc->base, config->ctm_property,0 );@@ -187,6 +189,8 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, config->gamma_lut_size_property, gamma_lut_size); } + + crtc->has_gamma_prop = !!gamma_lut_size; }EXPORT_SYMBOL (drm_crtc_enable_color_mgmt);drivers/gpu/drm/drm_fb_helper.c +6
-2@@ -1001,6 +1001,9 @@ static int setcmap_atomic(struct fb_cmap *cmap, struct fb_info *info)drm_client_for_each_modeset (modeset, &fb_helper->client) { crtc = modeset->crtc; +if (!crtc->has_gamma_prop && !crtc->has_degamma_prop) +continue ; +if (!gamma_lut) gamma_lut =setcmap_new_gamma_lut (crtc, cmap);if (IS_ERR (gamma_lut)) {@@ -1015,11 +1018,12 @@ static int setcmap_atomic(struct fb_cmap *cmap, struct fb_info *info) goto out_state; } +/* Set GAMMA/DEGAMMA_LUT and reset DEGAMMA/GAMMA_LUT and CTM */ replaced =drm_property_replace_blob (&crtc_state->degamma_lut, -NULL ); + crtc->has_gamma_prop ?NULL : gamma_lut); replaced |=drm_property_replace_blob (&crtc_state->ctm,NULL ); replaced |=drm_property_replace_blob (&crtc_state->gamma_lut, - gamma_lut); + crtc->has_gamma_prop ? gamma_lut :NULL ); crtc_state->color_mgmt_changed |= replaced; }include/drm/drm_crtc.h +3
-0@@ -1084,6 +1084,9 @@ struct drm_crtc {*/ uint16_t *gamma_store; + bool has_gamma_prop : 1; + bool has_degamma_prop : 1; +/** @helper_private: mid-layer private data */ const struct drm_crtc_helper_funcs *helper_private;
Signature · 7 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 1/2] drm: add legacy support for using degamma for gamma
Quoted 140 lines · Laurent Pinchart
Hi Tomi,
Thank you for the patch.
Quoted 20 lines · Tomi Valkeinen
We currently have
drm_atomic_helper_legacy_gamma_set()helper which can be used to handle legacy gamma-set ioctl.drm_atomic_helper_legacy_gamma_set()setsGAMMA_LUT, and clears CTM andDEGAMMA_LUT. This works fine on HW where we have either:degamma -> ctm -> gamma -> out
or
ctm -> gamma -> out
However, if the HW has gamma table before ctm, the atomic property should be
DEGAMMA_LUT, and thus we have:degamma -> ctm -> out
This is fine for userspace which sets gamma table using the properties, as the userspace can check for the existence of gamma & degamma, but the legacy gamma-set ioctl does not work.
Quoted 5 lines
This patch fixes the issue by changing
drm_atomic_helper_legacy_gamma_set()so thatGAMMA_LUTwill be used if it exists, andDEGAMMA_LUTwill be used as a fallback.Signed-off-by Tomi Valkeinen <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>Quoted 107 lines
--- drivers/gpu/drm/drm_atomic_helper.c | 15 ++++++++++++--- drivers/gpu/drm/drm_color_mgmt.c | 4 ++++ drivers/gpu/drm/drm_fb_helper.c | 8 ++++++-- include/drm/drm_crtc.h | 3 +++ 4 files changed, 25 insertions(+), 5 deletions(-)drivers/gpu/drm/drm_atomic_helper.c +12
-3@@ -3512,6 +3512,10 @@ EXPORT_SYMBOL(drm_atomic_helper_page_flip_target);* that support color management through the DEGAMMA_LUT/GAMMA_LUT * properties. See drm_crtc_enable_color_mgmt() and the containing chapter for * how the atomic color management and gamma tables work. +* +* This function uses the GAMMA_LUT or DEGAMMA_LUT property for the gamma table. +* GAMMA_LUT property is used if it exists, and DEGAMMA_LUT property is used as +* a fallback. */ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue,@@ -3526,6 +3530,9 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc,int i, ret =0 ;bool replaced; +if (!crtc->has_gamma_prop && !crtc->has_degamma_prop) +return -ENODEV ; + state =drm_atomic_state_alloc (crtc->dev);if (!state)return -ENOMEM ;@@ -3554,10 +3561,12 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, goto fail; } -/* Reset DEGAMMA_LUT and CTM properties. */ - replaced =drm_property_replace_blob (&crtc_state->degamma_lut,NULL ); +/* Set GAMMA/DEGAMMA_LUT and reset DEGAMMA/GAMMA_LUT and CTM */ + replaced =drm_property_replace_blob (&crtc_state->degamma_lut, + crtc->has_gamma_prop ?NULL : blob); replaced |=drm_property_replace_blob (&crtc_state->ctm,NULL ); - replaced |=drm_property_replace_blob (&crtc_state->gamma_lut, blob); + replaced |=drm_property_replace_blob (&crtc_state->gamma_lut, + crtc->has_gamma_prop ? blob :NULL ); crtc_state->color_mgmt_changed |= replaced; ret =drm_atomic_commit (state);drivers/gpu/drm/drm_color_mgmt.c +4
-0@@ -176,6 +176,8 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, degamma_lut_size); } + crtc->has_degamma_prop = !!degamma_lut_size; +if (has_ctm)drm_object_attach_property (&crtc->base, config->ctm_property,0 );@@ -187,6 +189,8 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, config->gamma_lut_size_property, gamma_lut_size); } + + crtc->has_gamma_prop = !!gamma_lut_size; }EXPORT_SYMBOL (drm_crtc_enable_color_mgmt);drivers/gpu/drm/drm_fb_helper.c +6
-2@@ -1001,6 +1001,9 @@ static int setcmap_atomic(struct fb_cmap *cmap, struct fb_info *info)drm_client_for_each_modeset (modeset, &fb_helper->client) { crtc = modeset->crtc; +if (!crtc->has_gamma_prop && !crtc->has_degamma_prop) +continue ; +if (!gamma_lut) gamma_lut =setcmap_new_gamma_lut (crtc, cmap);if (IS_ERR (gamma_lut)) {@@ -1015,11 +1018,12 @@ static int setcmap_atomic(struct fb_cmap *cmap, struct fb_info *info) goto out_state; } +/* Set GAMMA/DEGAMMA_LUT and reset DEGAMMA/GAMMA_LUT and CTM */ replaced =drm_property_replace_blob (&crtc_state->degamma_lut, -NULL ); + crtc->has_gamma_prop ?NULL : gamma_lut); replaced |=drm_property_replace_blob (&crtc_state->ctm,NULL ); replaced |=drm_property_replace_blob (&crtc_state->gamma_lut, - gamma_lut); + crtc->has_gamma_prop ? gamma_lut :NULL ); crtc_state->color_mgmt_changed |= replaced; }include/drm/drm_crtc.h +0
-0@@ -1084,6 +1084,9 @@ struct drm_crtc {*/ uint16_t *gamma_store;
Quoted 2 lines
include/drm/drm_crtc.h struct drm_crtc { · line 1088
Quoted 2 lines
include/drm/drm_crtc.h +2
-0+ bool has_gamma_prop : 1; + bool has_degamma_prop : 1;
I'm a bit behind on patches, but in case this got missed please remove this and replace with the (obj, prop) lookup function thing or something like that. Makes sure everything stays in sync, plus like I said atomic uses this a ton. So not a problem here.
-Daniel
Quoted 9 lines
Quoted 4 lines
include/drm/drm_crtc.h +1
-0+/** @helper_private: mid-layer private data */ const struct drm_crtc_helper_funcs *helper_private;Signature · 3 lines
Regards, Laurent Pinchart
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
Re: [PATCH v2 1/2] drm: add legacy support for using degamma for gamma
Hi Daniel,
Quoted 8 lines · Daniel Vetter
Quoted 8 lines
Quoted 8 lines
include/drm/drm_crtc.h +0
-0@@ -1084,6 +1084,9 @@ struct drm_crtc {*/ uint16_t *gamma_store;
Quoted 7 lines
Quoted 2 lines
include/drm/drm_crtc.h struct drm_crtc { · line 1088
Quoted 2 lines
include/drm/drm_crtc.h +2
-0+ bool has_gamma_prop : 1; + bool has_degamma_prop : 1;I'm a bit behind on patches, but in case this got missed please remove this and replace with the (obj, prop) lookup function thing or something like that. Makes sure everything stays in sync, plus like I said atomic uses this a ton. So not a problem here.
The drm_mode_obj_find_prop_id() is in core drm.ko, and not exported, but I need it also from drm_kms_helper.ko.
drm_mode_obj_find_prop_id() is declared in drm_crtc_internal.h. Are those functions supposed to be not exported from drm.ko?
So, is it fine to just export drm_mode_obj_find_prop_id? If I export, should I move it to drm_mode_object.h?
Tomi
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 1/2] drm: add legacy support for using degamma for gamma
Quoted 21 lines · Tomi Valkeinen
Hi Daniel,
Quoted 8 lines · Daniel Vetter
Quoted 8 lines
Quoted 8 lines
include/drm/drm_crtc.h +0
-0@@ -1084,6 +1084,9 @@ struct drm_crtc {*/ uint16_t *gamma_store;Quoted 7 lines
Quoted 2 lines
include/drm/drm_crtc.h struct drm_crtc { · line 1088
Quoted 2 lines
include/drm/drm_crtc.h +2
-0+ bool has_gamma_prop : 1; + bool has_degamma_prop : 1;I'm a bit behind on patches, but in case this got missed please remove this and replace with the (obj, prop) lookup function thing or something like that. Makes sure everything stays in sync, plus like I said atomic uses this a ton. So not a problem here.
Quoted 8 lines
The
drm_mode_obj_find_prop_id()is in core drm.ko, and not exported, but I need it also from drm_kms_helper.ko.
drm_mode_obj_find_prop_id()is declared indrm_crtc_internal.h. Are those functions supposed to be not exported from drm.ko?So, is it fine to just export
drm_mode_obj_find_prop_id? If I export, should I move it todrm_mode_object.h?
It's not exported to drivers so they don't play games in their own ioctls or do something else than the atomic set/get_property hooks. I guess we could export, but I think here the better solution is to lift the legacy gamma compat function to core code status, since I think that's the direction we want to go anyway. Bit more churn since the name changes.
-Daniel
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
PATCH v2 2/2 drm: automatic legacy gamma support
In reply to Tomi ValkeinenTo support legacy gamma ioctls the drivers need to set drm_crtc_funcs.gamma_set either to a custom implementation or to drm_atomic_helper_legacy_gamma_set. Most of the atomic drivers do the latter.
We can simplify this by making the core handle it automatically.
Add two functions: drm_crtc_supports_legacy_gamma() which tells if the legacy gamma table can be set, and drm_crtc_legacy_gamma_set() which does the work by either calling the drm_crtc_funcs.gamma_set or using GAMMA_LUT or DEGAMMA_LUT.
We can then drop drm_atomic_helper_legacy_gamma_set() and remove all its uses.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 - .../gpu/drm/arm/display/komeda/komeda_crtc.c | 1 - drivers/gpu/drm/arm/malidp_crtc.c | 1 - drivers/gpu/drm/armada/armada_crtc.c | 1 - drivers/gpu/drm/ast/ast_mode.c | 1 - .../gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 1 - drivers/gpu/drm/drm_atomic_helper.c | 79 ------------ drivers/gpu/drm/drm_color_mgmt.c | 118 ++++++++++++++++-- drivers/gpu/drm/drm_crtc_internal.h | 6 + drivers/gpu/drm/drm_fb_helper.c | 13 +- drivers/gpu/drm/i915/display/intel_display.c | 1 - drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 2 - drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 1 - drivers/gpu/drm/nouveau/dispnv50/head.c | 2 - drivers/gpu/drm/omapdrm/omap_crtc.c | 1 - drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 1 - drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 1 - drivers/gpu/drm/stm/ltdc.c | 1 - drivers/gpu/drm/vc4/vc4_crtc.c | 1 - drivers/gpu/drm/vc4/vc4_txp.c | 1 - include/drm/drm_atomic_helper.h | 4 - 21 files changed, 122 insertions(+), 116 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -1
@@ -5396,7 +5396,6 @@ static void dm_disable_vblank(struct drm_crtc *crtc)static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = { .reset = dm_crtc_reset_state, .destroy = amdgpu_dm_crtc_destroy, - .gamma_set = drm_atomic_helper_legacy_gamma_set, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip, .atomic_duplicate_state = dm_crtc_duplicate_state,
drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +0 -1
@@ -550,7 +550,6 @@ static void komeda_crtc_vblank_disable(struct drm_crtc *crtc) }static const struct drm_crtc_funcs komeda_crtc_funcs = { - .gamma_set = drm_atomic_helper_legacy_gamma_set, .destroy = drm_crtc_cleanup, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip,
drivers/gpu/drm/arm/malidp_crtc.c +0 -1
@@ -510,7 +510,6 @@ static void malidp_crtc_disable_vblank(struct drm_crtc *crtc) }static const struct drm_crtc_funcs malidp_crtc_funcs = { - .gamma_set = drm_atomic_helper_legacy_gamma_set, .destroy = drm_crtc_cleanup, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip,
drivers/gpu/drm/armada/armada_crtc.c +0 -1
@@ -820,7 +820,6 @@ static const struct drm_crtc_funcs armada_crtc_funcs = { .cursor_set = armada_drm_crtc_cursor_set, .cursor_move = armada_drm_crtc_cursor_move, .destroy = armada_drm_crtc_destroy, - .gamma_set = drm_atomic_helper_legacy_gamma_set, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip, .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
drivers/gpu/drm/ast/ast_mode.c +0 -1
@@ -903,7 +903,6 @@ static void ast_crtc_atomic_destroy_state(struct drm_crtc *crtc,static const struct drm_crtc_funcs ast_crtc_funcs = { .reset = ast_crtc_reset, - .gamma_set = drm_atomic_helper_legacy_gamma_set, .destroy = drm_crtc_cleanup, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip,
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +0 -1
@@ -473,7 +473,6 @@ static const struct drm_crtc_funcs atmel_hlcdc_crtc_funcs = { .atomic_destroy_state = atmel_hlcdc_crtc_destroy_state, .enable_vblank = atmel_hlcdc_crtc_enable_vblank, .disable_vblank = atmel_hlcdc_crtc_disable_vblank, - .gamma_set = drm_atomic_helper_legacy_gamma_set, };int atmel_hlcdc_crtc_create (struct drm_device *dev)
drivers/gpu/drm/drm_atomic_helper.c +0 -79
85 lines not on this page · raw message
drivers/gpu/drm/drm_color_mgmt.c +109 -9
154 lines not on this page · raw message
drivers/gpu/drm/drm_crtc_internal.h +6 -0
@@ -114,6 +114,12 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,const char *drm_get_color_encoding_name (enum drm_color_encoding encoding);const char *drm_get_color_range_name (enum drm_color_range range); +bool drm_crtc_supports_legacy_gamma (struct drm_crtc *crtc); +int drm_crtc_legacy_gamma_set (struct drm_crtc *crtc, +u16 *red,u16 *green,u16 *blue, +uint32_t size, +struct drm_modeset_acquire_ctx *ctx); +/* IOCTLs */ int drm_mode_gamma_get_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv);
drivers/gpu/drm/drm_fb_helper.c +7 -6
@@ -46,6 +46,7 @@#include <drm/drm_print.h> #include <drm/drm_vblank.h> +#include "drm_crtc_internal.h" #include "drm_crtc_helper_internal.h" #include "drm_internal.h"
@@ -136,15 +137,15 @@ static void drm_fb_helper_restore_lut_atomic(struct drm_crtc *crtc) {uint16_t *r_base, *g_base, *b_base; -if (crtc->funcs->gamma_set ==NULL ) +if (!drm_crtc_supports_legacy_gamma (crtc))return ; r_base = crtc->gamma_store; g_base = r_base + crtc->gamma_size; b_base = g_base + crtc->gamma_size; - crtc->funcs->gamma_set (crtc, r_base, g_base, b_base, - crtc->gamma_size,NULL ); +drm_crtc_legacy_gamma_set (crtc, r_base, g_base, b_base, + crtc->gamma_size,NULL ); }/**
@@ -907,7 +908,7 @@ static int setcmap_legacy(struct fb_cmap *cmap, struct fb_info *info)drm_modeset_lock_all (fb_helper->dev);drm_client_for_each_modeset (modeset, &fb_helper->client) { crtc = modeset->crtc; -if (!crtc->funcs->gamma_set || !crtc->gamma_size) +if (!drm_crtc_supports_legacy_gamma (crtc))return -EINVAL ;if (cmap->start + cmap->len > crtc->gamma_size)
@@ -921,8 +922,8 @@ static int setcmap_legacy(struct fb_cmap *cmap, struct fb_info *info)memcpy (g + cmap->start, cmap->green, cmap->len *sizeof (*g));memcpy (b + cmap->start, cmap->blue, cmap->len *sizeof (*b)); - ret = crtc->funcs->gamma_set (crtc, r, g, b, - crtc->gamma_size,NULL ); + ret =drm_crtc_legacy_gamma_set (crtc, r, g, b, crtc->gamma_size, +NULL );if (ret)return ret; }
drivers/gpu/drm/i915/display/intel_display.c +0 -1
@@ -16879,7 +16879,6 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, }#define INTEL_CRTC_FUNCS \ - .gamma_set = drm_atomic_helper_legacy_gamma_set, \ .set_config = drm_atomic_helper_set_config, \ .destroy = intel_crtc_destroy, \ .page_flip = drm_atomic_helper_page_flip, \
drivers/gpu/drm/ingenic/ingenic-drm-drv.c +0 -2
@@ -755,8 +755,6 @@ static const struct drm_crtc_funcs ingenic_drm_crtc_funcs = { .enable_vblank = ingenic_drm_enable_vblank, .disable_vblank = ingenic_drm_disable_vblank, - - .gamma_set = drm_atomic_helper_legacy_gamma_set, };static const struct drm_plane_helper_funcs ingenic_drm_plane_helper_funcs = {
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +0 -1
@@ -619,7 +619,6 @@ static const struct drm_crtc_funcs mtk_crtc_funcs = { .reset = mtk_drm_crtc_reset, .atomic_duplicate_state = mtk_drm_crtc_duplicate_state, .atomic_destroy_state = mtk_drm_crtc_destroy_state, - .gamma_set = drm_atomic_helper_legacy_gamma_set, .enable_vblank = mtk_drm_crtc_enable_vblank, .disable_vblank = mtk_drm_crtc_disable_vblank, };
drivers/gpu/drm/nouveau/dispnv50/head.c +0 -2
@@ -503,7 +503,6 @@ nv50_head_destroy(struct drm_crtc *crtc)static const struct drm_crtc_funcs nv50_head_func = { .reset = nv50_head_reset, - .gamma_set = drm_atomic_helper_legacy_gamma_set, .destroy = nv50_head_destroy, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip,
@@ -518,7 +517,6 @@ nv50_head_func = {static const struct drm_crtc_funcs nvd9_head_func = { .reset = nv50_head_reset, - .gamma_set = drm_atomic_helper_legacy_gamma_set, .destroy = nv50_head_destroy, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip,
drivers/gpu/drm/omapdrm/omap_crtc.c +0 -1
@@ -741,7 +741,6 @@ static const struct drm_crtc_funcs omap_crtc_funcs = { .set_config = drm_atomic_helper_set_config, .destroy = omap_crtc_destroy, .page_flip = drm_atomic_helper_page_flip, - .gamma_set = drm_atomic_helper_legacy_gamma_set, .atomic_duplicate_state = omap_crtc_duplicate_state, .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, .atomic_set_property = omap_crtc_atomic_set_property,
drivers/gpu/drm/rcar-du/rcar_du_crtc.c +0 -1
@@ -1144,7 +1144,6 @@ static const struct drm_crtc_funcs crtc_funcs_gen3 = { .set_crc_source = rcar_du_crtc_set_crc_source, .verify_crc_source = rcar_du_crtc_verify_crc_source, .get_crc_sources = rcar_du_crtc_get_crc_sources, - .gamma_set = drm_atomic_helper_legacy_gamma_set, };/* -----------------------------------------------------------------------------
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +0 -1
@@ -1643,7 +1643,6 @@ static const struct drm_crtc_funcs vop_crtc_funcs = { .disable_vblank = vop_crtc_disable_vblank, .set_crc_source = vop_crtc_set_crc_source, .verify_crc_source = vop_crtc_verify_crc_source, - .gamma_set = drm_atomic_helper_legacy_gamma_set, };static void vop_fb_unref_worker (struct drm_flip_work *work,void *val)
drivers/gpu/drm/stm/ltdc.c +0 -1
@@ -713,7 +713,6 @@ static const struct drm_crtc_funcs ltdc_crtc_funcs = { .enable_vblank = ltdc_crtc_enable_vblank, .disable_vblank = ltdc_crtc_disable_vblank, .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp, - .gamma_set = drm_atomic_helper_legacy_gamma_set, };/*
drivers/gpu/drm/vc4/vc4_crtc.c +0 -1
@@ -884,7 +884,6 @@ static const struct drm_crtc_funcs vc4_crtc_funcs = { .reset = vc4_crtc_reset, .atomic_duplicate_state = vc4_crtc_duplicate_state, .atomic_destroy_state = vc4_crtc_destroy_state, - .gamma_set = drm_atomic_helper_legacy_gamma_set, .enable_vblank = vc4_enable_vblank, .disable_vblank = vc4_disable_vblank, .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp,
drivers/gpu/drm/vc4/vc4_txp.c +0 -1
@@ -382,7 +382,6 @@ static const struct drm_crtc_funcs vc4_txp_crtc_funcs = { .reset = vc4_crtc_reset, .atomic_duplicate_state = vc4_crtc_duplicate_state, .atomic_destroy_state = vc4_crtc_destroy_state, - .gamma_set = drm_atomic_helper_legacy_gamma_set, .enable_vblank = vc4_txp_enable_vblank, .disable_vblank = vc4_txp_disable_vblank, };
include/drm/drm_atomic_helper.h +0 -4
@@ -147,10 +147,6 @@ int drm_atomic_helper_page_flip_target(uint32_t flags, uint32_t target, struct drm_modeset_acquire_ctx *ctx); -int drm_atomic_helper_legacy_gamma_set (struct drm_crtc *crtc, -u16 *red,u16 *green,u16 *blue, -uint32_t size, -struct drm_modeset_acquire_ctx *ctx);/** * drm_atomic_crtc_for_each_plane - iterate over planes currently attached to CRTC
Signature · 7 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 2/2] drm: automatic legacy gamma support
Hi Tomi,
Thank you for the patch.
Quoted 278 lines · Tomi Valkeinen
To support legacy gamma ioctls the drivers need to set drm_crtc_funcs.gamma_set either to a custom implementation or to
drm_atomic_helper_legacy_gamma_set. Most of the atomic drivers do the latter.We can simplify this by making the core handle it automatically.
Add two functions:
drm_crtc_supports_legacy_gamma()which tells if the legacy gamma table can be set, anddrm_crtc_legacy_gamma_set()which does the work by either calling the drm_crtc_funcs.gamma_set or usingGAMMA_LUTorDEGAMMA_LUT.We can then drop
drm_atomic_helper_legacy_gamma_set()and remove all its uses.Signed-off-by Tomi Valkeinen <[email protected]>--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 - .../gpu/drm/arm/display/komeda/komeda_crtc.c | 1 - drivers/gpu/drm/arm/malidp_crtc.c | 1 - drivers/gpu/drm/armada/armada_crtc.c | 1 - drivers/gpu/drm/ast/ast_mode.c | 1 - .../gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 1 - drivers/gpu/drm/drm_atomic_helper.c | 79 ------------ drivers/gpu/drm/drm_color_mgmt.c | 118 ++++++++++++++++-- drivers/gpu/drm/drm_crtc_internal.h | 6 + drivers/gpu/drm/drm_fb_helper.c | 13 +- drivers/gpu/drm/i915/display/intel_display.c | 1 - drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 2 - drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 1 - drivers/gpu/drm/nouveau/dispnv50/head.c | 2 - drivers/gpu/drm/omapdrm/omap_crtc.c | 1 - drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 1 - drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 1 - drivers/gpu/drm/stm/ltdc.c | 1 - drivers/gpu/drm/vc4/vc4_crtc.c | 1 - drivers/gpu/drm/vc4/vc4_txp.c | 1 - include/drm/drm_atomic_helper.h | 4 - 21 files changed, 122 insertions(+), 116 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0
-1@@ -5396,7 +5396,6 @@ static void dm_disable_vblank(struct drm_crtc *crtc)static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = { .reset = dm_crtc_reset_state, .destroy = amdgpu_dm_crtc_destroy, - .gamma_set = drm_atomic_helper_legacy_gamma_set, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip, .atomic_duplicate_state = dm_crtc_duplicate_state,drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +0
-1@@ -550,7 +550,6 @@ static void komeda_crtc_vblank_disable(struct drm_crtc *crtc) }static const struct drm_crtc_funcs komeda_crtc_funcs = { - .gamma_set = drm_atomic_helper_legacy_gamma_set, .destroy = drm_crtc_cleanup, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip,drivers/gpu/drm/arm/malidp_crtc.c +0
-1@@ -510,7 +510,6 @@ static void malidp_crtc_disable_vblank(struct drm_crtc *crtc) }static const struct drm_crtc_funcs malidp_crtc_funcs = { - .gamma_set = drm_atomic_helper_legacy_gamma_set, .destroy = drm_crtc_cleanup, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip,drivers/gpu/drm/armada/armada_crtc.c +0
-1@@ -820,7 +820,6 @@ static const struct drm_crtc_funcs armada_crtc_funcs = { .cursor_set = armada_drm_crtc_cursor_set, .cursor_move = armada_drm_crtc_cursor_move, .destroy = armada_drm_crtc_destroy, - .gamma_set = drm_atomic_helper_legacy_gamma_set, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip, .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,drivers/gpu/drm/ast/ast_mode.c +0
-1@@ -903,7 +903,6 @@ static void ast_crtc_atomic_destroy_state(struct drm_crtc *crtc,static const struct drm_crtc_funcs ast_crtc_funcs = { .reset = ast_crtc_reset, - .gamma_set = drm_atomic_helper_legacy_gamma_set, .destroy = drm_crtc_cleanup, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip,drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +0
-1@@ -473,7 +473,6 @@ static const struct drm_crtc_funcs atmel_hlcdc_crtc_funcs = { .atomic_destroy_state = atmel_hlcdc_crtc_destroy_state, .enable_vblank = atmel_hlcdc_crtc_enable_vblank, .disable_vblank = atmel_hlcdc_crtc_disable_vblank, - .gamma_set = drm_atomic_helper_legacy_gamma_set, };int atmel_hlcdc_crtc_create (struct drm_device *dev)drivers/gpu/drm/drm_atomic_helper.c +0
-79@@ -3499,85 +3499,6 @@ int drm_atomic_helper_page_flip_target(struct drm_crtc *crtc, }EXPORT_SYMBOL (drm_atomic_helper_page_flip_target); -/** -* drm_atomic_helper_legacy_gamma_set - set the legacy gamma correction table -* @crtc: CRTC object -* @red: red correction table -* @green: green correction table -* @blue: green correction table -* @size: size of the tables -* @ctx: lock acquire context -* -* Implements support for legacy gamma correction table for drivers -* that support color management through the DEGAMMA_LUT/GAMMA_LUT -* properties. See drm_crtc_enable_color_mgmt() and the containing chapter for -* how the atomic color management and gamma tables work. -* -* This function uses the GAMMA_LUT or DEGAMMA_LUT property for the gamma table. -* GAMMA_LUT property is used if it exists, and DEGAMMA_LUT property is used as -* a fallback. -*/ -int drm_atomic_helper_legacy_gamma_set (struct drm_crtc *crtc, -u16 *red,u16 *green,u16 *blue, -uint32_t size, -struct drm_modeset_acquire_ctx *ctx) -{ -struct drm_device *dev = crtc->dev; -struct drm_atomic_state *state; -struct drm_crtc_state *crtc_state; -struct drm_property_blob *blob =NULL ; -struct drm_color_lut *blob_data; -int i, ret =0 ; -bool replaced; - -if (!crtc->has_gamma_prop && !crtc->has_degamma_prop) -return -ENODEV ; - - state =drm_atomic_state_alloc (crtc->dev); -if (!state) -return -ENOMEM ; - - blob =drm_property_create_blob (dev, -sizeof (struct drm_color_lut ) * size, -NULL ); -if (IS_ERR (blob)) { - ret =PTR_ERR (blob); - blob =NULL ; - goto fail; - } - -/* Prepare GAMMA_LUT with the legacy values. */ - blob_data = blob->data; -for (i =0 ; i < size; i++) { - blob_data[i].red = red[i]; - blob_data[i].green = green[i]; - blob_data[i].blue = blue[i]; - } - - state->acquire_ctx = ctx; - crtc_state =drm_atomic_get_crtc_state (state, crtc); -if (IS_ERR (crtc_state)) { - ret =PTR_ERR (crtc_state); - goto fail; - } - -/* Set GAMMA/DEGAMMA_LUT and reset DEGAMMA/GAMMA_LUT and CTM */ - replaced =drm_property_replace_blob (&crtc_state->degamma_lut, - crtc->has_gamma_prop ?NULL : blob); - replaced |=drm_property_replace_blob (&crtc_state->ctm,NULL ); - replaced |=drm_property_replace_blob (&crtc_state->gamma_lut, - crtc->has_gamma_prop ? blob :NULL ); - crtc_state->color_mgmt_changed |= replaced; - - ret =drm_atomic_commit (state); - -fail: -drm_atomic_state_put (state); -drm_property_blob_put (blob); -return ret; -} -EXPORT_SYMBOL (drm_atomic_helper_legacy_gamma_set); -/** * drm_atomic_helper_bridge_propagate_bus_fmt() - Propagate output format to * the input end of a bridge drivers/gpu/drm/drm_color_mgmt.c +41
-6@@ -22,6 +22,7 @@#include <linux/uaccess.h> +#include <drm/drm_atomic.h> #include <drm/drm_color_mgmt.h> #include <drm/drm_crtc.h> #include <drm/drm_device.h> @@ -89,9 +90,8 @@* modes) appropriately. * * There is also support for a legacy gamma table, which is set up by calling -* drm_mode_crtc_set_gamma_size(). Drivers which support both should use -* drm_atomic_helper_legacy_gamma_set() to alias the legacy gamma ramp with the -* "GAMMA_LUT" property above. +* drm_mode_crtc_set_gamma_size(). The DRM core will then alias the legacy gamma +* ramp with "GAMMA_LUT", or if that is unavailable "DEGAMMA_LUT". * * Support for different non RGB color encodings is controlled through * &drm_plane specific COLOR_ENCODING and COLOR_RANGE properties. They @@ -156,9 +156,6 @@ EXPORT_SYMBOL(drm_color_ctm_s31_32_to_qm_n);* optional. The gamma and degamma properties are only attached if * their size is not 0 and ctm_property is only attached if has_ctm is * true. -* -* Drivers should use drm_atomic_helper_legacy_gamma_set() to implement the -* legacy &drm_crtc_funcs.gamma_set callback. */ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, uint degamma_lut_size,@@ -235,6 +232,109 @@ int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, }EXPORT_SYMBOL (drm_mode_crtc_set_gamma_size); +/** +* drm_crtc_supports_legacy_gamma - does the crtc support legacy gamma correction table +* @crtc: CRTC object +* +* Returns true/false if the given crtc supports setting the legacy gamma +* correction table. +*/ +bool drm_crtc_supports_legacy_gamma (struct drm_crtc *crtc) +{ +if (!crtc->gamma_size) +return false; + +if (crtc->funcs->gamma_set) +return true; + +return crtc->has_gamma_prop || crtc->has_degamma_prop; +} +EXPORT_SYMBOL (drm_crtc_supports_legacy_gamma); + +/** +* drm_crtc_legacy_gamma_set - set the legacy gamma correction table +* @crtc: CRTC object +* @red: red correction table +* @green: green correction table +* @blue: green correction table +* @size: size of the tables +* @ctx: lock acquire context +* +* Implements support for legacy gamma correction table for drivers +* that have set drm_crtc_funcs.gamma_set or that support color management +* through the DEGAMMA_LUT/GAMMA_LUT properties. See +* drm_crtc_enable_color_mgmt() and the containing chapter for +* how the atomic color management and gamma tables work. +* +* This function sets the gamma using the first one available: +* - drm_crtc_funcs.gamma_set() +* - GAMMA_LUT +* - DEGAMMA_LUT
drivers/gpu/drm/drm_color_mgmt.c int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, · line 282
Quoted 10 lines
drivers/gpu/drm/drm_color_mgmt.c +10
-0+*/ +int drm_crtc_legacy_gamma_set (struct drm_crtc *crtc, +u16 *red,u16 *green,u16 *blue, +uint32_t size, +struct drm_modeset_acquire_ctx *ctx) +{ +struct drm_device *dev = crtc->dev; +struct drm_atomic_state *state; +struct drm_crtc_state *crtc_state; +struct drm_property_blob *blob =NULL ;
No need to assign NULL to this variable.
Quoted 100 lines
drivers/gpu/drm/drm_color_mgmt.c +58
-3+struct drm_color_lut *blob_data; +int i, ret =0 ; +bool replaced; + +if (crtc->funcs->gamma_set) +return crtc->funcs->gamma_set (crtc, red, green, blue, size, ctx); + +if (!crtc->has_gamma_prop && !crtc->has_degamma_prop) +return -ENODEV ; + + state =drm_atomic_state_alloc (crtc->dev); +if (!state) +return -ENOMEM ; + + blob =drm_property_create_blob (dev, +sizeof (struct drm_color_lut ) * size, +NULL ); +if (IS_ERR (blob)) { + ret =PTR_ERR (blob); + blob =NULL ; + goto fail; + } + +/* Prepare GAMMA_LUT with the legacy values. */ + blob_data = blob->data; +for (i =0 ; i < size; i++) { + blob_data[i].red = red[i]; + blob_data[i].green = green[i]; + blob_data[i].blue = blue[i]; + } + + state->acquire_ctx = ctx; + crtc_state =drm_atomic_get_crtc_state (state, crtc); +if (IS_ERR (crtc_state)) { + ret =PTR_ERR (crtc_state); + goto fail; + } + +/* Set GAMMA/DEGAMMA_LUT and reset DEGAMMA/GAMMA_LUT and CTM */ + replaced =drm_property_replace_blob (&crtc_state->degamma_lut, + crtc->has_gamma_prop ?NULL : blob); + replaced |=drm_property_replace_blob (&crtc_state->ctm,NULL ); + replaced |=drm_property_replace_blob (&crtc_state->gamma_lut, + crtc->has_gamma_prop ? blob :NULL ); + crtc_state->color_mgmt_changed |= replaced; + + ret =drm_atomic_commit (state); + +fail: +drm_atomic_state_put (state); +drm_property_blob_put (blob); +return ret; +} +EXPORT_SYMBOL (drm_crtc_legacy_gamma_set); +/** * drm_mode_gamma_set_ioctl - set the gamma table * @dev: DRM device @@ -266,7 +366,7 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev,if (!crtc)return -ENOENT ; -if (crtc->funcs->gamma_set ==NULL ) +if (!drm_crtc_supports_legacy_gamma (crtc))return -ENOSYS ;/* memcpy into gamma store */ @@ -294,8 +394,8 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev, goto out; } - ret = crtc->funcs->gamma_set (crtc, r_base, g_base, b_base, - crtc->gamma_size, &ctx); + ret =drm_crtc_legacy_gamma_set (crtc, r_base, g_base, b_base, + crtc->gamma_size, &ctx); out:DRM_MODESET_LOCK_ALL_END (dev, ctx, ret);drivers/gpu/drm/drm_crtc_internal.h +6
-0@@ -114,6 +114,12 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,const char *drm_get_color_encoding_name (enum drm_color_encoding encoding);const char *drm_get_color_range_name (enum drm_color_range range); +bool drm_crtc_supports_legacy_gamma (struct drm_crtc *crtc); +int drm_crtc_legacy_gamma_set (struct drm_crtc *crtc, +u16 *red,u16 *green,u16 *blue, +uint32_t size, +struct drm_modeset_acquire_ctx *ctx); +/* IOCTLs */ int drm_mode_gamma_get_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv);drivers/gpu/drm/drm_fb_helper.c +0
-0
drivers/gpu/drm/drm_fb_helper.c line 50
Quoted 5 lines
drivers/gpu/drm/drm_fb_helper.c +1
-0@@ -46,6 +46,7 @@#include <drm/drm_print.h> #include <drm/drm_vblank.h> +#include "drm_crtc_internal.h" #include "drm_crtc_helper_internal.h"
i goes after h.
Quoted 185 lines
drivers/gpu/drm/drm_fb_helper.c +6
-6#include "drm_internal.h" @@ -136,15 +137,15 @@ static void drm_fb_helper_restore_lut_atomic(struct drm_crtc *crtc) {uint16_t *r_base, *g_base, *b_base; -if (crtc->funcs->gamma_set ==NULL ) +if (!drm_crtc_supports_legacy_gamma (crtc))return ; r_base = crtc->gamma_store; g_base = r_base + crtc->gamma_size; b_base = g_base + crtc->gamma_size; - crtc->funcs->gamma_set (crtc, r_base, g_base, b_base, - crtc->gamma_size,NULL ); +drm_crtc_legacy_gamma_set (crtc, r_base, g_base, b_base, + crtc->gamma_size,NULL ); }/** @@ -907,7 +908,7 @@ static int setcmap_legacy(struct fb_cmap *cmap, struct fb_info *info)drm_modeset_lock_all (fb_helper->dev);drm_client_for_each_modeset (modeset, &fb_helper->client) { crtc = modeset->crtc; -if (!crtc->funcs->gamma_set || !crtc->gamma_size) +if (!drm_crtc_supports_legacy_gamma (crtc))return -EINVAL ;if (cmap->start + cmap->len > crtc->gamma_size)@@ -921,8 +922,8 @@ static int setcmap_legacy(struct fb_cmap *cmap, struct fb_info *info)memcpy (g + cmap->start, cmap->green, cmap->len *sizeof (*g));memcpy (b + cmap->start, cmap->blue, cmap->len *sizeof (*b)); - ret = crtc->funcs->gamma_set (crtc, r, g, b, - crtc->gamma_size,NULL ); + ret =drm_crtc_legacy_gamma_set (crtc, r, g, b, crtc->gamma_size, +NULL );if (ret)return ret; }drivers/gpu/drm/i915/display/intel_display.c +0
-1@@ -16879,7 +16879,6 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, }#define INTEL_CRTC_FUNCS \ - .gamma_set = drm_atomic_helper_legacy_gamma_set, \ .set_config = drm_atomic_helper_set_config, \ .destroy = intel_crtc_destroy, \ .page_flip = drm_atomic_helper_page_flip, \drivers/gpu/drm/ingenic/ingenic-drm-drv.c +0
-2@@ -755,8 +755,6 @@ static const struct drm_crtc_funcs ingenic_drm_crtc_funcs = { .enable_vblank = ingenic_drm_enable_vblank, .disable_vblank = ingenic_drm_disable_vblank, - - .gamma_set = drm_atomic_helper_legacy_gamma_set, };static const struct drm_plane_helper_funcs ingenic_drm_plane_helper_funcs = {drivers/gpu/drm/mediatek/mtk_drm_crtc.c +0
-1@@ -619,7 +619,6 @@ static const struct drm_crtc_funcs mtk_crtc_funcs = { .reset = mtk_drm_crtc_reset, .atomic_duplicate_state = mtk_drm_crtc_duplicate_state, .atomic_destroy_state = mtk_drm_crtc_destroy_state, - .gamma_set = drm_atomic_helper_legacy_gamma_set, .enable_vblank = mtk_drm_crtc_enable_vblank, .disable_vblank = mtk_drm_crtc_disable_vblank, };drivers/gpu/drm/nouveau/dispnv50/head.c +0
-2@@ -503,7 +503,6 @@ nv50_head_destroy(struct drm_crtc *crtc)static const struct drm_crtc_funcs nv50_head_func = { .reset = nv50_head_reset, - .gamma_set = drm_atomic_helper_legacy_gamma_set, .destroy = nv50_head_destroy, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip,@@ -518,7 +517,6 @@ nv50_head_func = {static const struct drm_crtc_funcs nvd9_head_func = { .reset = nv50_head_reset, - .gamma_set = drm_atomic_helper_legacy_gamma_set, .destroy = nv50_head_destroy, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip,drivers/gpu/drm/omapdrm/omap_crtc.c +0
-1@@ -741,7 +741,6 @@ static const struct drm_crtc_funcs omap_crtc_funcs = { .set_config = drm_atomic_helper_set_config, .destroy = omap_crtc_destroy, .page_flip = drm_atomic_helper_page_flip, - .gamma_set = drm_atomic_helper_legacy_gamma_set, .atomic_duplicate_state = omap_crtc_duplicate_state, .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, .atomic_set_property = omap_crtc_atomic_set_property,drivers/gpu/drm/rcar-du/rcar_du_crtc.c +0
-1@@ -1144,7 +1144,6 @@ static const struct drm_crtc_funcs crtc_funcs_gen3 = { .set_crc_source = rcar_du_crtc_set_crc_source, .verify_crc_source = rcar_du_crtc_verify_crc_source, .get_crc_sources = rcar_du_crtc_get_crc_sources, - .gamma_set = drm_atomic_helper_legacy_gamma_set, };/* ----------------------------------------------------------------------------- drivers/gpu/drm/rockchip/rockchip_drm_vop.c +0
-1@@ -1643,7 +1643,6 @@ static const struct drm_crtc_funcs vop_crtc_funcs = { .disable_vblank = vop_crtc_disable_vblank, .set_crc_source = vop_crtc_set_crc_source, .verify_crc_source = vop_crtc_verify_crc_source, - .gamma_set = drm_atomic_helper_legacy_gamma_set, };static void vop_fb_unref_worker (struct drm_flip_work *work,void *val)drivers/gpu/drm/stm/ltdc.c +0
-1@@ -713,7 +713,6 @@ static const struct drm_crtc_funcs ltdc_crtc_funcs = { .enable_vblank = ltdc_crtc_enable_vblank, .disable_vblank = ltdc_crtc_disable_vblank, .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp, - .gamma_set = drm_atomic_helper_legacy_gamma_set, };/* drivers/gpu/drm/vc4/vc4_crtc.c +0
-1@@ -884,7 +884,6 @@ static const struct drm_crtc_funcs vc4_crtc_funcs = { .reset = vc4_crtc_reset, .atomic_duplicate_state = vc4_crtc_duplicate_state, .atomic_destroy_state = vc4_crtc_destroy_state, - .gamma_set = drm_atomic_helper_legacy_gamma_set, .enable_vblank = vc4_enable_vblank, .disable_vblank = vc4_disable_vblank, .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp,drivers/gpu/drm/vc4/vc4_txp.c +0
-1@@ -382,7 +382,6 @@ static const struct drm_crtc_funcs vc4_txp_crtc_funcs = { .reset = vc4_crtc_reset, .atomic_duplicate_state = vc4_crtc_duplicate_state, .atomic_destroy_state = vc4_crtc_destroy_state, - .gamma_set = drm_atomic_helper_legacy_gamma_set, .enable_vblank = vc4_txp_enable_vblank, .disable_vblank = vc4_txp_disable_vblank, };include/drm/drm_atomic_helper.h +0
-4@@ -147,10 +147,6 @@ int drm_atomic_helper_page_flip_target(uint32_t flags, uint32_t target, struct drm_modeset_acquire_ctx *ctx); -int drm_atomic_helper_legacy_gamma_set (struct drm_crtc *crtc, -u16 *red,u16 *green,u16 *blue, -uint32_t size, -struct drm_modeset_acquire_ctx *ctx);/** * drm_atomic_crtc_for_each_plane - iterate over planes currently attached to CRTC
Signature · 7 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
kernel test robot
build botRe: [PATCH v2 2/2] drm: automatic legacy gamma support
In reply to Tomi ValkeinenI love your patch! Perhaps something to improve:
Hi Tomi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on linus/master v5.10-rc7]
[cannot apply to drm-tip/drm-tip anholt/for-next next-20201208] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Tomi-Valkeinen/drm-fix-and-cleanup-legacy-gamma-support/20201208-215917 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: x86_64-randconfig-s021-20201208 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.3-179-ga00755aa-dirty # https://github.com/0day-ci/linux/commit/82a704a10c400f58d4b9b44e6def07cc7d6bab20 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Tomi-Valkeinen/drm-fix-and-cleanup-legacy-gamma-support/20201208-215917 git checkout 82a704a10c400f58d4b9b44e6def07cc7d6bab20 # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
In file included from drivers/gpu/drm/drm_ioc32.c:38:
>> drivers/gpu/drm/drm_crtc_internal.h:121:17: warning: 'struct drm_modeset_acquire_ctx' declared inside parameter list will not be visible outside of this definition or declaration
121 | struct drm_modeset_acquire_ctx *ctx);
| ^~~~~~~~~~~~~~~~~~~~~~~vim +121 drivers/gpu/drm/drm_crtc_internal.h
116
117 bool drm_crtc_supports_legacy_gamma(struct drm_crtc *crtc);
118 int drm_crtc_legacy_gamma_set(struct drm_crtc *crtc,
119 u16 *red, u16 *green, u16 *blue, 120 uint32_t size, > 121 struct drm_modeset_acquire_ctx *ctx);
122
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH v2 2/2] drm: automatic legacy gamma support
In reply to Tomi ValkeinenI love your patch! Perhaps something to improve:
Hi Tomi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on linus/master v5.10-rc7]
[cannot apply to drm-tip/drm-tip anholt/for-next next-20201210] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Tomi-Valkeinen/drm-fix-and-cleanup-legacy-gamma-support/20201208-215917 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: i386-randconfig-m021-20201209 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
New smatch warnings:drivers/gpu/drm/drm_color_mgmt.c:307 drm_crtc_legacy_gamma_set() error: potential null dereference 'blob'. (drm_property_create_blob returns null)
Old smatch warnings:drivers/gpu/drm/drm_color_mgmt.c:214 drm_mode_crtc_set_gamma_size() warn: double check that we're allocating correct size: 2 vs 6
vim +/blob +307 drivers/gpu/drm/drm_color_mgmt.c
253
254 /**
255 * drm_crtc_legacy_gamma_set - set the legacy gamma correction table
256 * @crtc: CRTC object
257 * @red: red correction table
258 * @green: green correction table
259 * @blue: green correction table
260 * @size: size of the tables
261 * @ctx: lock acquire context
262 *
263 * Implements support for legacy gamma correction table for drivers
264 * that have set drm_crtc_funcs.gamma_set or that support color management
265 * through the DEGAMMA_LUT/GAMMA_LUT properties. See
266 * drm_crtc_enable_color_mgmt() and the containing chapter for
267 * how the atomic color management and gamma tables work.
268 *
269 * This function sets the gamma using the first one available:
270 * - drm_crtc_funcs.gamma_set()
271 * - GAMMA_LUT
272 * - DEGAMMA_LUT
273 */
274 int drm_crtc_legacy_gamma_set(struct drm_crtc *crtc,
275 u16 *red, u16 *green, u16 *blue,
276 uint32_t size,
277 struct drm_modeset_acquire_ctx *ctx)
278 {
279 struct drm_device *dev = crtc->dev;
280 struct drm_atomic_state *state;
281 struct drm_crtc_state *crtc_state;
282 struct drm_property_blob *blob = NULL;
283 struct drm_color_lut *blob_data;
284 int i, ret = 0;
285 bool replaced;
286
287 if (crtc->funcs->gamma_set)
288 return crtc->funcs->gamma_set(crtc, red, green, blue, size, ctx);
289
290 if (!crtc->has_gamma_prop && !crtc->has_degamma_prop)
291 return -ENODEV;
292
293 state = drm_atomic_state_alloc(crtc->dev);
294 if (!state)
295 return -ENOMEM;
296
297 blob = drm_property_create_blob(dev,
298 sizeof(struct drm_color_lut) * size,
299 NULL);
300 if (IS_ERR(blob)) {
301 ret = PTR_ERR(blob);
302 blob = NULL;
303 goto fail;
304 }
305
306 /* Prepare GAMMA_LUT with the legacy values. */
> 307 blob_data = blob->data; 308 for (i = 0; i < size; i++) {
309 blob_data[i].red = red[i];
310 blob_data[i].green = green[i];
311 blob_data[i].blue = blue[i];
312 }
313
314 state->acquire_ctx = ctx;
315 crtc_state = drm_atomic_get_crtc_state(state, crtc);
316 if (IS_ERR(crtc_state)) {
317 ret = PTR_ERR(crtc_state);
318 goto fail;
319 }
320
321 /* Set GAMMA/DEGAMMA_LUT and reset DEGAMMA/GAMMA_LUT and CTM */
322 replaced = drm_property_replace_blob(&crtc_state->degamma_lut,
323 crtc->has_gamma_prop ? NULL : blob);
324 replaced |= drm_property_replace_blob(&crtc_state->ctm, NULL);
325 replaced |= drm_property_replace_blob(&crtc_state->gamma_lut,
326 crtc->has_gamma_prop ? blob : NULL);
327 crtc_state->color_mgmt_changed |= replaced;
328
329 ret = drm_atomic_commit(state);
330
331 fail:
332 drm_atomic_state_put(state);
333 drm_property_blob_put(blob);
334 return ret;
335 }
336 EXPORT_SYMBOL(drm_crtc_legacy_gamma_set);
337
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Re: [PATCH v2 2/2] drm: automatic legacy gamma support
Quoted 16 lines · kernel test robot
Hi Tomi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on linus/master v5.10-rc7]
[cannot apply to drm-tip/drm-tip anholt/for-next next-20201210] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]url: https://github.com/0day-ci/linux/commits/Tomi-Valkeinen/drm-fix-and-cleanup-legacy-gamma-support/20201208-215917 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: i386-randconfig-m021-20201209 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
Quoted 5 lines
If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>New smatch warnings:
drivers/gpu/drm/drm_color_mgmt.c:307drm_crtc_legacy_gamma_set()error: potential null dereference 'blob'. (drm_property_create_blobreturns null)
I don't see how this could happen. There's no code path I see where drm_property_create_blob could return null...
Tomi
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Re: [PATCH v2 2/2] drm: automatic legacy gamma support
Quoted 17 lines · Tomi Valkeinen
Quoted 16 lines · kernel test robot
Hi Tomi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on linus/master v5.10-rc7]
[cannot apply to drm-tip/drm-tip anholt/for-next next-20201210] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]url: https://github.com/0day-ci/linux/commits/Tomi-Valkeinen/drm-fix-and-cleanup-legacy-gamma-support/20201208-215917 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: i386-randconfig-m021-20201209 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
Quoted 8 lines
Quoted 5 lines
If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>New smatch warnings:
drivers/gpu/drm/drm_color_mgmt.c:307drm_crtc_legacy_gamma_set()error: potential null dereference 'blob'. (drm_property_create_blobreturns null)I don't see how this could happen. There's no code path I see where
drm_property_create_blobcould return null...
IIRC we've received multiple similar nonsense reports from lkp, but no explanation why it thinks it could ever be null. Hmm, maybe there is a codepath somewhere that has a null check on the return value?
Signature · 2 lines
Ville Syrjälä Intel
Re: [kbuild-all] Re: [PATCH v2 2/2] drm: automatic legacy gamma support
Quoted 24 lines · Ville Syrjälä
Quoted 23 lines · Tomi Valkeinen
Quoted 21 lines · kernel test robot
Hi Tomi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on linus/master v5.10-rc7]
[cannot apply to drm-tip/drm-tip anholt/for-next next-20201210] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]url: https://github.com/0day-ci/linux/commits/Tomi-Valkeinen/drm-fix-and-cleanup-legacy-gamma-support/20201208-215917 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: i386-randconfig-m021-20201209 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>New smatch warnings:
drivers/gpu/drm/drm_color_mgmt.c:307drm_crtc_legacy_gamma_set()error: potential null dereference 'blob'. (drm_property_create_blobreturns null)
Quoted 6 lines
Quoted 2 lines
I don't see how this could happen. There's no code path I see where
drm_property_create_blobcould return null...IIRC we've received multiple similar nonsense reports from lkp, but no explanation why it thinks it could ever be null. Hmm, maybe there is a codepath somewhere that has a null check on the return value?
hi Dan, can you help on this to share some idea?
The original report is at
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org/thread/F3MVBRGF2R4URBNLNY3GMTSDZUCBX6RF/
Thanks
Quoted 7 lines
Signature · 6 lines
-- Ville Syrjälä Intel _______________________________________________ kbuild-all mailing list -- kbuild-all(a)lists.01.org To unsubscribe send an email to kbuild-all-leave(a)lists.01.org
Re: [kbuild-all] Re: [PATCH v2 2/2] drm: automatic legacy gamma support
Quoted 28 lines · Philip Li
Quoted 27 lines · Ville Syrjälä
Quoted 25 lines · Tomi Valkeinen
Quoted 16 lines · kernel test robot
Hi Tomi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on linus/master v5.10-rc7]
[cannot apply to drm-tip/drm-tip anholt/for-next next-20201210] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch ]url: https://github.com/0day-ci/linux/commits/Tomi-Valkeinen/drm-fix-and-cleanup-legacy-gamma-support/20201208-215917 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: i386-randconfig-m021-20201209 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0Quoted 5 lines
If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>New smatch warnings:
drivers/gpu/drm/drm_color_mgmt.c:307drm_crtc_legacy_gamma_set()error: potential null dereference 'blob'. (drm_property_create_blobreturns null)I don't see how this could happen. There's no code path I see where
drm_property_create_blobcould return null...
Quoted 7 lines
Quoted 3 lines
IIRC we've received multiple similar nonsense reports from lkp, but no explanation why it thinks it could ever be null. Hmm, maybe there is a codepath somewhere that has a null check on the return value?
hi Dan, can you help on this to share some idea?
The original report is at
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org/thread/F3MVBRGF2R4URBNLNY3GMTSDZUCBX6RF/
Thanks, Philip. I've pushed a fix for this.
It didn't show up if you had the cross function DB built, so it's not something I would see in my testing.
regards,
dan carpenter
Re: [kbuild-all] Re: [PATCH v2 2/2] drm: automatic legacy gamma support
Quoted 32 lines · Dan Carpenter
Quoted 31 lines · Philip Li
Quoted 30 lines · Ville Syrjälä
Quoted 17 lines · Tomi Valkeinen
Quoted 16 lines · kernel test robot
Hi Tomi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on linus/master v5.10-rc7]
[cannot apply to drm-tip/drm-tip anholt/for-next next-20201210] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch ]url: https://github.com/0day-ci/linux/commits/Tomi-Valkeinen/drm-fix-and-cleanup-legacy-gamma-support/20201208-215917 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: i386-randconfig-m021-20201209 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0Quoted 8 lines
Quoted 5 lines
If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>New smatch warnings:
drivers/gpu/drm/drm_color_mgmt.c:307drm_crtc_legacy_gamma_set()error: potential null dereference 'blob'. (drm_property_create_blobreturns null)I don't see how this could happen. There's no code path I see where
drm_property_create_blobcould return null...IIRC we've received multiple similar nonsense reports from lkp, but no explanation why it thinks it could ever be null. Hmm, maybe there is a codepath somewhere that has a null check on the return value?
Quoted 6 lines
Quoted 4 lines
hi Dan, can you help on this to share some idea?
The original report is at
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org/thread/F3MVBRGF2R4URBNLNY3GMTSDZUCBX6RF/Thanks, Philip. I've pushed a fix for this.
Thanks Dan for this, we will pack the new code to run in the robot.
Quoted 3 lines
It didn't show up if you had the cross function DB built, so it's not something I would see in my testing.
Got it, do you recommend this "cross function DB" is necessary for us to setup or not a must?
Thanks
Quoted 4 lines
regards,
dan carpenter
Re: [kbuild-all] Re: [PATCH v2 2/2] drm: automatic legacy gamma support
Quoted 38 lines · Philip Li
Quoted 37 lines · Dan Carpenter
Quoted 35 lines · Philip Li
Quoted 24 lines · Ville Syrjälä
Quoted 23 lines · Tomi Valkeinen
Quoted 21 lines · kernel test robot
Hi Tomi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on linus/master v5.10-rc7]
[cannot apply to drm-tip/drm-tip anholt/for-next next-20201210] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch ]url: https://github.com/0day-ci/linux/commits/Tomi-Valkeinen/drm-fix-and-cleanup-legacy-gamma-support/20201208-215917 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: i386-randconfig-m021-20201209 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>New smatch warnings:
drivers/gpu/drm/drm_color_mgmt.c:307drm_crtc_legacy_gamma_set()error: potential null dereference 'blob'. (drm_property_create_blobreturns null)Quoted 6 lines
Quoted 2 lines
I don't see how this could happen. There's no code path I see where
drm_property_create_blobcould return null...IIRC we've received multiple similar nonsense reports from lkp, but no explanation why it thinks it could ever be null. Hmm, maybe there is a codepath somewhere that has a null check on the return value?
hi Dan, can you help on this to share some idea?
The original report is at
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org/thread/F3MVBRGF2R4URBNLNY3GMTSDZUCBX6RF/
Quoted 8 lines
Quoted 1 line
Thanks, Philip. I've pushed a fix for this.
Thanks Dan for this, we will pack the new code to run in the robot.
Quoted 3 lines
It didn't show up if you had the cross function DB built, so it's not something I would see in my testing.
Got it, do you recommend this "cross function DB" is necessary for us to setup or not a must?
It's not a must. Smatch is supposed to work fine without it.
regards,
dan carpenter