diff mbox

drm/i915: Added a new Panel-fitter property for connectors

Message ID 1392720124-3069-1-git-send-email-akash.goel@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

akash.goel@intel.com Feb. 18, 2014, 10:42 a.m. UTC
From: Akash Goel <akash.goel@intel.com>

Added a Panel-fitter enable/disable property support for the
connectors.

NOTE: By default, the value for the property will be disabled.

Signed-off-by: G Pallavi <pallavi.g@intel.com>
Signed-off-by: Akash Goel <akash.goel@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h    |  8 ++++++++
 drivers/gpu/drm/i915/intel_drv.h   |  1 +
 drivers/gpu/drm/i915/intel_modes.c | 31 +++++++++++++++++++++++++++++++
 3 files changed, 40 insertions(+)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 8c64831..a07f6cd 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1560,6 +1560,7 @@  typedef struct drm_i915_private {
 
 	struct drm_property *broadcast_rgb_property;
 	struct drm_property *force_audio_property;
+	struct drm_property *force_pfit_property;
 
 	uint32_t hw_context_size;
 	struct list_head context_list;
@@ -1613,6 +1614,13 @@  enum hdmi_force_audio {
 	HDMI_AUDIO_ON,			/* force turn on HDMI audio */
 };
 
+enum panel_fitter {
+	PFIT_OFF,
+	AUTOSCALE,
+	PILLARBOX,
+	LETTERBOX,
+};
+
 #define I915_GTT_OFFSET_NONE ((u32)-1)
 
 struct drm_i915_gem_object_ops {
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index a4ffc02..db6ea3e 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -819,6 +819,7 @@  int intel_connector_update_modes(struct drm_connector *connector,
 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_force_pfit_property(struct drm_connector *connector);
 
 
 /* intel_overlay.c */
diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c
index 0e860f3..967e080 100644
--- a/drivers/gpu/drm/i915/intel_modes.c
+++ b/drivers/gpu/drm/i915/intel_modes.c
@@ -28,6 +28,7 @@ 
 #include <linux/fb.h>
 #include <drm/drm_edid.h>
 #include <drm/drmP.h>
+#include <drm/drm_crtc.h>
 #include "intel_drv.h"
 #include "i915_drv.h"
 
@@ -126,3 +127,33 @@  intel_attach_broadcast_rgb_property(struct drm_connector *connector)
 
 	drm_object_attach_property(&connector->base, prop, 0);
 }
+
+static const struct drm_prop_enum_list pfit_names[] = {
+       { PFIT_OFF, "pfit off" },
+       { AUTO_SCALE, "Auto scale" },
+       { PILLAR_BOX, "PillarBox" },
+       { LETTER_BOX, "LetterBox" },
+};
+
+void
+intel_attach_force_pfit_property(struct drm_connector *connector)
+{
+       struct drm_device *dev = connector->dev;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct drm_property *prop;
+       struct drm_mode_object *obj = &connector->base;
+
+       prop = dev_priv->force_pfit_property;
+       if (prop == NULL) {
+               prop = drm_property_create_enum(dev, 0,
+                                               "pfit",
+                                               pfit_names,
+                                               ARRAY_SIZE(pfit_names));
+               if (prop == NULL)
+                       return;
+
+               dev_priv->force_pfit_property = prop;
+       }
+
+       drm_object_attach_property(obj, prop, 0);
+}