]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/drm_crtc: Introduce sharpness strength property
authorNemesa Garg <nemesa.garg@intel.com>
Tue, 28 Oct 2025 12:07:37 +0000 (17:37 +0530)
committerJani Nikula <jani.nikula@intel.com>
Thu, 30 Oct 2025 13:38:04 +0000 (15:38 +0200)
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>
drivers/gpu/drm/drm_atomic_uapi.c
drivers/gpu/drm/drm_crtc.c
include/drm/drm_crtc.h

index 85dbdaa4a2e25878c953b9b41539c8566d55c6d9..b2cb5ae5a1392bdf1c0bdf79962418956c522b57 100644 (file)
@@ -419,6 +419,8 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
                set_out_fence_for_crtc(state->state, crtc, fence_ptr);
        } else if (property == crtc->scaling_filter_property) {
                state->scaling_filter = val;
+       } else if (property == crtc->sharpness_strength_property) {
+               state->sharpness_strength = val;
        } else if (crtc->funcs->atomic_set_property) {
                return crtc->funcs->atomic_set_property(crtc, state, property, val);
        } else {
@@ -456,6 +458,8 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc,
                *val = 0;
        else if (property == crtc->scaling_filter_property)
                *val = state->scaling_filter;
+       else if (property == crtc->sharpness_strength_property)
+               *val = state->sharpness_strength;
        else if (crtc->funcs->atomic_get_property)
                return crtc->funcs->atomic_get_property(crtc, state, property, val);
        else {
index 46655339003db2a1b43441434839e26f61d79b4e..a7797d260f1e2fe5fae2127b340b39318e30a3e2 100644 (file)
@@ -229,6 +229,25 @@ struct dma_fence *drm_crtc_create_fence(struct drm_crtc *crtc)
  *             Driver's default scaling filter
  *     Nearest Neighbor:
  *             Nearest Neighbor scaling filter
+ * SHARPNESS_STRENGTH:
+ *     Atomic property for setting the sharpness strength/intensity by userspace.
+ *
+ *     The value of this property is set as an integer value ranging
+ *     from 0 - 255 where:
+ *
+ *     0: Sharpness feature is disabled(default value).
+ *
+ *     1: Minimum sharpness.
+ *
+ *     255: Maximum sharpness.
+ *
+ *     User can gradually increase or decrease the sharpness level and can
+ *     set the optimum value depending on content.
+ *     This value will be passed to kernel through the UAPI.
+ *     The setting of this property does not require modeset.
+ *     The sharpness effect takes place post blending on the final composed output.
+ *     If the feature is disabled, the content remains same without any sharpening effect
+ *     and when this feature is applied, it enhances the clarity of the content.
  */
 
 __printf(6, 0)
@@ -940,6 +959,22 @@ int drm_crtc_create_scaling_filter_property(struct drm_crtc *crtc,
 }
 EXPORT_SYMBOL(drm_crtc_create_scaling_filter_property);
 
+int drm_crtc_create_sharpness_strength_property(struct drm_crtc *crtc)
+{
+       struct drm_device *dev = crtc->dev;
+       struct drm_property *prop =
+               drm_property_create_range(dev, 0, "SHARPNESS_STRENGTH", 0, 255);
+
+       if (!prop)
+               return -ENOMEM;
+
+       crtc->sharpness_strength_property = prop;
+       drm_object_attach_property(&crtc->base, prop, 0);
+
+       return 0;
+}
+EXPORT_SYMBOL(drm_crtc_create_sharpness_strength_property);
+
 /**
  * drm_crtc_in_clone_mode - check if the given CRTC state is in clone mode
  *
index caa56e039da2a748cf40ebf45b37158acda439d9..bcdbde681986ad36a19a729b4c9c36f75634b6b9 100644 (file)
@@ -317,6 +317,17 @@ struct drm_crtc_state {
         */
        enum drm_scaling_filter scaling_filter;
 
+       /**
+        * @sharpness_strength:
+        *
+        * Used by the user to set the sharpness intensity.
+        * The value ranges from 0-255.
+        * Default value is 0 which disable the sharpness feature.
+        * Any value greater than 0 enables sharpening with the
+        * specified strength.
+        */
+       u8 sharpness_strength;
+
        /**
         * @event:
         *
@@ -1088,6 +1099,12 @@ struct drm_crtc {
         */
        struct drm_property *scaling_filter_property;
 
+       /**
+        * @sharpness_strength_property: property to apply
+        * the intensity of the sharpness requested.
+        */
+       struct drm_property *sharpness_strength_property;
+
        /**
         * @state:
         *
@@ -1324,4 +1341,5 @@ static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
 int drm_crtc_create_scaling_filter_property(struct drm_crtc *crtc,
                                            unsigned int supported_filters);
 bool drm_crtc_in_clone_mode(struct drm_crtc_state *crtc_state);
+int drm_crtc_create_sharpness_strength_property(struct drm_crtc *crtc);
 #endif /* __DRM_CRTC_H__ */