Skip to contentSkip to conversation

Introduce drm scaling filter property

PATCH Superseded Pankaj Bharadiya 3 participants 20 messages Mar 19, 2020 – Mar 26, 2020

Subsystems (5)

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v2 cover Introduce drm scaling filter property

This series is the continuation for the RFC that I posted earlier [1]

[1] RFC: https://patchwork.freedesktop.org/series/73884/

Integer scaling (IS) is a nearest-neighbor upscaling technique that simply scales up the existing pixels by an integer (i.e., whole number) multiplier. Nearest-neighbor (NN) interpolation works by filling in the missing color values in the upscaled image with that of the coordinate-mapped nearest source pixel value.

Both IS and NN preserve the clarity of the original image. In contrast, traditional upscaling algorithms, such as bilinear or bicubic interpolation, result in blurry upscaled images because they employ interpolation techniques that smooth out the transition from one pixel to another. Therefore, integer scaling is particularly useful for pixel art games that rely on sharp, blocky images to deliver their distinctive look.

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 -
- Introduces new scaling filter properties to allow userspace to select the driver's default scaling filter or Nearest-neighbor(NN) filter for scaling operations on crtc and plane.
- Implements and enable integer scaling for i915

Userspace patch series link: https://github.com/lrusak/xbmc/pull/24

Thanks to Shashank for initiating this work. His initial work can be found here [2]

[2] https://patchwork.freedesktop.org/patch/337082/

changes since v1:
* Add userspace patch link to this cover letter.
* 4/5 - Rearrange skl_scaler_setup_nearest_neighbor_filter() to iterate the registers directly instead of the phases and taps (Ville)

Pankaj Bharadiya (5):
drm: Introduce plane and CRTC scaling filter properties drm/drm-kms.rst: Add plane and CRTC scaling filter property documentation drm/i915: Introduce scaling filter related registers and bit fields. drm/i915/display: Add Nearest-neighbor based integer scaling support drm/i915: Enable scaling filter for plane and CRTC

 Documentation/gpu/drm-kms.rst                |  12 +++
 drivers/gpu/drm/drm_atomic_uapi.c            |   8 ++
 drivers/gpu/drm/drm_crtc.c                   |  33 ++++++
 drivers/gpu/drm/drm_mode_config.c            |  26 +++++
 drivers/gpu/drm/drm_plane.c                  |  33 ++++++
 drivers/gpu/drm/i915/display/intel_display.c | 104 ++++++++++++++++++-
 drivers/gpu/drm/i915/display/intel_display.h |   2 +
 drivers/gpu/drm/i915/display/intel_sprite.c  |  31 +++++-
 drivers/gpu/drm/i915/i915_reg.h              |  48 +++++++++
 include/drm/drm_crtc.h                       |  13 +++
 include/drm/drm_mode_config.h                |  12 +++
 include/drm/drm_plane.h                      |  13 +++
 12 files changed, 332 insertions(+), 3 deletions(-)
Signature · 6 lines
2.23.0

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

PATCH v2 1/5 drm: Introduce plane and CRTC scaling filter properties

Introduce new plane and CRTC scaling filter properties to allow userspace to select the driver's default scaling filter or Nearest-neighbor(NN) filter for upscaling operations on CRTC and plane.

Drivers can set up this property for a plane by calling drm_plane_enable_scaling_filter() and for a CRTC by calling drm_crtc_enable_scaling_filter().

NN filter works by filling in the missing color values in the upscaled image with that of the coordinate-mapped nearest source pixel value.

NN filter for integer multiple scaling can be particularly useful for for pixel art games that rely on sharp, blocky images to deliver their distinctive look.

changes since v1:
* None
changes since RFC:
* Add separate properties for plane and CRTC (Ville)

---
 drivers/gpu/drm/drm_atomic_uapi.c |  8 ++++++++
 drivers/gpu/drm/drm_crtc.c        | 33 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_mode_config.c | 26 ++++++++++++++++++++++++
 drivers/gpu/drm/drm_plane.c       | 33 +++++++++++++++++++++++++++++++
 include/drm/drm_crtc.h            | 13 ++++++++++++
 include/drm/drm_mode_config.h     | 12 +++++++++++
 include/drm/drm_plane.h           | 13 ++++++++++++
 7 files changed, 138 insertions(+)
drivers/gpu/drm/drm_atomic_uapi.c +8 -0
index a1e5e262bae2..3c72ab52ff62 100644
@@ -435,6 +435,8 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
 		return ret;
 	} else if (property == config->prop_vrr_enabled) {
 		state->vrr_enabled = val;
+	} else if (property == config->crtc_scaling_filter_property) {
+		state->scaling_filter = val;
 	} else if (property == config->degamma_lut_property) {
 		ret = drm_atomic_replace_property_blob_from_id(dev,
 					&state->degamma_lut,
@@ -503,6 +505,8 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc,
 		*val = (state->gamma_lut) ? state->gamma_lut->base.id : 0;
 	else if (property == config->prop_out_fence_ptr)
 		*val = 0;
+	else if (property == config->crtc_scaling_filter_property)
+		*val = state->scaling_filter;
 	else if (crtc->funcs->atomic_get_property)
 		return crtc->funcs->atomic_get_property(crtc, state, property, val);
 	else
@@ -583,6 +587,8 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
 					sizeof(struct drm_rect),
 					&replaced);
 		return ret;
+	} else if (property == config->plane_scaling_filter_property) {
+		state->scaling_filter = val;
 	} else if (plane->funcs->atomic_set_property) {
 		return plane->funcs->atomic_set_property(plane, state,
 				property, val);
@@ -641,6 +647,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
 	} else if (property == config->prop_fb_damage_clips) {
 		*val = (state->fb_damage_clips) ?
 			state->fb_damage_clips->base.id : 0;
+	} else if (property == config->plane_scaling_filter_property) {
+		*val = state->scaling_filter;
 	} else if (plane->funcs->atomic_get_property) {
 		return plane->funcs->atomic_get_property(plane, state, property, val);
 	} else {
drivers/gpu/drm/drm_crtc.c +33 -0
index 4936e1080e41..c8d387891dd5 100644
@@ -748,3 +748,36 @@ int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
 
 	return ret;
 }
+
+/**
+ * DOC: CRTC scaling filter property
+ *
+ * SCALING_FILTER:
+ *
+ *	Indicates scaling filter to be used for CRTC scaler
+ *
+ *	The value of this property can be one of the following:
+ *	Default:
+ *		Driver's default scaling filter
+ *	Nearest Neighbor:
+ *		Nearest Neighbor scaling filter
+ *
+ * Drivers can set up this property for a CRTC by calling
+ * drm_crtc_enable_scaling_filter()
+ */
+
+/**
+ * drm_crtc_enable_scaling_filter - Enables CRTC scaling filter property.
+ * @crtc: CRTC on which to enable scaling filter property.
+ *
+ * This function lets driver to enable the scaling filter property on a CRTC.
+ */
+void drm_crtc_enable_scaling_filter(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+
+	drm_object_attach_property(&crtc->base,
+				   dev->mode_config.crtc_scaling_filter_property,
+				   0);
+}
+EXPORT_SYMBOL(drm_crtc_enable_scaling_filter);
drivers/gpu/drm/drm_mode_config.c +26 -0
index e1ec1bb7068d..483705581930 100644
@@ -214,6 +214,16 @@ static const struct drm_prop_enum_list drm_plane_type_enum_list[] = {
 	{ DRM_PLANE_TYPE_CURSOR, "Cursor" },
 };
 
+static const struct drm_prop_enum_list drm_crtc_scaling_filter_enum_list[] = {
+	{ DRM_CRTC_SCALING_FILTER_DEFAULT, "Default" },
+	{ DRM_CRTC_SCALING_FILTER_NEAREST_NEIGHBOR, "Nearest Neighbor" },
+};
+
+static const struct drm_prop_enum_list drm_plane_scaling_filter_enum_list[] = {
+	{ DRM_PLANE_SCALING_FILTER_DEFAULT, "Default" },
+	{ DRM_PLANE_SCALING_FILTER_NEAREST_NEIGHBOR, "Nearest Neighbor" },
+};
+
 static int drm_mode_create_standard_properties(struct drm_device *dev)
 {
 	struct drm_property *prop;
@@ -370,6 +380,22 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)
 		return -ENOMEM;
 	dev->mode_config.modifiers_property = prop;
 
+	prop = drm_property_create_enum(dev, 0,
+				"SCALING_FILTER",
+				drm_crtc_scaling_filter_enum_list,
+				ARRAY_SIZE(drm_crtc_scaling_filter_enum_list));
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.crtc_scaling_filter_property = prop;
+
+	prop = drm_property_create_enum(dev, 0,
+				"SCALING_FILTER",
+				drm_plane_scaling_filter_enum_list,
+				ARRAY_SIZE(drm_plane_scaling_filter_enum_list));
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.plane_scaling_filter_property = prop;
+
 	return 0;
 }
 
drivers/gpu/drm/drm_plane.c +33 -0
index d6ad60ab0d38..f71cf50a4ef9 100644
@@ -1221,3 +1221,36 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 
 	return ret;
 }
+
+/**
+ * DOC: Plane scaling filter property
+ *
+ * SCALING_FILTER:
+ *
+ *	Indicates scaling filter to be used for plane scaler
+ *
+ *	The value of this property can be one of the following:
+ *	Default:
+ *		Driver's default scaling filter
+ *	Nearest Neighbor:
+ *		Nearest Neighbor scaling filter
+ *
+ * Drivers can set up this property for a plane by calling
+ * drm_plane_enable_scaling_filter()
+ */
+
+/**
+ * drm_plane_enable_scaling_filter - Enables plane scaling filter property.
+ * @plane: Plane on which to enable scaling filter property.
+ *
+ * This function lets driver to enable the scaling filter property on a plane.
+ */
+void drm_plane_enable_scaling_filter(struct drm_plane *plane)
+{
+	struct drm_device *dev = plane->dev;
+
+	drm_object_attach_property(&plane->base,
+				   dev->mode_config.plane_scaling_filter_property,
+				   0);
+}
+EXPORT_SYMBOL(drm_plane_enable_scaling_filter);
include/drm/drm_crtc.h +13 -0
index 59b51a09cae6..3187df6874d4 100644
@@ -76,6 +76,10 @@ struct drm_atomic_state;
 struct drm_crtc_helper_funcs;
 struct drm_plane_helper_funcs;
 
+enum drm_crtc_scaling_filter {
+	DRM_CRTC_SCALING_FILTER_DEFAULT,
+	DRM_CRTC_SCALING_FILTER_NEAREST_NEIGHBOR,
+};
 /**
  * struct drm_crtc_state - mutable CRTC state
  *
@@ -296,6 +300,13 @@ struct drm_crtc_state {
 	 */
 	u32 target_vblank;
 
+	/**
+	 * @scaling_filter:
+	 *
+	 * Scaling filter mode to be applied
+	 */
+	enum drm_crtc_scaling_filter scaling_filter;
+
 	/**
 	 * @async_flip:
 	 *
@@ -1266,4 +1277,6 @@ static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
 #define drm_for_each_crtc(crtc, dev) \
 	list_for_each_entry(crtc, &(dev)->mode_config.crtc_list, head)
 
+void drm_crtc_enable_scaling_filter(struct drm_crtc *crtc);
+
 #endif /* __DRM_CRTC_H__ */
include/drm/drm_mode_config.h +12 -0
index 3bcbe30339f0..2b394561359b 100644
@@ -914,6 +914,18 @@ struct drm_mode_config {
 	 */
 	struct drm_property *modifiers_property;
 
+	/**
+	 * @crtc_scaling_filter_property: CRTC property to apply a particular
+	 * filter while scaling.
+	 */
+	struct drm_property *crtc_scaling_filter_property;
+
+	/**
+	 * @plane_scaling_filter_property: Plane property to apply a particular
+	 * filter while scaling.
+	 */
+	struct drm_property *plane_scaling_filter_property;
+
 	/* cursor size */
 	uint32_t cursor_width, cursor_height;
 
include/drm/drm_plane.h +13 -0
index 3f396d94afe4..f75cee8c4ffa 100644
@@ -35,6 +35,10 @@ struct drm_crtc;
 struct drm_printer;
 struct drm_modeset_acquire_ctx;
 
+enum drm_plane_scaling_filter {
+	DRM_PLANE_SCALING_FILTER_DEFAULT,
+	DRM_PLANE_SCALING_FILTER_NEAREST_NEIGHBOR,
+};
 /**
  * struct drm_plane_state - mutable plane state
  *
@@ -214,6 +218,13 @@ struct drm_plane_state {
 	 */
 	bool visible;
 
+	/**
+	 * @scaling_filter:
+	 *
+	 * Scaling filter mode to be applied
+	 */
+	enum drm_plane_scaling_filter scaling_filter;
+
 	/**
 	 * @commit: Tracks the pending commit to prevent use-after-free conditions,
 	 * and for async plane updates.
@@ -862,4 +873,6 @@ drm_plane_get_damage_clips(const struct drm_plane_state *state)
 					state->fb_damage_clips->data : NULL);
 }
 
+void drm_plane_enable_scaling_filter(struct drm_plane *plane);
+
 #endif
Signature · 6 lines
2.23.0

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

Re: [PATCH v2 1/5] drm: Introduce plane and CRTC scaling filter properties

Quoted 12 lines · Pankaj Bharadiya

Introduce new plane and CRTC scaling filter properties to allow userspace to select the driver's default scaling filter or Nearest-neighbor(NN) filter for upscaling operations on CRTC and plane.

Drivers can set up this property for a plane by calling drm_plane_enable_scaling_filter() and for a CRTC by calling drm_crtc_enable_scaling_filter().

NN filter works by filling in the missing color values in the upscaled image with that of the coordinate-mapped nearest source pixel value.

Quoted 8 lines

NN filter for integer multiple scaling can be particularly useful for for pixel art games that rely on sharp, blocky images to deliver their distinctive look.

changes since v1:
* None
changes since RFC:
* Add separate properties for plane and CRTC (Ville)

I actually meant the prop should be per-object, not just separate prop for planes and crtcs.

Quoted 277 lines
---
 drivers/gpu/drm/drm_atomic_uapi.c |  8 ++++++++
 drivers/gpu/drm/drm_crtc.c        | 33 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_mode_config.c | 26 ++++++++++++++++++++++++
 drivers/gpu/drm/drm_plane.c       | 33 +++++++++++++++++++++++++++++++
 include/drm/drm_crtc.h            | 13 ++++++++++++
 include/drm/drm_mode_config.h     | 12 +++++++++++
 include/drm/drm_plane.h           | 13 ++++++++++++
 7 files changed, 138 insertions(+)
drivers/gpu/drm/drm_atomic_uapi.c +8 -0
index a1e5e262bae2..3c72ab52ff62 100644
@@ -435,6 +435,8 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
 		return ret;
 	} else if (property == config->prop_vrr_enabled) {
 		state->vrr_enabled = val;
+	} else if (property == config->crtc_scaling_filter_property) {
+		state->scaling_filter = val;
 	} else if (property == config->degamma_lut_property) {
 		ret = drm_atomic_replace_property_blob_from_id(dev,
 					&state->degamma_lut,
@@ -503,6 +505,8 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc,
 		*val = (state->gamma_lut) ? state->gamma_lut->base.id : 0;
 	else if (property == config->prop_out_fence_ptr)
 		*val = 0;
+	else if (property == config->crtc_scaling_filter_property)
+		*val = state->scaling_filter;
 	else if (crtc->funcs->atomic_get_property)
 		return crtc->funcs->atomic_get_property(crtc, state, property, val);
 	else
@@ -583,6 +587,8 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
 					sizeof(struct drm_rect),
 					&replaced);
 		return ret;
+	} else if (property == config->plane_scaling_filter_property) {
+		state->scaling_filter = val;
 	} else if (plane->funcs->atomic_set_property) {
 		return plane->funcs->atomic_set_property(plane, state,
 				property, val);
@@ -641,6 +647,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
 	} else if (property == config->prop_fb_damage_clips) {
 		*val = (state->fb_damage_clips) ?
 			state->fb_damage_clips->base.id : 0;
+	} else if (property == config->plane_scaling_filter_property) {
+		*val = state->scaling_filter;
 	} else if (plane->funcs->atomic_get_property) {
 		return plane->funcs->atomic_get_property(plane, state, property, val);
 	} else {
drivers/gpu/drm/drm_crtc.c +33 -0
index 4936e1080e41..c8d387891dd5 100644
@@ -748,3 +748,36 @@ int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
 
 	return ret;
 }
+
+/**
+ * DOC: CRTC scaling filter property
+ *
+ * SCALING_FILTER:
+ *
+ *	Indicates scaling filter to be used for CRTC scaler
+ *
+ *	The value of this property can be one of the following:
+ *	Default:
+ *		Driver's default scaling filter
+ *	Nearest Neighbor:
+ *		Nearest Neighbor scaling filter
+ *
+ * Drivers can set up this property for a CRTC by calling
+ * drm_crtc_enable_scaling_filter()
+ */
+
+/**
+ * drm_crtc_enable_scaling_filter - Enables CRTC scaling filter property.
+ * @crtc: CRTC on which to enable scaling filter property.
+ *
+ * This function lets driver to enable the scaling filter property on a CRTC.
+ */
+void drm_crtc_enable_scaling_filter(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+
+	drm_object_attach_property(&crtc->base,
+				   dev->mode_config.crtc_scaling_filter_property,
+				   0);
+}
+EXPORT_SYMBOL(drm_crtc_enable_scaling_filter);
drivers/gpu/drm/drm_mode_config.c +26 -0
index e1ec1bb7068d..483705581930 100644
@@ -214,6 +214,16 @@ static const struct drm_prop_enum_list drm_plane_type_enum_list[] = {
 	{ DRM_PLANE_TYPE_CURSOR, "Cursor" },
 };
 
+static const struct drm_prop_enum_list drm_crtc_scaling_filter_enum_list[] = {
+	{ DRM_CRTC_SCALING_FILTER_DEFAULT, "Default" },
+	{ DRM_CRTC_SCALING_FILTER_NEAREST_NEIGHBOR, "Nearest Neighbor" },
+};
+
+static const struct drm_prop_enum_list drm_plane_scaling_filter_enum_list[] = {
+	{ DRM_PLANE_SCALING_FILTER_DEFAULT, "Default" },
+	{ DRM_PLANE_SCALING_FILTER_NEAREST_NEIGHBOR, "Nearest Neighbor" },
+};
+
 static int drm_mode_create_standard_properties(struct drm_device *dev)
 {
 	struct drm_property *prop;
@@ -370,6 +380,22 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)
 		return -ENOMEM;
 	dev->mode_config.modifiers_property = prop;
 
+	prop = drm_property_create_enum(dev, 0,
+				"SCALING_FILTER",
+				drm_crtc_scaling_filter_enum_list,
+				ARRAY_SIZE(drm_crtc_scaling_filter_enum_list));
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.crtc_scaling_filter_property = prop;
+
+	prop = drm_property_create_enum(dev, 0,
+				"SCALING_FILTER",
+				drm_plane_scaling_filter_enum_list,
+				ARRAY_SIZE(drm_plane_scaling_filter_enum_list));
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.plane_scaling_filter_property = prop;
+
 	return 0;
 }
 
drivers/gpu/drm/drm_plane.c +33 -0
index d6ad60ab0d38..f71cf50a4ef9 100644
@@ -1221,3 +1221,36 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 
 	return ret;
 }
+
+/**
+ * DOC: Plane scaling filter property
+ *
+ * SCALING_FILTER:
+ *
+ *	Indicates scaling filter to be used for plane scaler
+ *
+ *	The value of this property can be one of the following:
+ *	Default:
+ *		Driver's default scaling filter
+ *	Nearest Neighbor:
+ *		Nearest Neighbor scaling filter
+ *
+ * Drivers can set up this property for a plane by calling
+ * drm_plane_enable_scaling_filter()
+ */
+
+/**
+ * drm_plane_enable_scaling_filter - Enables plane scaling filter property.
+ * @plane: Plane on which to enable scaling filter property.
+ *
+ * This function lets driver to enable the scaling filter property on a plane.
+ */
+void drm_plane_enable_scaling_filter(struct drm_plane *plane)
+{
+	struct drm_device *dev = plane->dev;
+
+	drm_object_attach_property(&plane->base,
+				   dev->mode_config.plane_scaling_filter_property,
+				   0);
+}
+EXPORT_SYMBOL(drm_plane_enable_scaling_filter);
include/drm/drm_crtc.h +13 -0
index 59b51a09cae6..3187df6874d4 100644
@@ -76,6 +76,10 @@ struct drm_atomic_state;
 struct drm_crtc_helper_funcs;
 struct drm_plane_helper_funcs;
 
+enum drm_crtc_scaling_filter {
+	DRM_CRTC_SCALING_FILTER_DEFAULT,
+	DRM_CRTC_SCALING_FILTER_NEAREST_NEIGHBOR,
+};
 /**
  * struct drm_crtc_state - mutable CRTC state
  *
@@ -296,6 +300,13 @@ struct drm_crtc_state {
 	 */
 	u32 target_vblank;
 
+	/**
+	 * @scaling_filter:
+	 *
+	 * Scaling filter mode to be applied
+	 */
+	enum drm_crtc_scaling_filter scaling_filter;
+
 	/**
 	 * @async_flip:
 	 *
@@ -1266,4 +1277,6 @@ static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
 #define drm_for_each_crtc(crtc, dev) \
 	list_for_each_entry(crtc, &(dev)->mode_config.crtc_list, head)
 
+void drm_crtc_enable_scaling_filter(struct drm_crtc *crtc);
+
 #endif /* __DRM_CRTC_H__ */
include/drm/drm_mode_config.h +12 -0
index 3bcbe30339f0..2b394561359b 100644
@@ -914,6 +914,18 @@ struct drm_mode_config {
 	 */
 	struct drm_property *modifiers_property;
 
+	/**
+	 * @crtc_scaling_filter_property: CRTC property to apply a particular
+	 * filter while scaling.
+	 */
+	struct drm_property *crtc_scaling_filter_property;
+
+	/**
+	 * @plane_scaling_filter_property: Plane property to apply a particular
+	 * filter while scaling.
+	 */
+	struct drm_property *plane_scaling_filter_property;
+
 	/* cursor size */
 	uint32_t cursor_width, cursor_height;
 
include/drm/drm_plane.h +13 -0
index 3f396d94afe4..f75cee8c4ffa 100644
@@ -35,6 +35,10 @@ struct drm_crtc;
 struct drm_printer;
 struct drm_modeset_acquire_ctx;
 
+enum drm_plane_scaling_filter {
+	DRM_PLANE_SCALING_FILTER_DEFAULT,
+	DRM_PLANE_SCALING_FILTER_NEAREST_NEIGHBOR,
+};
 /**
  * struct drm_plane_state - mutable plane state
  *
@@ -214,6 +218,13 @@ struct drm_plane_state {
 	 */
 	bool visible;
 
+	/**
+	 * @scaling_filter:
+	 *
+	 * Scaling filter mode to be applied
+	 */
+	enum drm_plane_scaling_filter scaling_filter;
+
 	/**
 	 * @commit: Tracks the pending commit to prevent use-after-free conditions,
 	 * and for async plane updates.
@@ -862,4 +873,6 @@ drm_plane_get_damage_clips(const struct drm_plane_state *state)
 					state->fb_damage_clips->data : NULL);
 }
 
+void drm_plane_enable_scaling_filter(struct drm_plane *plane);
+
 #endif
Signature · 1 line
2.23.0
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

RE: [PATCH v2 1/5] drm: Introduce plane and CRTC scaling filter properties

Quoted 32 lines

-----Original Message-----
From: Ville Syrjälä <[email protected]>
Sent: 23 March 2020 19:52
To: Laxminarayan Bharadiya, Pankaj <[email protected]>
Cc: Lattannavar, Sameer <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>; David Airlie <[email protected]>
Subject: Re: [PATCH v2 1/5] drm: Introduce plane and CRTC scaling filter properties

Quoted 16 lines · Pankaj Bharadiya

Introduce new plane and CRTC scaling filter properties to allow userspace to select the driver's default scaling filter or Nearest-neighbor(NN) filter for upscaling operations on CRTC and plane.

Drivers can set up this property for a plane by calling drm_plane_enable_scaling_filter() and for a CRTC by calling drm_crtc_enable_scaling_filter().

NN filter works by filling in the missing color values in the upscaled image with that of the coordinate-mapped nearest source pixel value.

NN filter for integer multiple scaling can be particularly useful for for pixel art games that rely on sharp, blocky images to deliver their distinctive look.

Quoted 7 lines
Quoted 4 lines

changes since v1:
* None
changes since RFC:
* Add separate properties for plane and CRTC (Ville)

I actually meant the prop should be per-object, not just separate prop for planes and crtcs.

My bad, I misunderstood it ☹.
Will add drm_property in drm_crtc and drm_plane.

Thanks,
Pankaj

Quoted 292 lines

drivers/gpu/drm/drm_atomic_uapi.c static int drm_atomic_crtc_set_property(struct

Quoted 22 lines
Signed-off-by Pankaj Bharadiya

<[email protected]>

---
 drivers/gpu/drm/drm_atomic_uapi.c |  8 ++++++++
 drivers/gpu/drm/drm_crtc.c        | 33 +++++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_mode_config.c | 26 ++++++++++++++++++++++++
 drivers/gpu/drm/drm_plane.c       | 33 +++++++++++++++++++++++++++++++
 include/drm/drm_crtc.h            | 13 ++++++++++++
 include/drm/drm_mode_config.h     | 12 +++++++++++
 include/drm/drm_plane.h           | 13 ++++++++++++
 7 files changed, 138 insertions(+)
drivers/gpu/drm/drm_atomic_uapi.c +0 -0
index a1e5e262bae2..3c72ab52ff62 100644
@@ -435,6 +435,8 @@ static int drm_atomic_crtc_set_property(struct

drm_crtc *crtc,

Quoted 9 lines
drivers/gpu/drm/drm_atomic_uapi.c +2 -0
 		return ret;
 	} else if (property == config->prop_vrr_enabled) {
 		state->vrr_enabled = val;
+	} else if (property == config->crtc_scaling_filter_property) {
+		state->scaling_filter = val;
 	} else if (property == config->degamma_lut_property) {
 		ret = drm_atomic_replace_property_blob_from_id(dev,
 					&state->degamma_lut,

drivers/gpu/drm/drm_atomic_uapi.c drm_atomic_crtc_get_property(struct drm_crtc *crtc, · line 511

Quoted 7 lines
drivers/gpu/drm/drm_atomic_uapi.c +2 -0
@@ -503,6 +505,8 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc,
 		*val = (state->gamma_lut) ? state->gamma_lut->base.id : 0;
 	else if (property == config->prop_out_fence_ptr)
 		*val = 0;
+	else if (property == config->crtc_scaling_filter_property)
+		*val = state->scaling_filter;
 	else if (crtc->funcs->atomic_get_property)
 		return crtc->funcs->atomic_get_property(crtc, state, property,

val);

drivers/gpu/drm/drm_atomic_uapi.c static int drm_atomic_plane_set_property(struct

Quoted 2 lines
drivers/gpu/drm/drm_atomic_uapi.c +0 -0
 	else
@@ -583,6 +587,8 @@ static int drm_atomic_plane_set_property(struct

drm_plane *plane,

drivers/gpu/drm/drm_atomic_uapi.c drm_atomic_plane_get_property(struct drm_plane

Quoted 9 lines
drivers/gpu/drm/drm_atomic_uapi.c +2 -0
 					sizeof(struct drm_rect),
 					&replaced);
 		return ret;
+	} else if (property == config->plane_scaling_filter_property) {
+		state->scaling_filter = val;
 	} else if (plane->funcs->atomic_set_property) {
 		return plane->funcs->atomic_set_property(plane, state,
 				property, val);
@@ -641,6 +647,8 @@ drm_atomic_plane_get_property(struct drm_plane

*plane,

drivers/gpu/drm/drm_atomic_uapi.c drm_atomic_plane_get_property(struct drm_plane *plane,

Quoted 7 lines
drivers/gpu/drm/drm_atomic_uapi.c +2 -0
 	} else if (property == config->prop_fb_damage_clips) {
 		*val = (state->fb_damage_clips) ?
 			state->fb_damage_clips->base.id : 0;
+	} else if (property == config->plane_scaling_filter_property) {
+		*val = state->scaling_filter;
 	} else if (plane->funcs->atomic_get_property) {
 		return plane->funcs->atomic_get_property(plane, state,

property, val);

drivers/gpu/drm/drm_mode_config.c static const struct drm_prop_enum_list

Quoted 49 lines
drivers/gpu/drm/drm_atomic_uapi.c +0 -0
 	} else {
drivers/gpu/drm/drm_crtc.c +29 -0
index 4936e1080e41..c8d387891dd5 100644
@@ -748,3 +748,36 @@ int drm_mode_crtc_set_obj_prop(struct
 drm_mode_object *obj,
 
 	return ret;
 }
+
+/**
+ * DOC: CRTC scaling filter property
+ *
+ * SCALING_FILTER:
+ *
+ *	Indicates scaling filter to be used for CRTC scaler
+ *
+ *	The value of this property can be one of the following:
+ *	Default:
+ *		Driver's default scaling filter
+ *	Nearest Neighbor:
+ *		Nearest Neighbor scaling filter
+ *
+ * Drivers can set up this property for a CRTC by calling
+ * drm_crtc_enable_scaling_filter()
+ */
+
+/**
+ * drm_crtc_enable_scaling_filter - Enables CRTC scaling filter property.
+ * @crtc: CRTC on which to enable scaling filter property.
+ *
+ * This function lets driver to enable the scaling filter property on a CRTC.
+ */
+void drm_crtc_enable_scaling_filter(struct drm_crtc *crtc) {
+	struct drm_device *dev = crtc->dev;
+
+	drm_object_attach_property(&crtc->base,
+				   dev-

mode_config.crtc_scaling_filter_property,

drivers/gpu/drm/drm_crtc.c +3 -0
+				   0);
+}
+EXPORT_SYMBOL(drm_crtc_enable_scaling_filter);
drivers/gpu/drm/drm_mode_config.c +0 -0
index e1ec1bb7068d..483705581930 100644
@@ -214,6 +214,16 @@ static const struct drm_prop_enum_list

drm_plane_type_enum_list[] = {

drivers/gpu/drm/drm_mode_config.c static const struct drm_prop_enum_list · line 216

Quoted 3 lines
drivers/gpu/drm/drm_mode_config.c +1 -0
 	{ DRM_PLANE_TYPE_CURSOR, "Cursor" },  };
 
+static const struct drm_prop_enum_list drm_crtc_scaling_filter_enum_list[] =

{

drivers/gpu/drm/drm_mode_config.c static const struct drm_prop_enum_list · line 218

Quoted 2 lines
drivers/gpu/drm/drm_mode_config.c +2 -0
+	{ DRM_CRTC_SCALING_FILTER_DEFAULT, "Default" },
+	{ DRM_CRTC_SCALING_FILTER_NEAREST_NEIGHBOR, "Nearest

Neighbor" }, };

drivers/gpu/drm/drm_mode_config.c static const struct drm_prop_enum_list · line 220

Quoted 2 lines
drivers/gpu/drm/drm_mode_config.c +2 -0
+
+static const struct drm_prop_enum_list drm_plane_scaling_filter_enum_list[]

= {

drivers/gpu/drm/drm_mode_config.c static const struct drm_prop_enum_list · line 222

Quoted 2 lines
drivers/gpu/drm/drm_mode_config.c +2 -0
+	{ DRM_PLANE_SCALING_FILTER_DEFAULT, "Default" },
+	{ DRM_PLANE_SCALING_FILTER_NEAREST_NEIGHBOR, "Nearest

Neighbor" },

drivers/gpu/drm/drm_mode_config.c static int

Quoted 6 lines
drivers/gpu/drm/drm_mode_config.c +2 -0
+};
+
 static int drm_mode_create_standard_properties(struct drm_device
 *dev)  {
 	struct drm_property *prop;
@@ -370,6 +380,22 @@ static int

drm_mode_create_standard_properties(struct drm_device *dev)

drivers/gpu/drm/drm_mode_config.c static int drm_mode_create_standard_properties(struct drm_device *dev) · line 390

Quoted 7 lines
drivers/gpu/drm/drm_mode_config.c +4 -0
 		return -ENOMEM;
 	dev->mode_config.modifiers_property = prop;
 
+	prop = drm_property_create_enum(dev, 0,
+				"SCALING_FILTER",
+				drm_crtc_scaling_filter_enum_list,
+
	ARRAY_SIZE(drm_crtc_scaling_filter_enum_list));

drivers/gpu/drm/drm_mode_config.c static int drm_mode_create_standard_properties(struct drm_device *dev) · line 398

Quoted 8 lines
drivers/gpu/drm/drm_mode_config.c +8 -0
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.crtc_scaling_filter_property = prop;
+
+	prop = drm_property_create_enum(dev, 0,
+				"SCALING_FILTER",
+				drm_plane_scaling_filter_enum_list,
+
	ARRAY_SIZE(drm_plane_scaling_filter_enum_list));
Quoted 78 lines
drivers/gpu/drm/drm_mode_config.c +4 -0
+	if (!prop)
+		return -ENOMEM;
+	dev->mode_config.plane_scaling_filter_property = prop;
+
 	return 0;
 }
 
drivers/gpu/drm/drm_plane.c +29 -0
index d6ad60ab0d38..f71cf50a4ef9 100644
@@ -1221,3 +1221,36 @@ int drm_mode_page_flip_ioctl(struct drm_device
 *dev,
 
 	return ret;
 }
+
+/**
+ * DOC: Plane scaling filter property
+ *
+ * SCALING_FILTER:
+ *
+ *	Indicates scaling filter to be used for plane scaler
+ *
+ *	The value of this property can be one of the following:
+ *	Default:
+ *		Driver's default scaling filter
+ *	Nearest Neighbor:
+ *		Nearest Neighbor scaling filter
+ *
+ * Drivers can set up this property for a plane by calling
+ * drm_plane_enable_scaling_filter()
+ */
+
+/**
+ * drm_plane_enable_scaling_filter - Enables plane scaling filter property.
+ * @plane: Plane on which to enable scaling filter property.
+ *
+ * This function lets driver to enable the scaling filter property on a plane.
+ */
+void drm_plane_enable_scaling_filter(struct drm_plane *plane) {
+	struct drm_device *dev = plane->dev;
+
+	drm_object_attach_property(&plane->base,
+				   dev-

mode_config.plane_scaling_filter_property,

drivers/gpu/drm/drm_plane.c +3 -0
+				   0);
+}
+EXPORT_SYMBOL(drm_plane_enable_scaling_filter);
include/drm/drm_crtc.h index renamed from include/drm/drm_crtc.h +0 -0

59b51a09cae6..3187df6874d4 100644

include/drm/drm_crtc.h +11 -0
@@ -76,6 +76,10 @@ struct drm_atomic_state;  struct
 drm_crtc_helper_funcs;  struct drm_plane_helper_funcs;
 
+enum drm_crtc_scaling_filter {
+	DRM_CRTC_SCALING_FILTER_DEFAULT,
+	DRM_CRTC_SCALING_FILTER_NEAREST_NEIGHBOR,
+};
 /**
  * struct drm_crtc_state - mutable CRTC state
  *
@@ -296,6 +300,13 @@ struct drm_crtc_state {
 	 */
 	u32 target_vblank;
 
+	/**
+	 * @scaling_filter:
+	 *
+	 * Scaling filter mode to be applied
+	 */
+	enum drm_crtc_scaling_filter scaling_filter;
+
 	/**
 	 * @async_flip:
 	 *

include/drm/drm_crtc.h static inline struct drm_crtc · line 1277

Quoted 1 line
include/drm/drm_crtc.h +0 -0
@@ -1266,4 +1277,6 @@ static inline struct drm_crtc
 *drm_crtc_find(struct drm_device *dev,  #define drm_for_each_crtc(crtc, dev)

\

Quoted 47 lines
include/drm/drm_crtc.h +2 -0
 	list_for_each_entry(crtc, &(dev)->mode_config.crtc_list, head)
 
+void drm_crtc_enable_scaling_filter(struct drm_crtc *crtc);
+
 #endif /* __DRM_CRTC_H__ */
(quoted diff) +0 -0

b/include/drm/drm_mode_config.h index 3bcbe30339f0..2b394561359b 100644

include/drm/drm_mode_config.h +12 -0
@@ -914,6 +914,18 @@ struct drm_mode_config {
 	 */
 	struct drm_property *modifiers_property;
 
+	/**
+	 * @crtc_scaling_filter_property: CRTC property to apply a particular
+	 * filter while scaling.
+	 */
+	struct drm_property *crtc_scaling_filter_property;
+
+	/**
+	 * @plane_scaling_filter_property: Plane property to apply a particular
+	 * filter while scaling.
+	 */
+	struct drm_property *plane_scaling_filter_property;
+
 	/* cursor size */
 	uint32_t cursor_width, cursor_height;
 
include/drm/drm_plane.h index renamed from include/drm/drm_plane.h +0 -0

3f396d94afe4..f75cee8c4ffa 100644

include/drm/drm_plane.h +4 -0
@@ -35,6 +35,10 @@ struct drm_crtc;
 struct drm_printer;
 struct drm_modeset_acquire_ctx;
 
+enum drm_plane_scaling_filter {
+	DRM_PLANE_SCALING_FILTER_DEFAULT,
+	DRM_PLANE_SCALING_FILTER_NEAREST_NEIGHBOR,
+};
 /**
  * struct drm_plane_state - mutable plane state
  *
@@ -214,6 +218,13 @@ struct drm_plane_state {
 	 */
 	bool visible;

include/drm/drm_plane.h struct drm_plane_state { · line 229

Quoted 10 lines
include/drm/drm_plane.h +7 -0
 
+	/**
+	 * @scaling_filter:
+	 *
+	 * Scaling filter mode to be applied
+	 */
+	enum drm_plane_scaling_filter scaling_filter;
+
 	/**
 	 * @commit: Tracks the pending commit to prevent use-after-free

conditions,

include/drm/drm_plane.h drm_plane_get_damage_clips(const struct

Quoted 2 lines
include/drm/drm_plane.h +0 -0
 	 * and for async plane updates.
@@ -862,4 +873,6 @@ drm_plane_get_damage_clips(const struct

drm_plane_state *state)

include/drm/drm_plane.h drm_plane_get_damage_clips(const struct drm_plane_state *state) · line 873

Quoted 1 line
include/drm/drm_plane.h +0 -0
 					state->fb_damage_clips->data : NULL);

}

Quoted 1 line
Quoted 9 lines
Quoted 5 lines
include/drm/drm_plane.h +2 -1
+void drm_plane_enable_scaling_filter(struct drm_plane *plane);
+
 #endif
--

2.23.0

--
Ville Syrjälä
Intel

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

#4 lore raw

PATCH v2 2/5 drm/drm-kms.rst: Add plane and CRTC scaling filter property documentation

In reply to Pankaj Bharadiya

Add documentation for newly introduced KMS plane and CRTC scaling filter properties.

changes since v1:
* None
changes since RFC:
* Add separate documentation for plane and CRTC.

---
 Documentation/gpu/drm-kms.rst | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Documentation/gpu/drm-kms.rst +12 -0
index 906771e03103..b0335e9d887c 100644
@@ -509,6 +509,18 @@ Variable Refresh Properties
 .. kernel-doc:: drivers/gpu/drm/drm_connector.c
    :doc: Variable refresh properties
 
+Plane Scaling Filter Property
+-----------------------
+
+.. kernel-doc:: drivers/gpu/drm/drm_plane.c
+   :doc: Plane scaling filter property
+
+CRTC Scaling Filter Property
+-----------------------
+
+.. kernel-doc:: drivers/gpu/drm/drm_crtc.c
+   :doc: CRTC scaling filter property
+
 Existing KMS Properties
 -----------------------
 
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

PATCH v2 3/5 drm/i915: Introduce scaling filter related registers and bit fields.

In reply to Pankaj Bharadiya

Introduce scaler registers and bit fields needed to configure the scaling filter in prgrammed mode and configure scaling filter coefficients.

changes since v1:
* None
changes since RFC:
* Parametrize scaler coeffient macros by 'set' (Ville)

---
 drivers/gpu/drm/i915/i915_reg.h | 48 +++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +48 -0
index 9c53fe918be6..d40f12d2a6b5 100644
@@ -7205,6 +7205,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)
@@ -7219,6 +7220,10 @@ enum {
 #define PS_VADAPT_MODE_MOST_ADAPT  (3 << 5)
 #define PS_PLANE_Y_SEL_MASK  (7 << 5)
 #define PS_PLANE_Y_SEL(plane) (((plane) + 1) << 5)
+#define PS_Y_VERT_FILTER_SELECT(set)   ((set) << 4)
+#define PS_Y_HORZ_FILTER_SELECT(set)   ((set) << 3)
+#define PS_UV_VERT_FILTER_SELECT(set)  ((set) << 2)
+#define PS_UV_HORZ_FILTER_SELECT(set)  ((set) << 1)
 
 #define _PS_PWR_GATE_1A     0x68160
 #define _PS_PWR_GATE_2A     0x68260
@@ -7281,6 +7286,25 @@ 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_COEE_INDEX_AUTO_INC	   (1 << 10)
+
+#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),       \
@@ -7310,6 +7334,30 @@ enum {
 			_ID(id, _PS_ECC_STAT_1A, _PS_ECC_STAT_2A),   \
 			_ID(id, _PS_ECC_STAT_1B, _PS_ECC_STAT_2B))
 
+#define _SKL_PS_COEF_INDEX_SET0(pipe, id)  _ID(pipe,    \
+			_ID(id, _PS_COEF_SET0_INDEX_1A, _PS_COEF_SET0_INDEX_2A), \
+			_ID(id, _PS_COEF_SET0_INDEX_1B, _PS_COEF_SET0_INDEX_2B))
+
+#define _SKL_PS_COEF_INDEX_SET1(pipe, id)  _ID(pipe,    \
+			_ID(id, _PS_COEF_SET1_INDEX_1A, _PS_COEF_SET1_INDEX_2A), \
+			_ID(id, _PS_COEF_SET1_INDEX_1B, _PS_COEF_SET1_INDEX_2B))
+
+#define _SKL_PS_COEF_DATA_SET0(pipe, id)  _ID(pipe,     \
+			_ID(id, _PS_COEF_SET0_DATA_1A, _PS_COEF_SET0_DATA_2A), \
+			_ID(id, _PS_COEF_SET0_DATA_1B, _PS_COEF_SET0_DATA_2B))
+
+#define _SKL_PS_COEF_DATA_SET1(pipe, id)  _ID(pipe,     \
+			_ID(id, _PS_COEF_SET1_DATA_1A, _PS_COEF_SET1_DATA_2A), \
+			_ID(id, _PS_COEF_SET1_DATA_1B, _PS_COEF_SET1_DATA_2B))
+
+#define SKL_PS_COEF_INDEX_SET(pipe, id, set) \
+			_MMIO_PIPE(set, _SKL_PS_COEF_INDEX_SET0(pipe, id), \
+			    _SKL_PS_COEF_INDEX_SET1(pipe, id))
+
+#define SKL_PS_COEF_DATA_SET(pipe, id, set) \
+			_MMIO_PIPE(set, _SKL_PS_COEF_DATA_SET0(pipe, id), \
+			    _SKL_PS_COEF_DATA_SET1(pipe, id))
+
 /* legacy palette */
 #define _LGC_PALETTE_A           0x4a000
 #define _LGC_PALETTE_B           0x4a800
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw

Re: [PATCH v2 3/5] drm/i915: Introduce scaling filter related registers and bit fields.

Quoted 82 lines · Pankaj Bharadiya

Introduce scaler registers and bit fields needed to configure the scaling filter in prgrammed mode and configure scaling filter coefficients.

changes since v1:
* None
changes since RFC:
* Parametrize scaler coeffient macros by 'set' (Ville)

---
 drivers/gpu/drm/i915/i915_reg.h | 48 +++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +37 -0
index 9c53fe918be6..d40f12d2a6b5 100644
@@ -7205,6 +7205,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)
@@ -7219,6 +7220,10 @@ enum {
 #define PS_VADAPT_MODE_MOST_ADAPT  (3 << 5)
 #define PS_PLANE_Y_SEL_MASK  (7 << 5)
 #define PS_PLANE_Y_SEL(plane) (((plane) + 1) << 5)
+#define PS_Y_VERT_FILTER_SELECT(set)   ((set) << 4)
+#define PS_Y_HORZ_FILTER_SELECT(set)   ((set) << 3)
+#define PS_UV_VERT_FILTER_SELECT(set)  ((set) << 2)
+#define PS_UV_HORZ_FILTER_SELECT(set)  ((set) << 1)
 
 #define _PS_PWR_GATE_1A     0x68160
 #define _PS_PWR_GATE_2A     0x68260
@@ -7281,6 +7286,25 @@ 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_COEE_INDEX_AUTO_INC	   (1 << 10)
+
+#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),       \
@@ -7310,6 +7334,30 @@ enum {
 			_ID(id, _PS_ECC_STAT_1A, _PS_ECC_STAT_2A),   \
 			_ID(id, _PS_ECC_STAT_1B, _PS_ECC_STAT_2B))
 
+#define _SKL_PS_COEF_INDEX_SET0(pipe, id)  _ID(pipe,    \
+			_ID(id, _PS_COEF_SET0_INDEX_1A, _PS_COEF_SET0_INDEX_2A), \
+			_ID(id, _PS_COEF_SET0_INDEX_1B, _PS_COEF_SET0_INDEX_2B))
+
+#define _SKL_PS_COEF_INDEX_SET1(pipe, id)  _ID(pipe,    \
+			_ID(id, _PS_COEF_SET1_INDEX_1A, _PS_COEF_SET1_INDEX_2A), \
+			_ID(id, _PS_COEF_SET1_INDEX_1B, _PS_COEF_SET1_INDEX_2B))
+
+#define _SKL_PS_COEF_DATA_SET0(pipe, id)  _ID(pipe,     \
+			_ID(id, _PS_COEF_SET0_DATA_1A, _PS_COEF_SET0_DATA_2A), \
+			_ID(id, _PS_COEF_SET0_DATA_1B, _PS_COEF_SET0_DATA_2B))
+
+#define _SKL_PS_COEF_DATA_SET1(pipe, id)  _ID(pipe,     \

drivers/gpu/drm/i915/i915_reg.h enum { · line 7359

Quoted 10 lines
drivers/gpu/drm/i915/i915_reg.h +10 -0
+			_ID(id, _PS_COEF_SET1_DATA_1A, _PS_COEF_SET1_DATA_2A), \
+			_ID(id, _PS_COEF_SET1_DATA_1B, _PS_COEF_SET1_DATA_2B))
+
+#define SKL_PS_COEF_INDEX_SET(pipe, id, set) \
+			_MMIO_PIPE(set, _SKL_PS_COEF_INDEX_SET0(pipe, id), \
+			    _SKL_PS_COEF_INDEX_SET1(pipe, id))
+
+#define SKL_PS_COEF_DATA_SET(pipe, id, set) \
+			_MMIO_PIPE(set, _SKL_PS_COEF_DATA_SET0(pipe, id), \
+			    _SKL_PS_COEF_DATA_SET1(pipe, id))

I'd name those CNL_PS_COEF_{DATA,INDEX}(). Or maybe eeven GLK_ since it already has this despite not being officially supported.

Also I'd probably just have used +(set)*8 instead of adding another trip through _PICK_EVEN(). It's getting a bit hard to read this.

Quoted 6 lines
drivers/gpu/drm/i915/i915_reg.h +1 -0
+
 /* legacy palette */
 #define _LGC_PALETTE_A           0x4a000
 #define _LGC_PALETTE_B           0x4a800
Signature · 1 line
2.23.0
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw

RE: [PATCH v2 3/5] drm/i915: Introduce scaling filter related registers and bit fields.

Quoted 120 lines

-----Original Message-----
From: Ville Syrjälä <[email protected]>
Sent: 23 March 2020 20:09
To: Laxminarayan Bharadiya, Pankaj <[email protected]>
Cc: Lattannavar, Sameer <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Joonas Lahtinen <[email protected]>; Vivi, Rodrigo <[email protected]>; David Airlie <[email protected]>
Subject: Re: [PATCH v2 3/5] drm/i915: Introduce scaling filter related registers and bit fields.

Quoted 69 lines · Pankaj Bharadiya

Introduce scaler registers and bit fields needed to configure the scaling filter in prgrammed mode and configure scaling filter coefficients.

changes since v1:
* None
changes since RFC:
* Parametrize scaler coeffient macros by 'set' (Ville)

Signed-off-by Pankaj Bharadiya

<[email protected]>

---
 drivers/gpu/drm/i915/i915_reg.h | 48
+++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_reg.h index 9c53fe918be6..d40f12d2a6b5 100644

drivers/gpu/drm/i915/i915_reg.h +25 -0
@@ -7205,6 +7205,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)
@@ -7219,6 +7220,10 @@ enum {
 #define PS_VADAPT_MODE_MOST_ADAPT  (3 << 5)  #define
 PS_PLANE_Y_SEL_MASK  (7 << 5)  #define PS_PLANE_Y_SEL(plane) (((plane)
+ 1) << 5)
+#define PS_Y_VERT_FILTER_SELECT(set)   ((set) << 4)
+#define PS_Y_HORZ_FILTER_SELECT(set)   ((set) << 3)
+#define PS_UV_VERT_FILTER_SELECT(set)  ((set) << 2) #define
+PS_UV_HORZ_FILTER_SELECT(set)  ((set) << 1)
 
 #define _PS_PWR_GATE_1A     0x68160
 #define _PS_PWR_GATE_2A     0x68260
@@ -7281,6 +7286,25 @@ 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_COEE_INDEX_AUTO_INC	   (1 << 10)
+
+#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),       \

drivers/gpu/drm/i915/i915_reg.h enum { · line 7338

Quoted 5 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
@@ -7310,6 +7334,30 @@ enum {
 			_ID(id, _PS_ECC_STAT_1A, _PS_ECC_STAT_2A),   \
 			_ID(id, _PS_ECC_STAT_1B, _PS_ECC_STAT_2B))
 
+#define _SKL_PS_COEF_INDEX_SET0(pipe, id)  _ID(pipe,    \
+			_ID(id, _PS_COEF_SET0_INDEX_1A,

_PS_COEF_SET0_INDEX_2A), \

drivers/gpu/drm/i915/i915_reg.h enum { · line 7339

Quoted 1 line
drivers/gpu/drm/i915/i915_reg.h +1 -0
+			_ID(id, _PS_COEF_SET0_INDEX_1B,

_PS_COEF_SET0_INDEX_2B))

drivers/gpu/drm/i915/i915_reg.h enum {

Quoted 3 lines
drivers/gpu/drm/i915/i915_reg.h +3 -0
+
+#define _SKL_PS_COEF_INDEX_SET1(pipe, id)  _ID(pipe,    \
+			_ID(id, _PS_COEF_SET1_INDEX_1A,

_PS_COEF_SET1_INDEX_2A), \

drivers/gpu/drm/i915/i915_reg.h enum { · line 7343

Quoted 1 line
drivers/gpu/drm/i915/i915_reg.h +1 -0
+			_ID(id, _PS_COEF_SET1_INDEX_1B,

_PS_COEF_SET1_INDEX_2B))

drivers/gpu/drm/i915/i915_reg.h enum {

Quoted 3 lines
drivers/gpu/drm/i915/i915_reg.h +3 -0
+
+#define _SKL_PS_COEF_DATA_SET0(pipe, id)  _ID(pipe,     \
+			_ID(id, _PS_COEF_SET0_DATA_1A,

_PS_COEF_SET0_DATA_2A), \

drivers/gpu/drm/i915/i915_reg.h enum { · line 7347

Quoted 1 line
drivers/gpu/drm/i915/i915_reg.h +1 -0
+			_ID(id, _PS_COEF_SET0_DATA_1B,

_PS_COEF_SET0_DATA_2B))

drivers/gpu/drm/i915/i915_reg.h enum {

Quoted 3 lines
drivers/gpu/drm/i915/i915_reg.h +3 -0
+
+#define _SKL_PS_COEF_DATA_SET1(pipe, id)  _ID(pipe,     \
+			_ID(id, _PS_COEF_SET1_DATA_1A,

_PS_COEF_SET1_DATA_2A), \

drivers/gpu/drm/i915/i915_reg.h enum { · line 7351

Quoted 1 line
drivers/gpu/drm/i915/i915_reg.h +1 -0
+			_ID(id, _PS_COEF_SET1_DATA_1B,

_PS_COEF_SET1_DATA_2B))

drivers/gpu/drm/i915/i915_reg.h enum {

Quoted 3 lines
drivers/gpu/drm/i915/i915_reg.h +3 -0
+
+#define SKL_PS_COEF_INDEX_SET(pipe, id, set) \
+			_MMIO_PIPE(set, _SKL_PS_COEF_INDEX_SET0(pipe, id),

\

drivers/gpu/drm/i915/i915_reg.h enum {

Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +4 -0
+			    _SKL_PS_COEF_INDEX_SET1(pipe, id))
+
+#define SKL_PS_COEF_DATA_SET(pipe, id, set) \
+			_MMIO_PIPE(set, _SKL_PS_COEF_DATA_SET0(pipe, id),

\

Quoted 4 lines

drivers/gpu/drm/i915/i915_reg.h enum { · line 7359

Quoted 1 line
drivers/gpu/drm/i915/i915_reg.h +1 -0
+			    _SKL_PS_COEF_DATA_SET1(pipe, id))

I'd name those CNL_PS_COEF_{DATA,INDEX}(). Or maybe eeven GLK_ since it already has this despite not being officially supported.

All other existing scaler macros start will SKL_PS_*, adding new CNL_PS_* may lead to confusion IMO since we will end up in using mixed SKL_PS_* and CNL_PS_* name to configure scaler.

Quoted 3 lines

Also I'd probably just have used +(set)*8 instead of adding another trip through _PICK_EVEN(). It's getting a bit hard to read this.

OK.
How does this sound like? -

+#define SKL_PS_COEF_INDEX_SET(pipe, id, set) _MMIO_PIPE(pipe, \
+ _ID(id, _PS_COEF_SET0_INDEX_1A, _PS_COEF_SET0_INDEX_2A) + (set) * 8, \
+ _ID(id, _PS_COEF_SET0_INDEX_1B, _PS_COEF_SET0_INDEX_2B) + (set) * 8)

+#define SKL_PS_COEF_DATA_SET(pipe, id, set) _MMIO_PIPE(pipe, \
+ _ID(id, _PS_COEF_SET0_DATA_1A, _PS_COEF_SET0_DATA_2A) + (set) * 8, \
+ _ID(id, _PS_COEF_SET0_DATA_1B, _PS_COEF_SET0_DATA_2B) + (set) * 8)

Thanks,
Pankaj

Quoted 11 lines
Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +1 -1
+
 /* legacy palette */
 #define _LGC_PALETTE_A           0x4a000
 #define _LGC_PALETTE_B           0x4a800
--

2.23.0

--
Ville Syrjälä
Intel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw

Re: [PATCH v2 3/5] drm/i915: Introduce scaling filter related registers and bit fields.

Quoted 120 lines · Pankaj
Quoted 120 lines

-----Original Message-----
From: Ville Syrjälä <[email protected]>
Sent: 23 March 2020 20:09
To: Laxminarayan Bharadiya, Pankaj <[email protected]>
Cc: Lattannavar, Sameer <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Joonas Lahtinen <[email protected]>; Vivi, Rodrigo <[email protected]>; David Airlie <[email protected]>
Subject: Re: [PATCH v2 3/5] drm/i915: Introduce scaling filter related registers and bit fields.

Quoted 69 lines · Pankaj Bharadiya

Introduce scaler registers and bit fields needed to configure the scaling filter in prgrammed mode and configure scaling filter coefficients.

changes since v1:
* None
changes since RFC:
* Parametrize scaler coeffient macros by 'set' (Ville)

Signed-off-by Pankaj Bharadiya

<[email protected]>

---
 drivers/gpu/drm/i915/i915_reg.h | 48
+++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_reg.h index 9c53fe918be6..d40f12d2a6b5 100644

drivers/gpu/drm/i915/i915_reg.h +25 -0
@@ -7205,6 +7205,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)
@@ -7219,6 +7220,10 @@ enum {
 #define PS_VADAPT_MODE_MOST_ADAPT  (3 << 5)  #define
 PS_PLANE_Y_SEL_MASK  (7 << 5)  #define PS_PLANE_Y_SEL(plane) (((plane)
+ 1) << 5)
+#define PS_Y_VERT_FILTER_SELECT(set)   ((set) << 4)
+#define PS_Y_HORZ_FILTER_SELECT(set)   ((set) << 3)
+#define PS_UV_VERT_FILTER_SELECT(set)  ((set) << 2) #define
+PS_UV_HORZ_FILTER_SELECT(set)  ((set) << 1)
 
 #define _PS_PWR_GATE_1A     0x68160
 #define _PS_PWR_GATE_2A     0x68260
@@ -7281,6 +7286,25 @@ 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_COEE_INDEX_AUTO_INC	   (1 << 10)
+
+#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),       \

drivers/gpu/drm/i915/i915_reg.h enum { · line 7338

Quoted 5 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
@@ -7310,6 +7334,30 @@ enum {
 			_ID(id, _PS_ECC_STAT_1A, _PS_ECC_STAT_2A),   \
 			_ID(id, _PS_ECC_STAT_1B, _PS_ECC_STAT_2B))
 
+#define _SKL_PS_COEF_INDEX_SET0(pipe, id)  _ID(pipe,    \
+			_ID(id, _PS_COEF_SET0_INDEX_1A,

_PS_COEF_SET0_INDEX_2A), \

drivers/gpu/drm/i915/i915_reg.h enum { · line 7339

Quoted 1 line
drivers/gpu/drm/i915/i915_reg.h +1 -0
+			_ID(id, _PS_COEF_SET0_INDEX_1B,

_PS_COEF_SET0_INDEX_2B))

drivers/gpu/drm/i915/i915_reg.h enum {

Quoted 3 lines
drivers/gpu/drm/i915/i915_reg.h +3 -0
+
+#define _SKL_PS_COEF_INDEX_SET1(pipe, id)  _ID(pipe,    \
+			_ID(id, _PS_COEF_SET1_INDEX_1A,

_PS_COEF_SET1_INDEX_2A), \

drivers/gpu/drm/i915/i915_reg.h enum { · line 7343

Quoted 1 line
drivers/gpu/drm/i915/i915_reg.h +1 -0
+			_ID(id, _PS_COEF_SET1_INDEX_1B,

_PS_COEF_SET1_INDEX_2B))

drivers/gpu/drm/i915/i915_reg.h enum {

Quoted 3 lines
drivers/gpu/drm/i915/i915_reg.h +3 -0
+
+#define _SKL_PS_COEF_DATA_SET0(pipe, id)  _ID(pipe,     \
+			_ID(id, _PS_COEF_SET0_DATA_1A,

_PS_COEF_SET0_DATA_2A), \

drivers/gpu/drm/i915/i915_reg.h enum { · line 7347

Quoted 1 line
drivers/gpu/drm/i915/i915_reg.h +1 -0
+			_ID(id, _PS_COEF_SET0_DATA_1B,

_PS_COEF_SET0_DATA_2B))

drivers/gpu/drm/i915/i915_reg.h enum {

Quoted 3 lines
drivers/gpu/drm/i915/i915_reg.h +3 -0
+
+#define _SKL_PS_COEF_DATA_SET1(pipe, id)  _ID(pipe,     \
+			_ID(id, _PS_COEF_SET1_DATA_1A,

_PS_COEF_SET1_DATA_2A), \

drivers/gpu/drm/i915/i915_reg.h enum { · line 7351

Quoted 1 line
drivers/gpu/drm/i915/i915_reg.h +1 -0
+			_ID(id, _PS_COEF_SET1_DATA_1B,

_PS_COEF_SET1_DATA_2B))

drivers/gpu/drm/i915/i915_reg.h enum {

Quoted 3 lines
drivers/gpu/drm/i915/i915_reg.h +3 -0
+
+#define SKL_PS_COEF_INDEX_SET(pipe, id, set) \
+			_MMIO_PIPE(set, _SKL_PS_COEF_INDEX_SET0(pipe, id),

\

drivers/gpu/drm/i915/i915_reg.h enum {

Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +4 -0
+			    _SKL_PS_COEF_INDEX_SET1(pipe, id))
+
+#define SKL_PS_COEF_DATA_SET(pipe, id, set) \
+			_MMIO_PIPE(set, _SKL_PS_COEF_DATA_SET0(pipe, id),

\

Quoted 8 lines
Quoted 4 lines

drivers/gpu/drm/i915/i915_reg.h enum { · line 7359

Quoted 1 line
drivers/gpu/drm/i915/i915_reg.h +1 -0
+			    _SKL_PS_COEF_DATA_SET1(pipe, id))

I'd name those CNL_PS_COEF_{DATA,INDEX}(). Or maybe eeven GLK_ since it already has this despite not being officially supported.

All other existing scaler macros start will SKL_PS_*, adding new CNL_PS_* may lead to confusion IMO since we will end up in using mixed SKL_PS_* and CNL_PS_* name to configure scaler.

They are called SKL_ because skl is where they got introduced.

Quoted 8 lines
Quoted 4 lines

Also I'd probably just have used +(set)*8 instead of adding another trip through _PICK_EVEN(). It's getting a bit hard to read this.

OK.
How does this sound like? -

Review

Quoted 7 lines
(quoted diff) +6 -0
+#define SKL_PS_COEF_INDEX_SET(pipe, id, set)  _MMIO_PIPE(pipe,    \
+                       _ID(id, _PS_COEF_SET0_INDEX_1A, _PS_COEF_SET0_INDEX_2A) + (set) * 8, \
+                       _ID(id, _PS_COEF_SET0_INDEX_1B, _PS_COEF_SET0_INDEX_2B) + (set) * 8)
 
+#define SKL_PS_COEF_DATA_SET(pipe, id, set)  _MMIO_PIPE(pipe,     \
+                       _ID(id, _PS_COEF_SET0_DATA_1A, _PS_COEF_SET0_DATA_2A) + (set) * 8, \
+                       _ID(id, _PS_COEF_SET0_DATA_1B, _PS_COEF_SET0_DATA_2B) + (set) * 8)

Looks all right.

Quoted 14 lines

Thanks,
Pankaj

Quoted 11 lines
Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +1 -1
+
 /* legacy palette */
 #define _LGC_PALETTE_A           0x4a000
 #define _LGC_PALETTE_B           0x4a800
--

2.23.0

--
Ville Syrjälä
Intel

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

PATCH v2 4/5 drm/i915/display: Add Nearest-neighbor based integer scaling support

In reply to Pankaj Bharadiya

Integer scaling (IS) is a nearest-neighbor upscaling technique that simply scales up the existing pixels by an integer (i.e., whole number) multiplier.Nearest-neighbor (NN) interpolation works by filling in the missing color values in the upscaled image with that of the coordinate-mapped nearest source pixel value.

Both IS and NN preserve the clarity of the original image. Integer scaling is particularly useful for pixel art games that rely on sharp, blocky images to deliver their distinctive look.

Introduce skl_scaler_setup_nearest_neighbor_filter() function which configures the scaler filter coefficients to enable nearest-neighbor filtering.

Bspec: 49247

changes since v1:
* Rearrange skl_scaler_setup_nearest_neighbor_filter() to iterate the registers directly instead of the phases and taps (Ville)

changes since RFC:
* Refine the skl_scaler_setup_nearest_neighbor_filter() logic (Ville)

---
 drivers/gpu/drm/i915/display/intel_display.c | 72 ++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_display.h |  2 +
 2 files changed, 74 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +72 -0
index 8f23c4d51c33..791dd908aa89 100644
@@ -6237,6 +6237,78 @@ void skl_scaler_disable(const struct intel_crtc_state *old_crtc_state)
 		skl_detach_scaler(crtc, i);
 }
 
+static int skl_coef_tap(int i)
+{
+	return i % 7;
+}
+
+static u16 skl_nearest_filter_coef(int t)
+{
+	return t == 3 ? 0x0800 : 0x3000;
+}
+
+/**
+ *  Theory behind setting nearest-neighbor integer scaling:
+ *
+ *  17 phase of 7 taps requires 119 coefficients in 60 dwords per set.
+ *  The letter represents the filter tap (D is the center tap) and the number
+ *  represents the coefficient set for a phase (0-16).
+ *
+ *         +------------+------------------------+------------------------+
+ *         |Index value | Data value coeffient 1 | Data value coeffient 2 |
+ *         +------------+------------------------+------------------------+
+ *         |   00h      |          B0            |          A0            |
+ *         +------------+------------------------+------------------------+
+ *         |   01h      |          D0            |          C0            |
+ *         +------------+------------------------+------------------------+
+ *         |   02h      |          F0            |          E0            |
+ *         +------------+------------------------+------------------------+
+ *         |   03h      |          A1            |          G0            |
+ *         +------------+------------------------+------------------------+
+ *         |   04h      |          C1            |          B1            |
+ *         +------------+------------------------+------------------------+
+ *         |   ...      |          ...           |          ...           |
+ *         +------------+------------------------+------------------------+
+ *         |   38h      |          B16           |          A16           |
+ *         +------------+------------------------+------------------------+
+ *         |   39h      |          D16           |          C16           |
+ *         +------------+------------------------+------------------------+
+ *         |   3Ah      |          F16           |          C16           |
+ *         +------------+------------------------+------------------------+
+ *         |   3Bh      |        Reserved        |          G16           |
+ *         +------------+------------------------+------------------------+
+ *
+ *  To enable nearest-neighbor scaling:  program scaler coefficents with
+ *  the center tap (Dxx) values set to 1 and all other values set to 0 as per
+ *  SCALER_COEFFICIENT_FORMAT
+ *
+ */
+
+void skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv,
+					      enum pipe pipe, int id, int set)
+{
+	int i;
+
+	/*enable the index auto increment.*/
+	intel_de_write_fw(dev_priv,
+			  SKL_PS_COEF_INDEX_SET(pipe, id, set),
+			  PS_COEE_INDEX_AUTO_INC);
+
+	for (i = 0; i < 17 * 7; i += 2) {
+		u32 tmp;
+		int t;
+
+		t = skl_coef_tap(i);
+		tmp = skl_nearest_filter_coef(t);
+
+		t = skl_coef_tap(i+1);
+		tmp |= skl_nearest_filter_coef(t)<<16;
+
+		intel_de_write_fw(dev_priv, SKL_PS_COEF_DATA_SET(pipe, id, set),
+				  tmp);
+	}
+}
+
 static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
 {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
drivers/gpu/drm/i915/display/intel_display.h +2 -0
index adb1225a3480..88f3c77f6806 100644
@@ -587,6 +587,8 @@ void intel_crtc_arm_fifo_underrun(struct intel_crtc *crtc,
 u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_center);
 int skl_update_scaler_crtc(struct intel_crtc_state *crtc_state);
 void skl_scaler_disable(const struct intel_crtc_state *old_crtc_state);
+void skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv,
+					      enum pipe pipe, int id, int set);
 void ilk_pfit_disable(const struct intel_crtc_state *old_crtc_state);
 u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state,
 			const struct intel_plane_state *plane_state);
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#10 lore raw

Re: [PATCH v2 4/5] drm/i915/display: Add Nearest-neighbor based integer scaling support

Quoted 82 lines · Pankaj Bharadiya

Integer scaling (IS) is a nearest-neighbor upscaling technique that simply scales up the existing pixels by an integer (i.e., whole number) multiplier.Nearest-neighbor (NN) interpolation works by filling in the missing color values in the upscaled image with that of the coordinate-mapped nearest source pixel value.

Both IS and NN preserve the clarity of the original image. Integer scaling is particularly useful for pixel art games that rely on sharp, blocky images to deliver their distinctive look.

Introduce skl_scaler_setup_nearest_neighbor_filter() function which configures the scaler filter coefficients to enable nearest-neighbor filtering.

Bspec: 49247

changes since v1:
* Rearrange skl_scaler_setup_nearest_neighbor_filter() to iterate the registers directly instead of the phases and taps (Ville)

changes since RFC:
* Refine the skl_scaler_setup_nearest_neighbor_filter() logic (Ville)

---
 drivers/gpu/drm/i915/display/intel_display.c | 72 ++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_display.h |  2 +
 2 files changed, 74 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +43 -0
index 8f23c4d51c33..791dd908aa89 100644
@@ -6237,6 +6237,78 @@ void skl_scaler_disable(const struct intel_crtc_state *old_crtc_state)
 		skl_detach_scaler(crtc, i);
 }
 
+static int skl_coef_tap(int i)
+{
+	return i % 7;
+}
+
+static u16 skl_nearest_filter_coef(int t)
+{
+	return t == 3 ? 0x0800 : 0x3000;
+}
+
+/**
+ *  Theory behind setting nearest-neighbor integer scaling:
+ *
+ *  17 phase of 7 taps requires 119 coefficients in 60 dwords per set.
+ *  The letter represents the filter tap (D is the center tap) and the number
+ *  represents the coefficient set for a phase (0-16).
+ *
+ *         +------------+------------------------+------------------------+
+ *         |Index value | Data value coeffient 1 | Data value coeffient 2 |
+ *         +------------+------------------------+------------------------+
+ *         |   00h      |          B0            |          A0            |
+ *         +------------+------------------------+------------------------+
+ *         |   01h      |          D0            |          C0            |
+ *         +------------+------------------------+------------------------+
+ *         |   02h      |          F0            |          E0            |
+ *         +------------+------------------------+------------------------+
+ *         |   03h      |          A1            |          G0            |
+ *         +------------+------------------------+------------------------+
+ *         |   04h      |          C1            |          B1            |
+ *         +------------+------------------------+------------------------+
+ *         |   ...      |          ...           |          ...           |
+ *         +------------+------------------------+------------------------+
+ *         |   38h      |          B16           |          A16           |
+ *         +------------+------------------------+------------------------+
+ *         |   39h      |          D16           |          C16           |
+ *         +------------+------------------------+------------------------+
+ *         |   3Ah      |          F16           |          C16           |
+ *         +------------+------------------------+------------------------+
+ *         |   3Bh      |        Reserved        |          G16           |
+ *         +------------+------------------------+------------------------+
+ *
+ *  To enable nearest-neighbor scaling:  program scaler coefficents with
+ *  the center tap (Dxx) values set to 1 and all other values set to 0 as per

drivers/gpu/drm/i915/display/intel_display.c void skl_scaler_disable(const struct intel_crtc_state *old_crtc_state) · line 6292

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display.c +10 -0
+ *  SCALER_COEFFICIENT_FORMAT
+ *
+ */
+
+void skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv,
+					      enum pipe pipe, int id, int set)
+{
+	int i;
+
+	/*enable the index auto increment.*/

Pointless comment, and also misformatted.

drivers/gpu/drm/i915/display/intel_display.c void skl_scaler_disable(const struct intel_crtc_state *old_crtc_state) · line 6305

Quoted 13 lines
drivers/gpu/drm/i915/display/intel_display.c +13 -0
+	intel_de_write_fw(dev_priv,
+			  SKL_PS_COEF_INDEX_SET(pipe, id, set),
+			  PS_COEE_INDEX_AUTO_INC);
+
+	for (i = 0; i < 17 * 7; i += 2) {
+		u32 tmp;
+		int t;
+
+		t = skl_coef_tap(i);
+		tmp = skl_nearest_filter_coef(t);
+
+		t = skl_coef_tap(i+1);
+		tmp |= skl_nearest_filter_coef(t)<<16;

Missing spaces.

drivers/gpu/drm/i915/display/intel_display.c void skl_scaler_disable(const struct intel_crtc_state *old_crtc_state) · line 6309

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +4 -0
+
+		intel_de_write_fw(dev_priv, SKL_PS_COEF_DATA_SET(pipe, id, set),
+				  tmp);
+	}

I'd maybe reset the index back to 0 here and disable the auto-increment bit.

Quoted 20 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
+}
+
 static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
 {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
drivers/gpu/drm/i915/display/intel_display.h +2 -0
index adb1225a3480..88f3c77f6806 100644
@@ -587,6 +587,8 @@ void intel_crtc_arm_fifo_underrun(struct intel_crtc *crtc,
 u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_center);
 int skl_update_scaler_crtc(struct intel_crtc_state *crtc_state);
 void skl_scaler_disable(const struct intel_crtc_state *old_crtc_state);
+void skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv,
+					      enum pipe pipe, int id, int set);
 void ilk_pfit_disable(const struct intel_crtc_state *old_crtc_state);
 u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state,
 			const struct intel_plane_state *plane_state);
Signature · 1 line
2.23.0
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

PATCH v2 5/5 drm/i915: Enable scaling filter for plane and CRTC

In reply to Pankaj Bharadiya

GEN >= 10 hardware supports the programmable scaler filter.

Attach scaling filter property for CRTC and plane for GEN >= 10 hardwares and program scaler filter based on the selected filter type.

changes since v1:
* None
Changes since RFC:
* Enable properties for GEN >= 10 platforms (Ville)
* Do not round off the crtc co-ordinate (Danial Stone, Ville)
* Add new functions to handle scaling filter setup (Ville)
* Remove coefficient set 0 hardcoding.

---
 drivers/gpu/drm/i915/display/intel_display.c | 32 ++++++++++++++++++--
 drivers/gpu/drm/i915/display/intel_sprite.c  | 31 ++++++++++++++++++-
 2 files changed, 60 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +30 -2
index 791dd908aa89..4b3387ee332e 100644
@@ -6309,6 +6309,25 @@ void skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv,
 	}
 }
 
+static u32
+skl_scaler_crtc_setup_filter(struct drm_i915_private *dev_priv, enum pipe pipe,
+			  int id, int set, enum drm_crtc_scaling_filter filter)
+{
+	u32 scaler_filter_ctl = PS_FILTER_MEDIUM;
+
+	if (filter == DRM_CRTC_SCALING_FILTER_NEAREST_NEIGHBOR) {
+		skl_scaler_setup_nearest_neighbor_filter(dev_priv, pipe, id,
+							 set);
+		scaler_filter_ctl = PS_FILTER_PROGRAMMED |
+				PS_UV_VERT_FILTER_SELECT(set) |
+				PS_UV_HORZ_FILTER_SELECT(set) |
+				PS_Y_VERT_FILTER_SELECT(set) |
+				PS_Y_HORZ_FILTER_SELECT(set);
+
+	}
+	return scaler_filter_ctl;
+}
+
 static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
 {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
@@ -6316,12 +6335,14 @@ static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
 	enum pipe pipe = crtc->pipe;
 	const struct intel_crtc_scaler_state *scaler_state =
 		&crtc_state->scaler_state;
+	const struct drm_crtc_state *state = &crtc_state->uapi;
 
 	if (crtc_state->pch_pfit.enabled) {
 		u16 uv_rgb_hphase, uv_rgb_vphase;
 		int pfit_w, pfit_h, hscale, vscale;
 		unsigned long irqflags;
 		int id;
+		int scaler_filter_ctl;
 
 		if (drm_WARN_ON(&dev_priv->drm,
 				crtc_state->scaler_state.scaler_id < 0))
@@ -6340,8 +6361,12 @@ static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
 
 		spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
 
-		intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, id), PS_SCALER_EN |
-				  PS_FILTER_MEDIUM | scaler_state->scalers[id].mode);
+		scaler_filter_ctl =
+			skl_scaler_crtc_setup_filter(dev_priv, pipe, id, 0,
+						state->scaling_filter);
+		intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, id),
+				  PS_SCALER_EN | scaler_filter_ctl |
+				  scaler_state->scalers[id].mode);
 		intel_de_write_fw(dev_priv, SKL_PS_VPHASE(pipe, id),
 				  PS_Y_PHASE(0) | PS_UV_RGB_PHASE(uv_rgb_vphase));
 		intel_de_write_fw(dev_priv, SKL_PS_HPHASE(pipe, id),
@@ -16777,6 +16802,9 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
 		dev_priv->plane_to_crtc_mapping[i9xx_plane] = crtc;
 	}
 
+	if (INTEL_GEN(dev_priv) >= 10)
+		drm_crtc_enable_scaling_filter(&crtc->base);
+
 	intel_color_init(crtc);
 
 	intel_crtc_crc_init(crtc);
drivers/gpu/drm/i915/display/intel_sprite.c +30 -1
index deda351719db..ac3fd9843ace 100644
@@ -395,6 +395,26 @@ skl_plane_max_stride(struct intel_plane *plane,
 		return min(8192 * cpp, 32768);
 }
 
+static u32
+skl_scaler_plane_setup_filter(struct drm_i915_private *dev_priv, enum pipe pipe,
+			      int id, int set,
+			      enum drm_plane_scaling_filter filter)
+{
+	u32 scaler_filter_ctl = PS_FILTER_MEDIUM;
+
+	if (filter == DRM_PLANE_SCALING_FILTER_NEAREST_NEIGHBOR) {
+		skl_scaler_setup_nearest_neighbor_filter(dev_priv, pipe, id,
+							 set);
+		scaler_filter_ctl = PS_FILTER_PROGRAMMED |
+				PS_UV_VERT_FILTER_SELECT(set) |
+				PS_UV_HORZ_FILTER_SELECT(set) |
+				PS_Y_VERT_FILTER_SELECT(set) |
+				PS_Y_HORZ_FILTER_SELECT(set);
+
+	}
+	return scaler_filter_ctl;
+}
+
 static void
 skl_program_scaler(struct intel_plane *plane,
 		   const struct intel_crtc_state *crtc_state,
@@ -406,6 +426,7 @@ skl_program_scaler(struct intel_plane *plane,
 	int scaler_id = plane_state->scaler_id;
 	const struct intel_scaler *scaler =
 		&crtc_state->scaler_state.scalers[scaler_id];
+	const struct drm_plane_state *state = &plane_state->uapi;
 	int crtc_x = plane_state->uapi.dst.x1;
 	int crtc_y = plane_state->uapi.dst.y1;
 	u32 crtc_w = drm_rect_width(&plane_state->uapi.dst);
@@ -413,6 +434,7 @@ skl_program_scaler(struct intel_plane *plane,
 	u16 y_hphase, uv_rgb_hphase;
 	u16 y_vphase, uv_rgb_vphase;
 	int hscale, vscale;
+	int scaler_filter_ctl;
 
 	hscale = drm_rect_calc_hscale(&plane_state->uapi.src,
 				      &plane_state->uapi.dst,
@@ -439,8 +461,12 @@ skl_program_scaler(struct intel_plane *plane,
 		uv_rgb_vphase = skl_scaler_calc_phase(1, vscale, false);
 	}
 
+	scaler_filter_ctl =
+		skl_scaler_plane_setup_filter(dev_priv, pipe, scaler_id, 0,
+					      state->scaling_filter);
 	intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, scaler_id),
-			  PS_SCALER_EN | PS_PLANE_SEL(plane->id) | scaler->mode);
+			  PS_SCALER_EN | PS_PLANE_SEL(plane->id) |
+			  scaler->mode | scaler_filter_ctl);
 	intel_de_write_fw(dev_priv, SKL_PS_VPHASE(pipe, scaler_id),
 			  PS_Y_PHASE(y_vphase) | PS_UV_RGB_PHASE(uv_rgb_vphase));
 	intel_de_write_fw(dev_priv, SKL_PS_HPHASE(pipe, scaler_id),
@@ -3121,6 +3147,9 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
 
 	drm_plane_create_zpos_immutable_property(&plane->base, plane_id);
 
+	if (INTEL_GEN(dev_priv) >= 10)
+		drm_plane_enable_scaling_filter(&plane->base);
+
 	drm_plane_helper_add(&plane->base, &intel_plane_helper_funcs);
 
 	return plane;
Signature · 6 lines
2.23.0

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

Re: [PATCH v2 5/5] drm/i915: Enable scaling filter for plane and CRTC

Quoted 37 lines · Pankaj Bharadiya

GEN >= 10 hardware supports the programmable scaler filter.

Attach scaling filter property for CRTC and plane for GEN >= 10 hardwares and program scaler filter based on the selected filter type.

changes since v1:
* None
Changes since RFC:
* Enable properties for GEN >= 10 platforms (Ville)
* Do not round off the crtc co-ordinate (Danial Stone, Ville)
* Add new functions to handle scaling filter setup (Ville)
* Remove coefficient set 0 hardcoding.

---
 drivers/gpu/drm/i915/display/intel_display.c | 32 ++++++++++++++++++--
 drivers/gpu/drm/i915/display/intel_sprite.c  | 31 ++++++++++++++++++-
 2 files changed, 60 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +7 -0
index 791dd908aa89..4b3387ee332e 100644
@@ -6309,6 +6309,25 @@ void skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv,
 	}
 }
 
+static u32
+skl_scaler_crtc_setup_filter(struct drm_i915_private *dev_priv, enum pipe pipe,
+			  int id, int set, enum drm_crtc_scaling_filter filter)
+{
+	u32 scaler_filter_ctl = PS_FILTER_MEDIUM;
+
+	if (filter == DRM_CRTC_SCALING_FILTER_NEAREST_NEIGHBOR) {

drivers/gpu/drm/i915/display/intel_display.c void skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv, · line 6328

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display.c +10 -0
+		skl_scaler_setup_nearest_neighbor_filter(dev_priv, pipe, id,
+							 set);
+		scaler_filter_ctl = PS_FILTER_PROGRAMMED |
+				PS_UV_VERT_FILTER_SELECT(set) |
+				PS_UV_HORZ_FILTER_SELECT(set) |
+				PS_Y_VERT_FILTER_SELECT(set) |
+				PS_Y_HORZ_FILTER_SELECT(set);
+
+	}
+	return scaler_filter_ctl;

This function does too many things.

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state) · line 6338

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display.c +3 -0
+}
+
 static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
 {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
@@ -6316,12 +6335,14 @@ static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
 	enum pipe pipe = crtc->pipe;
 	const struct intel_crtc_scaler_state *scaler_state =
 		&crtc_state->scaler_state;
+	const struct drm_crtc_state *state = &crtc_state->uapi;

Pls don't add this kind of aliases. We're moving away from using the drm_ types as much as possible.

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state) · line 6345

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -0
 	if (crtc_state->pch_pfit.enabled) {
 		u16 uv_rgb_hphase, uv_rgb_vphase;
 		int pfit_w, pfit_h, hscale, vscale;
 		unsigned long irqflags;
 		int id;
+		int scaler_filter_ctl;

It's a register value so u32. I'd also s/scaler_filter_ctl/filter_select/ or something like that.

Alternatively we could just call it ps_ctrl and have it contain the full register value for that particular register.

Quoted 46 lines
drivers/gpu/drm/i915/display/intel_display.c +9 -2
 		if (drm_WARN_ON(&dev_priv->drm,
 				crtc_state->scaler_state.scaler_id < 0))
@@ -6340,8 +6361,12 @@ static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
 
 		spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
 
-		intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, id), PS_SCALER_EN |
-				  PS_FILTER_MEDIUM | scaler_state->scalers[id].mode);
+		scaler_filter_ctl =
+			skl_scaler_crtc_setup_filter(dev_priv, pipe, id, 0,
+						state->scaling_filter);
+		intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, id),
+				  PS_SCALER_EN | scaler_filter_ctl |
+				  scaler_state->scalers[id].mode);
 		intel_de_write_fw(dev_priv, SKL_PS_VPHASE(pipe, id),
 				  PS_Y_PHASE(0) | PS_UV_RGB_PHASE(uv_rgb_vphase));
 		intel_de_write_fw(dev_priv, SKL_PS_HPHASE(pipe, id),
@@ -16777,6 +16802,9 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
 		dev_priv->plane_to_crtc_mapping[i9xx_plane] = crtc;
 	}
 
+	if (INTEL_GEN(dev_priv) >= 10)
+		drm_crtc_enable_scaling_filter(&crtc->base);
+
 	intel_color_init(crtc);
 
 	intel_crtc_crc_init(crtc);
drivers/gpu/drm/i915/display/intel_sprite.c +10 -0
index deda351719db..ac3fd9843ace 100644
@@ -395,6 +395,26 @@ skl_plane_max_stride(struct intel_plane *plane,
 		return min(8192 * cpp, 32768);
 }
 
+static u32
+skl_scaler_plane_setup_filter(struct drm_i915_private *dev_priv, enum pipe pipe,
+			      int id, int set,
+			      enum drm_plane_scaling_filter filter)
+{
+	u32 scaler_filter_ctl = PS_FILTER_MEDIUM;
+
+	if (filter == DRM_PLANE_SCALING_FILTER_NEAREST_NEIGHBOR) {
+		skl_scaler_setup_nearest_neighbor_filter(dev_priv, pipe, id,
+							 set);

drivers/gpu/drm/i915/display/intel_sprite.c skl_plane_max_stride(struct intel_plane *plane, · line 417

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_sprite.c +10 -0
+		scaler_filter_ctl = PS_FILTER_PROGRAMMED |
+				PS_UV_VERT_FILTER_SELECT(set) |
+				PS_UV_HORZ_FILTER_SELECT(set) |
+				PS_Y_VERT_FILTER_SELECT(set) |
+				PS_Y_HORZ_FILTER_SELECT(set);
+
+	}
+	return scaler_filter_ctl;
+}
+

We don't want such copy pasta between planes and crtcs.

Quoted 45 lines
drivers/gpu/drm/i915/display/intel_sprite.c +10 -1
 static void
 skl_program_scaler(struct intel_plane *plane,
 		   const struct intel_crtc_state *crtc_state,
@@ -406,6 +426,7 @@ skl_program_scaler(struct intel_plane *plane,
 	int scaler_id = plane_state->scaler_id;
 	const struct intel_scaler *scaler =
 		&crtc_state->scaler_state.scalers[scaler_id];
+	const struct drm_plane_state *state = &plane_state->uapi;
 	int crtc_x = plane_state->uapi.dst.x1;
 	int crtc_y = plane_state->uapi.dst.y1;
 	u32 crtc_w = drm_rect_width(&plane_state->uapi.dst);
@@ -413,6 +434,7 @@ skl_program_scaler(struct intel_plane *plane,
 	u16 y_hphase, uv_rgb_hphase;
 	u16 y_vphase, uv_rgb_vphase;
 	int hscale, vscale;
+	int scaler_filter_ctl;
 
 	hscale = drm_rect_calc_hscale(&plane_state->uapi.src,
 				      &plane_state->uapi.dst,
@@ -439,8 +461,12 @@ skl_program_scaler(struct intel_plane *plane,
 		uv_rgb_vphase = skl_scaler_calc_phase(1, vscale, false);
 	}
 
+	scaler_filter_ctl =
+		skl_scaler_plane_setup_filter(dev_priv, pipe, scaler_id, 0,
+					      state->scaling_filter);
 	intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, scaler_id),
-			  PS_SCALER_EN | PS_PLANE_SEL(plane->id) | scaler->mode);
+			  PS_SCALER_EN | PS_PLANE_SEL(plane->id) |
+			  scaler->mode | scaler_filter_ctl);
 	intel_de_write_fw(dev_priv, SKL_PS_VPHASE(pipe, scaler_id),
 			  PS_Y_PHASE(y_vphase) | PS_UV_RGB_PHASE(uv_rgb_vphase));
 	intel_de_write_fw(dev_priv, SKL_PS_HPHASE(pipe, scaler_id),
@@ -3121,6 +3147,9 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
 
 	drm_plane_create_zpos_immutable_property(&plane->base, plane_id);
 
+	if (INTEL_GEN(dev_priv) >= 10)
+		drm_plane_enable_scaling_filter(&plane->base);
+
 	drm_plane_helper_add(&plane->base, &intel_plane_helper_funcs);
 
 	return plane;
Signature · 1 line
2.23.0
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#13 lore raw

RE: [PATCH v2 5/5] drm/i915: Enable scaling filter for plane and CRTC

Quoted 54 lines

-----Original Message-----
From: Ville Syrjälä <[email protected]>
Sent: 23 March 2020 20:18
To: Laxminarayan Bharadiya, Pankaj <[email protected]>
Cc: Lattannavar, Sameer <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Joonas Lahtinen <[email protected]>; Vivi, Rodrigo <[email protected]>; David Airlie <[email protected]>; Chris Wilson <[email protected]>; Maarten Lankhorst <[email protected]>; Souza, Jose <[email protected]>; Deak, Imre <[email protected]>; Shankar, Uma <[email protected]>
Subject: Re: [PATCH v2 5/5] drm/i915: Enable scaling filter for plane and CRTC

drivers/gpu/drm/i915/display/intel_display.c void

Quoted 29 lines · Pankaj Bharadiya

GEN >= 10 hardware supports the programmable scaler filter.

Attach scaling filter property for CRTC and plane for GEN >= 10 hardwares and program scaler filter based on the selected filter type.

changes since v1:
* None
Changes since RFC:
* Enable properties for GEN >= 10 platforms (Ville)
* Do not round off the crtc co-ordinate (Danial Stone, Ville)
* Add new functions to handle scaling filter setup (Ville)
* Remove coefficient set 0 hardcoding.

Signed-off-by Pankaj Bharadiya

<[email protected]>

---
 drivers/gpu/drm/i915/display/intel_display.c | 32
++++++++++++++++++--  drivers/gpu/drm/i915/display/intel_sprite.c  |
31 ++++++++++++++++++-
 2 files changed, 60 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +0 -0
index 791dd908aa89..4b3387ee332e 100644
@@ -6309,6 +6309,25 @@ void

skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/display/intel_display.c void skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv,

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
 	}
 }
 
+static u32
+skl_scaler_crtc_setup_filter(struct drm_i915_private *dev_priv, enum pipe

pipe,

Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +4 -0
+			  int id, int set, enum drm_crtc_scaling_filter filter) {
+	u32 scaler_filter_ctl = PS_FILTER_MEDIUM;
+
+	if (filter == DRM_CRTC_SCALING_FILTER_NEAREST_NEIGHBOR) {

drivers/gpu/drm/i915/display/intel_display.c void skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv, · line 6328

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display.c +10 -0
+		skl_scaler_setup_nearest_neighbor_filter(dev_priv, pipe, id,
+							 set);
+		scaler_filter_ctl = PS_FILTER_PROGRAMMED |
+				PS_UV_VERT_FILTER_SELECT(set) |
+				PS_UV_HORZ_FILTER_SELECT(set) |
+				PS_Y_VERT_FILTER_SELECT(set) |
+				PS_Y_HORZ_FILTER_SELECT(set);
+
+	}
+	return scaler_filter_ctl;

This function does too many things.

I was thinking to have a common function which configures the filter and also provides the register bits (ps_ctrl) to select a desired filter so that we need not have extra condition to figure out filter select register bits where this function is being called.
How about renaming this function to some better name like skl_scaler_set_and_get_filter_select() or something else?
Or shall I breakdown this function into multiple functions?

Any suggestions?

Quoted 8 lines

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
+}
+
 static void skl_pfit_enable(const struct intel_crtc_state
 *crtc_state)  {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
@@ -6316,12 +6335,14 @@ static void skl_pfit_enable(const struct

intel_crtc_state *crtc_state)

Quoted 7 lines

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state) · line 6338

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -0
 	enum pipe pipe = crtc->pipe;
 	const struct intel_crtc_scaler_state *scaler_state =
 		&crtc_state->scaler_state;
+	const struct drm_crtc_state *state = &crtc_state->uapi;

Pls don't add this kind of aliases. We're moving away from using the drm_ types as much as possible.

OK.

Quoted 10 lines

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state) · line 6345

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -0
 	if (crtc_state->pch_pfit.enabled) {
 		u16 uv_rgb_hphase, uv_rgb_vphase;
 		int pfit_w, pfit_h, hscale, vscale;
 		unsigned long irqflags;
 		int id;
+		int scaler_filter_ctl;

It's a register value so u32. I'd also

Yes, I missed it. Thanks for pointing out.

Quoted 4 lines

s/scaler_filter_ctl/filter_select/ or something like that.

Alternatively we could just call it ps_ctrl and have it contain the full register value for that particular register.

ps_ctrl sounds better, will use this name.

Quoted 58 lines

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct · line 6346

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -0
 		if (drm_WARN_ON(&dev_priv->drm,
 				crtc_state->scaler_state.scaler_id < 0)) @@ -

6340,8 +6361,12 @@

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -0
 static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
 
drivers/gpu/drm/i915/display/intel_display.c +0 -1
 		spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
 
-		intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, id),

PS_SCALER_EN |

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -1
-				  PS_FILTER_MEDIUM | scaler_state-

scalers[id].mode);

drivers/gpu/drm/i915/display/intel_display.c +6 -0
+		scaler_filter_ctl =
+			skl_scaler_crtc_setup_filter(dev_priv, pipe, id, 0,
+						state->scaling_filter);
+		intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, id),
+				  PS_SCALER_EN | scaler_filter_ctl |
+				  scaler_state->scalers[id].mode);
 		intel_de_write_fw(dev_priv, SKL_PS_VPHASE(pipe, id),
 				  PS_Y_PHASE(0) |

PS_UV_RGB_PHASE(uv_rgb_vphase));

Quoted 1 line

intel_de_write_fw(dev_priv, SKL_PS_HPHASE(pipe, id), @@ -

16777,6

Quoted 1 line

+16802,9 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv,

enum pipe pipe)

Quoted 15 lines
drivers/gpu/drm/i915/display/intel_display.c +3 -0
 		dev_priv->plane_to_crtc_mapping[i9xx_plane] = crtc;
 	}
 
+	if (INTEL_GEN(dev_priv) >= 10)
+		drm_crtc_enable_scaling_filter(&crtc->base);
+
 	intel_color_init(crtc);
 
 	intel_crtc_crc_init(crtc);
drivers/gpu/drm/i915/display/intel_sprite.c +0 -0
index deda351719db..ac3fd9843ace 100644

drivers/gpu/drm/i915/display/intel_sprite.c skl_plane_max_stride(struct intel_plane *plane, · line 399

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_sprite.c +2 -0
@@ -395,6 +395,26 @@ skl_plane_max_stride(struct intel_plane *plane,
 		return min(8192 * cpp, 32768);
 }
 
+static u32
+skl_scaler_plane_setup_filter(struct drm_i915_private *dev_priv, enum pipe

pipe,

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_sprite.c +11 -0
+			      int id, int set,
+			      enum drm_plane_scaling_filter filter) {
+	u32 scaler_filter_ctl = PS_FILTER_MEDIUM;
+
+	if (filter == DRM_PLANE_SCALING_FILTER_NEAREST_NEIGHBOR) {
+		skl_scaler_setup_nearest_neighbor_filter(dev_priv, pipe, id,
+							 set);
+		scaler_filter_ctl = PS_FILTER_PROGRAMMED |
+				PS_UV_VERT_FILTER_SELECT(set) |
+				PS_UV_HORZ_FILTER_SELECT(set) |
+				PS_Y_VERT_FILTER_SELECT(set) |
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_sprite.c skl_plane_max_stride(struct intel_plane *plane, · line 416

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_sprite.c +6 -0
+				PS_Y_HORZ_FILTER_SELECT(set);
+
+	}
+	return scaler_filter_ctl;
+}
+

We don't want such copy pasta between planes and crtcs.

Yeah, got it.
Will add a common enum drm_scaling_filter and use it.

Thanks,
Pankaj

Quoted 47 lines

drivers/gpu/drm/i915/display/intel_sprite.c skl_plane_max_stride(struct intel_plane *plane,

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_sprite.c +0 -0
 static void
 skl_program_scaler(struct intel_plane *plane,
 		   const struct intel_crtc_state *crtc_state, @@ -406,6 +426,7

@@

Quoted 20 lines

skl_program_scaler(struct intel_plane *plane,

drivers/gpu/drm/i915/display/intel_sprite.c +2 -0
 	int scaler_id = plane_state->scaler_id;
 	const struct intel_scaler *scaler =
 		&crtc_state->scaler_state.scalers[scaler_id];
+	const struct drm_plane_state *state = &plane_state->uapi;
 	int crtc_x = plane_state->uapi.dst.x1;
 	int crtc_y = plane_state->uapi.dst.y1;
 	u32 crtc_w = drm_rect_width(&plane_state->uapi.dst);
@@ -413,6 +434,7 @@ skl_program_scaler(struct intel_plane *plane,
 	u16 y_hphase, uv_rgb_hphase;
 	u16 y_vphase, uv_rgb_vphase;
 	int hscale, vscale;
+	int scaler_filter_ctl;
 
 	hscale = drm_rect_calc_hscale(&plane_state->uapi.src,
 				      &plane_state->uapi.dst,
@@ -439,8 +461,12 @@ skl_program_scaler(struct intel_plane *plane,
 		uv_rgb_vphase = skl_scaler_calc_phase(1, vscale, false);
 	}
 

drivers/gpu/drm/i915/display/intel_sprite.c skl_program_scaler(struct intel_plane *plane, · line 472

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_sprite.c +5 -1
+	scaler_filter_ctl =
+		skl_scaler_plane_setup_filter(dev_priv, pipe, scaler_id, 0,
+					      state->scaling_filter);
 	intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, scaler_id),
-			  PS_SCALER_EN | PS_PLANE_SEL(plane->id) | scaler-
 mode);
+			  PS_SCALER_EN | PS_PLANE_SEL(plane->id) |
+			  scaler->mode | scaler_filter_ctl);
 	intel_de_write_fw(dev_priv, SKL_PS_VPHASE(pipe, scaler_id),
 			  PS_Y_PHASE(y_vphase) |

PS_UV_RGB_PHASE(uv_rgb_vphase));

Quoted 11 lines

intel_de_write_fw(dev_priv, SKL_PS_HPHASE(pipe, scaler_id), @@
-3121,6 +3147,9 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/display/intel_sprite.c +3 -0
 	drm_plane_create_zpos_immutable_property(&plane->base, plane_id);
 
+	if (INTEL_GEN(dev_priv) >= 10)
+		drm_plane_enable_scaling_filter(&plane->base);
+
 	drm_plane_helper_add(&plane->base, &intel_plane_helper_funcs);
Quoted 7 lines
Quoted 3 lines

return plane;
--
2.23.0

--
Ville Syrjälä
Intel

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

#14 lore raw

Re: [PATCH v2 5/5] drm/i915: Enable scaling filter for plane and CRTC

Quoted 71 lines · Pankaj
Quoted 54 lines

-----Original Message-----
From: Ville Syrjälä <[email protected]>
Sent: 23 March 2020 20:18
To: Laxminarayan Bharadiya, Pankaj <[email protected]>
Cc: Lattannavar, Sameer <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Joonas Lahtinen <[email protected]>; Vivi, Rodrigo <[email protected]>; David Airlie <[email protected]>; Chris Wilson <[email protected]>; Maarten Lankhorst <[email protected]>; Souza, Jose <[email protected]>; Deak, Imre <[email protected]>; Shankar, Uma <[email protected]>
Subject: Re: [PATCH v2 5/5] drm/i915: Enable scaling filter for plane and CRTC

drivers/gpu/drm/i915/display/intel_display.c void

Quoted 29 lines · Pankaj Bharadiya

GEN >= 10 hardware supports the programmable scaler filter.

Attach scaling filter property for CRTC and plane for GEN >= 10 hardwares and program scaler filter based on the selected filter type.

changes since v1:
* None
Changes since RFC:
* Enable properties for GEN >= 10 platforms (Ville)
* Do not round off the crtc co-ordinate (Danial Stone, Ville)
* Add new functions to handle scaling filter setup (Ville)
* Remove coefficient set 0 hardcoding.

Signed-off-by Pankaj Bharadiya

<[email protected]>

---
 drivers/gpu/drm/i915/display/intel_display.c | 32
++++++++++++++++++--  drivers/gpu/drm/i915/display/intel_sprite.c  |
31 ++++++++++++++++++-
 2 files changed, 60 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +0 -0
index 791dd908aa89..4b3387ee332e 100644
@@ -6309,6 +6309,25 @@ void

skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/display/intel_display.c void skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv,

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
 	}
 }
 
+static u32
+skl_scaler_crtc_setup_filter(struct drm_i915_private *dev_priv, enum pipe

pipe,

Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +4 -0
+			  int id, int set, enum drm_crtc_scaling_filter filter) {
+	u32 scaler_filter_ctl = PS_FILTER_MEDIUM;
+
+	if (filter == DRM_CRTC_SCALING_FILTER_NEAREST_NEIGHBOR) {

drivers/gpu/drm/i915/display/intel_display.c void skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv, · line 6328

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display.c +10 -0
+		skl_scaler_setup_nearest_neighbor_filter(dev_priv, pipe, id,
+							 set);
+		scaler_filter_ctl = PS_FILTER_PROGRAMMED |
+				PS_UV_VERT_FILTER_SELECT(set) |
+				PS_UV_HORZ_FILTER_SELECT(set) |
+				PS_Y_VERT_FILTER_SELECT(set) |
+				PS_Y_HORZ_FILTER_SELECT(set);
+
+	}
+	return scaler_filter_ctl;

This function does too many things.

Quoted 7 lines

I was thinking to have a common function which configures the filter and also provides the register bits (ps_ctrl) to select a desired filter so that we need not have extra condition to figure out filter select register bits where this function is being called.
How about renaming this function to some better name like skl_scaler_set_and_get_filter_select() or something else?
Or shall I breakdown this function into multiple functions?

I'd just inline the PS_CTRL stuff into the current function.

Quoted 168 lines

Any suggestions?

Quoted 8 lines

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
+}
+
 static void skl_pfit_enable(const struct intel_crtc_state
 *crtc_state)  {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
@@ -6316,12 +6335,14 @@ static void skl_pfit_enable(const struct

intel_crtc_state *crtc_state)

Quoted 7 lines

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state) · line 6338

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -0
 	enum pipe pipe = crtc->pipe;
 	const struct intel_crtc_scaler_state *scaler_state =
 		&crtc_state->scaler_state;
+	const struct drm_crtc_state *state = &crtc_state->uapi;

Pls don't add this kind of aliases. We're moving away from using the drm_ types as much as possible.

OK.

Quoted 10 lines

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state) · line 6345

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -0
 	if (crtc_state->pch_pfit.enabled) {
 		u16 uv_rgb_hphase, uv_rgb_vphase;
 		int pfit_w, pfit_h, hscale, vscale;
 		unsigned long irqflags;
 		int id;
+		int scaler_filter_ctl;

It's a register value so u32. I'd also

Yes, I missed it. Thanks for pointing out.

Quoted 4 lines

s/scaler_filter_ctl/filter_select/ or something like that.

Alternatively we could just call it ps_ctrl and have it contain the full register value for that particular register.

ps_ctrl sounds better, will use this name.

Quoted 58 lines

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct · line 6346

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -0
 		if (drm_WARN_ON(&dev_priv->drm,
 				crtc_state->scaler_state.scaler_id < 0)) @@ -

6340,8 +6361,12 @@

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -0
 static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
 
drivers/gpu/drm/i915/display/intel_display.c +0 -1
 		spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
 
-		intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, id),

PS_SCALER_EN |

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -1
-				  PS_FILTER_MEDIUM | scaler_state-

scalers[id].mode);

drivers/gpu/drm/i915/display/intel_display.c +6 -0
+		scaler_filter_ctl =
+			skl_scaler_crtc_setup_filter(dev_priv, pipe, id, 0,
+						state->scaling_filter);
+		intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, id),
+				  PS_SCALER_EN | scaler_filter_ctl |
+				  scaler_state->scalers[id].mode);
 		intel_de_write_fw(dev_priv, SKL_PS_VPHASE(pipe, id),
 				  PS_Y_PHASE(0) |

PS_UV_RGB_PHASE(uv_rgb_vphase));

Quoted 1 line

intel_de_write_fw(dev_priv, SKL_PS_HPHASE(pipe, id), @@ -

16777,6

Quoted 1 line

+16802,9 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv,

enum pipe pipe)

Quoted 15 lines
drivers/gpu/drm/i915/display/intel_display.c +3 -0
 		dev_priv->plane_to_crtc_mapping[i9xx_plane] = crtc;
 	}
 
+	if (INTEL_GEN(dev_priv) >= 10)
+		drm_crtc_enable_scaling_filter(&crtc->base);
+
 	intel_color_init(crtc);
 
 	intel_crtc_crc_init(crtc);
drivers/gpu/drm/i915/display/intel_sprite.c +0 -0
index deda351719db..ac3fd9843ace 100644

drivers/gpu/drm/i915/display/intel_sprite.c skl_plane_max_stride(struct intel_plane *plane, · line 399

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_sprite.c +2 -0
@@ -395,6 +395,26 @@ skl_plane_max_stride(struct intel_plane *plane,
 		return min(8192 * cpp, 32768);
 }
 
+static u32
+skl_scaler_plane_setup_filter(struct drm_i915_private *dev_priv, enum pipe

pipe,

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_sprite.c +11 -0
+			      int id, int set,
+			      enum drm_plane_scaling_filter filter) {
+	u32 scaler_filter_ctl = PS_FILTER_MEDIUM;
+
+	if (filter == DRM_PLANE_SCALING_FILTER_NEAREST_NEIGHBOR) {
+		skl_scaler_setup_nearest_neighbor_filter(dev_priv, pipe, id,
+							 set);
+		scaler_filter_ctl = PS_FILTER_PROGRAMMED |
+				PS_UV_VERT_FILTER_SELECT(set) |
+				PS_UV_HORZ_FILTER_SELECT(set) |
+				PS_Y_VERT_FILTER_SELECT(set) |
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_sprite.c skl_plane_max_stride(struct intel_plane *plane, · line 416

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_sprite.c +6 -0
+				PS_Y_HORZ_FILTER_SELECT(set);
+
+	}
+	return scaler_filter_ctl;
+}
+

We don't want such copy pasta between planes and crtcs.

Yeah, got it.
Will add a common enum drm_scaling_filter and use it.

Thanks,
Pankaj

Quoted 54 lines

drivers/gpu/drm/i915/display/intel_sprite.c skl_plane_max_stride(struct intel_plane *plane,

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_sprite.c +0 -0
 static void
 skl_program_scaler(struct intel_plane *plane,
 		   const struct intel_crtc_state *crtc_state, @@ -406,6 +426,7

@@

Quoted 20 lines

skl_program_scaler(struct intel_plane *plane,

drivers/gpu/drm/i915/display/intel_sprite.c +2 -0
 	int scaler_id = plane_state->scaler_id;
 	const struct intel_scaler *scaler =
 		&crtc_state->scaler_state.scalers[scaler_id];
+	const struct drm_plane_state *state = &plane_state->uapi;
 	int crtc_x = plane_state->uapi.dst.x1;
 	int crtc_y = plane_state->uapi.dst.y1;
 	u32 crtc_w = drm_rect_width(&plane_state->uapi.dst);
@@ -413,6 +434,7 @@ skl_program_scaler(struct intel_plane *plane,
 	u16 y_hphase, uv_rgb_hphase;
 	u16 y_vphase, uv_rgb_vphase;
 	int hscale, vscale;
+	int scaler_filter_ctl;
 
 	hscale = drm_rect_calc_hscale(&plane_state->uapi.src,
 				      &plane_state->uapi.dst,
@@ -439,8 +461,12 @@ skl_program_scaler(struct intel_plane *plane,
 		uv_rgb_vphase = skl_scaler_calc_phase(1, vscale, false);
 	}
 

drivers/gpu/drm/i915/display/intel_sprite.c skl_program_scaler(struct intel_plane *plane, · line 472

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_sprite.c +5 -1
+	scaler_filter_ctl =
+		skl_scaler_plane_setup_filter(dev_priv, pipe, scaler_id, 0,
+					      state->scaling_filter);
 	intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, scaler_id),
-			  PS_SCALER_EN | PS_PLANE_SEL(plane->id) | scaler-
 mode);
+			  PS_SCALER_EN | PS_PLANE_SEL(plane->id) |
+			  scaler->mode | scaler_filter_ctl);
 	intel_de_write_fw(dev_priv, SKL_PS_VPHASE(pipe, scaler_id),
 			  PS_Y_PHASE(y_vphase) |

PS_UV_RGB_PHASE(uv_rgb_vphase));

Quoted 13 lines

intel_de_write_fw(dev_priv, SKL_PS_HPHASE(pipe, scaler_id), @@
-3121,6 +3147,9 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/display/intel_sprite.c +3 -1
 	drm_plane_create_zpos_immutable_property(&plane->base, plane_id);
 
+	if (INTEL_GEN(dev_priv) >= 10)
+		drm_plane_enable_scaling_filter(&plane->base);
+
 	drm_plane_helper_add(&plane->base, &intel_plane_helper_funcs);
 
 	return plane;
--
Quoted 1 line

2.23.0

--
Ville Syrjälä
Intel

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

Re: [PATCH v2 5/5] drm/i915: Enable scaling filter for plane and CRTC

Quoted 80 lines · Ville Syrjälä
Quoted 71 lines · Pankaj
Quoted 54 lines

-----Original Message-----
From: Ville Syrjälä <[email protected]>
Sent: 23 March 2020 20:18
To: Laxminarayan Bharadiya, Pankaj <[email protected]>
Cc: Lattannavar, Sameer <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Joonas Lahtinen <[email protected]>; Vivi, Rodrigo <[email protected]>; David Airlie <[email protected]>; Chris Wilson <[email protected]>; Maarten Lankhorst <[email protected]>; Souza, Jose <[email protected]>; Deak, Imre <[email protected]>; Shankar, Uma <[email protected]>
Subject: Re: [PATCH v2 5/5] drm/i915: Enable scaling filter for plane and CRTC

drivers/gpu/drm/i915/display/intel_display.c void

Quoted 29 lines · Pankaj Bharadiya

GEN >= 10 hardware supports the programmable scaler filter.

Attach scaling filter property for CRTC and plane for GEN >= 10 hardwares and program scaler filter based on the selected filter type.

changes since v1:
* None
Changes since RFC:
* Enable properties for GEN >= 10 platforms (Ville)
* Do not round off the crtc co-ordinate (Danial Stone, Ville)
* Add new functions to handle scaling filter setup (Ville)
* Remove coefficient set 0 hardcoding.

Signed-off-by Pankaj Bharadiya

<[email protected]>

---
 drivers/gpu/drm/i915/display/intel_display.c | 32
++++++++++++++++++--  drivers/gpu/drm/i915/display/intel_sprite.c  |
31 ++++++++++++++++++-
 2 files changed, 60 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +0 -0
index 791dd908aa89..4b3387ee332e 100644
@@ -6309,6 +6309,25 @@ void

skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/display/intel_display.c void skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv,

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
 	}
 }
 
+static u32
+skl_scaler_crtc_setup_filter(struct drm_i915_private *dev_priv, enum pipe

pipe,

Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +4 -0
+			  int id, int set, enum drm_crtc_scaling_filter filter) {
+	u32 scaler_filter_ctl = PS_FILTER_MEDIUM;
+
+	if (filter == DRM_CRTC_SCALING_FILTER_NEAREST_NEIGHBOR) {

drivers/gpu/drm/i915/display/intel_display.c void skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv, · line 6328

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display.c +10 -0
+		skl_scaler_setup_nearest_neighbor_filter(dev_priv, pipe, id,
+							 set);
+		scaler_filter_ctl = PS_FILTER_PROGRAMMED |
+				PS_UV_VERT_FILTER_SELECT(set) |
+				PS_UV_HORZ_FILTER_SELECT(set) |
+				PS_Y_VERT_FILTER_SELECT(set) |
+				PS_Y_HORZ_FILTER_SELECT(set);
+
+	}
+	return scaler_filter_ctl;

This function does too many things.

Quoted 7 lines

I was thinking to have a common function which configures the filter and also provides the register bits (ps_ctrl) to select a desired filter so that we need not have extra condition to figure out filter select register bits where this function is being called.
How about renaming this function to some better name like skl_scaler_set_and_get_filter_select() or something else?
Or shall I breakdown this function into multiple functions?

Quoted 1 line

I'd just inline the PS_CTRL stuff into the current function.

I am yet to verify this, but would like to get your early comments. How about something like this? -

+inline u32 skl_scaler_get_filter_select(enum drm_scaling_filter filter, int set) +{
+ u32 filter_select = PS_FILTER_MEDIUM;
+
+ if (filter == DRM_SCALING_FILTER_NEAREST_NEIGHBOR) {
+ filter_select = PS_FILTER_PROGRAMMED |

+                       PS_UV_VERT_FILTER_SELECT(set) |
+                       PS_UV_HORZ_FILTER_SELECT(set) |
+                       PS_Y_VERT_FILTER_SELECT(set) |
+                       PS_Y_HORZ_FILTER_SELECT(set);

+ }
+
+ return filter_select;
+}
+
+void skl_scaler_setup_filter(struct drm_i915_private *dev_priv, enum pipe pipe,
+ int id, int set, enum drm_scaling_filter filter)
+{
+ switch(filter) {
+ case DRM_SCALING_FILTER_DEFAULT:
+ break;
+ case DRM_SCALING_FILTER_NEAREST_NEIGHBOR:
+ cnl_program_nearest_filter_coefs(dev_priv, pipe, id, set);
+ break;
+ default:
+ default:
+ MISSING_CASE(filter);
+ }
+}
+
static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)

 {
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
@@ -6250,6 +6351,7 @@ static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
                int pfit_w, pfit_h, hscale, vscale;
                unsigned long irqflags;
                int id;

+ u32 ps_ctrl;

                if (drm_WARN_ON(&dev_priv->drm,
                                crtc_state->scaler_state.scaler_id < 0))

@@ -6268,8 +6370,13 @@ static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)

                spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);

- intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, id), PS_SCALER_EN |
- PS_FILTER_MEDIUM | scaler_state->scalers[id].mode);
+ skl_scaler_setup_filter(dev_priv, pipe, id, 0,
+ crtc_state->uapi.scaling_filter);
+
+ ps_ctrl = skl_scaler_get_filter_select(crtc_state->uapi.scaling_filter, 0);
+ ps_ctrl |= PS_SCALER_EN | scaler_state->scalers[id].mode;
+
+ intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, id), ps_ctrl);
intel_de_write_fw(dev_priv, SKL_PS_VPHASE(pipe, id),
PS_Y_PHASE(0) | PS_UV_RGB_PHASE(uv_rgb_vphase));
intel_de_write_fw(dev_priv, SKL_PS_HPHASE(pipe, id),
@@ -16703,6 +16810,11 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)

                dev_priv->plane_to_crtc_mapping[i9xx_plane] = crtc;
        }

Thanks,
Pankaj

Quoted 162 lines
Quoted 162 lines

Any suggestions?

Quoted 8 lines

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
+}
+
 static void skl_pfit_enable(const struct intel_crtc_state
 *crtc_state)  {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
@@ -6316,12 +6335,14 @@ static void skl_pfit_enable(const struct

intel_crtc_state *crtc_state)

Quoted 7 lines

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state) · line 6338

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -0
 	enum pipe pipe = crtc->pipe;
 	const struct intel_crtc_scaler_state *scaler_state =
 		&crtc_state->scaler_state;
+	const struct drm_crtc_state *state = &crtc_state->uapi;

Pls don't add this kind of aliases. We're moving away from using the drm_ types as much as possible.

OK.

Quoted 10 lines

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state) · line 6345

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -0
 	if (crtc_state->pch_pfit.enabled) {
 		u16 uv_rgb_hphase, uv_rgb_vphase;
 		int pfit_w, pfit_h, hscale, vscale;
 		unsigned long irqflags;
 		int id;
+		int scaler_filter_ctl;

It's a register value so u32. I'd also

Yes, I missed it. Thanks for pointing out.

Quoted 4 lines

s/scaler_filter_ctl/filter_select/ or something like that.

Alternatively we could just call it ps_ctrl and have it contain the full register value for that particular register.

ps_ctrl sounds better, will use this name.

Quoted 58 lines

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct · line 6346

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -0
 		if (drm_WARN_ON(&dev_priv->drm,
 				crtc_state->scaler_state.scaler_id < 0)) @@ -

6340,8 +6361,12 @@

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -0
 static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
 
drivers/gpu/drm/i915/display/intel_display.c +0 -1
 		spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
 
-		intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, id),

PS_SCALER_EN |

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -1
-				  PS_FILTER_MEDIUM | scaler_state-

scalers[id].mode);

drivers/gpu/drm/i915/display/intel_display.c +6 -0
+		scaler_filter_ctl =
+			skl_scaler_crtc_setup_filter(dev_priv, pipe, id, 0,
+						state->scaling_filter);
+		intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, id),
+				  PS_SCALER_EN | scaler_filter_ctl |
+				  scaler_state->scalers[id].mode);
 		intel_de_write_fw(dev_priv, SKL_PS_VPHASE(pipe, id),
 				  PS_Y_PHASE(0) |

PS_UV_RGB_PHASE(uv_rgb_vphase));

Quoted 1 line

intel_de_write_fw(dev_priv, SKL_PS_HPHASE(pipe, id), @@ -

16777,6

Quoted 1 line

+16802,9 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv,

enum pipe pipe)

Quoted 15 lines
drivers/gpu/drm/i915/display/intel_display.c +3 -0
 		dev_priv->plane_to_crtc_mapping[i9xx_plane] = crtc;
 	}
 
+	if (INTEL_GEN(dev_priv) >= 10)
+		drm_crtc_enable_scaling_filter(&crtc->base);
+
 	intel_color_init(crtc);
 
 	intel_crtc_crc_init(crtc);
drivers/gpu/drm/i915/display/intel_sprite.c +0 -0
index deda351719db..ac3fd9843ace 100644

drivers/gpu/drm/i915/display/intel_sprite.c skl_plane_max_stride(struct intel_plane *plane, · line 399

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_sprite.c +2 -0
@@ -395,6 +395,26 @@ skl_plane_max_stride(struct intel_plane *plane,
 		return min(8192 * cpp, 32768);
 }
 
+static u32
+skl_scaler_plane_setup_filter(struct drm_i915_private *dev_priv, enum pipe

pipe,

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_sprite.c +11 -0
+			      int id, int set,
+			      enum drm_plane_scaling_filter filter) {
+	u32 scaler_filter_ctl = PS_FILTER_MEDIUM;
+
+	if (filter == DRM_PLANE_SCALING_FILTER_NEAREST_NEIGHBOR) {
+		skl_scaler_setup_nearest_neighbor_filter(dev_priv, pipe, id,
+							 set);
+		scaler_filter_ctl = PS_FILTER_PROGRAMMED |
+				PS_UV_VERT_FILTER_SELECT(set) |
+				PS_UV_HORZ_FILTER_SELECT(set) |
+				PS_Y_VERT_FILTER_SELECT(set) |
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_sprite.c skl_plane_max_stride(struct intel_plane *plane, · line 416

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_sprite.c +6 -0
+				PS_Y_HORZ_FILTER_SELECT(set);
+
+	}
+	return scaler_filter_ctl;
+}
+

We don't want such copy pasta between planes and crtcs.

Yeah, got it.
Will add a common enum drm_scaling_filter and use it.

Thanks,
Pankaj

Quoted 47 lines

drivers/gpu/drm/i915/display/intel_sprite.c skl_plane_max_stride(struct intel_plane *plane,

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_sprite.c +0 -0
 static void
 skl_program_scaler(struct intel_plane *plane,
 		   const struct intel_crtc_state *crtc_state, @@ -406,6 +426,7

@@

Quoted 20 lines

skl_program_scaler(struct intel_plane *plane,

drivers/gpu/drm/i915/display/intel_sprite.c +2 -0
 	int scaler_id = plane_state->scaler_id;
 	const struct intel_scaler *scaler =
 		&crtc_state->scaler_state.scalers[scaler_id];
+	const struct drm_plane_state *state = &plane_state->uapi;
 	int crtc_x = plane_state->uapi.dst.x1;
 	int crtc_y = plane_state->uapi.dst.y1;
 	u32 crtc_w = drm_rect_width(&plane_state->uapi.dst);
@@ -413,6 +434,7 @@ skl_program_scaler(struct intel_plane *plane,
 	u16 y_hphase, uv_rgb_hphase;
 	u16 y_vphase, uv_rgb_vphase;
 	int hscale, vscale;
+	int scaler_filter_ctl;
 
 	hscale = drm_rect_calc_hscale(&plane_state->uapi.src,
 				      &plane_state->uapi.dst,
@@ -439,8 +461,12 @@ skl_program_scaler(struct intel_plane *plane,
 		uv_rgb_vphase = skl_scaler_calc_phase(1, vscale, false);
 	}
 

drivers/gpu/drm/i915/display/intel_sprite.c skl_program_scaler(struct intel_plane *plane, · line 472

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_sprite.c +5 -1
+	scaler_filter_ctl =
+		skl_scaler_plane_setup_filter(dev_priv, pipe, scaler_id, 0,
+					      state->scaling_filter);
 	intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, scaler_id),
-			  PS_SCALER_EN | PS_PLANE_SEL(plane->id) | scaler-
 mode);
+			  PS_SCALER_EN | PS_PLANE_SEL(plane->id) |
+			  scaler->mode | scaler_filter_ctl);
 	intel_de_write_fw(dev_priv, SKL_PS_VPHASE(pipe, scaler_id),
 			  PS_Y_PHASE(y_vphase) |

PS_UV_RGB_PHASE(uv_rgb_vphase));

Quoted 11 lines

intel_de_write_fw(dev_priv, SKL_PS_HPHASE(pipe, scaler_id), @@
-3121,6 +3147,9 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/display/intel_sprite.c +3 -0
 	drm_plane_create_zpos_immutable_property(&plane->base, plane_id);
 
+	if (INTEL_GEN(dev_priv) >= 10)
+		drm_plane_enable_scaling_filter(&plane->base);
+
 	drm_plane_helper_add(&plane->base, &intel_plane_helper_funcs);
Quoted 11 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

return plane;
--
2.23.0

--
Ville Syrjälä
Intel

Signature · 2 lines
Ville Syrjälä
Intel

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

#16 lore raw

Re: [PATCH v2 5/5] drm/i915: Enable scaling filter for plane and CRTC

Quoted 86 lines · Bharadiya,Pankaj
Quoted 80 lines · Ville Syrjälä
Quoted 71 lines · Pankaj
Quoted 54 lines

-----Original Message-----
From: Ville Syrjälä <[email protected]>
Sent: 23 March 2020 20:18
To: Laxminarayan Bharadiya, Pankaj <[email protected]>
Cc: Lattannavar, Sameer <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Joonas Lahtinen <[email protected]>; Vivi, Rodrigo <[email protected]>; David Airlie <[email protected]>; Chris Wilson <[email protected]>; Maarten Lankhorst <[email protected]>; Souza, Jose <[email protected]>; Deak, Imre <[email protected]>; Shankar, Uma <[email protected]>
Subject: Re: [PATCH v2 5/5] drm/i915: Enable scaling filter for plane and CRTC

drivers/gpu/drm/i915/display/intel_display.c void

Quoted 29 lines · Pankaj Bharadiya

GEN >= 10 hardware supports the programmable scaler filter.

Attach scaling filter property for CRTC and plane for GEN >= 10 hardwares and program scaler filter based on the selected filter type.

changes since v1:
* None
Changes since RFC:
* Enable properties for GEN >= 10 platforms (Ville)
* Do not round off the crtc co-ordinate (Danial Stone, Ville)
* Add new functions to handle scaling filter setup (Ville)
* Remove coefficient set 0 hardcoding.

Signed-off-by Pankaj Bharadiya

<[email protected]>

---
 drivers/gpu/drm/i915/display/intel_display.c | 32
++++++++++++++++++--  drivers/gpu/drm/i915/display/intel_sprite.c  |
31 ++++++++++++++++++-
 2 files changed, 60 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +0 -0
index 791dd908aa89..4b3387ee332e 100644
@@ -6309,6 +6309,25 @@ void

skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/display/intel_display.c void skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv,

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
 	}
 }
 
+static u32
+skl_scaler_crtc_setup_filter(struct drm_i915_private *dev_priv, enum pipe

pipe,

Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +4 -0
+			  int id, int set, enum drm_crtc_scaling_filter filter) {
+	u32 scaler_filter_ctl = PS_FILTER_MEDIUM;
+
+	if (filter == DRM_CRTC_SCALING_FILTER_NEAREST_NEIGHBOR) {

drivers/gpu/drm/i915/display/intel_display.c void skl_scaler_setup_nearest_neighbor_filter(struct drm_i915_private *dev_priv, · line 6328

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display.c +10 -0
+		skl_scaler_setup_nearest_neighbor_filter(dev_priv, pipe, id,
+							 set);
+		scaler_filter_ctl = PS_FILTER_PROGRAMMED |
+				PS_UV_VERT_FILTER_SELECT(set) |
+				PS_UV_HORZ_FILTER_SELECT(set) |
+				PS_Y_VERT_FILTER_SELECT(set) |
+				PS_Y_HORZ_FILTER_SELECT(set);
+
+	}
+	return scaler_filter_ctl;

This function does too many things.

Quoted 7 lines

I was thinking to have a common function which configures the filter and also provides the register bits (ps_ctrl) to select a desired filter so that we need not have extra condition to figure out filter select register bits where this function is being called.
How about renaming this function to some better name like skl_scaler_set_and_get_filter_select() or something else?
Or shall I breakdown this function into multiple functions?

Quoted 1 line

I'd just inline the PS_CTRL stuff into the current function.

I am yet to verify this, but would like to get your early comments. How about something like this? -

Review

Quoted 3 lines
(quoted diff) +3 -0
+inline u32 skl_scaler_get_filter_select(enum drm_scaling_filter filter, int set)
+{
+       u32 filter_select = PS_FILTER_MEDIUM;

Pointless variable.

if (whatever)

	return A;
else
	return B;
Quoted 39 lines
drivers/gpu/drm/i915/display/intel_display.c +28 -0
+
+       if (filter == DRM_SCALING_FILTER_NEAREST_NEIGHBOR) {
+               filter_select = PS_FILTER_PROGRAMMED |
+                       PS_UV_VERT_FILTER_SELECT(set) |
+                       PS_UV_HORZ_FILTER_SELECT(set) |
+                       PS_Y_VERT_FILTER_SELECT(set) |
+                       PS_Y_HORZ_FILTER_SELECT(set);
+       }
+
+       return filter_select;
+}
+
+void skl_scaler_setup_filter(struct drm_i915_private *dev_priv, enum pipe pipe,
+                            int id, int set, enum drm_scaling_filter filter)
+{
+       switch(filter) {
+       case DRM_SCALING_FILTER_DEFAULT:
+               break;
+       case DRM_SCALING_FILTER_NEAREST_NEIGHBOR:
+               cnl_program_nearest_filter_coefs(dev_priv, pipe, id, set);
+               break;
+       default:
+       default:
+               MISSING_CASE(filter);
+       }
+}
+
 static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
 {
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
@@ -6250,6 +6351,7 @@ static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
                int pfit_w, pfit_h, hscale, vscale;
                unsigned long irqflags;
                int id;
+               u32 ps_ctrl;
 
                if (drm_WARN_ON(&dev_priv->drm,
                                crtc_state->scaler_state.scaler_id < 0))

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state) · line 6374

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -2
@@ -6268,8 +6370,13 @@ static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
 
                spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
 
-               intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, id), PS_SCALER_EN |
-                                 PS_FILTER_MEDIUM | scaler_state->scalers[id].mode);
+                skl_scaler_setup_filter(dev_priv, pipe, id, 0,
+                                        crtc_state->uapi.scaling_filter);

btw we need to duplicate the scaling filter in the hw state.

Review static void skl_pfit_enable(const struct intel_crtc_state *crtc_state) · line 6377

Quoted 3 lines
(quoted diff) +3 -0
+
+               ps_ctrl = skl_scaler_get_filter_select(crtc_state->uapi.scaling_filter, 0);
+               ps_ctrl |=  PS_SCALER_EN | scaler_state->scalers[id].mode;

This can all be done outside the spinlock.

Otherwise lgtm

Quoted 185 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
+
+               intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, id), ps_ctrl);
                intel_de_write_fw(dev_priv, SKL_PS_VPHASE(pipe, id),
                                  PS_Y_PHASE(0) | PS_UV_RGB_PHASE(uv_rgb_vphase));
                intel_de_write_fw(dev_priv, SKL_PS_HPHASE(pipe, id),
@@ -16703,6 +16810,11 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
                dev_priv->plane_to_crtc_mapping[i9xx_plane] = crtc;
        }
 
 Thanks,

Pankaj

Quoted 173 lines
Quoted 169 lines

Any suggestions?

Quoted 8 lines

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_display.c +2 -0
+}
+
 static void skl_pfit_enable(const struct intel_crtc_state
 *crtc_state)  {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
@@ -6316,12 +6335,14 @@ static void skl_pfit_enable(const struct

intel_crtc_state *crtc_state)

Quoted 7 lines

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state) · line 6338

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -0
 	enum pipe pipe = crtc->pipe;
 	const struct intel_crtc_scaler_state *scaler_state =
 		&crtc_state->scaler_state;
+	const struct drm_crtc_state *state = &crtc_state->uapi;

Pls don't add this kind of aliases. We're moving away from using the drm_ types as much as possible.

OK.

Quoted 10 lines

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state) · line 6345

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -0
 	if (crtc_state->pch_pfit.enabled) {
 		u16 uv_rgb_hphase, uv_rgb_vphase;
 		int pfit_w, pfit_h, hscale, vscale;
 		unsigned long irqflags;
 		int id;
+		int scaler_filter_ctl;

It's a register value so u32. I'd also

Yes, I missed it. Thanks for pointing out.

Quoted 4 lines

s/scaler_filter_ctl/filter_select/ or something like that.

Alternatively we could just call it ps_ctrl and have it contain the full register value for that particular register.

ps_ctrl sounds better, will use this name.

Quoted 58 lines

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct · line 6346

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -0
 		if (drm_WARN_ON(&dev_priv->drm,
 				crtc_state->scaler_state.scaler_id < 0)) @@ -

6340,8 +6361,12 @@

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -0
 static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)
 
drivers/gpu/drm/i915/display/intel_display.c +0 -1
 		spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
 
-		intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, id),

PS_SCALER_EN |

drivers/gpu/drm/i915/display/intel_display.c static void skl_pfit_enable(const struct intel_crtc_state *crtc_state)

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display.c +0 -1
-				  PS_FILTER_MEDIUM | scaler_state-

scalers[id].mode);

drivers/gpu/drm/i915/display/intel_display.c +6 -0
+		scaler_filter_ctl =
+			skl_scaler_crtc_setup_filter(dev_priv, pipe, id, 0,
+						state->scaling_filter);
+		intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, id),
+				  PS_SCALER_EN | scaler_filter_ctl |
+				  scaler_state->scalers[id].mode);
 		intel_de_write_fw(dev_priv, SKL_PS_VPHASE(pipe, id),
 				  PS_Y_PHASE(0) |

PS_UV_RGB_PHASE(uv_rgb_vphase));

Quoted 1 line

intel_de_write_fw(dev_priv, SKL_PS_HPHASE(pipe, id), @@ -

16777,6

Quoted 1 line

+16802,9 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv,

enum pipe pipe)

Quoted 15 lines
drivers/gpu/drm/i915/display/intel_display.c +3 -0
 		dev_priv->plane_to_crtc_mapping[i9xx_plane] = crtc;
 	}
 
+	if (INTEL_GEN(dev_priv) >= 10)
+		drm_crtc_enable_scaling_filter(&crtc->base);
+
 	intel_color_init(crtc);
 
 	intel_crtc_crc_init(crtc);
drivers/gpu/drm/i915/display/intel_sprite.c +0 -0
index deda351719db..ac3fd9843ace 100644

drivers/gpu/drm/i915/display/intel_sprite.c skl_plane_max_stride(struct intel_plane *plane, · line 399

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_sprite.c +2 -0
@@ -395,6 +395,26 @@ skl_plane_max_stride(struct intel_plane *plane,
 		return min(8192 * cpp, 32768);
 }
 
+static u32
+skl_scaler_plane_setup_filter(struct drm_i915_private *dev_priv, enum pipe

pipe,

Quoted 11 lines
drivers/gpu/drm/i915/display/intel_sprite.c +11 -0
+			      int id, int set,
+			      enum drm_plane_scaling_filter filter) {
+	u32 scaler_filter_ctl = PS_FILTER_MEDIUM;
+
+	if (filter == DRM_PLANE_SCALING_FILTER_NEAREST_NEIGHBOR) {
+		skl_scaler_setup_nearest_neighbor_filter(dev_priv, pipe, id,
+							 set);
+		scaler_filter_ctl = PS_FILTER_PROGRAMMED |
+				PS_UV_VERT_FILTER_SELECT(set) |
+				PS_UV_HORZ_FILTER_SELECT(set) |
+				PS_Y_VERT_FILTER_SELECT(set) |
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_sprite.c skl_plane_max_stride(struct intel_plane *plane, · line 416

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_sprite.c +6 -0
+				PS_Y_HORZ_FILTER_SELECT(set);
+
+	}
+	return scaler_filter_ctl;
+}
+

We don't want such copy pasta between planes and crtcs.

Yeah, got it.
Will add a common enum drm_scaling_filter and use it.

Thanks,
Pankaj

Quoted 54 lines

drivers/gpu/drm/i915/display/intel_sprite.c skl_plane_max_stride(struct intel_plane *plane,

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_sprite.c +0 -0
 static void
 skl_program_scaler(struct intel_plane *plane,
 		   const struct intel_crtc_state *crtc_state, @@ -406,6 +426,7

@@

Quoted 20 lines

skl_program_scaler(struct intel_plane *plane,

drivers/gpu/drm/i915/display/intel_sprite.c +2 -0
 	int scaler_id = plane_state->scaler_id;
 	const struct intel_scaler *scaler =
 		&crtc_state->scaler_state.scalers[scaler_id];
+	const struct drm_plane_state *state = &plane_state->uapi;
 	int crtc_x = plane_state->uapi.dst.x1;
 	int crtc_y = plane_state->uapi.dst.y1;
 	u32 crtc_w = drm_rect_width(&plane_state->uapi.dst);
@@ -413,6 +434,7 @@ skl_program_scaler(struct intel_plane *plane,
 	u16 y_hphase, uv_rgb_hphase;
 	u16 y_vphase, uv_rgb_vphase;
 	int hscale, vscale;
+	int scaler_filter_ctl;
 
 	hscale = drm_rect_calc_hscale(&plane_state->uapi.src,
 				      &plane_state->uapi.dst,
@@ -439,8 +461,12 @@ skl_program_scaler(struct intel_plane *plane,
 		uv_rgb_vphase = skl_scaler_calc_phase(1, vscale, false);
 	}
 

drivers/gpu/drm/i915/display/intel_sprite.c skl_program_scaler(struct intel_plane *plane, · line 472

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_sprite.c +5 -1
+	scaler_filter_ctl =
+		skl_scaler_plane_setup_filter(dev_priv, pipe, scaler_id, 0,
+					      state->scaling_filter);
 	intel_de_write_fw(dev_priv, SKL_PS_CTRL(pipe, scaler_id),
-			  PS_SCALER_EN | PS_PLANE_SEL(plane->id) | scaler-
 mode);
+			  PS_SCALER_EN | PS_PLANE_SEL(plane->id) |
+			  scaler->mode | scaler_filter_ctl);
 	intel_de_write_fw(dev_priv, SKL_PS_VPHASE(pipe, scaler_id),
 			  PS_Y_PHASE(y_vphase) |

PS_UV_RGB_PHASE(uv_rgb_vphase));

Quoted 13 lines

intel_de_write_fw(dev_priv, SKL_PS_HPHASE(pipe, scaler_id), @@
-3121,6 +3147,9 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/display/intel_sprite.c +3 -1
 	drm_plane_create_zpos_immutable_property(&plane->base, plane_id);
 
+	if (INTEL_GEN(dev_priv) >= 10)
+		drm_plane_enable_scaling_filter(&plane->base);
+
 	drm_plane_helper_add(&plane->base, &intel_plane_helper_funcs);
 
 	return plane;
--
Quoted 1 line

2.23.0

--
Ville Syrjälä
Intel

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

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Introduce drm scaling filter property (rev3)

In reply to Pankaj Bharadiya
== Series Details ==

== Series Details ==

Series: Introduce drm scaling filter property (rev3)
URL : https://patchwork.freedesktop.org/series/73883/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
51d1ea0ac87f drm: Introduce plane and CRTC scaling filter properties
-:138: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#138: FILE: drivers/gpu/drm/drm_mode_config.c:384:
+	prop = drm_property_create_enum(dev, 0,
+				"SCALING_FILTER",

-:146: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #146: FILE: drivers/gpu/drm/drm_mode_config.c:392:
+ prop = drm_property_create_enum(dev, 0,
+ "SCALING_FILTER",

total: 0 errors, 0 warnings, 2 checks, 218 lines checked
dbd02a4bbf34 drm/drm-kms.rst: Add plane and CRTC scaling filter property documentation c0c485082dda drm/i915: Introduce scaling filter related registers and bit fields. -:73: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'id' - possible side-effects? #73: FILE: drivers/gpu/drm/i915/i915_reg.h:7337:
+#define _SKL_PS_COEF_INDEX_SET0(pipe, id) _ID(pipe, \
+ _ID(id, _PS_COEF_SET0_INDEX_1A, _PS_COEF_SET0_INDEX_2A), \
+ _ID(id, _PS_COEF_SET0_INDEX_1B, _PS_COEF_SET0_INDEX_2B))

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

-:81: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'id' - possible side-effects? #81: FILE: drivers/gpu/drm/i915/i915_reg.h:7345:
+#define _SKL_PS_COEF_DATA_SET0(pipe, id) _ID(pipe, \
+ _ID(id, _PS_COEF_SET0_DATA_1A, _PS_COEF_SET0_DATA_2A), \
+ _ID(id, _PS_COEF_SET0_DATA_1B, _PS_COEF_SET0_DATA_2B))

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

-:89: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'pipe' - possible side-effects? #89: FILE: drivers/gpu/drm/i915/i915_reg.h:7353:
+#define SKL_PS_COEF_INDEX_SET(pipe, id, set) \
+ _MMIO_PIPE(set, _SKL_PS_COEF_INDEX_SET0(pipe, id), \
+ _SKL_PS_COEF_INDEX_SET1(pipe, id))

-:89: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'id' - possible side-effects? #89: FILE: drivers/gpu/drm/i915/i915_reg.h:7353:
+#define SKL_PS_COEF_INDEX_SET(pipe, id, set) \
+ _MMIO_PIPE(set, _SKL_PS_COEF_INDEX_SET0(pipe, id), \
+ _SKL_PS_COEF_INDEX_SET1(pipe, id))

-:93: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'pipe' - possible side-effects? #93: FILE: drivers/gpu/drm/i915/i915_reg.h:7357:
+#define SKL_PS_COEF_DATA_SET(pipe, id, set) \
+ _MMIO_PIPE(set, _SKL_PS_COEF_DATA_SET0(pipe, id), \
+ _SKL_PS_COEF_DATA_SET1(pipe, id))

-:93: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'id' - possible side-effects? #93: FILE: drivers/gpu/drm/i915/i915_reg.h:7357:
+#define SKL_PS_COEF_DATA_SET(pipe, id, set) \
+ _MMIO_PIPE(set, _SKL_PS_COEF_DATA_SET0(pipe, id), \
+ _SKL_PS_COEF_DATA_SET1(pipe, id))

total: 0 errors, 0 warnings, 8 checks, 72 lines checked
2bda386ae840 drm/i915/display: Add Nearest-neighbor based integer scaling support -:106: CHECK:SPACING: spaces preferred around that '+' (ctx:VxV) #106: FILE: drivers/gpu/drm/i915/display/intel_display.c:6304:
+ t = skl_coef_tap(i+1);
^

-:107: CHECK:SPACING: spaces preferred around that '<<' (ctx:VxV) #107: FILE: drivers/gpu/drm/i915/display/intel_display.c:6305:
+ tmp |= skl_nearest_filter_coef(t)<<16;
^

total: 0 errors, 0 warnings, 2 checks, 86 lines checked b7639a6e88a8 drm/i915: Enable scaling filter for plane and CRTC -:34: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #34: FILE: drivers/gpu/drm/i915/display/intel_display.c:6314:
+skl_scaler_crtc_setup_filter(struct drm_i915_private *dev_priv, enum pipe pipe,
+ int id, int set, enum drm_crtc_scaling_filter filter)

-:47: CHECK:BRACES: Blank lines aren't necessary before a close brace '}' #47: FILE: drivers/gpu/drm/i915/display/intel_display.c:6327:
+
+ }

-:77: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #77: FILE: drivers/gpu/drm/i915/display/intel_display.c:6366:
+ skl_scaler_crtc_setup_filter(dev_priv, pipe, id, 0,
+ state->scaling_filter);

-:118: CHECK:BRACES: Blank lines aren't necessary before a close brace '}' #118: FILE: drivers/gpu/drm/i915/display/intel_sprite.c:414:
+
+ }

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

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

#18 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for Introduce drm scaling filter property (rev3)

In reply to Pankaj Bharadiya
== Series Details ==

== Series Details ==

Series: Introduce drm scaling filter property (rev3)
URL : https://patchwork.freedesktop.org/series/73883/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_8158 -> Patchwork_17023
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

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

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

### IGT changes ###

#### Issues hit ####

* igt@i915_selftest@live@gem_contexts:
- fi-skl-lmem: [PASS][1] -> [DMESG-FAIL][2] ([i915#933])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/fi-skl-lmem/igt@i915_selftest@live@gem_contexts.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/fi-skl-lmem/igt@i915_selftest@live@gem_contexts.html

#### Possible fixes ####

* igt@i915_selftest@live@execlists:
- fi-skl-lmem: [INCOMPLETE][3] ([i915#656]) -> [PASS][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/fi-skl-lmem/igt@i915_selftest@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/fi-skl-lmem/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@gem_contexts:
- fi-cml-s: [DMESG-FAIL][5] ([i915#877]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/fi-cml-s/igt@i915_selftest@live@gem_contexts.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/fi-cml-s/igt@i915_selftest@live@gem_contexts.html

[i915#656]: https://gitlab.freedesktop.org/drm/intel/issues/656
[i915#877]: https://gitlab.freedesktop.org/drm/intel/issues/877
[i915#933]: https://gitlab.freedesktop.org/drm/intel/issues/933

Participating hosts (40 -> 33)
------------------------------

Additional (4): fi-icl-dsi fi-elk-e7500 fi-gdg-551 fi-bsw-n3050
Missing (11): fi-kbl-soraka fi-byt-squawks fi-bsw-cyan fi-bwr-2160 fi-kbl-7500u fi-ivb-3770 fi-cfl-8109u fi-blb-e6850 fi-byt-clapper fi-skl-6600u fi-snb-2600

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_8158 -> Patchwork_17023

CI-20190529: 20190529
CI_DRM_8158: 513c064047e872bab4113465459e67bece56b99d @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5522: bd2b01af69c9720d54e68a8702a23e4ff3637746 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_17023: b7639a6e88a87032d41d66477b5fb79306ec0f54 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

b7639a6e88a8 drm/i915: Enable scaling filter for plane and CRTC 2bda386ae840 drm/i915/display: Add Nearest-neighbor based integer scaling support c0c485082dda drm/i915: Introduce scaling filter related registers and bit fields. dbd02a4bbf34 drm/drm-kms.rst: Add plane and CRTC scaling filter property documentation 51d1ea0ac87f drm: Introduce plane and CRTC scaling filter properties

== Logs ==

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

#19 lore raw

[Intel-gfx] ✓ Fi.CI.IGT: success for Introduce drm scaling filter property (rev3)

In reply to Pankaj Bharadiya
== Series Details ==

== Series Details ==

Series: Introduce drm scaling filter property (rev3)
URL : https://patchwork.freedesktop.org/series/73883/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_8158_full -> Patchwork_17023_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_eio@in-flight-suspend:
- shard-skl: [PASS][1] -> [INCOMPLETE][2] ([i915#69])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-skl6/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-skl9/igt@[email protected]

* igt@gem_exec_schedule@fifo-bsd1:
- shard-iclb: [PASS][3] -> [SKIP][4] ([fdo#109276]) +14 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-iclb2/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-iclb3/igt@[email protected]

* igt@gem_exec_schedule@implicit-read-write-bsd1:
- shard-iclb: [PASS][5] -> [SKIP][6] ([fdo#109276] / [i915#677]) +1 similar issue
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-iclb2/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-iclb3/igt@[email protected]

* igt@gem_exec_schedule@pi-shared-iova-bsd:
- shard-iclb: [PASS][7] -> [SKIP][8] ([i915#677]) +1 similar issue
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-iclb6/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-iclb2/igt@[email protected]

* igt@gem_exec_schedule@reorder-wide-bsd:
- shard-iclb: [PASS][9] -> [SKIP][10] ([fdo#112146]) +5 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-iclb6/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-iclb2/igt@[email protected]

* igt@gem_ppgtt@flink-and-close-vma-leak:
- shard-apl: [PASS][11] -> [FAIL][12] ([i915#644])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-apl7/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-apl6/igt@[email protected]

* igt@i915_selftest@live@execlists:
- shard-glk: [PASS][13] -> [INCOMPLETE][14] ([i915#58] / [i915#656] / [k.org#198133])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-glk2/igt@i915_selftest@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-glk6/igt@i915_selftest@[email protected]

* igt@kms_flip@flip-vs-suspend-interruptible:
- shard-iclb: [PASS][15] -> [INCOMPLETE][16] ([i915#1185] / [i915#221])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-iclb6/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-iclb3/igt@[email protected]

* igt@kms_hdr@bpc-switch:
- shard-skl: [PASS][17] -> [FAIL][18] ([i915#1188])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-skl2/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-skl3/igt@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- shard-kbl: [PASS][19] -> [DMESG-WARN][20] ([i915#180]) +3 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-kbl7/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-kbl7/igt@[email protected]

* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-c-planes:
- shard-apl: [PASS][21] -> [DMESG-WARN][22] ([i915#180])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-apl2/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-apl1/igt@[email protected]

* igt@kms_psr@no_drrs:
- shard-iclb: [PASS][23] -> [FAIL][24] ([i915#173])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-iclb7/igt@kms_psr@no_drrs.html
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-iclb1/igt@kms_psr@no_drrs.html

* igt@kms_psr@psr2_primary_mmap_cpu:
- shard-iclb: [PASS][25] -> [SKIP][26] ([fdo#109441]) +2 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-iclb2/igt@kms_psr@psr2_primary_mmap_cpu.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-iclb1/igt@kms_psr@psr2_primary_mmap_cpu.html

* igt@kms_setmode@basic:
- shard-apl: [PASS][27] -> [FAIL][28] ([i915#31])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-apl7/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-apl2/igt@[email protected]
- shard-skl: [PASS][29] -> [FAIL][30] ([i915#31])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-skl5/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-skl6/igt@[email protected]

* igt@perf_pmu@busy-check-all-vcs1:
- shard-iclb: [PASS][31] -> [SKIP][32] ([fdo#112080]) +14 similar issues
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-iclb1/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-iclb6/igt@[email protected]

#### Possible fixes ####

* igt@gem_busy@busy-vcs1:
- shard-iclb: [SKIP][33] ([fdo#112080]) -> [PASS][34] +9 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-iclb8/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-iclb2/igt@[email protected]

* igt@gem_exec_balancer@hang:
- shard-tglb: [FAIL][35] ([i915#1277]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-tglb7/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-tglb5/igt@[email protected]

* igt@gem_exec_schedule@implicit-both-bsd1:
- shard-iclb: [SKIP][37] ([fdo#109276] / [i915#677]) -> [PASS][38] +1 similar issue
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-iclb6/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-iclb2/igt@[email protected]

* igt@gem_exec_schedule@preempt-self-bsd:
- shard-iclb: [SKIP][39] ([fdo#112146]) -> [PASS][40] +3 similar issues
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-iclb2/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-iclb3/igt@[email protected]

* igt@gem_exec_suspend@basic-s3:
- shard-skl: [INCOMPLETE][41] ([i915#69]) -> [PASS][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-skl1/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-skl9/igt@[email protected]

* igt@i915_pm_rpm@system-suspend-modeset:
- shard-kbl: [INCOMPLETE][43] ([i915#151] / [i915#155]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-kbl2/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-kbl2/igt@[email protected]

* igt@kms_cursor_crc@pipe-a-cursor-suspend:
- shard-kbl: [DMESG-WARN][45] ([i915#180]) -> [PASS][46] +2 similar issues
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-kbl7/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-kbl7/igt@[email protected]

* igt@kms_dp_dsc@basic-dsc-enable-edp:
- shard-iclb: [SKIP][47] ([fdo#109349]) -> [PASS][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-iclb8/igt@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-iclb2/igt@[email protected]

* igt@kms_flip@flip-vs-suspend-interruptible:
- shard-apl: [DMESG-WARN][49] ([i915#180]) -> [PASS][50] +1 similar issue
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-apl1/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-apl6/igt@[email protected]

* igt@kms_flip@plain-flip-fb-recreate-interruptible:
- shard-skl: [FAIL][51] ([i915#34]) -> [PASS][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-skl8/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-skl2/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-rte:
- shard-snb: [SKIP][53] ([fdo#109271]) -> [PASS][54] +1 similar issue
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-snb5/igt@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-snb5/igt@[email protected]

* igt@kms_hdr@bpc-switch-dpms:
- shard-skl: [FAIL][55] ([i915#1188]) -> [PASS][56]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-skl2/igt@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-skl1/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
- shard-skl: [FAIL][57] ([fdo#108145] / [i915#265]) -> [PASS][58]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-skl6/igt@[email protected]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-skl5/igt@[email protected]

* igt@kms_psr@psr2_sprite_plane_move:
- shard-iclb: [SKIP][59] ([fdo#109441]) -> [PASS][60] +2 similar issues
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-iclb6/igt@kms_psr@psr2_sprite_plane_move.html
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-iclb2/igt@kms_psr@psr2_sprite_plane_move.html

* igt@prime_busy@hang-bsd2:
- shard-iclb: [SKIP][61] ([fdo#109276]) -> [PASS][62] +14 similar issues
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-iclb8/igt@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-iclb2/igt@[email protected]

#### Warnings ####

* igt@i915_pm_dc@dc3co-vpb-simulation:
- shard-iclb: [SKIP][63] ([i915#588]) -> [SKIP][64] ([i915#658])
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-iclb2/igt@[email protected]
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-iclb3/igt@[email protected]

* igt@i915_pm_dc@dc6-psr:
- shard-tglb: [SKIP][65] ([i915#468]) -> [FAIL][66] ([i915#454])
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8158/shard-tglb2/igt@[email protected]
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17023/shard-tglb8/igt@[email protected]

[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109349]: https://bugs.freedesktop.org/show_bug.cgi?id=109349
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#112080]: https://bugs.freedesktop.org/show_bug.cgi?id=112080
[fdo#112146]: https://bugs.freedesktop.org/show_bug.cgi?id=112146
[i915#1185]: https://gitlab.freedesktop.org/drm/intel/issues/1185
[i915#1188]: https://gitlab.freedesktop.org/drm/intel/issues/1188
[i915#1277]: https://gitlab.freedesktop.org/drm/intel/issues/1277
[i915#151]: https://gitlab.freedesktop.org/drm/intel/issues/151
[i915#155]: https://gitlab.freedesktop.org/drm/intel/issues/155
[i915#173]: https://gitlab.freedesktop.org/drm/intel/issues/173
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#221]: https://gitlab.freedesktop.org/drm/intel/issues/221
[i915#265]: https://gitlab.freedesktop.org/drm/intel/issues/265
[i915#31]: https://gitlab.freedesktop.org/drm/intel/issues/31
[i915#34]: https://gitlab.freedesktop.org/drm/intel/issues/34
[i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
[i915#468]: https://gitlab.freedesktop.org/drm/intel/issues/468
[i915#58]: https://gitlab.freedesktop.org/drm/intel/issues/58
[i915#588]: https://gitlab.freedesktop.org/drm/intel/issues/588
[i915#644]: https://gitlab.freedesktop.org/drm/intel/issues/644
[i915#656]: https://gitlab.freedesktop.org/drm/intel/issues/656
[i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
[i915#677]: https://gitlab.freedesktop.org/drm/intel/issues/677
[i915#69]: https://gitlab.freedesktop.org/drm/intel/issues/69
[k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133

Participating hosts (10 -> 10)
------------------------------

No changes in participating hosts

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_8158 -> Patchwork_17023

CI-20190529: 20190529
CI_DRM_8158: 513c064047e872bab4113465459e67bece56b99d @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5522: bd2b01af69c9720d54e68a8702a23e4ff3637746 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_17023: b7639a6e88a87032d41d66477b5fb79306ec0f54 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

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