Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/drm_crtc: Introduce sharpness strength property

Introduce a new crtc property "SHARPNESS_STRENGTH" that allows
the user to set the intensity so as to get the sharpness effect.
The value of this property can be set from 0-255.
It is useful in scenario when the output is blurry and user
want to sharpen the pixels. User can increase/decrease the
sharpness level depending on the content displayed.

v2: Rename crtc property variable [Arun]
Add modeset detail in uapi doc[Uma]
v3: Fix build issue
v4: Modify the subject line[Ankit]

Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Tested-by: Adarsh G M <Adarsh.g.m@intel.com>
Acked-by: Simona Vetter <simona.vetter@ffwll.ch>
Link: https://invent.kde.org/plasma/kwin/-/merge_requests/7689
Link: https://patch.msgid.link/20251028120747.3027332-2-ankit.k.nautiyal@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

authored by

Nemesa Garg and committed by
Jani Nikula
d1ac2573 e69b7a6b

+57
+4
drivers/gpu/drm/drm_atomic_uapi.c
··· 419 419 set_out_fence_for_crtc(state->state, crtc, fence_ptr); 420 420 } else if (property == crtc->scaling_filter_property) { 421 421 state->scaling_filter = val; 422 + } else if (property == crtc->sharpness_strength_property) { 423 + state->sharpness_strength = val; 422 424 } else if (crtc->funcs->atomic_set_property) { 423 425 return crtc->funcs->atomic_set_property(crtc, state, property, val); 424 426 } else { ··· 458 456 *val = 0; 459 457 else if (property == crtc->scaling_filter_property) 460 458 *val = state->scaling_filter; 459 + else if (property == crtc->sharpness_strength_property) 460 + *val = state->sharpness_strength; 461 461 else if (crtc->funcs->atomic_get_property) 462 462 return crtc->funcs->atomic_get_property(crtc, state, property, val); 463 463 else {
+35
drivers/gpu/drm/drm_crtc.c
··· 229 229 * Driver's default scaling filter 230 230 * Nearest Neighbor: 231 231 * Nearest Neighbor scaling filter 232 + * SHARPNESS_STRENGTH: 233 + * Atomic property for setting the sharpness strength/intensity by userspace. 234 + * 235 + * The value of this property is set as an integer value ranging 236 + * from 0 - 255 where: 237 + * 238 + * 0: Sharpness feature is disabled(default value). 239 + * 240 + * 1: Minimum sharpness. 241 + * 242 + * 255: Maximum sharpness. 243 + * 244 + * User can gradually increase or decrease the sharpness level and can 245 + * set the optimum value depending on content. 246 + * This value will be passed to kernel through the UAPI. 247 + * The setting of this property does not require modeset. 248 + * The sharpness effect takes place post blending on the final composed output. 249 + * If the feature is disabled, the content remains same without any sharpening effect 250 + * and when this feature is applied, it enhances the clarity of the content. 232 251 */ 233 252 234 253 __printf(6, 0) ··· 958 939 return 0; 959 940 } 960 941 EXPORT_SYMBOL(drm_crtc_create_scaling_filter_property); 942 + 943 + int drm_crtc_create_sharpness_strength_property(struct drm_crtc *crtc) 944 + { 945 + struct drm_device *dev = crtc->dev; 946 + struct drm_property *prop = 947 + drm_property_create_range(dev, 0, "SHARPNESS_STRENGTH", 0, 255); 948 + 949 + if (!prop) 950 + return -ENOMEM; 951 + 952 + crtc->sharpness_strength_property = prop; 953 + drm_object_attach_property(&crtc->base, prop, 0); 954 + 955 + return 0; 956 + } 957 + EXPORT_SYMBOL(drm_crtc_create_sharpness_strength_property); 961 958 962 959 /** 963 960 * drm_crtc_in_clone_mode - check if the given CRTC state is in clone mode
+18
include/drm/drm_crtc.h
··· 318 318 enum drm_scaling_filter scaling_filter; 319 319 320 320 /** 321 + * @sharpness_strength: 322 + * 323 + * Used by the user to set the sharpness intensity. 324 + * The value ranges from 0-255. 325 + * Default value is 0 which disable the sharpness feature. 326 + * Any value greater than 0 enables sharpening with the 327 + * specified strength. 328 + */ 329 + u8 sharpness_strength; 330 + 331 + /** 321 332 * @event: 322 333 * 323 334 * Optional pointer to a DRM event to signal upon completion of the ··· 1100 1089 struct drm_property *scaling_filter_property; 1101 1090 1102 1091 /** 1092 + * @sharpness_strength_property: property to apply 1093 + * the intensity of the sharpness requested. 1094 + */ 1095 + struct drm_property *sharpness_strength_property; 1096 + 1097 + /** 1103 1098 * @state: 1104 1099 * 1105 1100 * Current atomic state for this CRTC. ··· 1341 1324 int drm_crtc_create_scaling_filter_property(struct drm_crtc *crtc, 1342 1325 unsigned int supported_filters); 1343 1326 bool drm_crtc_in_clone_mode(struct drm_crtc_state *crtc_state); 1327 + int drm_crtc_create_sharpness_strength_property(struct drm_crtc *crtc); 1344 1328 #endif /* __DRM_CRTC_H__ */