Re: [Intel-gfx] [PATCH v6 1/5] drm: Introduce plane and CRTC scaling filter properties

2020-10-13 Thread Simon Ser
On Monday, October 12, 2020 8:41 PM, Pankaj Bharadiya 
 wrote:

> +/**
> + * 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_create_scaling_filter_property
> + */

Can we put this under the existing "Standard CRTC Properties" doc comment
instead? I'd prefer to avoid having a lot of different headings for properties.
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v6 1/5] drm: Introduce plane and CRTC scaling filter properties

2020-10-13 Thread Simon Ser
> +/**
> + * 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_create_scaling_filter_property
> + */

Similarily, this can be moved in "Plane Composition Properties".

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


[Intel-gfx] [PATCH v6 1/5] drm: Introduce plane and CRTC scaling filter properties

2020-10-12 Thread Pankaj Bharadiya
Introduce per-plane and per-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_create_scaling_filter() and for a CRTC by calling
drm_crtc_create_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 v3:
* Refactor code, add new function for common code (Ville)
changes since v2:
* Create per-plane and per-CRTC scaling filter property (Ville)
changes since v1:
* None
changes since RFC:
* Add separate properties for plane and CRTC (Ville)

Reviewed-by: Uma Shankar 
Signed-off-by: Pankaj Bharadiya 
---
 drivers/gpu/drm/drm_atomic_uapi.c   |  8 +++
 drivers/gpu/drm/drm_crtc.c  | 48 +++
 drivers/gpu/drm/drm_crtc_internal.h |  3 +
 drivers/gpu/drm/drm_plane.c | 90 +
 include/drm/drm_crtc.h  | 16 +
 include/drm/drm_plane.h | 21 +++
 6 files changed, 186 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_uapi.c 
b/drivers/gpu/drm/drm_atomic_uapi.c
index 25c269bc4681..ef82009035e6 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -469,6 +469,8 @@ static int drm_atomic_crtc_set_property(struct drm_crtc 
*crtc,
return -EFAULT;
 
set_out_fence_for_crtc(state->state, crtc, fence_ptr);
+   } else if (property == crtc->scaling_filter_property) {
+   state->scaling_filter = val;
} else if (crtc->funcs->atomic_set_property) {
return crtc->funcs->atomic_set_property(crtc, state, property, 
val);
} else {
@@ -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 == 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
@@ -585,6 +589,8 @@ static int drm_atomic_plane_set_property(struct drm_plane 
*plane,
sizeof(struct drm_rect),
);
return ret;
+   } else if (property == 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);
@@ -643,6 +649,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 == 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 {
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index aecdd7ea26dc..d75536f820b5 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -774,3 +774,51 @@ 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_create_scaling_filter_property
+ */
+
+/**
+ * drm_crtc_create_scaling_filter_property - create a new scaling filter
+ * property
+ *
+ * @crtc: drm CRTC
+ * @supported_filters: bitmask of supported scaling filters, must include
+ *BIT(DRM_SCALING_FILTER_DEFAULT).
+ *
+ * This function lets driver to enable the scaling filter property on a given
+ * CRTC.
+ *
+ * RETURNS:
+ * Zero for success or -errno
+ */
+int drm_crtc_create_scaling_filter_property(struct drm_crtc *crtc,
+   unsigned int supported_filters)
+{
+   struct drm_property *prop =
+   drm_create_scaling_filter_prop(crtc->dev, supported_filters);
+
+   if (IS_ERR(prop))
+   return PTR_ERR(prop);
+
+