Skip to contentSkip to conversation

Introduce drm sharpening property

RFC In review Nemesa Garg 6 participants 23 messages Feb 14, 2024 – Jun 19, 2024

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover Introduce drm sharpening property

Many a times images are blurred or upscaled content is also not as
crisp as original rendered image. Traditional sharpening techniques often apply a uniform level of enhancement across entire image, which sometimes result in over-sharpening of some areas and potential loss of natural details.

Intel has come up with Display Engine based adaptive sharpening filter with minimal power and performance impact. From LNL onwards, the Display hardware can use one of the pipe scaler for adaptive sharpness filter. This can be used for both gaming and non-gaming use cases like photos, image viewing. It works on a region of pixels depending on the tap size.

This RFC is an attempt to introduce an adaptive sharpness solution which helps in improving the image quality. For this new CRTC property is added. The user can set this property with desired sharpness strength value with 0-255. A value of 1 representing minimum sharpening strength and 255 representing maximum sharpness strength. A strength value of 0 means no sharpening or sharpening feature disabled.
It works on a region of pixels depending on the tap size. The coefficients are used to generate an alpha value which is used to blend the sharpened image to original image.

Userspace implementation for sharpening feature and IGT implementation is in progress.

Nemesa Garg (5):
drm: Introduce sharpeness mode property drm/i915/display/: Compute the scaler filter coefficients drm/i915/dispaly/: Enable the second scaler drm/i915/display/: Add registers and compute the strength drm/i915/display: Load the lut values and enable sharpness

 drivers/gpu/drm/drm_atomic_uapi.c             |   4 +
 drivers/gpu/drm/drm_crtc.c                    |  17 ++
 drivers/gpu/drm/i915/Makefile                 |   1 +
 drivers/gpu/drm/i915/display/intel_crtc.c     |   3 +
 drivers/gpu/drm/i915/display/intel_display.c  |  20 +-
 .../drm/i915/display/intel_display_types.h    |  11 +
 .../drm/i915/display/intel_modeset_verify.c   |   1 +
 .../drm/i915/display/intel_sharpen_filter.c   | 214 ++++++++++++++++++
 .../drm/i915/display/intel_sharpen_filter.h   |  31 +++
 drivers/gpu/drm/i915/display/skl_scaler.c     |  86 ++++++-
 drivers/gpu/drm/i915/display/skl_scaler.h     |   1 +
 drivers/gpu/drm/i915/i915_reg.h               |  19 ++
 drivers/gpu/drm/xe/Makefile                   |   1 +
 include/drm/drm_crtc.h                        |  17 ++
 14 files changed, 416 insertions(+), 10 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/intel_sharpen_filter.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_sharpen_filter.h
Signature · 1 line
2.25.1
#1 lore raw

RFC 1/5 drm: Introduce sharpeness mode property

This allows the user to set the intensity
so as to get the sharpness effect.

It is useful in scenario when the output is blurry and user want to sharpen the pixels.

---
 drivers/gpu/drm/drm_atomic_uapi.c |  4 ++++
 drivers/gpu/drm/drm_crtc.c        | 17 +++++++++++++++++
 include/drm/drm_crtc.h            | 17 +++++++++++++++++
 3 files changed, 38 insertions(+)
drivers/gpu/drm/drm_atomic_uapi.c +4 -0
index 29d4940188d4..773873726b87 100644
@@ -417,6 +417,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->sharpening_strength_prop) {
+		state->sharpeness_strength = val;
 	} else if (crtc->funcs->atomic_set_property) {
 		return crtc->funcs->atomic_set_property(crtc, state, property, val);
 	} else {
@@ -454,6 +456,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->sharpening_strength_prop)
+		*val = state->sharpeness_strength;
 	else if (crtc->funcs->atomic_get_property)
 		return crtc->funcs->atomic_get_property(crtc, state, property, val);
 	else {
drivers/gpu/drm/drm_crtc.c +17 -0
index cb90e70d85e8..d01ab76a719f 100644
@@ -955,3 +955,20 @@ int drm_crtc_create_scaling_filter_property(struct drm_crtc *crtc,
 	return 0;
 }
 EXPORT_SYMBOL(drm_crtc_create_scaling_filter_property);
+
+int drm_crtc_create_sharpening_strength_property(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+
+	struct drm_property *prop =
+		drm_property_create_range(dev, 0, "SHARPENESS_STRENGTH", 0, 255);
+
+	if (!prop)
+		return -ENOMEM;
+
+	crtc->sharpening_strength_prop = prop;
+	drm_object_attach_property(&crtc->base, prop, 0);
+
+	return 0;
+}
+EXPORT_SYMBOL(drm_crtc_create_sharpening_strength_property);
include/drm/drm_crtc.h +17 -0
index 8b48a1974da3..241514fc3eea 100644
@@ -317,6 +317,16 @@ 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.
+	 * Any value greater than 0 means enabling the featuring
+	 * along with setting the value for sharpness.
+	 */
+	u8 sharpeness_strength;
+
 	/**
 	 * @event:
 	 *
@@ -1088,6 +1098,12 @@ struct drm_crtc {
 	 */
 	struct drm_property *scaling_filter_property;
 
+	/**
+	 * @sharpening_strength_prop: property to apply
+	 * the intensity of the sharpness requested.
+	 */
+	struct drm_property *sharpening_strength_prop;
+
 	/**
 	 * @state:
 	 *
@@ -1324,4 +1340,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);
 
+int drm_crtc_create_sharpening_strength_property(struct drm_crtc *crtc);
 #endif /* __DRM_CRTC_H__ */
Signature · 1 line
2.25.1
#2 lore raw

RFC 2/5 drm/i915/display/: Compute the scaler filter coefficients

In reply to Nemesa Garg

Scaler coefficient values are based on experiments and vary for different tap value/win size. These values are normalized by taking the sum of all values and then dividing each value with a sum.

---
 drivers/gpu/drm/i915/Makefile                 |   1 +
 drivers/gpu/drm/i915/display/intel_display.c  |   3 +
 .../drm/i915/display/intel_display_types.h    |   9 ++
 .../drm/i915/display/intel_sharpen_filter.c   | 121 ++++++++++++++++++
 .../drm/i915/display/intel_sharpen_filter.h   |  27 ++++
 drivers/gpu/drm/i915/i915_reg.h               |   2 +
 drivers/gpu/drm/xe/Makefile                   |   1 +
 7 files changed, 164 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/display/intel_sharpen_filter.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_sharpen_filter.h
drivers/gpu/drm/i915/Makefile +1 -0
index c13f14edb508..97d1cf705b40 100644
@@ -305,6 +305,7 @@ i915-y += \
 	display/intel_pmdemand.o \
 	display/intel_psr.o \
 	display/intel_quirks.o \
+	display/intel_sharpen_filter.o \
 	display/intel_sprite.o \
 	display/intel_sprite_uapi.o \
 	display/intel_tc.o \
drivers/gpu/drm/i915/display/intel_display.c +3 -0
index 7db0655d8c9e..5a93bbd1fe25 100644
@@ -2444,6 +2444,9 @@ static int intel_crtc_compute_config(struct intel_atomic_state *state,
 	if (crtc_state->has_pch_encoder)
 		return ilk_fdi_compute_config(crtc, crtc_state);
 
+	if (crtc_state->hw.casf_params.strength_changed)
+		intel_sharpness_scaler_compute_config(crtc_state);
+
 	return 0;
 }
 
drivers/gpu/drm/i915/display/intel_display_types.h +9 -0
index 01eb6e4e6049..a7a24d177586 100644
@@ -53,6 +53,7 @@
 #include "intel_display_limits.h"
 #include "intel_display_power.h"
 #include "intel_dpll_mgr.h"
+#include "intel_sharpen_filter.h"
 #include "intel_wm_types.h"
 
 struct drm_printer;
@@ -794,6 +795,13 @@ struct intel_scaler {
 	u32 mode;
 };
 
+struct intel_sharpen_filter {
+	struct scaler_filter_coeff coeff[7];
+	u32 scaler_coefficient[119];
+	bool strength_changed;
+	u8 win_size;
+};
+
 struct intel_crtc_scaler_state {
 #define SKL_NUM_SCALERS 2
 	struct intel_scaler scalers[SKL_NUM_SCALERS];
@@ -1075,6 +1083,7 @@ struct intel_crtc_state {
 		struct drm_property_blob *degamma_lut, *gamma_lut, *ctm;
 		struct drm_display_mode mode, pipe_mode, adjusted_mode;
 		enum drm_scaling_filter scaling_filter;
+		struct intel_sharpen_filter casf_params;
 	} hw;
 
 	/* actual state of LUTs */
drivers/gpu/drm/i915/display/intel_sharpen_filter.c new file +121 -0

121 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_sharpen_filter.h new file +27 -0
new file mode 100644
index 000000000000..6b668aaedf65
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2024 Intel Corporation
+ */
+
+#ifndef __INTEL_SHARPEN_FLITER_H__
+#define __INTEL_SHARPEN_FILTER_H__
+
+#include <linux/types.h>
+
+#define SHARP_COEFF_TO_REG_FORMAT(coefficient) ((u16)(coefficient.sign << 15 | \
+			coefficient.exp << 12 | coefficient.mantissa << 3))
+
+struct intel_crtc;
+struct intel_crtc_state;
+struct intel_atomic_state;
+
+struct scaler_filter_coeff {
+	u16 sign;
+	u16 exp;
+	u16 mantissa;
+};
+
+void intel_sharpen_filter_enable(struct intel_crtc_state *crtc_state);
+void intel_sharpness_scaler_compute_config(struct intel_crtc_state *crtc_state);
+
+#endif /* __INTEL_SHARPEN_FLITER_H__ */
drivers/gpu/drm/i915/i915_reg.h +2 -0
index e00557e1a57f..9d759026add4 100644
@@ -4072,6 +4072,8 @@
 #define   PS_VERT_INT_INVERT_FIELD		REG_BIT(20)
 #define   PS_PROG_SCALE_FACTOR			REG_BIT(19) /* tgl+ */
 #define   PS_PWRUP_PROGRESS			REG_BIT(17)
+#define   PS_BYPASS_ARMING			REG_BIT(10)
+#define   PS_DB_STALL				REG_BIT(9)
 #define   PS_V_FILTER_BYPASS			REG_BIT(8)
 #define   PS_VADAPT_EN				REG_BIT(7) /* skl/bxt */
 #define   PS_VADAPT_MODE_MASK			REG_GENMASK(6, 5) /* skl/bxt */
drivers/gpu/drm/xe/Makefile +1 -0
index c531210695db..4148eb015c11 100644
@@ -269,6 +269,7 @@ xe-$(CONFIG_DRM_XE_DISPLAY) += \
 	i915-display/intel_psr.o \
 	i915-display/intel_qp_tables.o \
 	i915-display/intel_quirks.o \
+	i915-display/intel_sharpen_filter.o \
 	i915-display/intel_snps_phy.o \
 	i915-display/intel_tc.o \
 	i915-display/intel_vblank.o \
Signature · 1 line
2.25.1
#3 lore raw

RFC 3/5 drm/i915/dispaly/: Enable the second scaler

In reply to Nemesa Garg

The strength value should be greater than zero to set to the scaler flag true and if the second scaler is free then it can be used for sharpening purpose.

---
 drivers/gpu/drm/i915/display/intel_display.c  |  7 +-
 .../drm/i915/display/intel_display_types.h    |  1 +
 .../drm/i915/display/intel_modeset_verify.c   |  1 +
 .../drm/i915/display/intel_sharpen_filter.c   |  9 +++
 .../drm/i915/display/intel_sharpen_filter.h   |  2 +-
 drivers/gpu/drm/i915/display/skl_scaler.c     | 75 +++++++++++++++++--
 drivers/gpu/drm/i915/display/skl_scaler.h     |  1 +
 7 files changed, 86 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +5 -2
index 5a93bbd1fe25..3d05bd203ca8 100644
@@ -1940,7 +1940,7 @@ static void get_crtc_power_domains(struct intel_crtc_state *crtc_state,
 	set_bit(POWER_DOMAIN_PIPE(pipe), mask->bits);
 	set_bit(POWER_DOMAIN_TRANSCODER(cpu_transcoder), mask->bits);
 	if (crtc_state->pch_pfit.enabled ||
-	    crtc_state->pch_pfit.force_thru)
+	    crtc_state->pch_pfit.force_thru || crtc_state->hw.casf_params.need_scaler)
 		set_bit(POWER_DOMAIN_PIPE_PANEL_FITTER(pipe), mask->bits);
 
 	drm_for_each_encoder_mask(encoder, &dev_priv->drm,
@@ -2195,7 +2195,7 @@ static u32 ilk_pipe_pixel_rate(const struct intel_crtc_state *crtc_state)
 	 * PF-ID we'll need to adjust the pixel_rate here.
 	 */
 
-	if (!crtc_state->pch_pfit.enabled)
+	if (!crtc_state->pch_pfit.enabled || crtc_state->hw.casf_params.need_scaler)
 		return pixel_rate;
 
 	drm_rect_init(&src, 0, 0,
@@ -5334,6 +5334,9 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
 		PIPE_CONF_CHECK_I(vrr.guardband);
 	}
 
+	if (pipe_config->uapi.sharpeness_strength > 0)
+		PIPE_CONF_CHECK_BOOL(hw.casf_params.need_scaler);
+
 #undef PIPE_CONF_CHECK_X
 #undef PIPE_CONF_CHECK_I
 #undef PIPE_CONF_CHECK_BOOL
drivers/gpu/drm/i915/display/intel_display_types.h +1 -0
index a7a24d177586..d43931127ec2 100644
@@ -800,6 +800,7 @@ struct intel_sharpen_filter {
 	u32 scaler_coefficient[119];
 	bool strength_changed;
 	u8 win_size;
+	bool need_scaler;
 };
 
 struct intel_crtc_scaler_state {
drivers/gpu/drm/i915/display/intel_modeset_verify.c +1 -0
index 076298a8d405..e7e2d26a4c9c 100644
@@ -177,6 +177,7 @@ verify_crtc_state(struct intel_atomic_state *state,
 		    crtc->base.name);
 
 	hw_crtc_state->hw.enable = sw_crtc_state->hw.enable;
+	hw_crtc_state->hw.casf_params.need_scaler = sw_crtc_state->hw.casf_params.need_scaler;
 
 	intel_crtc_get_pipe_config(hw_crtc_state);
 
drivers/gpu/drm/i915/display/intel_sharpen_filter.c +9 -0
index 366739d9dead..221dca3bcba5 100644
@@ -36,6 +36,15 @@ void intel_sharpen_filter_enable(struct intel_crtc_state *crtc_state)
 		intel_de_write_fw(dev_priv, GLK_PS_COEF_DATA_SET(crtc->pipe, id, 1),
 				  crtc_state->hw.casf_params. scaler_coefficient[index]);
 	}
+
+	casf_scaler_enable(crtc_state);
+}
+
+int intel_filter_compute_config(struct intel_crtc_state *crtc_state)
+{
+	crtc_state->hw.casf_params.need_scaler = true;
+
+	return 0;
 }
 
 static void convert_sharpness_coef_binary(struct scaler_filter_coeff *coeff,
drivers/gpu/drm/i915/display/intel_sharpen_filter.h +1 -1
index 6b668aaedf65..89c0d689469c 100644
@@ -23,5 +23,5 @@ struct scaler_filter_coeff {
 
 void intel_sharpen_filter_enable(struct intel_crtc_state *crtc_state);
 void intel_sharpness_scaler_compute_config(struct intel_crtc_state *crtc_state);
-
+int intel_filter_compute_config(struct intel_crtc_state *crtc_state);
 #endif /* __INTEL_SHARPEN_FLITER_H__ */
drivers/gpu/drm/i915/display/skl_scaler.c +68 -7

121 lines not on this page · raw message

drivers/gpu/drm/i915/display/skl_scaler.h +1 -0
index 63f93ca03c89..444527e6a15b 100644
@@ -33,5 +33,6 @@ void skl_detach_scalers(const struct intel_crtc_state *crtc_state);
 void skl_scaler_disable(const struct intel_crtc_state *old_crtc_state);
 
 void skl_scaler_get_config(struct intel_crtc_state *crtc_state);
+void casf_scaler_enable(struct intel_crtc_state *crtc_state);
 
 #endif
Signature · 1 line
2.25.1
#4 lore raw

RFC 4/5 drm/i915/display/: Add registers and compute the strength

In reply to Nemesa Garg

Add new registers and related bits. Compute the strength value and tap value based on display mode.

---
 .../drm/i915/display/intel_display_types.h    |  1 +
 .../drm/i915/display/intel_sharpen_filter.c   | 84 +++++++++++++++++++
 .../drm/i915/display/intel_sharpen_filter.h   |  4 +
 drivers/gpu/drm/i915/i915_reg.h               | 17 ++++
 4 files changed, 106 insertions(+)
drivers/gpu/drm/i915/display/intel_display_types.h +1 -0
index d43931127ec2..ff1facc1c2c6 100644
@@ -801,6 +801,7 @@ struct intel_sharpen_filter {
 	bool strength_changed;
 	u8 win_size;
 	bool need_scaler;
+	u8 strength;
 };
 
 struct intel_crtc_scaler_state {
drivers/gpu/drm/i915/display/intel_sharpen_filter.c +84 -0

102 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_sharpen_filter.h +4 -0
index 89c0d689469c..3100ef696448 100644
@@ -24,4 +24,8 @@ struct scaler_filter_coeff {
 void intel_sharpen_filter_enable(struct intel_crtc_state *crtc_state);
 void intel_sharpness_scaler_compute_config(struct intel_crtc_state *crtc_state);
 int intel_filter_compute_config(struct intel_crtc_state *crtc_state);
+void intel_filter_lut_load(struct intel_crtc *crtc,
+			   const struct intel_crtc_state *crtc_state);
+void intel_sharpen_strength_changed(struct intel_atomic_state *state);
+
 #endif /* __INTEL_SHARPEN_FLITER_H__ */
drivers/gpu/drm/i915/i915_reg.h +17 -0
index 9d759026add4..a49d946c4479 100644
@@ -4211,6 +4211,23 @@
 			_ID(id, _PS_COEF_SET0_DATA_1A, _PS_COEF_SET0_DATA_2A) + (set) * 8, \
 			_ID(id, _PS_COEF_SET0_DATA_1B, _PS_COEF_SET0_DATA_2B) + (set) * 8)
 
+#define _SHARPNESS_CTL_A               0x682B0
+#define SHARPNESS_CTL(trans)           _MMIO_PIPE2(trans, _SHARPNESS_CTL_A)
+#define  FILTER_EN                      REG_BIT(31)
+#define  FILTER_STRENGTH_MASK           REG_GENMASK(15, 8)
+#define  FILTER_STRENGTH(x)             REG_FIELD_PREP(FILTER_STRENGTH_MASK, (x))
+#define  FILTER_SIZE_MASK               REG_GENMASK(1, 0)
+#define  FILTER_SIZE(x)                 REG_FIELD_PREP(FILTER_SIZE_MASK, (x))
+
+#define _SHRPLUT_DATA_A			0x682B8
+#define SHRPLUT_DATA(trans)		_MMIO_PIPE2(trans, _SHRPLUT_DATA_A)
+
+#define _SHRPLUT_INDEX_A		0x682B4
+#define SHRPLUT_INDEX(trans)		_MMIO_PIPE2(trans, _SHRPLUT_INDEX_A)
+#define  INDEX_AUTO_INCR		REG_BIT(10)
+#define  INDEX_VALUE_MASK		REG_GENMASK(4, 0)
+#define  INDEX_VALUE(x)			REG_FIELD_PREP(INDEX_VALUE_MASK, (x))
+
 /* Display Internal Timeout Register */
 #define RM_TIMEOUT		_MMIO(0x42060)
 #define  MMIO_TIMEOUT_US(us)	((us) << 0)
Signature · 1 line
2.25.1
#5 lore raw

RFC 5/5 drm/i915/display: Load the lut values and enable sharpness

In reply to Nemesa Garg

Load the lut values during pipe enable.

---
 drivers/gpu/drm/i915/display/intel_crtc.c    |  3 +++
 drivers/gpu/drm/i915/display/intel_display.c | 12 +++++++++++-
 drivers/gpu/drm/i915/display/skl_scaler.c    | 11 ++++++++++-
 3 files changed, 24 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_crtc.c +3 -0
index 25593f6aae7d..74c498733283 100644
@@ -383,6 +383,9 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
 
 	drm_WARN_ON(&dev_priv->drm, drm_crtc_index(&crtc->base) != crtc->pipe);
 
+	if (DISPLAY_VER(dev_priv) >= 20)
+		drm_crtc_create_sharpening_strength_property(&crtc->base);
+
 	return 0;
 
 fail:
drivers/gpu/drm/i915/display/intel_display.c +11 -1
index 3d05bd203ca8..e8bd615e6977 100644
@@ -1722,6 +1722,9 @@ static void hsw_crtc_enable(struct intel_atomic_state *state,
 		intel_crtc_wait_for_next_vblank(wa_crtc);
 		intel_crtc_wait_for_next_vblank(wa_crtc);
 	}
+
+	if (new_crtc_state->hw.casf_params.strength_changed)
+		intel_filter_lut_load(crtc, new_crtc_state);
 }
 
 void ilk_pfit_disable(const struct intel_crtc_state *old_crtc_state)
@@ -2444,8 +2447,12 @@ static int intel_crtc_compute_config(struct intel_atomic_state *state,
 	if (crtc_state->has_pch_encoder)
 		return ilk_fdi_compute_config(crtc, crtc_state);
 
-	if (crtc_state->hw.casf_params.strength_changed)
+	intel_sharpen_strength_changed(state);
+
+	if (crtc_state->hw.casf_params.strength_changed) {
 		intel_sharpness_scaler_compute_config(crtc_state);
+		intel_filter_compute_config(crtc_state);
+	}
 
 	return 0;
 }
@@ -6744,6 +6751,9 @@ static void intel_update_crtc(struct intel_atomic_state *state,
 	if (intel_crtc_needs_fastset(new_crtc_state) &&
 	    old_crtc_state->inherited)
 		intel_crtc_arm_fifo_underrun(crtc, new_crtc_state);
+
+	if (new_crtc_state->hw.casf_params.strength_changed)
+		intel_sharpen_filter_enable(new_crtc_state);
 }
 
 static void intel_old_crtc_state_disables(struct intel_atomic_state *state,
drivers/gpu/drm/i915/display/skl_scaler.c +10 -1
index be61a6ebd7e3..cb828b3880b2 100644
@@ -925,7 +925,7 @@ void skl_scaler_get_config(struct intel_crtc_state *crtc_state)
 
 	/* find scaler attached to this pipe */
 	for (i = 0; i < crtc->num_scalers; i++) {
-		u32 ctl, pos, size;
+		u32 ctl, pos, size, sharp;
 
 		ctl = intel_de_read(dev_priv, SKL_PS_CTRL(crtc->pipe, i));
 		if ((ctl & (PS_SCALER_EN | PS_BINDING_MASK)) != (PS_SCALER_EN | PS_BINDING_PIPE))
@@ -933,6 +933,15 @@ void skl_scaler_get_config(struct intel_crtc_state *crtc_state)
 
 		id = i;
 
+		sharp = intel_de_read(dev_priv, SHARPNESS_CTL(crtc->pipe));
+		if (sharp & FILTER_EN) {
+			crtc_state->hw.casf_params.strength =
+				REG_FIELD_GET(FILTER_STRENGTH_MASK, sharp) - 16;
+			crtc_state->hw.casf_params.need_scaler = true;
+			crtc_state->hw.casf_params.win_size =
+				REG_FIELD_GET(FILTER_SIZE_MASK, sharp);
+		}
+
 		if (!crtc_state->hw.casf_params.need_scaler)
 			crtc_state->pch_pfit.enabled = true;
 
Signature · 1 line
2.25.1
#6 lore raw

✗ Fi.CI.CHECKPATCH: warning for Introduce drm sharpening property

In reply to Nemesa Garg
== Series Details ==

== Series Details ==

Series: Introduce drm sharpening property
URL : https://patchwork.freedesktop.org/series/129888/
State : warning

== Summary ==

Error: dim checkpatch failed
f800fb698aab drm: Introduce sharpeness mode property
3f3bad5af877 drm/i915/display/: Compute the scaler filter coefficients
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
-:74: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #74:
new file mode 100644

-:196: WARNING:LONG_LINE: line length of 102 exceeds 100 columns #196: FILE: drivers/gpu/drm/i915/display/intel_sharpen_filter.c:118:
+ SHARP_COEFF_TO_REG_FORMAT(crtc_state->hw.casf_params.coeff[tapindex]);

-:216: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'coefficient' - possible side-effects? #216: FILE: drivers/gpu/drm/i915/display/intel_sharpen_filter.h:11:
+#define SHARP_COEFF_TO_REG_FORMAT(coefficient) ((u16)(coefficient.sign << 15 | \
+ coefficient.exp << 12 | coefficient.mantissa << 3))

total: 0 errors, 2 warnings, 1 checks, 206 lines checked cc434912b492 drm/i915/dispaly/: Enable the second scaler -:177: CHECK:MULTIPLE_ASSIGNMENTS: multiple assignments should be avoided #177: FILE: drivers/gpu/drm/i915/display/skl_scaler.c:740:
+ x = y = 0;

total: 0 errors, 0 warnings, 1 checks, 187 lines checked 7cc66558b5a9 drm/i915/display/: Add registers and compute the strength -:124: ERROR:TRAILING_WHITESPACE: trailing whitespace
#124: FILE: drivers/gpu/drm/i915/display/intel_sharpen_filter.c:126:
+^I$

total: 1 errors, 0 warnings, 0 checks, 140 lines checked 87344f4fc30c drm/i915/display: Load the lut values and enable sharpness

#8 lore raw

✗ Fi.CI.BAT: failure for Introduce drm sharpening property

In reply to Nemesa Garg
== Series Details ==

== Series Details ==

Series: Introduce drm sharpening property
URL : https://patchwork.freedesktop.org/series/129888/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_14269 -> Patchwork_129888v1
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_129888v1 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes
introduced in Patchwork_129888v1, please notify your bug team ([email protected]) to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/index.html

Participating hosts (37 -> 35)
------------------------------

Missing (2): fi-glk-j4005 fi-snb-2520m

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_129888v1:

### IGT changes ###

#### Possible regressions ####

* igt@i915_module_load@load:
- bat-dg1-7: [PASS][1] -> [ABORT][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14269/bat-dg1-7/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-dg1-7/igt@[email protected]
- bat-adlp-9: [PASS][3] -> [INCOMPLETE][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14269/bat-adlp-9/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-adlp-9/igt@[email protected]
- fi-skl-guc: [PASS][5] -> [ABORT][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14269/fi-skl-guc/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/fi-skl-guc/igt@[email protected]
- bat-dg2-11: [PASS][7] -> [INCOMPLETE][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14269/bat-dg2-11/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-dg2-11/igt@[email protected]
- fi-kbl-7567u: [PASS][9] -> [INCOMPLETE][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14269/fi-kbl-7567u/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/fi-kbl-7567u/igt@[email protected]
- fi-cfl-8700k: [PASS][11] -> [INCOMPLETE][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14269/fi-cfl-8700k/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/fi-cfl-8700k/igt@[email protected]
- fi-cfl-guc: [PASS][13] -> [INCOMPLETE][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14269/fi-cfl-guc/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/fi-cfl-guc/igt@[email protected]
- bat-dg2-9: [PASS][15] -> [INCOMPLETE][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14269/bat-dg2-9/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-dg2-9/igt@[email protected]
- fi-cfl-8109u: [PASS][17] -> [INCOMPLETE][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14269/fi-cfl-8109u/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/fi-cfl-8109u/igt@[email protected]
- bat-dg2-8: [PASS][19] -> [INCOMPLETE][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14269/bat-dg2-8/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-dg2-8/igt@[email protected]

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@i915_module_load@load:
- {bat-arls-1}: [PASS][21] -> [ABORT][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14269/bat-arls-1/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-arls-1/igt@[email protected]
- {bat-dg2-13}: [PASS][23] -> [INCOMPLETE][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14269/bat-dg2-13/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-dg2-13/igt@[email protected]
- {bat-dg2-14}: [PASS][25] -> [INCOMPLETE][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14269/bat-dg2-14/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-dg2-14/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_129888v1 that come from known issues:

### CI changes ###

#### Issues hit ####

* boot:
- fi-apl-guc: [PASS][27] -> [FAIL][28] ([i915#8293])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14269/fi-apl-guc/boot.html
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/fi-apl-guc/boot.html

### IGT changes ###

#### Issues hit ####

* igt@gem_lmem_swapping@verify-random:
- bat-mtlp-6: NOTRUN -> [SKIP][29] ([i915#4613]) +3 other tests skip
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-mtlp-6/igt@[email protected]

* igt@i915_pm_rps@basic-api:
- bat-mtlp-6: NOTRUN -> [SKIP][30] ([i915#6621])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-mtlp-6/igt@[email protected]

* igt@kms_force_connector_basic@force-load-detect:
- bat-mtlp-6: NOTRUN -> [SKIP][31] ([fdo#109285] / [i915#9792])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-mtlp-6/igt@[email protected]

* igt@kms_force_connector_basic@prune-stale-modes:
- bat-mtlp-6: NOTRUN -> [SKIP][32] ([i915#5274] / [i915#9792])
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-mtlp-6/igt@[email protected]

* igt@kms_frontbuffer_tracking@basic:
- bat-mtlp-6: NOTRUN -> [SKIP][33] ([i915#4342] / [i915#5354] / [i915#9792])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-mtlp-6/igt@[email protected]

* igt@kms_pipe_crc_basic@hang-read-crc:
- bat-mtlp-6: NOTRUN -> [SKIP][34] ([i915#9792]) +6 other tests skip
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-mtlp-6/igt@[email protected]

* igt@kms_pm_backlight@basic-brightness:
- bat-mtlp-6: NOTRUN -> [SKIP][35] ([i915#5354] / [i915#9792])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-mtlp-6/igt@[email protected]

* igt@kms_setmode@basic-clone-single-crtc:
- bat-mtlp-6: NOTRUN -> [SKIP][36] ([i915#3555] / [i915#8809] / [i915#9792])
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-mtlp-6/igt@[email protected]

* igt@prime_vgem@basic-fence-flip:
- bat-mtlp-6: NOTRUN -> [SKIP][37] ([i915#3708] / [i915#9792])
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-mtlp-6/igt@[email protected]

* igt@prime_vgem@basic-fence-mmap:
- bat-mtlp-6: NOTRUN -> [SKIP][38] ([i915#3708] / [i915#4077]) +1 other test skip
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-mtlp-6/igt@[email protected]

* igt@prime_vgem@basic-write:
- bat-mtlp-6: NOTRUN -> [SKIP][39] ([i915#3708]) +2 other tests skip
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/bat-mtlp-6/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[i915#10194]: https://gitlab.freedesktop.org/drm/intel/issues/10194
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4342]: https://gitlab.freedesktop.org/drm/intel/issues/4342
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#5274]: https://gitlab.freedesktop.org/drm/intel/issues/5274
[i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#8293]: https://gitlab.freedesktop.org/drm/intel/issues/8293
[i915#8809]: https://gitlab.freedesktop.org/drm/intel/issues/8809
[i915#9673]: https://gitlab.freedesktop.org/drm/intel/issues/9673
[i915#9732]: https://gitlab.freedesktop.org/drm/intel/issues/9732
[i915#9792]: https://gitlab.freedesktop.org/drm/intel/issues/9792

Build changes
-------------

* Linux: CI_DRM_14269 -> Patchwork_129888v1

CI-20190529: 20190529
CI_DRM_14269: 403e424a8684b55d90b90f293a992e54f37892b3 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7711: 7711
Patchwork_129888v1: 403e424a8684b55d90b90f293a992e54f37892b3 @ git://anongit.freedesktop.org/gfx-ci/linux

### Linux commits

cf8aa8d0cb91 drm/i915/display: Load the lut values and enable sharpness 6ac1624999aa drm/i915/display/: Add registers and compute the strength 4c880d61f033 drm/i915/dispaly/: Enable the second scaler 43138116787c drm/i915/display/: Compute the scaler filter coefficients 4f11b0a17895 drm: Introduce sharpeness mode property

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_129888v1/index.html

#9 lore raw
In reply to Nemesa Garg

How much of this is Intel-specific? Are there any hardware vendors with a similar feature? How much is the "sharpness" knob tied to Intel hardware?

#10 lore raw

It is not intel specific and the goal is to have a generic API for configuring Sharpness, accessible to various vendors. Intel currently offers sharpness support through the Display Engine, while other vendors seem to support Sharpness through the GPU using GL shaders (Vulcan/Open GL based).

In terms of sharpness intensity adjustment, the plan is to provide users with the ability to customize and regulate sharpness levels. We suggest setting a minimum and maximum strength range from 1 to 255, where a value of 0 signifies that the sharpness feature is disabled, indicated by a u8 data type. For now we have mapped the strength value 0.0 to 14.9375 to 0-239 but as the datatype is u8 user can give value upto 255 which is gets clamped to 239.

We are also open to have alternative scales, such as 1-100 or 1-10, as long as a general consensus is reached within the community comprising OEMs and vendors.

Quoted 9 lines

-----Original Message-----
From: Simon Ser <[email protected]>
Sent: Thursday, February 15, 2024 2:03 PM
To: Garg, Nemesa <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [RFC 0/5] Introduce drm sharpening property

How much of this is Intel-specific? Are there any hardware vendors with a similar feature? How much is the "sharpness" knob tied to Intel hardware?

#11 lore raw
Quoted 5 lines · Nemesa

It is not intel specific and the goal is to have a generic API for configuring Sharpness, accessible to various vendors. Intel currently offers sharpness support through the Display Engine, while other vendors seem to support Sharpness through the GPU using GL shaders (Vulcan/Open GL based).

Do you mean that all vendors use the exact same mathematical algorithm (with only differences in operation precision at most)?

If yes, good.

If not, then we need to know where exactly in the virtual KMS color pipeline the operation happens, whether this can be generic or not.

Does this also work the same regardless of pixel formats, dynamic range, color gamut, transfer functions etc. on both plane input and connector output configurations?

Quoted 7 lines

In terms of sharpness intensity adjustment, the plan is to provide users with the ability to customize and regulate sharpness levels. We suggest setting a minimum and maximum strength range from 1 to 255, where a value of 0 signifies that the sharpness feature is disabled, indicated by a u8 data type. For now we have mapped the strength value 0.0 to 14.9375 to 0-239 but as the datatype is u8 user can give value upto 255 which is gets clamped to 239.

Naturally you will need to document all that, so that all drivers and vendors do the exact same thing.

I did not see any actual documentation in the patch series yet, e.g. a reference to a specific algorithm.

As Ville pointed out, there was also no specification at which point of the virtual color pipeline this operation will apply. Before/after DEGAMMA/CTM/GAMMA/scaling in plane/blending/CRTC?

Is the property being added to the list in
https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html#standard-crtc-properties
or where-ever it belongs?

Thanks,
pq

Quoted 14 lines

We are also open to have alternative scales, such as 1-100 or 1-10, as long as a general consensus is reached within the community comprising OEMs and vendors.

Quoted 10 lines

-----Original Message-----
From: Simon Ser <[email protected]>
Sent: Thursday, February 15, 2024 2:03 PM
To: Garg, Nemesa <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [RFC 0/5] Introduce drm sharpening property

How much of this is Intel-specific? Are there any hardware vendors with a similar feature? How much is the "sharpness" knob tied to Intel hardware?

#12 lore raw

This is generic as sharpness effect is applied post blending. Depending on the color gamut, pixel format and other inputs the image gets blended and once we get blended output it can be sharpened based on strength value provided by the user.

On intel platform it is implemented through pipe scaler. Pipe scaler can be used as either scaler or sharpness filter. As mentioned earlier the client can provide any strength value between 0-255 or any other scale based on discussions. Perhaps userspace can have provide options like low-med-high sharpness or in percentage form or steps which is mapped to 0-255.

I will add the documentation regarding property.

Quoted 71 lines

-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Pekka Paalanen
Sent: Friday, February 16, 2024 2:06 PM
To: Garg, Nemesa <[email protected]>
Cc: Simon Ser <[email protected]>; [email protected]; dri- [email protected]; G M, Adarsh <[email protected]>
Subject: Re: [RFC 0/5] Introduce drm sharpening property

Quoted 5 lines · Nemesa

It is not intel specific and the goal is to have a generic API for configuring Sharpness, accessible to various vendors. Intel currently offers sharpness support through the Display Engine, while other vendors seem to support Sharpness through the GPU using GL shaders (Vulcan/Open GL based).

Do you mean that all vendors use the exact same mathematical algorithm (with only differences in operation precision at most)?

If yes, good.

If not, then we need to know where exactly in the virtual KMS color pipeline the operation happens, whether this can be generic or not.

Does this also work the same regardless of pixel formats, dynamic range, color gamut, transfer functions etc. on both plane input and connector output configurations?

Quoted 7 lines

In terms of sharpness intensity adjustment, the plan is to provide users with the ability to customize and regulate sharpness levels. We suggest setting a minimum and maximum strength range from 1 to 255, where a value of 0 signifies that the sharpness feature is disabled, indicated by a u8 data type. For now we have mapped the strength value 0.0 to 14.9375 to 0-239 but as the datatype is u8 user can give value upto 255 which is gets clamped to 239.

Naturally you will need to document all that, so that all drivers and vendors do the exact same thing.

I did not see any actual documentation in the patch series yet, e.g. a reference to a specific algorithm.

As Ville pointed out, there was also no specification at which point of the virtual color pipeline this operation will apply. Before/after DEGAMMA/CTM/GAMMA/scaling in plane/blending/CRTC?

Is the property being added to the list in
https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html#standard-crtc-
properties
or where-ever it belongs?

Thanks,
pq

Quoted 14 lines

We are also open to have alternative scales, such as 1-100 or 1-10, as long as a general consensus is reached within the community comprising OEMs and vendors.

Quoted 10 lines

-----Original Message-----
From: Simon Ser <[email protected]>
Sent: Thursday, February 15, 2024 2:03 PM
To: Garg, Nemesa <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [RFC 0/5] Introduce drm sharpening property

How much of this is Intel-specific? Are there any hardware vendors with a similar feature? How much is the "sharpness" knob tied to Intel hardware?

#13 lore raw
Quoted 4 lines · Nemesa

This is generic as sharpness effect is applied post blending. Depending on the color gamut, pixel format and other inputs the image gets blended and once we get blended output it can be sharpened based on strength value provided by the user.

It would really help if you could provide the exact mathematical formula applied by this KMS property.

#14 lore raw

This KMS property is not implementing any formula and the values that are being used are based on empirical analysis and certain experiments done on the hardware. These values are fixed and is not expected to change and this can change from vendor to vendor. The client can choose any sharpness value on the scale and on the basis of it the sharpness will be set. The sharpness effect can be changed from content to content and from display to display so user needs to adjust the optimum intensity value so as to get good experience on the screen.

Quoted 20 lines

-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Simon Ser
Sent: Monday, March 4, 2024 7:46 PM
To: Garg, Nemesa <[email protected]>
Cc: Pekka Paalanen <[email protected]>; intel- [email protected]; [email protected]; G M, Adarsh <[email protected]>
Subject: RE: [RFC 0/5] Introduce drm sharpening property

Quoted 4 lines · Nemesa

This is generic as sharpness effect is applied post blending. Depending on the color gamut, pixel format and other inputs the image gets blended and once we get blended output it can be sharpened based on strength value provided by the user.

It would really help if you could provide the exact mathematical formula applied by this KMS property.

#15 lore raw
Quoted 1 line · Nemesa

This KMS property is not implementing any formula

Sure it is. Maybe Intel just does not want to tell what the algorithm is, or maybe it's even patented.

Quoted 10 lines

and the values
that are being used are based on empirical analysis and certain experiments done on the hardware. These values are fixed and is not expected to change and this can change from vendor to vendor. The client can choose any sharpness value on the scale and on the basis of it the sharpness will be set. The sharpness effect can be changed from content to content and from display to display so user needs to adjust the optimum intensity value so as to get good experience on the screen.

IOW, it's an opaque box operation, and there is no way to reproduce its results without the specific Intel hardware. Definitely no way to reproduce its results in free open source software alone.

Such opaque box operations can only occur after KMS blending, at the CRTC or later stage. They cannot appear before blending, not in the new KMS color pipeline design at least. The reason is that the modern way to use KMS planes is opportunistic composition off-loading. Opportunistic means that userspace decides from time to time whether it composes the final picture using KMS or some other rendering method (usually GPU and shaders). Since userspace will arbitrarily switch between KMS and render composition, both must result in the exact same image, or end users will observe unwanted flicker.

Such opaque box operations are fine after blending, because there they can be configured once and remain on forever. No switching, no flicker.

Where does "sharpeness" operation occur in the Intel color processing chain? Is it before or after blending?

What kind of transfer characteristics does it expect from the image, and can those be realized with KMS CRTC properties if KMS is configured such that the blending happens using some other characteristics (e.g. blending in optical space)?

What about SDR vs. HDR imagery?

Thanks,
pq

Quoted 20 lines
Quoted 20 lines

-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Simon Ser
Sent: Monday, March 4, 2024 7:46 PM
To: Garg, Nemesa <[email protected]>
Cc: Pekka Paalanen <[email protected]>; intel- [email protected]; [email protected]; G M, Adarsh <[email protected]>
Subject: RE: [RFC 0/5] Introduce drm sharpening property

Quoted 4 lines · Nemesa

This is generic as sharpness effect is applied post blending. Depending on the color gamut, pixel format and other inputs the image gets blended and once we get blended output it can be sharpened based on strength value provided by the user.

It would really help if you could provide the exact mathematical formula applied by this KMS property.

#16 lore raw
Quoted 33 lines · On Tue, 12 Mar 2024 16:26:00 +0200 Pekka Paalanen…
Quoted 1 line · Nemesa

This KMS property is not implementing any formula

Sure it is. Maybe Intel just does not want to tell what the algorithm is, or maybe it's even patented.

Quoted 10 lines

and the values
that are being used are based on empirical analysis and certain experiments done on the hardware. These values are fixed and is not expected to change and this can change from vendor to vendor. The client can choose any sharpness value on the scale and on the basis of it the sharpness will be set. The sharpness effect can be changed from content to content and from display to display so user needs to adjust the optimum intensity value so as to get good experience on the screen.

IOW, it's an opaque box operation, and there is no way to reproduce its results without the specific Intel hardware. Definitely no way to reproduce its results in free open source software alone.

Such opaque box operations can only occur after KMS blending, at the CRTC or later stage. They cannot appear before blending, not in the new KMS color pipeline design at least. The reason is that the modern way to use KMS planes is opportunistic composition off-loading. Opportunistic means that userspace decides from time to time whether it composes the final picture using KMS or some other rendering method (usually GPU and shaders). Since userspace will arbitrarily switch between KMS and render composition, both must result in the exact same image, or end users will observe unwanted flicker.

Quoted 2 lines

Such opaque box operations are fine after blending, because there they can be configured once and remain on forever. No switching, no flicker.

If you want to see how sharpness property would apply in Wayland design, it would be in step 5 "Adjust (settings UI)" of
https://gitlab.freedesktop.org/pq/color-and-hdr/-/blob/main/doc/color-management-model.md#compositor-color-management-model

To relate that diagram to KMS color processing, you can identify step 3 "Compose" as the KMS blending step. Everything before step 3 happens in KMS plane color processing, and steps 4-5 happen in KMS CRTC color processing.

Sharpening would essentially be a "compositor color effect", it just happens to be implementable only by specific Intel hardware.

If a color effect is dynamic or content-dependant, it will preclude colorimetric monitor calibration.

Thanks,
pq

Quoted 35 lines

Where does "sharpeness" operation occur in the Intel color processing chain? Is it before or after blending?

What kind of transfer characteristics does it expect from the image, and can those be realized with KMS CRTC properties if KMS is configured such that the blending happens using some other characteristics (e.g. blending in optical space)?

What about SDR vs. HDR imagery?

Thanks,
pq

Quoted 20 lines
Quoted 20 lines

-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Simon Ser
Sent: Monday, March 4, 2024 7:46 PM
To: Garg, Nemesa <[email protected]>
Cc: Pekka Paalanen <[email protected]>; intel- [email protected]; [email protected]; G M, Adarsh <[email protected]>
Subject: RE: [RFC 0/5] Introduce drm sharpening property

Quoted 4 lines · Nemesa

This is generic as sharpness effect is applied post blending. Depending on the color gamut, pixel format and other inputs the image gets blended and once we get blended output it can be sharpened based on strength value provided by the user.

It would really help if you could provide the exact mathematical formula applied by this KMS property.

#17 lore raw
Quoted 61 lines

-----Original Message-----
From: Pekka Paalanen <[email protected]>
Sent: Wednesday, March 13, 2024 3:07 PM
To: Garg, Nemesa <[email protected]>
Cc: Simon Ser <[email protected]>; [email protected]; dri- [email protected]; G M, Adarsh <[email protected]>
Subject: Re: [RFC 0/5] Introduce drm sharpening property

Quoted 33 lines · On Tue, 12 Mar 2024 16:26:00 +0200 Pekka Paalanen…
Quoted 1 line · Nemesa

This KMS property is not implementing any formula

Sure it is. Maybe Intel just does not want to tell what the algorithm is, or maybe it's even patented.

Quoted 10 lines

and the values
that are being used are based on empirical analysis and certain experiments done on the hardware. These values are fixed and is not expected to change and this can change from vendor to vendor. The client can choose any sharpness value on the scale and on the basis of it the sharpness will be set. The sharpness effect can be changed from content to content and from display to display so user needs to adjust the optimum intensity value so as to get good experience on the screen.

IOW, it's an opaque box operation, and there is no way to reproduce its results without the specific Intel hardware. Definitely no way to reproduce its results in free open source software alone.

Such opaque box operations can only occur after KMS blending, at the CRTC or later stage. They cannot appear before blending, not in the new KMS color pipeline design at least. The reason is that the modern way to use KMS planes is opportunistic composition off-loading. Opportunistic means that userspace decides from time to time whether it composes the final picture using KMS or some other rendering method (usually GPU and shaders). Since userspace will arbitrarily switch between KMS and render composition, both must result in the exact same image, or end users will observe unwanted flicker.

Quoted 2 lines

Such opaque box operations are fine after blending, because there they can be configured once and remain on forever. No switching, no flicker.

If you want to see how sharpness property would apply in Wayland design, it would be in step 5 "Adjust (settings UI)" of
https://gitlab.freedesktop.org/pq/color-and-hdr/-/blob/main/doc/color-
management-model.md#compositor-color-management-model

To relate that diagram to KMS color processing, you can identify step 3 "Compose" as the KMS blending step. Everything before step 3 happens in KMS plane color processing, and steps 4-5 happen in KMS CRTC color processing.

Sharpening would essentially be a "compositor color effect", it just happens to be implementable only by specific Intel hardware.

Quoted 11 lines

If a color effect is dynamic or content-dependant, it will preclude colorimetric monitor calibration.

Thanks,
pq

Quoted 3 lines

Where does "sharpeness" operation occur in the Intel color processing chain? Is it before or after blending?

Thank you for detail explanation and link.
Sharpness operation occur post blending in CRTC ie on the final
composed output after blending . Yes Pekka you are right as per the diagram it is done at step 5 "Adjust (settings UI)"). I will also document this thing along with documentation change.

Quoted 6 lines
Quoted 3 lines

What kind of transfer characteristics does it expect from the image, and can those be realized with KMS CRTC properties if KMS is configured such that the blending happens using some other characteristics

(e.g.

Quoted 2 lines

blending in optical space)?

The filter values are not dependent/calculated on the inputs of
image but depending on the blending space and other inputs the
blended output gets changed and the sharpness is applied post blending so according to the content user needs to adjust the strength value to get the better visual effect. So tuning of sharpness strength may be needed by user based on the input contents and blending policy to get the desired experience.

Quoted 2 lines
Quoted 2 lines

What about SDR vs. HDR imagery?

The interface can be used for both HDR and SDR. The effect is more prominent for SDR use cases. For HDR filter values and tap value may change.

Thanks,
Nemesa

Quoted 28 lines
Quoted 21 lines

Thanks,
pq

Quoted 17 lines
Quoted 17 lines

-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Simon Ser
Sent: Monday, March 4, 2024 7:46 PM
To: Garg, Nemesa <[email protected]>
Cc: Pekka Paalanen <[email protected]>; intel- [email protected]; [email protected]; G M, Adarsh <[email protected]>
Subject: RE: [RFC 0/5] Introduce drm sharpening property

Quoted 3 lines · Nemesa

This is generic as sharpness effect is applied post blending. Depending on the color gamut, pixel format and other inputs the image gets blended and once we get blended output it can be sharpened

based

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

on strength value provided by the user.

It would really help if you could provide the exact mathematical formula

applied

Quoted 2 lines
Quoted 1 line
Quoted 1 line

by this KMS property.

#18 lore raw
Quoted 90 lines · Nemesa
Quoted 59 lines

-----Original Message-----
From: Pekka Paalanen <[email protected]>
Sent: Wednesday, March 13, 2024 3:07 PM
To: Garg, Nemesa <[email protected]>
Cc: Simon Ser <[email protected]>; [email protected]; dri- [email protected]; G M, Adarsh <[email protected]>
Subject: Re: [RFC 0/5] Introduce drm sharpening property

Quoted 33 lines · On Tue, 12 Mar 2024 16:26:00 +0200 Pekka Paalanen…
Quoted 1 line · Nemesa

This KMS property is not implementing any formula

Sure it is. Maybe Intel just does not want to tell what the algorithm is, or maybe it's even patented.

Quoted 10 lines

and the values
that are being used are based on empirical analysis and certain experiments done on the hardware. These values are fixed and is not expected to change and this can change from vendor to vendor. The client can choose any sharpness value on the scale and on the basis of it the sharpness will be set. The sharpness effect can be changed from content to content and from display to display so user needs to adjust the optimum intensity value so as to get good experience on the screen.

IOW, it's an opaque box operation, and there is no way to reproduce its results without the specific Intel hardware. Definitely no way to reproduce its results in free open source software alone.

Such opaque box operations can only occur after KMS blending, at the CRTC or later stage. They cannot appear before blending, not in the new KMS color pipeline design at least. The reason is that the modern way to use KMS planes is opportunistic composition off-loading. Opportunistic means that userspace decides from time to time whether it composes the final picture using KMS or some other rendering method (usually GPU and shaders). Since userspace will arbitrarily switch between KMS and render composition, both must result in the exact same image, or end users will observe unwanted flicker.

Quoted 2 lines

Such opaque box operations are fine after blending, because there they can be configured once and remain on forever. No switching, no flicker.

If you want to see how sharpness property would apply in Wayland design, it would be in step 5 "Adjust (settings UI)" of
https://gitlab.freedesktop.org/pq/color-and-hdr/-/blob/main/doc/color-
management-model.md#compositor-color-management-model

To relate that diagram to KMS color processing, you can identify step 3 "Compose" as the KMS blending step. Everything before step 3 happens in KMS plane color processing, and steps 4-5 happen in KMS CRTC color processing.

Sharpening would essentially be a "compositor color effect", it just happens to be implementable only by specific Intel hardware.

Quoted 11 lines

If a color effect is dynamic or content-dependant, it will preclude colorimetric monitor calibration.

Thanks,
pq

Quoted 3 lines

Where does "sharpeness" operation occur in the Intel color processing chain? Is it before or after blending?

Thank you for detail explanation and link.
Sharpness operation occur post blending in CRTC ie on the final
composed output after blending . Yes Pekka you are right as per the diagram it is done at step 5 "Adjust (settings UI)"). I will also document this thing along with documentation change.

Quoted 6 lines
Quoted 3 lines

What kind of transfer characteristics does it expect from the image, and can those be realized with KMS CRTC properties if KMS is configured such that the blending happens using some other characteristics

(e.g.

Quoted 2 lines

blending in optical space)?

The filter values are not dependent/calculated on the inputs of
image but depending on the blending space and other inputs the
blended output gets changed and the sharpness is applied post blending so according to the content user needs to adjust the strength value to get the better visual effect. So tuning of sharpness strength may be needed by user based on the input contents and blending policy to get the desired experience.

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

What about SDR vs. HDR imagery?

The interface can be used for both HDR and SDR. The effect is more prominent for SDR use cases. For HDR filter values and tap value may change.

Who will be providing these values?

The kernel driver cannot know if it is dealing with SDR or HDR or which transfer function is in effect at that point of the post-blending color pipeline.

If the UAPI is one "strength" value, then how can it work?

Maybe the UAPI needs more controls, if not providing all "filter and tap" values directly. Maybe all the filter and tap values should be provided by userspace?

Thanks,
pq

#19 lore raw
Quoted 104 lines · On Wed, 27 Mar 2024 13:29:16 +0200 Pekka Paalanen…
Quoted 90 lines · Nemesa
Quoted 59 lines

-----Original Message-----
From: Pekka Paalanen <[email protected]>
Sent: Wednesday, March 13, 2024 3:07 PM
To: Garg, Nemesa <[email protected]>
Cc: Simon Ser <[email protected]>; [email protected]; dri- [email protected]; G M, Adarsh <[email protected]>
Subject: Re: [RFC 0/5] Introduce drm sharpening property

Quoted 33 lines · On Tue, 12 Mar 2024 16:26:00 +0200 Pekka Paalanen…
Quoted 1 line · Nemesa

This KMS property is not implementing any formula

Sure it is. Maybe Intel just does not want to tell what the algorithm is, or maybe it's even patented.

Quoted 10 lines

and the values
that are being used are based on empirical analysis and certain experiments done on the hardware. These values are fixed and is not expected to change and this can change from vendor to vendor. The client can choose any sharpness value on the scale and on the basis of it the sharpness will be set. The sharpness effect can be changed from content to content and from display to display so user needs to adjust the optimum intensity value so as to get good experience on the screen.

IOW, it's an opaque box operation, and there is no way to reproduce its results without the specific Intel hardware. Definitely no way to reproduce its results in free open source software alone.

Such opaque box operations can only occur after KMS blending, at the CRTC or later stage. They cannot appear before blending, not in the new KMS color pipeline design at least. The reason is that the modern way to use KMS planes is opportunistic composition off-loading. Opportunistic means that userspace decides from time to time whether it composes the final picture using KMS or some other rendering method (usually GPU and shaders). Since userspace will arbitrarily switch between KMS and render composition, both must result in the exact same image, or end users will observe unwanted flicker.

Quoted 2 lines

Such opaque box operations are fine after blending, because there they can be configured once and remain on forever. No switching, no flicker.

If you want to see how sharpness property would apply in Wayland design, it would be in step 5 "Adjust (settings UI)" of
https://gitlab.freedesktop.org/pq/color-and-hdr/-/blob/main/doc/color-
management-model.md#compositor-color-management-model

To relate that diagram to KMS color processing, you can identify step 3 "Compose" as the KMS blending step. Everything before step 3 happens in KMS plane color processing, and steps 4-5 happen in KMS CRTC color processing.

Sharpening would essentially be a "compositor color effect", it just happens to be implementable only by specific Intel hardware.

Quoted 11 lines

If a color effect is dynamic or content-dependant, it will preclude colorimetric monitor calibration.

Thanks,
pq

Quoted 3 lines

Where does "sharpeness" operation occur in the Intel color processing chain? Is it before or after blending?

Thank you for detail explanation and link.
Sharpness operation occur post blending in CRTC ie on the final
composed output after blending . Yes Pekka you are right as per the diagram it is done at step 5 "Adjust (settings UI)"). I will also document this thing along with documentation change.

Quoted 6 lines
Quoted 3 lines

What kind of transfer characteristics does it expect from the image, and can those be realized with KMS CRTC properties if KMS is configured such that the blending happens using some other characteristics

(e.g.

Quoted 2 lines

blending in optical space)?

The filter values are not dependent/calculated on the inputs of
image but depending on the blending space and other inputs the
blended output gets changed and the sharpness is applied post blending so according to the content user needs to adjust the strength value to get the better visual effect. So tuning of sharpness strength may be needed by user based on the input contents and blending policy to get the desired experience.

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

What about SDR vs. HDR imagery?

The interface can be used for both HDR and SDR. The effect is more prominent for SDR use cases. For HDR filter values and tap value may change.

Who will be providing these values?

The kernel driver cannot know if it is dealing with SDR or HDR or which transfer function is in effect at that point of the post-blending color pipeline.

Quoted 5 lines

If the UAPI is one "strength" value, then how can it work?

Maybe the UAPI needs more controls, if not providing all "filter and tap" values directly. Maybe all the filter and tap values should be provided by userspace?

Actually, is the hardware just doing a convolution with a filter defined by the driver?

Convolution algorithm (it is a formula!) is pretty standard stuff I believe. If the hardware is actually doing convolution, then the driver really should be exposing the convolution operation. Then people can choose to use it for sharpening with the Intel developed kernels, or for custom effects with custom kernels. Everyone would win. Convolution is also something that other hardware vendors could implement.

A convolution filter would fit very well in the new KMS color pipeline design for post-compositing operations, too.

Is the sharpening element doing something similar to the unsharp masking?

I suppose users might want different strength based on what kind of content is the majority on the screen. That makes it something that a Wayland compositor would adjust automatically based on Wayland content type (similar to HDMI content type), for example.

Thanks,
pq

#20 lore raw
Quoted 144 lines

-----Original Message-----
From: Pekka Paalanen <[email protected]>
Sent: Thursday, March 28, 2024 3:35 PM
To: Garg, Nemesa <[email protected]>
Cc: Simon Ser <[email protected]>; [email protected]; dri- [email protected]; G M, Adarsh <[email protected]>
Subject: Re: [RFC 0/5] Introduce drm sharpening property

Quoted 34 lines · On Wed, 27 Mar 2024 13:29:16 +0200 Pekka Paalanen…
Quoted 31 lines · Nemesa
Quoted 31 lines

-----Original Message-----
From: Pekka Paalanen <[email protected]>
Sent: Wednesday, March 13, 2024 3:07 PM
To: Garg, Nemesa <[email protected]>
Cc: Simon Ser <[email protected]>; [email protected]; dri- [email protected]; G M, Adarsh <[email protected]>
Subject: Re: [RFC 0/5] Introduce drm sharpening property

Quoted 19 lines · On Tue, 12 Mar 2024 16:26:00 +0200 Pekka Paalanen…
Quoted 1 line · Nemesa

This KMS property is not implementing any formula

Sure it is. Maybe Intel just does not want to tell what the algorithm is, or maybe it's even patented.

Quoted 10 lines

and the values
that are being used are based on empirical analysis and certain experiments done on the hardware. These values are fixed and is not expected to change and this can change from vendor to vendor. The client can choose any sharpness value on the scale and on the basis of it the sharpness will be set. The sharpness effect can be changed from content to content and from display to display so user needs to adjust the optimum intensity value so as to get good experience on the screen.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

IOW, it's an opaque box operation, and there is no way to reproduce its results without the specific Intel hardware. Definitely no way to reproduce its results in free open source software

alone.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Such opaque box operations can only occur after KMS blending, at the CRTC or later stage. They cannot appear before blending, not in the new KMS color pipeline design at least. The reason is that the modern way to use KMS planes is opportunistic composition off-

loading.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

Opportunistic means that userspace decides from time to time whether it composes the final picture using KMS or some other rendering method (usually GPU and shaders). Since userspace will arbitrarily switch between KMS and render composition, both must result in the exact same image, or end users will observe unwanted flicker.

Such opaque box operations are fine after blending, because there they can be configured once and remain on forever. No switching, no flicker.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

If you want to see how sharpness property would apply in Wayland design, it would be in step 5 "Adjust (settings UI)" of
https://gitlab.freedesktop.org/pq/color-and-hdr/-/blob/main/doc/co
lor- management-model.md#compositor-color-management-model

To relate that diagram to KMS color processing, you can identify step 3

"Compose"

Quoted 23 lines
Quoted 23 lines
Quoted 6 lines

as the KMS blending step. Everything before step 3 happens in KMS plane color processing, and steps 4-5 happen in KMS CRTC color processing.

Sharpening would essentially be a "compositor color effect", it just happens to be implementable only by specific Intel hardware.

Quoted 11 lines

If a color effect is dynamic or content-dependant, it will preclude colorimetric monitor calibration.

Thanks,
pq

Quoted 3 lines

Where does "sharpeness" operation occur in the Intel color processing chain? Is it before or after blending?

Thank you for detail explanation and link.
Sharpness operation occur post blending in CRTC ie on the final composed output after blending . Yes Pekka you are right as per the diagram it is done at step 5 "Adjust (settings UI)"). I will also document this thing along with documentation change.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

What kind of transfer characteristics does it expect from the image, and can those be realized with KMS CRTC properties if KMS is configured such that the blending happens using some other

characteristics

Quoted 11 lines
Quoted 11 lines
Quoted 3 lines

(e.g.

Quoted 2 lines

blending in optical space)?

The filter values are not dependent/calculated on the inputs of image but depending on the blending space and other inputs the blended output gets changed and the sharpness is applied post blending so according to the content user needs to adjust the strength value to get the better visual effect. So tuning of sharpness strength may be needed by user based on the input contents and blending policy to get the desired experience.

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines

What about SDR vs. HDR imagery?

The interface can be used for both HDR and SDR. The effect is more

prominent for SDR use cases.

Quoted 8 lines
Quoted 1 line

For HDR filter values and tap value may change.

Who will be providing these values?

The kernel driver cannot know if it is dealing with SDR or HDR or which transfer function is in effect at that point of the post-blending color pipeline.

Quoted 5 lines

If the UAPI is one "strength" value, then how can it work?

Maybe the UAPI needs more controls, if not providing all "filter and tap" values directly. Maybe all the filter and tap values should be provided by userspace?

Actually, is the hardware just doing a convolution with a filter defined by the driver?

Convolution algorithm (it is a formula!) is pretty standard stuff I believe. If the hardware is actually doing convolution, then the driver really should be exposing the convolution operation. Then people can choose to use it for sharpening with the Intel developed kernels, or for custom effects with custom kernels. Everyone would win. Convolution is also something that other hardware vendors could implement.

A convolution filter would fit very well in the new KMS color pipeline design for post-compositing operations, too.

Is the sharpening element doing something similar to the unsharp masking?

Quoted 8 lines

I suppose users might want different strength based on what kind of content is the majority on the screen. That makes it something that a Wayland compositor would adjust automatically based on Wayland content type (similar to HDMI content type), for example.

Thanks,
pq

Hi Pekka,

Thank you for the feedback and suggestions. Based on the discussions in Hackfest(2024 Linux Display Next) and community feedback we were exploring various solutions from the user-space side and come up with a looking glass solution. Below is the link for mutter MR:
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3665

There is a sort of convolution along with other optimizations which are within the hardware and the user-space should just control the extent of sharpness. This value will be received in the driver and appropriate programming should be done based on respective hardware design. Also as agreed it should be fine if sharpness is applied post blending or if we drive a single plane use-case.

In cases when hardware doesn't support sharpness due to various reasons we can implement the generic shader using some open source algorithm. This may not match pixel by pixel with hardware but should be ok if hardware applies post blending.

Thanks and Regards,
Nemesa

#21 lore raw
In reply to Nemesa Garg

Adding a couple of compositor devs as they might be interested in this.

Quoted 5 lines · Nemesa Garg

Many a times images are blurred or upscaled content is also not as
crisp as original rendered image. Traditional sharpening techniques often apply a uniform level of enhancement across entire image, which sometimes result in over-sharpening of some areas and potential loss of natural details.

Quoted 8 lines

Intel has come up with Display Engine based adaptive sharpening filter with minimal power and performance impact. From LNL onwards, the Display hardware can use one of the pipe scaler for adaptive sharpness filter. This can be used for both gaming and non-gaming use cases like photos, image viewing. It works on a region of pixels depending on the tap size.

This RFC is an attempt to introduce an adaptive sharpness solution which helps in improving the image quality. For this new CRTC property is added.

I don't think CRTC is the right place for this. Scaling tends to be more of a plane thing. Planes can be scaled independently, or is that not the case for Intel? Or does Intel HW do this sharpening operation independent of any scaling, on the entire output?

Quoted 10 lines

The user can set this property with desired sharpness strength value with 0-255. A value of 1 representing minimum sharpening strength and 255 representing maximum sharpness strength. A strength value of 0 means no sharpening or sharpening feature disabled.
It works on a region of pixels depending on the tap size. The coefficients are used to generate an alpha value which is used to blend the sharpened image to original image.

Userspace implementation for sharpening feature and IGT implementation is in progress.

It would be very helpful to have an idea how this looks in userspace, and which compositors will implement this.

Harry

Quoted 26 lines

Nemesa Garg (5):
drm: Introduce sharpeness mode property drm/i915/display/: Compute the scaler filter coefficients drm/i915/dispaly/: Enable the second scaler drm/i915/display/: Add registers and compute the strength drm/i915/display: Load the lut values and enable sharpness

 drivers/gpu/drm/drm_atomic_uapi.c             |   4 +
 drivers/gpu/drm/drm_crtc.c                    |  17 ++
 drivers/gpu/drm/i915/Makefile                 |   1 +
 drivers/gpu/drm/i915/display/intel_crtc.c     |   3 +
 drivers/gpu/drm/i915/display/intel_display.c  |  20 +-
 .../drm/i915/display/intel_display_types.h    |  11 +
 .../drm/i915/display/intel_modeset_verify.c   |   1 +
 .../drm/i915/display/intel_sharpen_filter.c   | 214 ++++++++++++++++++
 .../drm/i915/display/intel_sharpen_filter.h   |  31 +++
 drivers/gpu/drm/i915/display/skl_scaler.c     |  86 ++++++-
 drivers/gpu/drm/i915/display/skl_scaler.h     |   1 +
 drivers/gpu/drm/i915/i915_reg.h               |  19 ++
 drivers/gpu/drm/xe/Makefile                   |   1 +
 include/drm/drm_crtc.h                        |  17 ++
 14 files changed, 416 insertions(+), 10 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/intel_sharpen_filter.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_sharpen_filter.h
#22 lore raw
Quoted 14 lines · Harry Wentland

Adding a couple of compositor devs as they might be interested in this.

Quoted 11 lines · Nemesa Garg

Many a times images are blurred or upscaled content is also not as
crisp as original rendered image. Traditional sharpening techniques often apply a uniform level of enhancement across entire image, which sometimes result in over-sharpening of some areas and potential loss of natural details.

Intel has come up with Display Engine based adaptive sharpening filter with minimal power and performance impact. From LNL onwards, the Display hardware can use one of the pipe scaler for adaptive sharpness filter. This can be used for both gaming and non-gaming use cases like photos, image viewing. It works on a region of pixels depending on the tap size.

Quoted 7 lines
Quoted 2 lines

This RFC is an attempt to introduce an adaptive sharpness solution which helps in improving the image quality. For this new CRTC property is added.

I don't think CRTC is the right place for this. Scaling tends to be more of a plane thing. Planes can be scaled independently, or is that not the case for Intel? Or does Intel HW do this sharpening operation independent of any scaling, on the entire output?

We can scale either individual planes, or the entire crtc.

Quoted 9 lines
Quoted 9 lines

The user can set this property with desired sharpness strength value with 0-255. A value of 1 representing minimum sharpening strength and 255 representing maximum sharpness strength. A strength value of 0 means no sharpening or sharpening feature disabled.
It works on a region of pixels depending on the tap size. The coefficients are used to generate an alpha value which is used to blend the sharpened image to original image.

Quoted 5 lines
Quoted 2 lines

Userspace implementation for sharpening feature and IGT implementation is in progress.

It would be very helpful to have an idea how this looks in userspace, and which compositors will implement this.

Someone will probably need to spend some real time thinking how this interacts with the scaling filter propery (eg. if we want to extend that property with new values) and the laptop panel scaling mode property. We also want to implement the margin properties for external displays which also involves scaling. Ie. we need some kind of consistent story how all those things will work together.

Quoted 29 lines

Harry

Quoted 26 lines

Nemesa Garg (5):
drm: Introduce sharpeness mode property drm/i915/display/: Compute the scaler filter coefficients drm/i915/dispaly/: Enable the second scaler drm/i915/display/: Add registers and compute the strength drm/i915/display: Load the lut values and enable sharpness

 drivers/gpu/drm/drm_atomic_uapi.c             |   4 +
 drivers/gpu/drm/drm_crtc.c                    |  17 ++
 drivers/gpu/drm/i915/Makefile                 |   1 +
 drivers/gpu/drm/i915/display/intel_crtc.c     |   3 +
 drivers/gpu/drm/i915/display/intel_display.c  |  20 +-
 .../drm/i915/display/intel_display_types.h    |  11 +
 .../drm/i915/display/intel_modeset_verify.c   |   1 +
 .../drm/i915/display/intel_sharpen_filter.c   | 214 ++++++++++++++++++
 .../drm/i915/display/intel_sharpen_filter.h   |  31 +++
 drivers/gpu/drm/i915/display/skl_scaler.c     |  86 ++++++-
 drivers/gpu/drm/i915/display/skl_scaler.h     |   1 +
 drivers/gpu/drm/i915/i915_reg.h               |  19 ++
 drivers/gpu/drm/xe/Makefile                   |   1 +
 include/drm/drm_crtc.h                        |  17 ++
 14 files changed, 416 insertions(+), 10 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/intel_sharpen_filter.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_sharpen_filter.h
Signature · 2 lines
Ville Syrjälä
Intel