@@ -2465,6 +2465,7 @@ struct drm_i915_private {
struct drm_property *broadcast_rgb_property;
struct drm_property *force_audio_property;
+ struct drm_property *max_bpc_property;
/* hda/i915 audio component */
struct i915_audio_component *audio_component;
@@ -58,6 +58,8 @@ int intel_digital_connector_atomic_get_property(struct drm_connector *connector,
*val = intel_conn_state->force_audio;
else if (property == dev_priv->broadcast_rgb_property)
*val = intel_conn_state->broadcast_rgb;
+ else if (property == dev_priv->max_bpc_property)
+ *val = intel_conn_state->max_bpc;
else {
DRM_DEBUG_ATOMIC("Unknown property %s\n", property->name);
return -EINVAL;
@@ -95,6 +97,11 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector,
return 0;
}
+ if (property == dev_priv->max_bpc_property) {
+ intel_conn_state->max_bpc = val;
+ return 0;
+ }
+
DRM_DEBUG_ATOMIC("Unknown property %s\n", property->name);
return -EINVAL;
}
@@ -337,6 +337,7 @@ struct intel_digital_connector_state {
enum hdmi_force_audio force_audio;
int broadcast_rgb;
+ int max_bpc;
};
#define to_intel_digital_connector_state(x) container_of(x, struct intel_digital_connector_state, base)
@@ -1692,6 +1693,7 @@ int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter);
void intel_attach_force_audio_property(struct drm_connector *connector);
void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
void intel_attach_aspect_ratio_property(struct drm_connector *connector);
+void intel_attach_max_bpc_property(struct drm_connector *connector, int min, int max);
/* intel_overlay.c */
@@ -1795,10 +1795,21 @@ static const struct drm_encoder_funcs intel_hdmi_enc_funcs = {
static void
intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *connector)
{
+ struct drm_i915_private *dev_priv = to_i915(connector->dev);
+
intel_attach_force_audio_property(connector);
intel_attach_broadcast_rgb_property(connector);
intel_attach_aspect_ratio_property(connector);
connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
+
+ if ((IS_G4X(dev_priv) || IS_VALLEYVIEW(dev_priv) ||
+ IS_CHERRYVIEW(dev_priv))) {
+ intel_attach_max_bpc_property(connector, 8, 10);
+ to_intel_digital_connector_state(connector->state)->max_bpc = 10;
+ } else if (INTEL_GEN(dev_priv) >= 5) {
+ intel_attach_max_bpc_property(connector, 8, 12);
+ to_intel_digital_connector_state(connector->state)->max_bpc = 12;
+ }
}
/*
@@ -151,3 +151,22 @@ intel_attach_aspect_ratio_property(struct drm_connector *connector)
connector->dev->mode_config.aspect_ratio_property,
DRM_MODE_PICTURE_ASPECT_NONE);
}
+
+void
+intel_attach_max_bpc_property(struct drm_connector *connector, int min, int max)
+{
+ struct drm_device *dev = connector->dev;
+ struct drm_i915_private *dev_priv = to_i915(dev);
+ struct drm_property *prop;
+
+ prop = dev_priv->max_bpc_property;
+ if (prop == NULL) {
+ prop = drm_property_create_range(dev, 0, "max bpc", min, max);
+ if (prop == NULL)
+ return;
+
+ dev_priv->max_bpc_property = prop;
+ }
+
+ drm_object_attach_property(&connector->base, prop, max);
+}