All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/2] Enable Nearest-neighbor for Integer mode scaling
@ 2019-09-03 16:52 Shashank Sharma
  2019-09-03 16:52 ` [RFC 1/2] drm/i915: Indicate integer up-scaling ratios Shashank Sharma
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Shashank Sharma @ 2019-09-03 16:52 UTC (permalink / raw)
  To: intel-gfx

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(-)

-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [RFC 1/2] drm/i915: Indicate integer up-scaling ratios
  2019-09-03 16:52 [RFC 0/2] Enable Nearest-neighbor for Integer mode scaling Shashank Sharma
@ 2019-09-03 16:52 ` Shashank Sharma
  2019-09-04  7:28   ` Jani Nikula
  2019-09-04  7:38   ` Ramalingam C
  2019-09-03 16:52 ` [RFC 2/2] drm/i915: Pick nearest-neighbor mode for integer scaling ratios Shashank Sharma
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 14+ messages in thread
From: Shashank Sharma @ 2019-09-03 16:52 UTC (permalink / raw)
  To: intel-gfx; +Cc: Jani Nikula, Vivi, Daniel Vetter

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 <jani.nikula@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Vivi, Rodrigo <rodrigo.vivi@intel.com>
Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c  | 21 +++++++++++++++++++
 .../drm/i915/display/intel_display_types.h    |  7 +++++++
 2 files changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index ee54d9659c99..613130db3c05 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -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
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 3c1a5f3e1d22..6bb32fbf3153 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -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 */
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [RFC 2/2] drm/i915: Pick nearest-neighbor mode for integer scaling ratios
  2019-09-03 16:52 [RFC 0/2] Enable Nearest-neighbor for Integer mode scaling Shashank Sharma
  2019-09-03 16:52 ` [RFC 1/2] drm/i915: Indicate integer up-scaling ratios Shashank Sharma
@ 2019-09-03 16:52 ` Shashank Sharma
  2019-09-04  7:54   ` Ramalingam C
  2019-09-03 17:05 ` ✗ Fi.CI.CHECKPATCH: warning for Enable Nearest-neighbor for Integer mode scaling Patchwork
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Shashank Sharma @ 2019-09-03 16:52 UTC (permalink / raw)
  To: intel-gfx; +Cc: Jani Nikula, Vivi, Daniel Vetter

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 <jani.nikula@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Vivi, Rodrigo <rodrigo.vivi@intel.com>
Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 81 +++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h              | 31 ++++++++
 2 files changed, 111 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 613130db3c05..9808797a92d9 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -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),
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index ea2f0fa2402d..42fdff3bbf29 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -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
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* ✗ Fi.CI.CHECKPATCH: warning for Enable Nearest-neighbor for Integer mode scaling
  2019-09-03 16:52 [RFC 0/2] Enable Nearest-neighbor for Integer mode scaling Shashank Sharma
  2019-09-03 16:52 ` [RFC 1/2] drm/i915: Indicate integer up-scaling ratios Shashank Sharma
  2019-09-03 16:52 ` [RFC 2/2] drm/i915: Pick nearest-neighbor mode for integer scaling ratios Shashank Sharma
@ 2019-09-03 17:05 ` Patchwork
  2019-09-03 17:20 ` [RFC 0/2] " Ville Syrjälä
  2019-09-03 17:21 ` ✗ Fi.CI.BAT: failure for " Patchwork
  4 siblings, 0 replies; 14+ messages in thread
From: Patchwork @ 2019-09-03 17:05 UTC (permalink / raw)
  To: Shashank Sharma; +Cc: intel-gfx

== 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
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFC 0/2] Enable Nearest-neighbor for Integer mode scaling
  2019-09-03 16:52 [RFC 0/2] Enable Nearest-neighbor for Integer mode scaling Shashank Sharma
                   ` (2 preceding siblings ...)
  2019-09-03 17:05 ` ✗ Fi.CI.CHECKPATCH: warning for Enable Nearest-neighbor for Integer mode scaling Patchwork
@ 2019-09-03 17:20 ` Ville Syrjälä
  2019-09-04  3:02   ` Sharma, Shashank
  2019-09-03 17:21 ` ✗ Fi.CI.BAT: failure for " Patchwork
  4 siblings, 1 reply; 14+ messages in thread
From: Ville Syrjälä @ 2019-09-03 17:20 UTC (permalink / raw)
  To: Shashank Sharma; +Cc: intel-gfx

On Tue, Sep 03, 2019 at 10:22:25PM +0530, Shashank Sharma wrote:
> 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.

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.

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* ✗ Fi.CI.BAT: failure for Enable Nearest-neighbor for Integer mode scaling
  2019-09-03 16:52 [RFC 0/2] Enable Nearest-neighbor for Integer mode scaling Shashank Sharma
                   ` (3 preceding siblings ...)
  2019-09-03 17:20 ` [RFC 0/2] " Ville Syrjälä
@ 2019-09-03 17:21 ` Patchwork
  4 siblings, 0 replies; 14+ messages in thread
From: Patchwork @ 2019-09-03 17:21 UTC (permalink / raw)
  To: Shashank Sharma; +Cc: intel-gfx

== 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@gem_exec_suspend@basic-s3.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-kbl-r/igt@gem_exec_suspend@basic-s3.html
    - fi-whl-u:           [PASS][3] -> [INCOMPLETE][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-whl-u/igt@gem_exec_suspend@basic-s3.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-whl-u/igt@gem_exec_suspend@basic-s3.html
    - fi-kbl-x1275:       [PASS][5] -> [INCOMPLETE][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-kbl-x1275/igt@gem_exec_suspend@basic-s3.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-kbl-x1275/igt@gem_exec_suspend@basic-s3.html
    - fi-kbl-7500u:       [PASS][7] -> [INCOMPLETE][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6828/fi-kbl-7500u/igt@gem_exec_suspend@basic-s3.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-kbl-7500u/igt@gem_exec_suspend@basic-s3.html

  * 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@kms_busy@basic-flip-a.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-skl-6700k2/igt@kms_busy@basic-flip-a.html

  
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@core_auth@basic-auth.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-icl-u3/igt@core_auth@basic-auth.html

  * 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@gem_exec_suspend@basic-s3.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-skl-6770hq/igt@gem_exec_suspend@basic-s3.html
    - 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@gem_exec_suspend@basic-s3.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-cfl-8109u/igt@gem_exec_suspend@basic-s3.html
    - 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@gem_exec_suspend@basic-s3.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-skl-lmem/igt@gem_exec_suspend@basic-s3.html
    - 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@gem_exec_suspend@basic-s3.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-skl-6260u/igt@gem_exec_suspend@basic-s3.html
    - 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@gem_exec_suspend@basic-s3.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-cfl-guc/igt@gem_exec_suspend@basic-s3.html
    - 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@gem_exec_suspend@basic-s3.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-skl-iommu/igt@gem_exec_suspend@basic-s3.html
    - 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@gem_exec_suspend@basic-s3.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-skl-guc/igt@gem_exec_suspend@basic-s3.html
    - 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@gem_exec_suspend@basic-s3.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-glk-dsi/igt@gem_exec_suspend@basic-s3.html
    - 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@gem_exec_suspend@basic-s3.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-cfl-8700k/igt@gem_exec_suspend@basic-s3.html
    - 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@gem_exec_suspend@basic-s3.html
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-kbl-guc/igt@gem_exec_suspend@basic-s3.html
    - 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@gem_exec_suspend@basic-s3.html
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-kbl-8809g/igt@gem_exec_suspend@basic-s3.html
    - 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@gem_exec_suspend@basic-s3.html
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-bxt-dsi/igt@gem_exec_suspend@basic-s3.html
    - 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@gem_exec_suspend@basic-s3.html
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-skl-gvtdvm/igt@gem_exec_suspend@basic-s3.html
    - 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@gem_exec_suspend@basic-s3.html
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-apl-guc/igt@gem_exec_suspend@basic-s3.html
    - 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@gem_exec_suspend@basic-s3.html
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-skl-6600u/igt@gem_exec_suspend@basic-s3.html

  * 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@kms_busy@basic-flip-a.html
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-icl-u3/igt@kms_busy@basic-flip-a.html
    - 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@kms_busy@basic-flip-a.html
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-icl-u2/igt@kms_busy@basic-flip-a.html
    - 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@kms_busy@basic-flip-a.html
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-cml-u2/igt@kms_busy@basic-flip-a.html

  
#### 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@gem_exec_reloc@basic-cpu-gtt-noreloc.html
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-icl-u3/igt@gem_exec_reloc@basic-cpu-gtt-noreloc.html

  * 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@gem_exec_suspend@basic-s3.html
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14267/fi-blb-e6850/igt@gem_exec_suspend@basic-s3.html

  
  {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
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFC 0/2] Enable Nearest-neighbor for Integer mode scaling
  2019-09-03 17:20 ` [RFC 0/2] " Ville Syrjälä
@ 2019-09-04  3:02   ` Sharma, Shashank
  2019-09-04 12:26     ` Ville Syrjälä
  0 siblings, 1 reply; 14+ messages in thread
From: Sharma, Shashank @ 2019-09-04  3:02 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

Hello Ville,

On 9/3/2019 10:50 PM, Ville Syrjälä wrote:
> On Tue, Sep 03, 2019 at 10:22:25PM +0530, Shashank Sharma wrote:
>> 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.
> 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 ?
> 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
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFC 1/2] drm/i915: Indicate integer up-scaling ratios
  2019-09-03 16:52 ` [RFC 1/2] drm/i915: Indicate integer up-scaling ratios Shashank Sharma
@ 2019-09-04  7:28   ` Jani Nikula
  2019-09-04 10:37     ` Sharma, Shashank
  2019-09-04  7:38   ` Ramalingam C
  1 sibling, 1 reply; 14+ messages in thread
From: Jani Nikula @ 2019-09-04  7:28 UTC (permalink / raw)
  To: Shashank Sharma, intel-gfx; +Cc: Daniel Vetter

On Tue, 03 Sep 2019, Shashank Sharma <shashank.sharma@intel.com> wrote:
> 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 <jani.nikula@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Vivi, Rodrigo <rodrigo.vivi@intel.com>
> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c  | 21 +++++++++++++++++++
>  .../drm/i915/display/intel_display_types.h    |  7 +++++++
>  2 files changed, 28 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index ee54d9659c99..613130db3c05 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -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.

> +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
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 3c1a5f3e1d22..6bb32fbf3153 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -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 */

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFC 1/2] drm/i915: Indicate integer up-scaling ratios
  2019-09-03 16:52 ` [RFC 1/2] drm/i915: Indicate integer up-scaling ratios Shashank Sharma
  2019-09-04  7:28   ` Jani Nikula
@ 2019-09-04  7:38   ` Ramalingam C
  2019-09-04 10:38     ` Sharma, Shashank
  1 sibling, 1 reply; 14+ messages in thread
From: Ramalingam C @ 2019-09-04  7:38 UTC (permalink / raw)
  To: Shashank Sharma; +Cc: Jani Nikula, Daniel Vetter, intel-gfx, Vivi

On 2019-09-03 at 22:22:26 +0530, Shashank Sharma wrote:
> 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 <jani.nikula@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Vivi, Rodrigo <rodrigo.vivi@intel.com>
> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c  | 21 +++++++++++++++++++
>  .../drm/i915/display/intel_display_types.h    |  7 +++++++
>  2 files changed, 28 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index ee54d9659c99..613130db3c05 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -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!?
> +{
> +	/* 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
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 3c1a5f3e1d22..6bb32fbf3153 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -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
> +	 * the upscaling ratio is a complete integer. This bool is to indicate
> +	 * such an opportunity.
> +	 */
> +	bool integer_scaling;
>  };
>  
>  /* drm_mode->private_flags */
> -- 
> 2.17.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFC 2/2] drm/i915: Pick nearest-neighbor mode for integer scaling ratios
  2019-09-03 16:52 ` [RFC 2/2] drm/i915: Pick nearest-neighbor mode for integer scaling ratios Shashank Sharma
@ 2019-09-04  7:54   ` Ramalingam C
  0 siblings, 0 replies; 14+ messages in thread
From: Ramalingam C @ 2019-09-04  7:54 UTC (permalink / raw)
  To: Shashank Sharma; +Cc: Jani Nikula, Daniel Vetter, intel-gfx, Vivi

On 2019-09-03 at 22:22:27 +0530, Shashank Sharma wrote:
> 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 <jani.nikula@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Vivi, Rodrigo <rodrigo.vivi@intel.com>
> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 81 +++++++++++++++++++-
>  drivers/gpu/drm/i915/i915_reg.h              | 31 ++++++++
>  2 files changed, 111 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 613130db3c05..9808797a92d9 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -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);
Shouldn't we take the 16 MSBites of val here? Am I missing something in
macro! 

-Ram
> +		}
> +	}
> +}
> +
>  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),
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index ea2f0fa2402d..42fdff3bbf29 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -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
> -- 
> 2.17.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFC 1/2] drm/i915: Indicate integer up-scaling ratios
  2019-09-04  7:28   ` Jani Nikula
@ 2019-09-04 10:37     ` Sharma, Shashank
  0 siblings, 0 replies; 14+ messages in thread
From: Sharma, Shashank @ 2019-09-04 10:37 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: Daniel Vetter


On 9/4/2019 12:58 PM, Jani Nikula wrote:
> On Tue, 03 Sep 2019, Shashank Sharma <shashank.sharma@intel.com> wrote:
>> 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 <jani.nikula@intel.com>
>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Cc: Daniel Vetter <daniel.vetter@intel.com>
>> Cc: Vivi, Rodrigo <rodrigo.vivi@intel.com>
>> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
>> ---
>>   drivers/gpu/drm/i915/display/intel_display.c  | 21 +++++++++++++++++++
>>   .../drm/i915/display/intel_display_types.h    |  7 +++++++
>>   2 files changed, 28 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
>> index ee54d9659c99..613130db3c05 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display.c
>> +++ b/drivers/gpu/drm/i915/display/intel_display.c
>> @@ -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.
Sure, got it !
> BR,
> Jani.
>
>> +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
>> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
>> index 3c1a5f3e1d22..6bb32fbf3153 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
>> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
>> @@ -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 */
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFC 1/2] drm/i915: Indicate integer up-scaling ratios
  2019-09-04  7:38   ` Ramalingam C
@ 2019-09-04 10:38     ` Sharma, Shashank
  0 siblings, 0 replies; 14+ messages in thread
From: Sharma, Shashank @ 2019-09-04 10:38 UTC (permalink / raw)
  To: Ramalingam C; +Cc: Jani Nikula, Daniel Vetter, intel-gfx, Vivi


On 9/4/2019 1:08 PM, Ramalingam C wrote:
> On 2019-09-03 at 22:22:26 +0530, Shashank Sharma wrote:
>> 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 <jani.nikula@intel.com>
>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Cc: Daniel Vetter <daniel.vetter@intel.com>
>> Cc: Vivi, Rodrigo <rodrigo.vivi@intel.com>
>> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
>> ---
>>   drivers/gpu/drm/i915/display/intel_display.c  | 21 +++++++++++++++++++
>>   .../drm/i915/display/intel_display_types.h    |  7 +++++++
>>   2 files changed, 28 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
>> index ee54d9659c99..613130db3c05 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display.c
>> +++ b/drivers/gpu/drm/i915/display/intel_display.c
>> @@ -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!?
Agree, certainly sounds better.
>> +{
>> +	/* 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
>> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
>> index 3c1a5f3e1d22..6bb32fbf3153 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
>> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
>> @@ -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.
got it.
>
> -Ram
>> +	 * the upscaling ratio is a complete integer. This bool is to indicate
>> +	 * such an opportunity.
>> +	 */
>> +	bool integer_scaling;
>>   };
>>   
>>   /* drm_mode->private_flags */
>> -- 
>> 2.17.1
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFC 0/2] Enable Nearest-neighbor for Integer mode scaling
  2019-09-04  3:02   ` Sharma, Shashank
@ 2019-09-04 12:26     ` Ville Syrjälä
  2019-09-04 15:17       ` Sharma, Shashank
  0 siblings, 1 reply; 14+ messages in thread
From: Ville Syrjälä @ 2019-09-04 12:26 UTC (permalink / raw)
  To: Sharma, Shashank; +Cc: intel-gfx

On Wed, Sep 04, 2019 at 08:32:09AM +0530, Sharma, Shashank wrote:
> Hello Ville,
> 
> On 9/3/2019 10:50 PM, Ville Syrjälä wrote:
> > On Tue, Sep 03, 2019 at 10:22:25PM +0530, Shashank Sharma wrote:
> >> 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.
> > 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.

> > 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 :)

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [RFC 0/2] Enable Nearest-neighbor for Integer mode scaling
  2019-09-04 12:26     ` Ville Syrjälä
@ 2019-09-04 15:17       ` Sharma, Shashank
  0 siblings, 0 replies; 14+ messages in thread
From: Sharma, Shashank @ 2019-09-04 15:17 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx


On 9/4/2019 5:56 PM, Ville Syrjälä wrote:
> On Wed, Sep 04, 2019 at 08:32:09AM +0530, Sharma, Shashank wrote:
>> Hello Ville,
>>
>> On 9/3/2019 10:50 PM, Ville Syrjälä wrote:
>>> On Tue, Sep 03, 2019 at 10:22:25PM +0530, Shashank Sharma wrote:
>>>> 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.
>>> 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.
Sounds good.
>>> 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
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-09-04 15:17 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 16:52 [RFC 0/2] Enable Nearest-neighbor for Integer mode scaling Shashank Sharma
2019-09-03 16:52 ` [RFC 1/2] drm/i915: Indicate integer up-scaling ratios Shashank Sharma
2019-09-04  7:28   ` Jani Nikula
2019-09-04 10:37     ` Sharma, Shashank
2019-09-04  7:38   ` Ramalingam C
2019-09-04 10:38     ` Sharma, Shashank
2019-09-03 16:52 ` [RFC 2/2] drm/i915: Pick nearest-neighbor mode for integer scaling ratios Shashank Sharma
2019-09-04  7:54   ` Ramalingam C
2019-09-03 17:05 ` ✗ Fi.CI.CHECKPATCH: warning for Enable Nearest-neighbor for Integer mode scaling Patchwork
2019-09-03 17:20 ` [RFC 0/2] " Ville Syrjälä
2019-09-04  3:02   ` Sharma, Shashank
2019-09-04 12:26     ` Ville Syrjälä
2019-09-04 15:17       ` Sharma, Shashank
2019-09-03 17:21 ` ✗ Fi.CI.BAT: failure for " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.