[Intel-gfx] [PATCH] drm/i915: Add a DRM property "psr"
Siva Chandra
sivachandra at chromium.org
Tue Mar 18 20:51:07 CET 2014
This property helps one turn PSR "on" and "off" via xrandr.
The default value is same as that of the module param i915.enable_psr.
Signed-off-by: Siva Chandra <sivachandra at google.com>
---
drivers/gpu/drm/i915/i915_drv.h | 6 ++++++
drivers/gpu/drm/i915/intel_dp.c | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 70fbe90..83e6303 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1607,6 +1607,7 @@ typedef struct drm_i915_private {
struct drm_property *broadcast_rgb_property;
struct drm_property *force_audio_property;
+ struct drm_property *psr_property;
uint32_t hw_context_size;
struct list_head context_list;
@@ -1661,6 +1662,11 @@ enum hdmi_force_audio {
HDMI_AUDIO_ON, /* force turn on HDMI audio */
};
+enum psr_state {
+ EDP_PSR_ON,
+ EDP_PSR_OFF
+};
+
#define I915_GTT_OFFSET_NONE ((u32)-1)
struct drm_i915_gem_object_ops {
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 59ee4dc..c4546fa 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3197,6 +3197,33 @@ static int intel_dp_get_modes(struct drm_connector *connector)
return 0;
}
+static const struct drm_prop_enum_list psr_names[] = {
+ { EDP_PSR_ON, "on" },
+ { EDP_PSR_OFF, "off" }
+};
+
+static void intel_attach_psr_property(struct drm_connector *connector)
+{
+ struct drm_device *dev = connector->dev;
+ struct drm_i915_private *dev_priv = dev->dev_private;
+ struct drm_property *prop;
+
+ prop = dev_priv->psr_property;
+ if (prop == NULL) {
+ prop = drm_property_create_enum(
+ dev,
+ i915.enable_psr ? EDP_PSR_ON : EDP_PSR_OFF,
+ "psr",
+ psr_names,
+ ARRAY_SIZE(psr_names));
+ if (prop == NULL)
+ return;
+
+ dev_priv->psr_property = prop;
+ }
+ drm_object_attach_property(&connector->base, prop, 0);
+}
+
static bool
intel_dp_detect_audio(struct drm_connector *connector)
{
@@ -3302,6 +3329,15 @@ intel_dp_set_property(struct drm_connector *connector,
goto done;
}
+ if (is_edp(intel_dp) && property == dev_priv->psr_property) {
+ if (val == EDP_PSR_ON)
+ intel_edp_psr_enable(intel_dp);
+ else
+ intel_edp_psr_disable(intel_dp);
+
+ return 0;
+ }
+
return -EINVAL;
done:
@@ -3424,6 +3460,7 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
{
struct intel_connector *intel_connector = to_intel_connector(connector);
+ intel_attach_psr_property(connector);
intel_attach_force_audio_property(connector);
intel_attach_broadcast_rgb_property(connector);
intel_dp->color_range_auto = true;
--
1.9.0.279.gdc9e3eb
More information about the Intel-gfx
mailing list