From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Cc: tzimmermann@suse.de, airlied@linux.ie,
intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, ankit.k.nautiyal@intel.com,
mihail.atanassov@arm.com
Subject: Re: [RFC][PATCH 1/5] drm: Introduce scaling filter property
Date: Tue, 10 Mar 2020 18:01:06 +0200 [thread overview]
Message-ID: <20200310160106.GH13686@intel.com> (raw)
In-Reply-To: <20200225070545.4482-2-pankaj.laxminarayan.bharadiya@intel.com>
On Tue, Feb 25, 2020 at 12:35:41PM +0530, Pankaj Bharadiya wrote:
> Introduce new scaling filter property to allow userspace to select
> the driver's default scaling filter or Nearest-neighbor(NN) filter
> for upscaling operations on crtc/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.
>
> Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> ---
> drivers/gpu/drm/drm_atomic_uapi.c | 8 +++++++
> drivers/gpu/drm/drm_crtc.c | 16 ++++++++++++++
> drivers/gpu/drm/drm_mode_config.c | 13 ++++++++++++
> drivers/gpu/drm/drm_plane.c | 35 +++++++++++++++++++++++++++++++
> include/drm/drm_crtc.h | 10 +++++++++
> include/drm/drm_mode_config.h | 6 ++++++
> include/drm/drm_plane.h | 14 +++++++++++++
> 7 files changed, 102 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index a1e5e262bae2..4e3c1f3176e4 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -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->scaling_filter_property) {
> + state->scaling_filter = val;
I think we want a per-plane/per-crtc prop for this. If we start adding
more filters we are surely going to need different sets for different hw
blocks.
> } 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->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->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->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 {
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 4936e1080e41..1ce7b2ac9eb5 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -748,3 +748,19 @@ int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
>
> return ret;
> }
> +
> +/**
> + * 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.scaling_filter_property,
> + 0);
> +}
> +EXPORT_SYMBOL(drm_crtc_enable_scaling_filter);
> diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
> index 08e6eff6a179..1024a8d1cd5d 100644
> --- a/drivers/gpu/drm/drm_mode_config.c
> +++ b/drivers/gpu/drm/drm_mode_config.c
> @@ -214,6 +214,11 @@ 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_scaling_filter_enum_list[] = {
> + { DRM_SCALING_FILTER_DEFAULT, "Default" },
> + { DRM_SCALING_FILTER_NEAREST_NEIGHBOR, "Nearest Neighbor" },
> +};
> +
> static int drm_mode_create_standard_properties(struct drm_device *dev)
> {
> struct drm_property *prop;
> @@ -370,6 +375,14 @@ 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_scaling_filter_enum_list,
> + ARRAY_SIZE(drm_scaling_filter_enum_list));
> + if (!prop)
> + return -ENOMEM;
> + dev->mode_config.scaling_filter_property = prop;
> +
> return 0;
> }
>
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index d6ad60ab0d38..ace7ee2775c8 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -1221,3 +1221,38 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>
> return ret;
> }
> +
> +/**
> + * DOC: Scaling filter property
> + *
> + *
> + * SCALING_FILTER:
> + *
> + * Indicates scaling filter to be used for CRTC/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() and for a CRTC by calling
> + * drm_crtc_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.scaling_filter_property,
> + 0);
> +}
> +EXPORT_SYMBOL(drm_plane_enable_scaling_filter);
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 59b51a09cae6..770f9328a5ba 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -58,6 +58,7 @@ struct device_node;
> struct dma_fence;
> struct edid;
>
> +
> static inline int64_t U642I64(uint64_t val)
> {
> return (int64_t)*((int64_t *)&val);
> @@ -296,6 +297,13 @@ struct drm_crtc_state {
> */
> u32 target_vblank;
>
> + /**
> + * @scaling_filter:
> + *
> + * Scaling filter mode to be applied
> + */
> + enum drm_scaling_filter scaling_filter;
> +
> /**
> * @async_flip:
> *
> @@ -1266,4 +1274,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__ */
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 3bcbe30339f0..8c308ae1056d 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -914,6 +914,12 @@ struct drm_mode_config {
> */
> struct drm_property *modifiers_property;
>
> + /**
> + * @scaling_filter_property: CRTC/plane property to apply a particular
> + * filter while scaling.
> + */
> + struct drm_property *scaling_filter_property;
> +
> /* cursor size */
> uint32_t cursor_width, cursor_height;
>
> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index 3f396d94afe4..2bc665cc6071 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -35,6 +35,11 @@ struct drm_crtc;
> struct drm_printer;
> struct drm_modeset_acquire_ctx;
>
> +
> +enum drm_scaling_filter {
> + DRM_SCALING_FILTER_DEFAULT,
> + DRM_SCALING_FILTER_NEAREST_NEIGHBOR,
> +};
> /**
> * struct drm_plane_state - mutable plane state
> *
> @@ -214,6 +219,13 @@ struct drm_plane_state {
> */
> bool visible;
>
> + /**
> + * @scaling_filter:
> + *
> + * Scaling filter mode to be applied
> + */
> + enum drm_scaling_filter scaling_filter;
> +
> /**
> * @commit: Tracks the pending commit to prevent use-after-free conditions,
> * and for async plane updates.
> @@ -862,4 +874,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
> --
> 2.23.0
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Cc: mripard@kernel.org, tzimmermann@suse.de, airlied@linux.ie,
intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, ankit.k.nautiyal@intel.com,
mihail.atanassov@arm.com
Subject: Re: [Intel-gfx] [RFC][PATCH 1/5] drm: Introduce scaling filter property
Date: Tue, 10 Mar 2020 18:01:06 +0200 [thread overview]
Message-ID: <20200310160106.GH13686@intel.com> (raw)
In-Reply-To: <20200225070545.4482-2-pankaj.laxminarayan.bharadiya@intel.com>
On Tue, Feb 25, 2020 at 12:35:41PM +0530, Pankaj Bharadiya wrote:
> Introduce new scaling filter property to allow userspace to select
> the driver's default scaling filter or Nearest-neighbor(NN) filter
> for upscaling operations on crtc/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.
>
> Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> ---
> drivers/gpu/drm/drm_atomic_uapi.c | 8 +++++++
> drivers/gpu/drm/drm_crtc.c | 16 ++++++++++++++
> drivers/gpu/drm/drm_mode_config.c | 13 ++++++++++++
> drivers/gpu/drm/drm_plane.c | 35 +++++++++++++++++++++++++++++++
> include/drm/drm_crtc.h | 10 +++++++++
> include/drm/drm_mode_config.h | 6 ++++++
> include/drm/drm_plane.h | 14 +++++++++++++
> 7 files changed, 102 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index a1e5e262bae2..4e3c1f3176e4 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -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->scaling_filter_property) {
> + state->scaling_filter = val;
I think we want a per-plane/per-crtc prop for this. If we start adding
more filters we are surely going to need different sets for different hw
blocks.
> } 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->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->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->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 {
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 4936e1080e41..1ce7b2ac9eb5 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -748,3 +748,19 @@ int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
>
> return ret;
> }
> +
> +/**
> + * 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.scaling_filter_property,
> + 0);
> +}
> +EXPORT_SYMBOL(drm_crtc_enable_scaling_filter);
> diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
> index 08e6eff6a179..1024a8d1cd5d 100644
> --- a/drivers/gpu/drm/drm_mode_config.c
> +++ b/drivers/gpu/drm/drm_mode_config.c
> @@ -214,6 +214,11 @@ 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_scaling_filter_enum_list[] = {
> + { DRM_SCALING_FILTER_DEFAULT, "Default" },
> + { DRM_SCALING_FILTER_NEAREST_NEIGHBOR, "Nearest Neighbor" },
> +};
> +
> static int drm_mode_create_standard_properties(struct drm_device *dev)
> {
> struct drm_property *prop;
> @@ -370,6 +375,14 @@ 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_scaling_filter_enum_list,
> + ARRAY_SIZE(drm_scaling_filter_enum_list));
> + if (!prop)
> + return -ENOMEM;
> + dev->mode_config.scaling_filter_property = prop;
> +
> return 0;
> }
>
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index d6ad60ab0d38..ace7ee2775c8 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -1221,3 +1221,38 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>
> return ret;
> }
> +
> +/**
> + * DOC: Scaling filter property
> + *
> + *
> + * SCALING_FILTER:
> + *
> + * Indicates scaling filter to be used for CRTC/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() and for a CRTC by calling
> + * drm_crtc_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.scaling_filter_property,
> + 0);
> +}
> +EXPORT_SYMBOL(drm_plane_enable_scaling_filter);
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 59b51a09cae6..770f9328a5ba 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -58,6 +58,7 @@ struct device_node;
> struct dma_fence;
> struct edid;
>
> +
> static inline int64_t U642I64(uint64_t val)
> {
> return (int64_t)*((int64_t *)&val);
> @@ -296,6 +297,13 @@ struct drm_crtc_state {
> */
> u32 target_vblank;
>
> + /**
> + * @scaling_filter:
> + *
> + * Scaling filter mode to be applied
> + */
> + enum drm_scaling_filter scaling_filter;
> +
> /**
> * @async_flip:
> *
> @@ -1266,4 +1274,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__ */
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 3bcbe30339f0..8c308ae1056d 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -914,6 +914,12 @@ struct drm_mode_config {
> */
> struct drm_property *modifiers_property;
>
> + /**
> + * @scaling_filter_property: CRTC/plane property to apply a particular
> + * filter while scaling.
> + */
> + struct drm_property *scaling_filter_property;
> +
> /* cursor size */
> uint32_t cursor_width, cursor_height;
>
> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index 3f396d94afe4..2bc665cc6071 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -35,6 +35,11 @@ struct drm_crtc;
> struct drm_printer;
> struct drm_modeset_acquire_ctx;
>
> +
> +enum drm_scaling_filter {
> + DRM_SCALING_FILTER_DEFAULT,
> + DRM_SCALING_FILTER_NEAREST_NEIGHBOR,
> +};
> /**
> * struct drm_plane_state - mutable plane state
> *
> @@ -214,6 +219,13 @@ struct drm_plane_state {
> */
> bool visible;
>
> + /**
> + * @scaling_filter:
> + *
> + * Scaling filter mode to be applied
> + */
> + enum drm_scaling_filter scaling_filter;
> +
> /**
> * @commit: Tracks the pending commit to prevent use-after-free conditions,
> * and for async plane updates.
> @@ -862,4 +874,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
> --
> 2.23.0
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Cc: jani.nikula@linux.intel.com, daniel@ffwll.ch,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
airlied@linux.ie, maarten.lankhorst@linux.intel.com,
tzimmermann@suse.de, mripard@kernel.org,
mihail.atanassov@arm.com, linux-kernel@vger.kernel.org,
ankit.k.nautiyal@intel.com
Subject: Re: [RFC][PATCH 1/5] drm: Introduce scaling filter property
Date: Tue, 10 Mar 2020 18:01:06 +0200 [thread overview]
Message-ID: <20200310160106.GH13686@intel.com> (raw)
In-Reply-To: <20200225070545.4482-2-pankaj.laxminarayan.bharadiya@intel.com>
On Tue, Feb 25, 2020 at 12:35:41PM +0530, Pankaj Bharadiya wrote:
> Introduce new scaling filter property to allow userspace to select
> the driver's default scaling filter or Nearest-neighbor(NN) filter
> for upscaling operations on crtc/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.
>
> Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> ---
> drivers/gpu/drm/drm_atomic_uapi.c | 8 +++++++
> drivers/gpu/drm/drm_crtc.c | 16 ++++++++++++++
> drivers/gpu/drm/drm_mode_config.c | 13 ++++++++++++
> drivers/gpu/drm/drm_plane.c | 35 +++++++++++++++++++++++++++++++
> include/drm/drm_crtc.h | 10 +++++++++
> include/drm/drm_mode_config.h | 6 ++++++
> include/drm/drm_plane.h | 14 +++++++++++++
> 7 files changed, 102 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index a1e5e262bae2..4e3c1f3176e4 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -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->scaling_filter_property) {
> + state->scaling_filter = val;
I think we want a per-plane/per-crtc prop for this. If we start adding
more filters we are surely going to need different sets for different hw
blocks.
> } 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->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->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->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 {
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 4936e1080e41..1ce7b2ac9eb5 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -748,3 +748,19 @@ int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
>
> return ret;
> }
> +
> +/**
> + * 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.scaling_filter_property,
> + 0);
> +}
> +EXPORT_SYMBOL(drm_crtc_enable_scaling_filter);
> diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
> index 08e6eff6a179..1024a8d1cd5d 100644
> --- a/drivers/gpu/drm/drm_mode_config.c
> +++ b/drivers/gpu/drm/drm_mode_config.c
> @@ -214,6 +214,11 @@ 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_scaling_filter_enum_list[] = {
> + { DRM_SCALING_FILTER_DEFAULT, "Default" },
> + { DRM_SCALING_FILTER_NEAREST_NEIGHBOR, "Nearest Neighbor" },
> +};
> +
> static int drm_mode_create_standard_properties(struct drm_device *dev)
> {
> struct drm_property *prop;
> @@ -370,6 +375,14 @@ 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_scaling_filter_enum_list,
> + ARRAY_SIZE(drm_scaling_filter_enum_list));
> + if (!prop)
> + return -ENOMEM;
> + dev->mode_config.scaling_filter_property = prop;
> +
> return 0;
> }
>
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index d6ad60ab0d38..ace7ee2775c8 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -1221,3 +1221,38 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>
> return ret;
> }
> +
> +/**
> + * DOC: Scaling filter property
> + *
> + *
> + * SCALING_FILTER:
> + *
> + * Indicates scaling filter to be used for CRTC/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() and for a CRTC by calling
> + * drm_crtc_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.scaling_filter_property,
> + 0);
> +}
> +EXPORT_SYMBOL(drm_plane_enable_scaling_filter);
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 59b51a09cae6..770f9328a5ba 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -58,6 +58,7 @@ struct device_node;
> struct dma_fence;
> struct edid;
>
> +
> static inline int64_t U642I64(uint64_t val)
> {
> return (int64_t)*((int64_t *)&val);
> @@ -296,6 +297,13 @@ struct drm_crtc_state {
> */
> u32 target_vblank;
>
> + /**
> + * @scaling_filter:
> + *
> + * Scaling filter mode to be applied
> + */
> + enum drm_scaling_filter scaling_filter;
> +
> /**
> * @async_flip:
> *
> @@ -1266,4 +1274,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__ */
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 3bcbe30339f0..8c308ae1056d 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -914,6 +914,12 @@ struct drm_mode_config {
> */
> struct drm_property *modifiers_property;
>
> + /**
> + * @scaling_filter_property: CRTC/plane property to apply a particular
> + * filter while scaling.
> + */
> + struct drm_property *scaling_filter_property;
> +
> /* cursor size */
> uint32_t cursor_width, cursor_height;
>
> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index 3f396d94afe4..2bc665cc6071 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -35,6 +35,11 @@ struct drm_crtc;
> struct drm_printer;
> struct drm_modeset_acquire_ctx;
>
> +
> +enum drm_scaling_filter {
> + DRM_SCALING_FILTER_DEFAULT,
> + DRM_SCALING_FILTER_NEAREST_NEIGHBOR,
> +};
> /**
> * struct drm_plane_state - mutable plane state
> *
> @@ -214,6 +219,13 @@ struct drm_plane_state {
> */
> bool visible;
>
> + /**
> + * @scaling_filter:
> + *
> + * Scaling filter mode to be applied
> + */
> + enum drm_scaling_filter scaling_filter;
> +
> /**
> * @commit: Tracks the pending commit to prevent use-after-free conditions,
> * and for async plane updates.
> @@ -862,4 +874,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
> --
> 2.23.0
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2020-03-10 16:01 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 7:05 [RFC][PATCH 0/5] Introduce drm scaling filter property Pankaj Bharadiya
2020-02-25 7:05 ` Pankaj Bharadiya
2020-02-25 7:05 ` [Intel-gfx] " Pankaj Bharadiya
2020-02-25 7:05 ` [RFC][PATCH 1/5] drm: Introduce " Pankaj Bharadiya
2020-02-25 7:05 ` Pankaj Bharadiya
2020-02-25 7:05 ` [Intel-gfx] " Pankaj Bharadiya
2020-02-25 9:56 ` Jani Nikula
2020-02-25 9:56 ` Jani Nikula
2020-02-25 9:56 ` [Intel-gfx] " Jani Nikula
2020-02-25 10:09 ` Laxminarayan Bharadiya, Pankaj
2020-02-25 10:09 ` Laxminarayan Bharadiya, Pankaj
2020-02-25 10:09 ` [Intel-gfx] " Laxminarayan Bharadiya, Pankaj
2020-02-25 11:07 ` Jani Nikula
2020-02-25 11:07 ` Jani Nikula
2020-02-25 11:07 ` [Intel-gfx] " Jani Nikula
2020-03-10 16:01 ` Ville Syrjälä [this message]
2020-03-10 16:01 ` Ville Syrjälä
2020-03-10 16:01 ` [Intel-gfx] " Ville Syrjälä
2020-03-16 8:31 ` Daniel Vetter
2020-03-16 8:31 ` Daniel Vetter
2020-03-16 8:31 ` [Intel-gfx] " Daniel Vetter
2020-03-16 15:14 ` Ville Syrjälä
2020-03-16 15:14 ` Ville Syrjälä
2020-03-16 15:14 ` [Intel-gfx] " Ville Syrjälä
2020-02-25 7:05 ` [RFC][PATCH 2/5] drm/drm-kms.rst: Add Scaling filter property documentation Pankaj Bharadiya
2020-02-25 7:05 ` Pankaj Bharadiya
2020-02-25 7:05 ` [Intel-gfx] " Pankaj Bharadiya
2020-02-25 7:05 ` [RFC][PATCH 3/5] drm/i915: Enable scaling filter for plane and pipe Pankaj Bharadiya
2020-02-25 7:05 ` Pankaj Bharadiya
2020-02-25 7:05 ` [Intel-gfx] " Pankaj Bharadiya
2020-03-10 16:05 ` Ville Syrjälä
2020-03-10 16:05 ` Ville Syrjälä
2020-03-10 16:05 ` [Intel-gfx] " Ville Syrjälä
2020-03-12 8:58 ` Laxminarayan Bharadiya, Pankaj
2020-03-12 8:58 ` Laxminarayan Bharadiya, Pankaj
2020-03-12 8:58 ` [Intel-gfx] " Laxminarayan Bharadiya, Pankaj
2020-03-12 12:27 ` Ville Syrjälä
2020-03-12 12:27 ` Ville Syrjälä
2020-03-12 12:27 ` [Intel-gfx] " Ville Syrjälä
2020-02-25 7:05 ` [RFC][PATCH 4/5] drm/i915: Introduce scaling filter related registers and bit fields Pankaj Bharadiya
2020-02-25 7:05 ` Pankaj Bharadiya
2020-02-25 7:05 ` [Intel-gfx] " Pankaj Bharadiya
2020-03-10 16:08 ` Ville Syrjälä
2020-03-10 16:08 ` Ville Syrjälä
2020-03-10 16:08 ` [Intel-gfx] " Ville Syrjälä
2020-02-25 7:05 ` [RFC][PATCH 5/5] drm/i915/display: Add Nearest-neighbor based integer scaling support Pankaj Bharadiya
2020-02-25 7:05 ` Pankaj Bharadiya
2020-02-25 7:05 ` [Intel-gfx] " Pankaj Bharadiya
2020-02-25 7:29 ` Daniel Stone
2020-02-25 7:29 ` Daniel Stone
2020-02-25 7:29 ` Daniel Stone
2020-02-28 5:50 ` Laxminarayan Bharadiya, Pankaj
2020-02-28 5:50 ` Laxminarayan Bharadiya, Pankaj
2020-02-28 5:50 ` Laxminarayan Bharadiya, Pankaj
2020-03-10 16:17 ` Ville Syrjälä
2020-03-10 16:17 ` Ville Syrjälä
2020-03-10 16:17 ` [Intel-gfx] " Ville Syrjälä
2020-03-12 9:13 ` Laxminarayan Bharadiya, Pankaj
2020-03-12 9:13 ` Laxminarayan Bharadiya, Pankaj
2020-03-12 9:13 ` [Intel-gfx] " Laxminarayan Bharadiya, Pankaj
2020-03-12 13:54 ` Ville Syrjälä
2020-03-12 13:54 ` Ville Syrjälä
2020-03-12 13:54 ` [Intel-gfx] " Ville Syrjälä
2020-03-13 8:45 ` Laxminarayan Bharadiya, Pankaj
2020-03-13 8:45 ` Laxminarayan Bharadiya, Pankaj
2020-03-13 8:45 ` [Intel-gfx] " Laxminarayan Bharadiya, Pankaj
2020-03-13 19:53 ` Ville Syrjälä
2020-03-13 19:53 ` Ville Syrjälä
2020-03-13 19:53 ` [Intel-gfx] " Ville Syrjälä
2020-02-25 7:24 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Introduce drm scaling filter property Patchwork
2020-02-25 7:50 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2020-03-12 14:04 ` [RFC][PATCH 0/5] " Ville Syrjälä
2020-03-12 14:04 ` Ville Syrjälä
2020-03-12 14:04 ` [Intel-gfx] " Ville Syrjälä
2020-03-12 15:37 ` Laxminarayan Bharadiya, Pankaj
2020-03-12 15:37 ` Laxminarayan Bharadiya, Pankaj
2020-03-12 15:37 ` [Intel-gfx] " Laxminarayan Bharadiya, Pankaj
2020-03-12 16:01 ` Ville Syrjälä
2020-03-12 16:01 ` Ville Syrjälä
2020-03-12 16:01 ` [Intel-gfx] " Ville Syrjälä
2020-03-13 10:35 ` Pekka Paalanen
2020-03-13 10:35 ` Pekka Paalanen
2020-03-13 10:35 ` [Intel-gfx] " Pekka Paalanen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200310160106.GH13686@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=airlied@linux.ie \
--cc=ankit.k.nautiyal@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mihail.atanassov@arm.com \
--cc=pankaj.laxminarayan.bharadiya@intel.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.