@@ -598,6 +598,8 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
state->color_range = val;
} else if (property == plane->transfer_function_property) {
state->transfer_function = val;
+ } else if (property == plane->sdr_white_level_property) {
+ state->sdr_white_level = val;
} else if (property == config->prop_fb_damage_clips) {
ret = drm_atomic_replace_property_blob_from_id(dev,
&state->fb_damage_clips,
@@ -666,6 +668,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
*val = state->color_range;
} else if (property == plane->transfer_function_property) {
*val = state->transfer_function;
+ } else if (property == plane->sdr_white_level_property) {
+ *val = state->sdr_white_level;
} else if (property == config->prop_fb_damage_clips) {
*val = (state->fb_damage_clips) ?
state->fb_damage_clips->base.id : 0;
@@ -556,6 +556,23 @@ const char *drm_get_color_range_name(enum drm_color_range range)
return color_range_name[range];
}
+int drm_plane_create_sdr_white_level_property(struct drm_plane *plane){
+
+ struct drm_property *prop;
+
+ prop = drm_property_create_range(plane->dev, 0, "SDR_WHITE_LEVEL", 0, UINT_MAX);
+
+ if (!prop)
+ return -ENOMEM;
+
+ plane->sdr_white_level_property = prop;
+ drm_object_attach_property(&plane->base, prop, DRM_DEFAULT_SDR_WHITE_LEVEL);
+
+ if (plane->state)
+ plane->state->sdr_white_level = DRM_DEFAULT_SDR_WHITE_LEVEL;
+
+ return 0;
+}
/**
* drm_get_transfer_function - return a string for transfer function
* @tf: transfer function to compute name of
@@ -26,6 +26,12 @@
#include <linux/ctype.h>
#include <drm/drm_property.h>
+/**
+ * Default SDR white level in nits. Although there is no standard SDR nit level, 200
+ * is chosen as the default since that is the generally accepted value.
+ */
+#define DRM_DEFAULT_SDR_WHITE_LEVEL 200
+
struct drm_crtc;
struct drm_plane;
@@ -187,6 +187,11 @@ struct drm_plane_state {
* format for a proper HDR color/luminance output.
*/
enum drm_transfer_function transfer_function;
+ /**
+ * @sdr_white_level:
+ * SDR white level boost for HDR+SDR multi plane usecases. max white level in nits
+ */
+ unsigned int sdr_white_level;
/**
* @fb_damage_clips:
*
@@ -757,7 +762,15 @@ struct drm_plane {
* See drm_plane_create_color_properties().
*/
struct drm_property *transfer_function_property;
-
+ /**
+ * @sdr_white_level:
+ *
+ * Optional sdr_white_level. When HDR and SDR are combined in multi plane
+ * overlay cases, the sdr plane will be very dim. This property allows
+ * the driver to boost the sdr plane's white level. The value should be
+ * max white level in nits.
+ */
+ struct drm_property *sdr_white_level_property;
/**
* @scaling_filter_property: property to apply a particular filter while
* scaling.