Skip to contentSkip to conversation

Enable Nearest-neighbor for Integer mode scaling

RFC In review Shashank Sharma 5 participants 14 messages Sep 3, 2019 – Sep 4, 2019

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

cover Enable Nearest-neighbor for Integer mode scaling

Blurry outputs during upscaling the buffer, is a generic problem of gfx industry. One of the major reason behind this blurriness is the interpolation of pixel values used by most of the upscaling hardwares.

Nearest-neighbor is a scaling mode, which works by filling in the missing color values in the upscaled image with that of the coordinate-mapped nearest source pixel value.

Nearest-neighbor can produce (almost) non-blurry scaling outputs when the scaling ratio is complete integer. For example:
- input buffer resolution: 1280x720(HD)
- output buffer resolution: 3840x2160(UHD/4K)
- scaling ratio (h) = 3840/1280 = 3
scaling ratio (v) = 2160/720 = 3
In such scenarios, we should try to pick Nearest-neighbor as scaling method when possible.

Many gaming communities have been asking for integer-mode scaling support, some links and background:
https://software.intel.com/en-us/articles/integer-scaling-support-on-intel-graphics
http://tanalin.com/en/articles/lossless-scaling/
https://community.amd.com/thread/209107
https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/1002/feature-request-nonblurry-upscaling-at-integer-rat/

This patch series enables NN scaling on Intel display (ICL), when the upscaling ratio is integer.

Shashank Sharma (2):
drm/i915: Indicate integer up-scaling ratios drm/i915: Pick nearest-neighbor mode for integer scaling ratios

 drivers/gpu/drm/i915/display/intel_display.c  | 97 ++++++++++++++++++-
 .../drm/i915/display/intel_display_types.h    |  7 ++
 drivers/gpu/drm/i915/i915_reg.h               | 31 ++++++
 3 files changed, 134 insertions(+), 1 deletion(-)
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

RFC 1/2 drm/i915: Indicate integer up-scaling ratios

If the upscaling ratio is a complete integer, Intel display HW can pickup special scaling mode, which can produce better non-blurry outputs. This patch adds a check to indicate if this is such an upscaling opportunity, while calculating the scaler config, and stores it into scaler state.

Cc Jani Nikula <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Vivi, Rodrigo <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c  | 21 +++++++++++++++++++
 .../drm/i915/display/intel_display_types.h    |  7 +++++++
 2 files changed, 28 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +21 -0
index ee54d9659c99..613130db3c05 100644
@@ -5388,6 +5388,19 @@ u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_cosited)
 #define SKL_MIN_YUV_420_SRC_W 16
 #define SKL_MIN_YUV_420_SRC_H 16
 
+static inline bool
+scaling_ratio_integer(int src_w, int dst_w, int src_h, int dst_h)
+{
+	/* Integer mode scaling is applicable only for upscaling scenarios */
+	if (dst_w < src_w || dst_h < src_h)
+		return false;
+
+	if (dst_w % src_w == 0 && dst_h % src_h == 0)
+		return true;
+
+	return false;
+}
+
 static int
 skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
 		  unsigned int scaler_user, int *scaler_id,
@@ -5422,6 +5435,14 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
 		return -EINVAL;
 	}
 
+	/*
+	 * If we are upscaling, and the scaling ratios are integer, we can
+	 * pick nearest-neighbour method in HW for scaling, which produces
+	 * blurless outputs in such scenarios.
+	 */
+	if (scaling_ratio_integer(src_w, dst_w, src_h, dst_h))
+		scaler_state->integer_scaling = true;
+
 	/*
 	 * if plane is being disabled or scaler is no more required or force detach
 	 *  - free scaler binded to this plane/crtc
drivers/gpu/drm/i915/display/intel_display_types.h +7 -0
index 3c1a5f3e1d22..6bb32fbf3153 100644
@@ -613,6 +613,13 @@ struct intel_crtc_scaler_state {
 
 	/* scaler used by crtc for panel fitting purpose */
 	int scaler_id;
+
+	/*
+	 * Nearest-neighbor method of upscaling gieves blurless output if
+	 * the upscaling ratio is a complete integer. This bool is to indicate
+	 * such an opportunity.
+	 */
+	bool integer_scaling;
 };
 
 /* drm_mode->private_flags */
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [RFC 1/2] drm/i915: Indicate integer up-scaling ratios

Quoted 21 lines · Shashank Sharma

If the upscaling ratio is a complete integer, Intel display HW can pickup special scaling mode, which can produce better non-blurry outputs. This patch adds a check to indicate if this is such an upscaling opportunity, while calculating the scaler config, and stores it into scaler state.

Cc Jani Nikula <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Vivi, Rodrigo <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c  | 21 +++++++++++++++++++
 .../drm/i915/display/intel_display_types.h    |  7 +++++++
 2 files changed, 28 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +0 -0
index ee54d9659c99..613130db3c05 100644

drivers/gpu/drm/i915/display/intel_display.c u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_cosited) · line 5391

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -0
@@ -5388,6 +5388,19 @@ u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_cosited)
 #define SKL_MIN_YUV_420_SRC_W 16
 #define SKL_MIN_YUV_420_SRC_H 16
 
+static inline bool

Please don't add superfluous inlines to static functions in .c files. Let the compiler do its job.

BR,
Jani.

Quoted 48 lines
drivers/gpu/drm/i915/display/intel_display.c +20 -0
+scaling_ratio_integer(int src_w, int dst_w, int src_h, int dst_h)
+{
+	/* Integer mode scaling is applicable only for upscaling scenarios */
+	if (dst_w < src_w || dst_h < src_h)
+		return false;
+
+	if (dst_w % src_w == 0 && dst_h % src_h == 0)
+		return true;
+
+	return false;
+}
+
 static int
 skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
 		  unsigned int scaler_user, int *scaler_id,
@@ -5422,6 +5435,14 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
 		return -EINVAL;
 	}
 
+	/*
+	 * If we are upscaling, and the scaling ratios are integer, we can
+	 * pick nearest-neighbour method in HW for scaling, which produces
+	 * blurless outputs in such scenarios.
+	 */
+	if (scaling_ratio_integer(src_w, dst_w, src_h, dst_h))
+		scaler_state->integer_scaling = true;
+
 	/*
 	 * if plane is being disabled or scaler is no more required or force detach
 	 *  - free scaler binded to this plane/crtc
drivers/gpu/drm/i915/display/intel_display_types.h +7 -0
index 3c1a5f3e1d22..6bb32fbf3153 100644
@@ -613,6 +613,13 @@ struct intel_crtc_scaler_state {
 
 	/* scaler used by crtc for panel fitting purpose */
 	int scaler_id;
+
+	/*
+	 * Nearest-neighbor method of upscaling gieves blurless output if
+	 * the upscaling ratio is a complete integer. This bool is to indicate
+	 * such an opportunity.
+	 */
+	bool integer_scaling;
 };
 
 /* drm_mode->private_flags */
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [RFC 1/2] drm/i915: Indicate integer up-scaling ratios

Quoted 25 lines · Jani Nikula
Quoted 24 lines · Shashank Sharma

If the upscaling ratio is a complete integer, Intel display HW can pickup special scaling mode, which can produce better non-blurry outputs. This patch adds a check to indicate if this is such an upscaling opportunity, while calculating the scaler config, and stores it into scaler state.

Cc Jani Nikula <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Vivi, Rodrigo <[email protected]>
---
  drivers/gpu/drm/i915/display/intel_display.c  | 21 +++++++++++++++++++
  .../drm/i915/display/intel_display_types.h    |  7 +++++++
  2 files changed, 28 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +0 -0
index ee54d9659c99..613130db3c05 100644
@@ -5388,6 +5388,19 @@ u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_cosited)
  #define SKL_MIN_YUV_420_SRC_W 16
  #define SKL_MIN_YUV_420_SRC_H 16
 
Quoted 3 lines

drivers/gpu/drm/i915/display/intel_display.c u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_cosited) · line 5391

Quoted 1 line
drivers/gpu/drm/i915/display/intel_display.c +1 -0
+static inline bool

Please don't add superfluous inlines to static functions in .c files. Let the compiler do its job.

Sure, got it !

Quoted 50 lines

BR,
Jani.

Quoted 47 lines
drivers/gpu/drm/i915/display/intel_display.c +20 -0
+scaling_ratio_integer(int src_w, int dst_w, int src_h, int dst_h)
+{
+	/* Integer mode scaling is applicable only for upscaling scenarios */
+	if (dst_w < src_w || dst_h < src_h)
+		return false;
+
+	if (dst_w % src_w == 0 && dst_h % src_h == 0)
+		return true;
+
+	return false;
+}
+
  static int
  skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
  		  unsigned int scaler_user, int *scaler_id,
@@ -5422,6 +5435,14 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
  		return -EINVAL;
  	}
 
+	/*
+	 * If we are upscaling, and the scaling ratios are integer, we can
+	 * pick nearest-neighbour method in HW for scaling, which produces
+	 * blurless outputs in such scenarios.
+	 */
+	if (scaling_ratio_integer(src_w, dst_w, src_h, dst_h))
+		scaler_state->integer_scaling = true;
+
  	/*
  	 * if plane is being disabled or scaler is no more required or force detach
  	 *  - free scaler binded to this plane/crtc
drivers/gpu/drm/i915/display/intel_display_types.h +7 -0
index 3c1a5f3e1d22..6bb32fbf3153 100644
@@ -613,6 +613,13 @@ struct intel_crtc_scaler_state {
 
  	/* scaler used by crtc for panel fitting purpose */
  	int scaler_id;
+
+	/*
+	 * Nearest-neighbor method of upscaling gieves blurless output if
+	 * the upscaling ratio is a complete integer. This bool is to indicate
+	 * such an opportunity.
+	 */
+	bool integer_scaling;
  };
 
Quoted 1 line

drivers/gpu/drm/i915/display/intel_display_types.h struct intel_crtc_scaler_state { · line 625

Quoted 1 line
drivers/gpu/drm/i915/display/intel_display_types.h +0 -0
  /* drm_mode->private_flags */

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Re: [RFC 1/2] drm/i915: Indicate integer up-scaling ratios

In reply to Shashank Sharma
Quoted 21 lines · Shashank Sharma

If the upscaling ratio is a complete integer, Intel display HW can pickup special scaling mode, which can produce better non-blurry outputs. This patch adds a check to indicate if this is such an upscaling opportunity, while calculating the scaler config, and stores it into scaler state.

Cc Jani Nikula <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Vivi, Rodrigo <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c  | 21 +++++++++++++++++++
 .../drm/i915/display/intel_display_types.h    |  7 +++++++
 2 files changed, 28 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +0 -0
index ee54d9659c99..613130db3c05 100644

drivers/gpu/drm/i915/display/intel_display.c u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_cosited) · line 5392

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
@@ -5388,6 +5388,19 @@ u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_cosited)
 #define SKL_MIN_YUV_420_SRC_W 16
 #define SKL_MIN_YUV_420_SRC_H 16
 
+static inline bool
+scaling_ratio_integer(int src_w, int dst_w, int src_h, int dst_h)

Just a suggestion: scaling_ratio_is_integer() might sound better here!?

Quoted 34 lines
drivers/gpu/drm/i915/display/intel_display.c +19 -0
+{
+	/* Integer mode scaling is applicable only for upscaling scenarios */
+	if (dst_w < src_w || dst_h < src_h)
+		return false;
+
+	if (dst_w % src_w == 0 && dst_h % src_h == 0)
+		return true;
+
+	return false;
+}
+
 static int
 skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
 		  unsigned int scaler_user, int *scaler_id,
@@ -5422,6 +5435,14 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
 		return -EINVAL;
 	}
 
+	/*
+	 * If we are upscaling, and the scaling ratios are integer, we can
+	 * pick nearest-neighbour method in HW for scaling, which produces
+	 * blurless outputs in such scenarios.
+	 */
+	if (scaling_ratio_integer(src_w, dst_w, src_h, dst_h))
+		scaler_state->integer_scaling = true;
+
 	/*
 	 * if plane is being disabled or scaler is no more required or force detach
 	 *  - free scaler binded to this plane/crtc
drivers/gpu/drm/i915/display/intel_display_types.h +0 -0
index 3c1a5f3e1d22..6bb32fbf3153 100644

drivers/gpu/drm/i915/display/intel_display_types.h struct intel_crtc_scaler_state { · line 618

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display_types.h +3 -0
@@ -613,6 +613,13 @@ struct intel_crtc_scaler_state {
 
 	/* scaler used by crtc for panel fitting purpose */
 	int scaler_id;
+
+	/*
+	 * Nearest-neighbor method of upscaling gieves blurless output if

Typo: Gives.

-Ram

Quoted 14 lines
drivers/gpu/drm/i915/display/intel_display_types.h +4 -0
+	 * the upscaling ratio is a complete integer. This bool is to indicate
+	 * such an opportunity.
+	 */
+	bool integer_scaling;
 };
 
 /* drm_mode->private_flags */
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

Re: [RFC 1/2] drm/i915: Indicate integer up-scaling ratios

Quoted 25 lines · Ramalingam C
Quoted 24 lines · Shashank Sharma

If the upscaling ratio is a complete integer, Intel display HW can pickup special scaling mode, which can produce better non-blurry outputs. This patch adds a check to indicate if this is such an upscaling opportunity, while calculating the scaler config, and stores it into scaler state.

Cc Jani Nikula <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Vivi, Rodrigo <[email protected]>
---
  drivers/gpu/drm/i915/display/intel_display.c  | 21 +++++++++++++++++++
  .../drm/i915/display/intel_display_types.h    |  7 +++++++
  2 files changed, 28 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +0 -0
index ee54d9659c99..613130db3c05 100644
@@ -5388,6 +5388,19 @@ u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_cosited)
  #define SKL_MIN_YUV_420_SRC_W 16
  #define SKL_MIN_YUV_420_SRC_H 16
 
Quoted 3 lines

drivers/gpu/drm/i915/display/intel_display.c u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_cosited) · line 5392

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
+static inline bool
+scaling_ratio_integer(int src_w, int dst_w, int src_h, int dst_h)

Just a suggestion: scaling_ratio_is_integer() might sound better here!?

Agree, certainly sounds better.

Quoted 35 lines
Quoted 35 lines
drivers/gpu/drm/i915/display/intel_display.c +19 -0
+{
+	/* Integer mode scaling is applicable only for upscaling scenarios */
+	if (dst_w < src_w || dst_h < src_h)
+		return false;
+
+	if (dst_w % src_w == 0 && dst_h % src_h == 0)
+		return true;
+
+	return false;
+}
+
  static int
  skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
  		  unsigned int scaler_user, int *scaler_id,
@@ -5422,6 +5435,14 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
  		return -EINVAL;
  	}
 
+	/*
+	 * If we are upscaling, and the scaling ratios are integer, we can
+	 * pick nearest-neighbour method in HW for scaling, which produces
+	 * blurless outputs in such scenarios.
+	 */
+	if (scaling_ratio_integer(src_w, dst_w, src_h, dst_h))
+		scaler_state->integer_scaling = true;
+
  	/*
  	 * if plane is being disabled or scaler is no more required or force detach
  	 *  - free scaler binded to this plane/crtc
drivers/gpu/drm/i915/display/intel_display_types.h +0 -0
index 3c1a5f3e1d22..6bb32fbf3153 100644
@@ -613,6 +613,13 @@ struct intel_crtc_scaler_state {
 
Quoted 6 lines

drivers/gpu/drm/i915/display/intel_display_types.h struct intel_crtc_scaler_state { · line 618

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display_types.h +3 -0
  	/* scaler used by crtc for panel fitting purpose */
  	int scaler_id;
+
+	/*
+	 * Nearest-neighbor method of upscaling gieves blurless output if

Typo: Gives.

got it.

Quoted 8 lines

-Ram

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_display_types.h +4 -0
+	 * the upscaling ratio is a complete integer. This bool is to indicate
+	 * such an opportunity.
+	 */
+	bool integer_scaling;
  };
 
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/display/intel_display_types.h +0 -0
  /* drm_mode->private_flags */
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

RFC 2/2 drm/i915: Pick nearest-neighbor mode for integer scaling ratios

In reply to Shashank Sharma

Nearest-neighbor, is a new scaling mode, introduced in GEN11 display HW. Nearest-neighbor results in blurless outputs, when upscaling ratio is a complete integer ratio like:

- upscaling from 1280x720(HD) to 3840x2160(UHD/4K) horizontal upscaling factor = 3840/1280 = 3 vertical upscaling factor = 2160/720 = 3

This is an example of a scenario with integer scaling ratios, and if we can pick nearest-neighbor mode scaling in display, it can produce sharp and non-blurry output, compared to the default scaling mode selected by I915 ("medium").

PS: NN has been introduced from GEN11 display HW only.

Cc Jani Nikula <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Vivi, Rodrigo <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 81 +++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h              | 31 ++++++++
 2 files changed, 111 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_display.c +80 -1
index 613130db3c05..9808797a92d9 100644
@@ -5613,6 +5613,74 @@ static void skylake_scaler_disable(struct intel_crtc *crtc)
 		skl_detach_scaler(crtc, i);
 }
 
+static void
+icl_setup_nearest_neighbor_mode(const struct intel_crtc_state *crtc_state)
+{
+	int count;
+	int phase;
+	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
+	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
+	int scaler_id = crtc_state->scaler_state.scaler_id;
+	enum pipe pipe = crtc->pipe;
+
+	/*
+	 * To setup nearest-neighbor integer scaling mode:
+	 * Write 60 dwords: represnting 119 coefficients.
+	 *
+	 * Seven basic Coefficients are named from An......Gn.
+	 * Value of every D'th coefficent must be 1, all others to be 0.
+	 *
+	 * 17 such phases of 7 such coefficients = 119 coefficients.
+	 * Arrange these 119 coefficients in 60 dwords, 2 coefficient
+	 * per dword, in the sequence shown below:
+	 *
+	 *+------------+--------------+
+	 *|     B0     |      A0      |
+	 *+---------------------------+
+	 *|    D0 = 1  |      C0      |
+	 *+---------------------------+
+	 *|     F0     |      E0      |
+	 *+---------------------------+
+	 *|     A1     |      G0      |
+	 *+---------------------------+
+	 *|     C1     |      B1      |
+	 *+---------------------------+
+	 *|     E1     |      D1 = 1  |
+	 *+---------------------------+
+	 *|    .....   |     .....    |
+	 *+---------------------------+
+	 *|    ......  |     ......   |
+	 *+---------------------------+
+	 *|    Res     |      G16     |
+	 *+------------+--------------+
+	 *
+	 */
+
+	for (phase = 0; phase < 17; phase++) {
+		for (count = 0; count < 7; count++) {
+			u32 val = 0;
+
+			/* Every D'th entry needs to be 1 */
+			if (count == 3) {
+				if (phase % 2)
+					val = 1;
+				else
+					val = (1 << 16);
+			}
+
+			I915_WRITE_FW(SKL_PS_COEF_INDEX_SET0(pipe, scaler_id),
+				      phase * 17 + count);
+			I915_WRITE_FW(SKL_PS_COEF_DATA_SET0(pipe, scaler_id),
+				      val);
+
+			I915_WRITE_FW(SKL_PS_COEF_INDEX_SET1(pipe, scaler_id),
+				      phase * 17 + count);
+			I915_WRITE_FW(SKL_PS_COEF_DATA_SET1(pipe, scaler_id),
+				      val);
+		}
+	}
+}
+
 static void skylake_pfit_enable(const struct intel_crtc_state *crtc_state)
 {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
@@ -5623,6 +5691,7 @@ static void skylake_pfit_enable(const struct intel_crtc_state *crtc_state)
 
 	if (crtc_state->pch_pfit.enabled) {
 		u16 uv_rgb_hphase, uv_rgb_vphase;
+		u32 scaler_mode = PS_FILTER_MEDIUM;
 		int pfit_w, pfit_h, hscale, vscale;
 		int id;
 
@@ -5638,9 +5707,19 @@ static void skylake_pfit_enable(const struct intel_crtc_state *crtc_state)
 		uv_rgb_hphase = skl_scaler_calc_phase(1, hscale, false);
 		uv_rgb_vphase = skl_scaler_calc_phase(1, vscale, false);
 
+		/*
+		 * Pick nearest-neighbor scaler mode over medium, if scaling
+		 * is happening at integer ratios.
+		 */
+		if (INTEL_GEN(dev_priv) >= 11 &&
+		    scaler_state->integer_scaling) {
+			scaler_mode = PS_FILTER_PROGRAMMED;
+			icl_setup_nearest_neighbor_mode(crtc_state);
+		}
+
 		id = scaler_state->scaler_id;
 		I915_WRITE(SKL_PS_CTRL(pipe, id), PS_SCALER_EN |
-			PS_FILTER_MEDIUM | scaler_state->scalers[id].mode);
+			scaler_mode | scaler_state->scalers[id].mode);
 		I915_WRITE_FW(SKL_PS_VPHASE(pipe, id),
 			      PS_Y_PHASE(0) | PS_UV_RGB_PHASE(uv_rgb_vphase));
 		I915_WRITE_FW(SKL_PS_HPHASE(pipe, id),
drivers/gpu/drm/i915/i915_reg.h +31 -0
index ea2f0fa2402d..42fdff3bbf29 100644
@@ -7062,6 +7062,7 @@ enum {
 #define PS_PLANE_SEL(plane) (((plane) + 1) << 25)
 #define PS_FILTER_MASK         (3 << 23)
 #define PS_FILTER_MEDIUM       (0 << 23)
+#define PS_FILTER_PROGRAMMED   (1 << 23)
 #define PS_FILTER_EDGE_ENHANCE (2 << 23)
 #define PS_FILTER_BILINEAR     (3 << 23)
 #define PS_VERT3TAP            (1 << 21)
@@ -7138,6 +7139,24 @@ enum {
 #define _PS_ECC_STAT_2B     0x68AD0
 #define _PS_ECC_STAT_1C     0x691D0
 
+#define _PS_COEF_SET0_INDEX_1A     0x68198
+#define _PS_COEF_SET0_INDEX_2A     0x68298
+#define _PS_COEF_SET0_INDEX_1B     0x68998
+#define _PS_COEF_SET0_INDEX_2B     0x68A98
+#define _PS_COEF_SET1_INDEX_1A     0x681A0
+#define _PS_COEF_SET1_INDEX_2A     0x682A0
+#define _PS_COEF_SET1_INDEX_1B     0x689A0
+#define _PS_COEF_SET1_INDEX_2B     0x68AA0
+
+#define _PS_COEF_SET0_DATA_1A     0x6819C
+#define _PS_COEF_SET0_DATA_2A     0x6829C
+#define _PS_COEF_SET0_DATA_1B     0x6899C
+#define _PS_COEF_SET0_DATA_2B     0x68A9C
+#define _PS_COEF_SET1_DATA_1A     0x681A4
+#define _PS_COEF_SET1_DATA_2A     0x682A4
+#define _PS_COEF_SET1_DATA_1B     0x689A4
+#define _PS_COEF_SET1_DATA_2B     0x68AA4
+
 #define _ID(id, a, b) _PICK_EVEN(id, a, b)
 #define SKL_PS_CTRL(pipe, id) _MMIO_PIPE(pipe,        \
 			_ID(id, _PS_1A_CTRL, _PS_2A_CTRL),       \
@@ -7166,6 +7185,18 @@ enum {
 #define SKL_PS_ECC_STAT(pipe, id)  _MMIO_PIPE(pipe,     \
 			_ID(id, _PS_ECC_STAT_1A, _PS_ECC_STAT_2A),   \
 			_ID(id, _PS_ECC_STAT_1B, _PS_ECC_STAT_2B))
+#define SKL_PS_COEF_DATA_SET0(pipe, id)  _MMIO_PIPE(pipe,     \
+			_ID(id, _PS_COEF_SET0_DATA_1A, _PS_COEF_SET0_DATA_2A), \
+			_ID(id, _PS_COEF_SET0_DATA_1B, _PS_COEF_SET0_DATA_1B))
+#define SKL_PS_COEF_DATA_SET1(pipe, id)  _MMIO_PIPE(pipe,     \
+			_ID(id, _PS_COEF_SET1_DATA_1A, _PS_COEF_SET1_DATA_2A), \
+			_ID(id, _PS_COEF_SET1_DATA_1B, _PS_COEF_SET1_DATA_1B))
+#define SKL_PS_COEF_INDEX_SET0(pipe, id)  _MMIO_PIPE(pipe,     \
+			_ID(id, _PS_COEF_SET0_INDEX_1A, _PS_COEF_SET0_INDEX_2A), \
+			_ID(id, _PS_COEF_SET0_INDEX_1B, _PS_COEF_SET0_INDEX_1B))
+#define SKL_PS_COEF_INDEX_SET1(pipe, id)  _MMIO_PIPE(pipe,     \
+			_ID(id, _PS_COEF_SET1_INDEX_1A, _PS_COEF_SET1_INDEX_2A), \
+			_ID(id, _PS_COEF_SET1_INDEX_1B, _PS_COEF_SET1_INDEX_1B))
 
 /* legacy palette */
 #define _LGC_PALETTE_A           0x4a000
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [RFC 2/2] drm/i915: Pick nearest-neighbor mode for integer scaling ratios

Quoted 87 lines · Shashank Sharma

Nearest-neighbor, is a new scaling mode, introduced in GEN11 display HW. Nearest-neighbor results in blurless outputs, when upscaling ratio is a complete integer ratio like:

- upscaling from 1280x720(HD) to 3840x2160(UHD/4K) horizontal upscaling factor = 3840/1280 = 3 vertical upscaling factor = 2160/720 = 3

This is an example of a scenario with integer scaling ratios, and if we can pick nearest-neighbor mode scaling in display, it can produce sharp and non-blurry output, compared to the default scaling mode selected by I915 ("medium").

PS: NN has been introduced from GEN11 display HW only.

Cc Jani Nikula <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Vivi, Rodrigo <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 81 +++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h              | 31 ++++++++
 2 files changed, 111 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_display.c +54 -0
index 613130db3c05..9808797a92d9 100644
@@ -5613,6 +5613,74 @@ static void skylake_scaler_disable(struct intel_crtc *crtc)
 		skl_detach_scaler(crtc, i);
 }
 
+static void
+icl_setup_nearest_neighbor_mode(const struct intel_crtc_state *crtc_state)
+{
+	int count;
+	int phase;
+	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
+	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
+	int scaler_id = crtc_state->scaler_state.scaler_id;
+	enum pipe pipe = crtc->pipe;
+
+	/*
+	 * To setup nearest-neighbor integer scaling mode:
+	 * Write 60 dwords: represnting 119 coefficients.
+	 *
+	 * Seven basic Coefficients are named from An......Gn.
+	 * Value of every D'th coefficent must be 1, all others to be 0.
+	 *
+	 * 17 such phases of 7 such coefficients = 119 coefficients.
+	 * Arrange these 119 coefficients in 60 dwords, 2 coefficient
+	 * per dword, in the sequence shown below:
+	 *
+	 *+------------+--------------+
+	 *|     B0     |      A0      |
+	 *+---------------------------+
+	 *|    D0 = 1  |      C0      |
+	 *+---------------------------+
+	 *|     F0     |      E0      |
+	 *+---------------------------+
+	 *|     A1     |      G0      |
+	 *+---------------------------+
+	 *|     C1     |      B1      |
+	 *+---------------------------+
+	 *|     E1     |      D1 = 1  |
+	 *+---------------------------+
+	 *|    .....   |     .....    |
+	 *+---------------------------+
+	 *|    ......  |     ......   |
+	 *+---------------------------+
+	 *|    Res     |      G16     |
+	 *+------------+--------------+
+	 *
+	 */
+
+	for (phase = 0; phase < 17; phase++) {
+		for (count = 0; count < 7; count++) {
+			u32 val = 0;
+
+			/* Every D'th entry needs to be 1 */
+			if (count == 3) {
+				if (phase % 2)
+					val = 1;
+				else
+					val = (1 << 16);
+			}

drivers/gpu/drm/i915/display/intel_display.c static void skylake_scaler_disable(struct intel_crtc *crtc) · line 5679

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display.c +10 -0
+
+			I915_WRITE_FW(SKL_PS_COEF_INDEX_SET0(pipe, scaler_id),
+				      phase * 17 + count);
+			I915_WRITE_FW(SKL_PS_COEF_DATA_SET0(pipe, scaler_id),
+				      val);
+
+			I915_WRITE_FW(SKL_PS_COEF_INDEX_SET1(pipe, scaler_id),
+				      phase * 17 + count);
+			I915_WRITE_FW(SKL_PS_COEF_DATA_SET1(pipe, scaler_id),
+				      val);

Shouldn't we take the 16 MSBites of val here? Am I missing something in macro!

-Ram

Quoted 99 lines
drivers/gpu/drm/i915/display/intel_display.c +16 -1
+		}
+	}
+}
+
 static void skylake_pfit_enable(const struct intel_crtc_state *crtc_state)
 {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
@@ -5623,6 +5691,7 @@ static void skylake_pfit_enable(const struct intel_crtc_state *crtc_state)
 
 	if (crtc_state->pch_pfit.enabled) {
 		u16 uv_rgb_hphase, uv_rgb_vphase;
+		u32 scaler_mode = PS_FILTER_MEDIUM;
 		int pfit_w, pfit_h, hscale, vscale;
 		int id;
 
@@ -5638,9 +5707,19 @@ static void skylake_pfit_enable(const struct intel_crtc_state *crtc_state)
 		uv_rgb_hphase = skl_scaler_calc_phase(1, hscale, false);
 		uv_rgb_vphase = skl_scaler_calc_phase(1, vscale, false);
 
+		/*
+		 * Pick nearest-neighbor scaler mode over medium, if scaling
+		 * is happening at integer ratios.
+		 */
+		if (INTEL_GEN(dev_priv) >= 11 &&
+		    scaler_state->integer_scaling) {
+			scaler_mode = PS_FILTER_PROGRAMMED;
+			icl_setup_nearest_neighbor_mode(crtc_state);
+		}
+
 		id = scaler_state->scaler_id;
 		I915_WRITE(SKL_PS_CTRL(pipe, id), PS_SCALER_EN |
-			PS_FILTER_MEDIUM | scaler_state->scalers[id].mode);
+			scaler_mode | scaler_state->scalers[id].mode);
 		I915_WRITE_FW(SKL_PS_VPHASE(pipe, id),
 			      PS_Y_PHASE(0) | PS_UV_RGB_PHASE(uv_rgb_vphase));
 		I915_WRITE_FW(SKL_PS_HPHASE(pipe, id),
drivers/gpu/drm/i915/i915_reg.h +31 -0
index ea2f0fa2402d..42fdff3bbf29 100644
@@ -7062,6 +7062,7 @@ enum {
 #define PS_PLANE_SEL(plane) (((plane) + 1) << 25)
 #define PS_FILTER_MASK         (3 << 23)
 #define PS_FILTER_MEDIUM       (0 << 23)
+#define PS_FILTER_PROGRAMMED   (1 << 23)
 #define PS_FILTER_EDGE_ENHANCE (2 << 23)
 #define PS_FILTER_BILINEAR     (3 << 23)
 #define PS_VERT3TAP            (1 << 21)
@@ -7138,6 +7139,24 @@ enum {
 #define _PS_ECC_STAT_2B     0x68AD0
 #define _PS_ECC_STAT_1C     0x691D0
 
+#define _PS_COEF_SET0_INDEX_1A     0x68198
+#define _PS_COEF_SET0_INDEX_2A     0x68298
+#define _PS_COEF_SET0_INDEX_1B     0x68998
+#define _PS_COEF_SET0_INDEX_2B     0x68A98
+#define _PS_COEF_SET1_INDEX_1A     0x681A0
+#define _PS_COEF_SET1_INDEX_2A     0x682A0
+#define _PS_COEF_SET1_INDEX_1B     0x689A0
+#define _PS_COEF_SET1_INDEX_2B     0x68AA0
+
+#define _PS_COEF_SET0_DATA_1A     0x6819C
+#define _PS_COEF_SET0_DATA_2A     0x6829C
+#define _PS_COEF_SET0_DATA_1B     0x6899C
+#define _PS_COEF_SET0_DATA_2B     0x68A9C
+#define _PS_COEF_SET1_DATA_1A     0x681A4
+#define _PS_COEF_SET1_DATA_2A     0x682A4
+#define _PS_COEF_SET1_DATA_1B     0x689A4
+#define _PS_COEF_SET1_DATA_2B     0x68AA4
+
 #define _ID(id, a, b) _PICK_EVEN(id, a, b)
 #define SKL_PS_CTRL(pipe, id) _MMIO_PIPE(pipe,        \
 			_ID(id, _PS_1A_CTRL, _PS_2A_CTRL),       \
@@ -7166,6 +7185,18 @@ enum {
 #define SKL_PS_ECC_STAT(pipe, id)  _MMIO_PIPE(pipe,     \
 			_ID(id, _PS_ECC_STAT_1A, _PS_ECC_STAT_2A),   \
 			_ID(id, _PS_ECC_STAT_1B, _PS_ECC_STAT_2B))
+#define SKL_PS_COEF_DATA_SET0(pipe, id)  _MMIO_PIPE(pipe,     \
+			_ID(id, _PS_COEF_SET0_DATA_1A, _PS_COEF_SET0_DATA_2A), \
+			_ID(id, _PS_COEF_SET0_DATA_1B, _PS_COEF_SET0_DATA_1B))
+#define SKL_PS_COEF_DATA_SET1(pipe, id)  _MMIO_PIPE(pipe,     \
+			_ID(id, _PS_COEF_SET1_DATA_1A, _PS_COEF_SET1_DATA_2A), \
+			_ID(id, _PS_COEF_SET1_DATA_1B, _PS_COEF_SET1_DATA_1B))
+#define SKL_PS_COEF_INDEX_SET0(pipe, id)  _MMIO_PIPE(pipe,     \
+			_ID(id, _PS_COEF_SET0_INDEX_1A, _PS_COEF_SET0_INDEX_2A), \
+			_ID(id, _PS_COEF_SET0_INDEX_1B, _PS_COEF_SET0_INDEX_1B))
+#define SKL_PS_COEF_INDEX_SET1(pipe, id)  _MMIO_PIPE(pipe,     \
+			_ID(id, _PS_COEF_SET1_INDEX_1A, _PS_COEF_SET1_INDEX_2A), \
+			_ID(id, _PS_COEF_SET1_INDEX_1B, _PS_COEF_SET1_INDEX_1B))
 
 /* legacy palette */
 #define _LGC_PALETTE_A           0x4a000
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

✗ Fi.CI.CHECKPATCH: warning for Enable Nearest-neighbor for Integer mode scaling

In reply to Shashank Sharma
== Series Details ==

== Series Details ==

Series: Enable Nearest-neighbor for Integer mode scaling
URL : https://patchwork.freedesktop.org/series/66175/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
705e07a4f105 drm/i915: Indicate integer up-scaling ratios
d3324b2f0df9 drm/i915: Pick nearest-neighbor mode for integer scaling ratios
-:180: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'id' - possible side-effects?
#180: FILE: drivers/gpu/drm/i915/i915_reg.h:7210:
+#define SKL_PS_COEF_DATA_SET0(pipe, id)  _MMIO_PIPE(pipe,     \
+			_ID(id, _PS_COEF_SET0_DATA_1A, _PS_COEF_SET0_DATA_2A), \
+			_ID(id, _PS_COEF_SET0_DATA_1B, _PS_COEF_SET0_DATA_1B))

-:183: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'id' - possible side-effects? #183: FILE: drivers/gpu/drm/i915/i915_reg.h:7213:
+#define SKL_PS_COEF_DATA_SET1(pipe, id) _MMIO_PIPE(pipe, \
+ _ID(id, _PS_COEF_SET1_DATA_1A, _PS_COEF_SET1_DATA_2A), \
+ _ID(id, _PS_COEF_SET1_DATA_1B, _PS_COEF_SET1_DATA_1B))

-:186: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'id' - possible side-effects? #186: FILE: drivers/gpu/drm/i915/i915_reg.h:7216:
+#define SKL_PS_COEF_INDEX_SET0(pipe, id) _MMIO_PIPE(pipe, \
+ _ID(id, _PS_COEF_SET0_INDEX_1A, _PS_COEF_SET0_INDEX_2A), \
+ _ID(id, _PS_COEF_SET0_INDEX_1B, _PS_COEF_SET0_INDEX_1B))

-:189: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'id' - possible side-effects? #189: FILE: drivers/gpu/drm/i915/i915_reg.h:7219:
+#define SKL_PS_COEF_INDEX_SET1(pipe, id) _MMIO_PIPE(pipe, \
+ _ID(id, _PS_COEF_SET1_INDEX_1A, _PS_COEF_SET1_INDEX_2A), \
+ _ID(id, _PS_COEF_SET1_INDEX_1B, _PS_COEF_SET1_INDEX_1B))

total: 0 errors, 0 warnings, 4 checks, 150 lines checked

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw
In reply to Shashank Sharma
Quoted 24 lines · Shashank Sharma

Blurry outputs during upscaling the buffer, is a generic problem of gfx industry. One of the major reason behind this blurriness is the interpolation of pixel values used by most of the upscaling hardwares.

Nearest-neighbor is a scaling mode, which works by filling in the missing color values in the upscaled image with that of the coordinate-mapped nearest source pixel value.

Nearest-neighbor can produce (almost) non-blurry scaling outputs when the scaling ratio is complete integer. For example:
- input buffer resolution: 1280x720(HD)
- output buffer resolution: 3840x2160(UHD/4K)
- scaling ratio (h) = 3840/1280 = 3
scaling ratio (v) = 2160/720 = 3
In such scenarios, we should try to pick Nearest-neighbor as scaling method when possible.

Many gaming communities have been asking for integer-mode scaling support, some links and background:
https://software.intel.com/en-us/articles/integer-scaling-support-on-intel-graphics
http://tanalin.com/en/articles/lossless-scaling/
https://community.amd.com/thread/209107
https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/1002/feature-request-nonblurry-upscaling-at-integer-rat/

Quoted 2 lines

This patch series enables NN scaling on Intel display (ICL), when the upscaling ratio is integer.

I think we'd probably want a property for this sort of stuff. igt could perhaps also use it to enable crc based scaling tests.

Another problem is that we currently don't expose the panel fitter for external displays so this would be limited to eDP/DSI only. I have a branch that implements borders (for underscan) for DP/HDMI which is at least moving the code a little bit into a direction where we could consider exposing the panel fitter for external displays.

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

Hello Ville,

Quoted 25 lines · Ville Syrjälä
Quoted 24 lines · Shashank Sharma

Blurry outputs during upscaling the buffer, is a generic problem of gfx industry. One of the major reason behind this blurriness is the interpolation of pixel values used by most of the upscaling hardwares.

Nearest-neighbor is a scaling mode, which works by filling in the missing color values in the upscaled image with that of the coordinate-mapped nearest source pixel value.

Nearest-neighbor can produce (almost) non-blurry scaling outputs when the scaling ratio is complete integer. For example:
- input buffer resolution: 1280x720(HD)
- output buffer resolution: 3840x2160(UHD/4K)
- scaling ratio (h) = 3840/1280 = 3
scaling ratio (v) = 2160/720 = 3
In such scenarios, we should try to pick Nearest-neighbor as scaling method when possible.

Many gaming communities have been asking for integer-mode scaling support, some links and background:
https://software.intel.com/en-us/articles/integer-scaling-support-on-intel-graphics
http://tanalin.com/en/articles/lossless-scaling/
https://community.amd.com/thread/209107
https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/1002/feature-request-nonblurry-upscaling-at-integer-rat/

Quoted 4 lines
Quoted 2 lines

This patch series enables NN scaling on Intel display (ICL), when the upscaling ratio is integer.

I think we'd probably want a property for this sort of stuff. igt could perhaps also use it to enable crc based scaling tests.

I was initially planning to attach this to scaling mode property, probably create a new option in there called "Integer mode scaling" or we can use the "maintain aspect ratio" sub-option too. Do you think it would make sense ? Or should we create a new property altogether ?

Quoted 5 lines

Another problem is that we currently don't expose the panel fitter for external displays so this would be limited to eDP/DSI only. I have a branch that implements borders (for underscan) for DP/HDMI which is at least moving the code a little bit into a direction where we could consider exposing the panel fitter for external displays.

This would be very interesting, do you have any plans to publish this soon ?

- Shashank

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw
Quoted 28 lines · Shashank

Hello Ville,

Quoted 25 lines · Ville Syrjälä
Quoted 24 lines · Shashank Sharma

Blurry outputs during upscaling the buffer, is a generic problem of gfx industry. One of the major reason behind this blurriness is the interpolation of pixel values used by most of the upscaling hardwares.

Nearest-neighbor is a scaling mode, which works by filling in the missing color values in the upscaled image with that of the coordinate-mapped nearest source pixel value.

Nearest-neighbor can produce (almost) non-blurry scaling outputs when the scaling ratio is complete integer. For example:
- input buffer resolution: 1280x720(HD)
- output buffer resolution: 3840x2160(UHD/4K)
- scaling ratio (h) = 3840/1280 = 3
scaling ratio (v) = 2160/720 = 3
In such scenarios, we should try to pick Nearest-neighbor as scaling method when possible.

Many gaming communities have been asking for integer-mode scaling support, some links and background:
https://software.intel.com/en-us/articles/integer-scaling-support-on-intel-graphics
http://tanalin.com/en/articles/lossless-scaling/
https://community.amd.com/thread/209107
https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/1002/feature-request-nonblurry-upscaling-at-integer-rat/

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

This patch series enables NN scaling on Intel display (ICL), when the upscaling ratio is integer.

I think we'd probably want a property for this sort of stuff. igt could perhaps also use it to enable crc based scaling tests.

I was initially planning to attach this to scaling mode property, probably create a new option in there called "Integer mode scaling" or we can use the "maintain aspect ratio" sub-option too. Do you think it would make sense ? Or should we create a new property altogether ?

I was thinking a new prop. It would also expose the possibility of adding even more filter/window functions. Maybe someone wants a linear filter for instance.

Quoted 7 lines
Quoted 5 lines

Another problem is that we currently don't expose the panel fitter for external displays so this would be limited to eDP/DSI only. I have a branch that implements borders (for underscan) for DP/HDMI which is at least moving the code a little bit into a direction where we could consider exposing the panel fitter for external displays.

This would be very interesting, do you have any plans to publish this soon ?

I can send it out. Been hanging on to it because there's other pending stuff on the list as well, but a few more patches probably won't hurt :)

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw
Quoted 33 lines · Ville Syrjälä
Quoted 32 lines · Shashank

Hello Ville,

Quoted 29 lines · Ville Syrjälä
Quoted 24 lines · Shashank Sharma

Blurry outputs during upscaling the buffer, is a generic problem of gfx industry. One of the major reason behind this blurriness is the interpolation of pixel values used by most of the upscaling hardwares.

Nearest-neighbor is a scaling mode, which works by filling in the missing color values in the upscaled image with that of the coordinate-mapped nearest source pixel value.

Nearest-neighbor can produce (almost) non-blurry scaling outputs when the scaling ratio is complete integer. For example:
- input buffer resolution: 1280x720(HD)
- output buffer resolution: 3840x2160(UHD/4K)
- scaling ratio (h) = 3840/1280 = 3

    scaling ratio (v) = 2160/720 = 3

In such scenarios, we should try to pick Nearest-neighbor as scaling method when possible.

Many gaming communities have been asking for integer-mode scaling support, some links and background:
https://software.intel.com/en-us/articles/integer-scaling-support-on-intel-graphics
http://tanalin.com/en/articles/lossless-scaling/
https://community.amd.com/thread/209107
https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/1002/feature-request-nonblurry-upscaling-at-integer-rat/

Quoted 2 lines

This patch series enables NN scaling on Intel display (ICL), when the upscaling ratio is integer.

I think we'd probably want a property for this sort of stuff. igt could perhaps also use it to enable crc based scaling tests.

Quoted 7 lines
Quoted 4 lines

I was initially planning to attach this to scaling mode property, probably create a new option in there called "Integer mode scaling" or we can use the "maintain aspect ratio" sub-option too. Do you think it would make sense ? Or should we create a new property altogether ?

I was thinking a new prop. It would also expose the possibility of adding even more filter/window functions. Maybe someone wants a linear filter for instance.

Sounds good.

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

Another problem is that we currently don't expose the panel fitter for external displays so this would be limited to eDP/DSI only. I have a branch that implements borders (for underscan) for DP/HDMI which is at least moving the code a little bit into a direction where we could consider exposing the panel fitter for external displays.

This would be very interesting, do you have any plans to publish this soon ?

I can send it out. Been hanging on to it because there's other pending stuff on the list as well, but a few more patches probably won't hurt :)

Looking forward to it, then :)

- Shashank

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#13 lore raw

✗ Fi.CI.BAT: failure for Enable Nearest-neighbor for Integer mode scaling

In reply to Shashank Sharma
== Series Details ==

== Series Details ==

Series: Enable Nearest-neighbor for Integer mode scaling
URL : https://patchwork.freedesktop.org/series/66175/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_6828 -> Patchwork_14267
====================================================

Summary
-------

**FAILURE**

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

If you think the reported changes have nothing to do with the changes introduced in Patchwork_14267, please notify your bug team 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_14267/

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

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

### IGT changes ###

#### Possible regressions ####

* igt@gem_exec_suspend@basic-s3:
- fi-kbl-r: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-kbl-r/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-kbl-r/igt@[email protected]
- fi-whl-u: [PASS][3] -> [INCOMPLETE][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-whl-u/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-whl-u/igt@[email protected]
- fi-kbl-x1275: [PASS][5] -> [INCOMPLETE][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-kbl-x1275/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-kbl-x1275/igt@[email protected]
- fi-kbl-7500u: [PASS][7] -> [INCOMPLETE][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-kbl-7500u/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-kbl-7500u/igt@[email protected]

* igt@kms_busy@basic-flip-a:
- fi-skl-6700k2: [PASS][9] -> [INCOMPLETE][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-skl-6700k2/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-skl-6700k2/igt@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@core_auth@basic-auth:
- fi-icl-u3: [PASS][11] -> [DMESG-WARN][12] ([fdo#107724])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-icl-u3/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-icl-u3/igt@[email protected]

* igt@gem_exec_suspend@basic-s3:
- fi-skl-6770hq: [PASS][13] -> [INCOMPLETE][14] ([fdo#104108])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-skl-6770hq/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-skl-6770hq/igt@[email protected]
- fi-cfl-8109u: [PASS][15] -> [INCOMPLETE][16] ([fdo#108126])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-cfl-8109u/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-cfl-8109u/igt@[email protected]
- fi-skl-lmem: [PASS][17] -> [INCOMPLETE][18] ([fdo#104108])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-skl-lmem/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-skl-lmem/igt@[email protected]
- fi-skl-6260u: [PASS][19] -> [INCOMPLETE][20] ([fdo#104108])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-skl-6260u/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-skl-6260u/igt@[email protected]
- fi-cfl-guc: [PASS][21] -> [INCOMPLETE][22] ([fdo#108126] / [fdo#108743])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-cfl-guc/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-cfl-guc/igt@[email protected]
- fi-skl-iommu: [PASS][23] -> [INCOMPLETE][24] ([fdo#104108])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-skl-iommu/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-skl-iommu/igt@[email protected]
- fi-skl-guc: [PASS][25] -> [INCOMPLETE][26] ([fdo#104108] / [fdo#108743])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-skl-guc/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-skl-guc/igt@[email protected]
- fi-glk-dsi: [PASS][27] -> [INCOMPLETE][28] ([fdo#103359] / [k.org#198133])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-glk-dsi/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-glk-dsi/igt@[email protected]
- fi-cfl-8700k: [PASS][29] -> [INCOMPLETE][30] ([fdo#108126])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-cfl-8700k/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-cfl-8700k/igt@[email protected]
- fi-kbl-guc: [PASS][31] -> [INCOMPLETE][32] ([fdo#108743])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-kbl-guc/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-kbl-guc/igt@[email protected]
- fi-kbl-8809g: [PASS][33] -> [INCOMPLETE][34] ([fdo#103665] / [fdo#108126])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-kbl-8809g/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-kbl-8809g/igt@[email protected]
- fi-bxt-dsi: [PASS][35] -> [INCOMPLETE][36] ([fdo#103927])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-bxt-dsi/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-bxt-dsi/igt@[email protected]
- fi-skl-gvtdvm: [PASS][37] -> [INCOMPLETE][38] ([fdo#104108])
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-skl-gvtdvm/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-skl-gvtdvm/igt@[email protected]
- fi-apl-guc: [PASS][39] -> [INCOMPLETE][40] ([fdo#103927] / [fdo#108743])
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-apl-guc/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-apl-guc/igt@[email protected]
- fi-skl-6600u: [PASS][41] -> [INCOMPLETE][42] ([fdo#104108])
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-skl-6600u/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-skl-6600u/igt@[email protected]

* igt@kms_busy@basic-flip-a:
- fi-icl-u3: [PASS][43] -> [INCOMPLETE][44] ([fdo#107713])
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-icl-u3/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-icl-u3/igt@[email protected]
- fi-icl-u2: [PASS][45] -> [INCOMPLETE][46] ([fdo#107713])
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-icl-u2/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-icl-u2/igt@[email protected]
- fi-cml-u2: [PASS][47] -> [INCOMPLETE][48] ([fdo#110566])
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-cml-u2/igt@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-cml-u2/igt@[email protected]

#### Possible fixes ####

* igt@gem_exec_reloc@basic-cpu-gtt-noreloc:
- fi-icl-u3: [DMESG-WARN][49] ([fdo#107724]) -> [PASS][50]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-icl-u3/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-icl-u3/igt@[email protected]

* igt@gem_exec_suspend@basic-s3:
- fi-blb-e6850: [INCOMPLETE][51] ([fdo#107718]) -> [PASS][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-blb-e6850/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-blb-e6850/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#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359
[fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602
[fdo#107556]: https://bugs.freedesktop.org/show_bug.cgi?id=107556
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#107859]: https://bugs.freedesktop.org/show_bug.cgi?id=107859
[fdo#108126]: https://bugs.freedesktop.org/show_bug.cgi?id=108126
[fdo#108743]: https://bugs.freedesktop.org/show_bug.cgi?id=108743
[fdo#110566]: https://bugs.freedesktop.org/show_bug.cgi?id=110566
[k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133

Participating hosts (53 -> 45)
------------------------------

Missing (8): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-gdg-551 fi-icl-y fi-byt-clapper fi-bdw-samus

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_6828 -> Patchwork_14267

CI-20190529: 20190529
CI_DRM_6828: 6e043dde15a1b2b97d908d0467e9197ffa8934c2 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5164: 90babd3f12707dfabaa58bb18f6b8e22636b6895 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14267: d3324b2f0df94e02f7ec5b6368cda4973285834c @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

d3324b2f0df9 drm/i915: Pick nearest-neighbor mode for integer scaling ratios 705e07a4f105 drm/i915: Indicate integer up-scaling ratios

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx