@@ -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 {
@@ -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);
@@ -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;
}
@@ -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);
@@ -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__ */
@@ -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;
@@ -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