aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorVandana Kannan <vandana.kannan@intel.com>2015-01-09 15:55:56 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-01-27 03:50:47 -0500
commit96178eeb37298a9452f0c4b04f47fafedc7bab47 (patch)
tree7c4f57033e61ae0f1a2cec44578eb5d44ececf73 /drivers/gpu/drm
parentf78ae63f28c3f7de06360c553711fb07abd69734 (diff)
drm/i915: Modifying structures related to DRRS
Earlier, DRRS structures were specific to eDP (used only in intel_dp). Since DRRS can be extended to other internal display types (if the panel supports multiple RR), modifying structures to be part of drm_i915_private and have a provision to add display related structs like intel_dp. Also, aligning with frontbuffer tracking mechanism, the new structure contains data for busy frontbuffer bits. Signed-off-by: Vandana Kannan <vandana.kannan@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h32
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c50
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h18
3 files changed, 47 insertions, 53 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index b5616471f45d..2d3355aa17ac 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -777,11 +777,33 @@ struct i915_fbc {
777 } no_fbc_reason; 777 } no_fbc_reason;
778}; 778};
779 779
780struct i915_drrs { 780/**
781 struct intel_connector *connector; 781 * HIGH_RR is the highest eDP panel refresh rate read from EDID
782 * LOW_RR is the lowest eDP panel refresh rate found from EDID
783 * parsing for same resolution.
784 */
785enum drrs_refresh_rate_type {
786 DRRS_HIGH_RR,
787 DRRS_LOW_RR,
788 DRRS_MAX_RR, /* RR count */
789};
790
791enum drrs_support_type {
792 DRRS_NOT_SUPPORTED = 0,
793 STATIC_DRRS_SUPPORT = 1,
794 SEAMLESS_DRRS_SUPPORT = 2
782}; 795};
783 796
784struct intel_dp; 797struct intel_dp;
798struct i915_drrs {
799 struct mutex mutex;
800 struct delayed_work work;
801 struct intel_dp *dp;
802 unsigned busy_frontbuffer_bits;
803 enum drrs_refresh_rate_type refresh_rate_type;
804 enum drrs_support_type type;
805};
806
785struct i915_psr { 807struct i915_psr {
786 struct mutex lock; 808 struct mutex lock;
787 bool sink_support; 809 bool sink_support;
@@ -1361,12 +1383,6 @@ struct ddi_vbt_port_info {
1361 uint8_t supports_dp:1; 1383 uint8_t supports_dp:1;
1362}; 1384};
1363 1385
1364enum drrs_support_type {
1365 DRRS_NOT_SUPPORTED = 0,
1366 STATIC_DRRS_SUPPORT = 1,
1367 SEAMLESS_DRRS_SUPPORT = 2
1368};
1369
1370enum psr_lines_to_wait { 1386enum psr_lines_to_wait {
1371 PSR_0_LINES_TO_WAIT = 0, 1387 PSR_0_LINES_TO_WAIT = 0,
1372 PSR_1_LINE_TO_WAIT, 1388 PSR_1_LINE_TO_WAIT,
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index df7b558f3222..003437df10c0 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1269,7 +1269,7 @@ found:
1269 &pipe_config->dp_m_n); 1269 &pipe_config->dp_m_n);
1270 1270
1271 if (intel_connector->panel.downclock_mode != NULL && 1271 if (intel_connector->panel.downclock_mode != NULL &&
1272 intel_dp->drrs_state.type == SEAMLESS_DRRS_SUPPORT) { 1272 dev_priv->drrs.type == SEAMLESS_DRRS_SUPPORT) {
1273 pipe_config->has_drrs = true; 1273 pipe_config->has_drrs = true;
1274 intel_link_compute_m_n(bpp, lane_count, 1274 intel_link_compute_m_n(bpp, lane_count,
1275 intel_connector->panel.downclock_mode->clock, 1275 intel_connector->panel.downclock_mode->clock,
@@ -4745,24 +4745,24 @@ intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev,
4745 I915_READ(pp_div_reg)); 4745 I915_READ(pp_div_reg));
4746} 4746}
4747 4747
4748void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate) 4748static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
4749{ 4749{
4750 struct drm_i915_private *dev_priv = dev->dev_private; 4750 struct drm_i915_private *dev_priv = dev->dev_private;
4751 struct intel_encoder *encoder; 4751 struct intel_encoder *encoder;
4752 struct intel_dp *intel_dp = NULL; 4752 struct intel_digital_port *dig_port = NULL;
4753 struct intel_dp *intel_dp = dev_priv->drrs.dp;
4753 struct intel_crtc_config *config = NULL; 4754 struct intel_crtc_config *config = NULL;
4754 struct intel_crtc *intel_crtc = NULL; 4755 struct intel_crtc *intel_crtc = NULL;
4755 struct intel_connector *intel_connector = dev_priv->drrs.connector;
4756 u32 reg, val; 4756 u32 reg, val;
4757 enum edp_drrs_refresh_rate_type index = DRRS_HIGH_RR; 4757 enum drrs_refresh_rate_type index = DRRS_HIGH_RR;
4758 4758
4759 if (refresh_rate <= 0) { 4759 if (refresh_rate <= 0) {
4760 DRM_DEBUG_KMS("Refresh rate should be positive non-zero.\n"); 4760 DRM_DEBUG_KMS("Refresh rate should be positive non-zero.\n");
4761 return; 4761 return;
4762 } 4762 }
4763 4763
4764 if (intel_connector == NULL) { 4764 if (intel_dp == NULL) {
4765 DRM_DEBUG_KMS("DRRS supported for eDP only.\n"); 4765 DRM_DEBUG_KMS("DRRS not supported.\n");
4766 return; 4766 return;
4767 } 4767 }
4768 4768
@@ -4771,8 +4771,8 @@ void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
4771 * platforms that cannot have PSR and DRRS enabled at the same time. 4771 * platforms that cannot have PSR and DRRS enabled at the same time.
4772 */ 4772 */
4773 4773
4774 encoder = intel_attached_encoder(&intel_connector->base); 4774 dig_port = dp_to_dig_port(intel_dp);
4775 intel_dp = enc_to_intel_dp(&encoder->base); 4775 encoder = &dig_port->base;
4776 intel_crtc = encoder->new_crtc; 4776 intel_crtc = encoder->new_crtc;
4777 4777
4778 if (!intel_crtc) { 4778 if (!intel_crtc) {
@@ -4782,15 +4782,16 @@ void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
4782 4782
4783 config = &intel_crtc->config; 4783 config = &intel_crtc->config;
4784 4784
4785 if (intel_dp->drrs_state.type < SEAMLESS_DRRS_SUPPORT) { 4785 if (dev_priv->drrs.type < SEAMLESS_DRRS_SUPPORT) {
4786 DRM_DEBUG_KMS("Only Seamless DRRS supported.\n"); 4786 DRM_DEBUG_KMS("Only Seamless DRRS supported.\n");
4787 return; 4787 return;
4788 } 4788 }
4789 4789
4790 if (intel_connector->panel.downclock_mode->vrefresh == refresh_rate) 4790 if (intel_dp->attached_connector->panel.downclock_mode->vrefresh ==
4791 refresh_rate)
4791 index = DRRS_LOW_RR; 4792 index = DRRS_LOW_RR;
4792 4793
4793 if (index == intel_dp->drrs_state.refresh_rate_type) { 4794 if (index == dev_priv->drrs.refresh_rate_type) {
4794 DRM_DEBUG_KMS( 4795 DRM_DEBUG_KMS(
4795 "DRRS requested for previously set RR...ignoring\n"); 4796 "DRRS requested for previously set RR...ignoring\n");
4796 return; 4797 return;
@@ -4820,23 +4821,21 @@ void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
4820 * possible calls from user space to set differnt RR are made. 4821 * possible calls from user space to set differnt RR are made.
4821 */ 4822 */
4822 4823
4823 mutex_lock(&intel_dp->drrs_state.mutex); 4824 mutex_lock(&dev_priv->drrs.mutex);
4824 4825
4825 intel_dp->drrs_state.refresh_rate_type = index; 4826 dev_priv->drrs.refresh_rate_type = index;
4826 4827
4827 mutex_unlock(&intel_dp->drrs_state.mutex); 4828 mutex_unlock(&dev_priv->drrs.mutex);
4828 4829
4829 DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate); 4830 DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate);
4830} 4831}
4831 4832
4832static struct drm_display_mode * 4833static struct drm_display_mode *
4833intel_dp_drrs_init(struct intel_digital_port *intel_dig_port, 4834intel_dp_drrs_init(struct intel_connector *intel_connector,
4834 struct intel_connector *intel_connector, 4835 struct drm_display_mode *fixed_mode)
4835 struct drm_display_mode *fixed_mode)
4836{ 4836{
4837 struct drm_connector *connector = &intel_connector->base; 4837 struct drm_connector *connector = &intel_connector->base;
4838 struct intel_dp *intel_dp = &intel_dig_port->dp; 4838 struct drm_device *dev = connector->dev;
4839 struct drm_device *dev = intel_dig_port->base.base.dev;
4840 struct drm_i915_private *dev_priv = dev->dev_private; 4839 struct drm_i915_private *dev_priv = dev->dev_private;
4841 struct drm_display_mode *downclock_mode = NULL; 4840 struct drm_display_mode *downclock_mode = NULL;
4842 4841
@@ -4858,13 +4857,11 @@ intel_dp_drrs_init(struct intel_digital_port *intel_dig_port,
4858 return NULL; 4857 return NULL;
4859 } 4858 }
4860 4859
4861 dev_priv->drrs.connector = intel_connector; 4860 mutex_init(&dev_priv->drrs.mutex);
4862
4863 mutex_init(&intel_dp->drrs_state.mutex);
4864 4861
4865 intel_dp->drrs_state.type = dev_priv->vbt.drrs_type; 4862 dev_priv->drrs.type = dev_priv->vbt.drrs_type;
4866 4863
4867 intel_dp->drrs_state.refresh_rate_type = DRRS_HIGH_RR; 4864 dev_priv->drrs.refresh_rate_type = DRRS_HIGH_RR;
4868 DRM_DEBUG_KMS("seamless DRRS supported for eDP panel.\n"); 4865 DRM_DEBUG_KMS("seamless DRRS supported for eDP panel.\n");
4869 return downclock_mode; 4866 return downclock_mode;
4870} 4867}
@@ -4884,7 +4881,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
4884 struct edid *edid; 4881 struct edid *edid;
4885 enum pipe pipe = INVALID_PIPE; 4882 enum pipe pipe = INVALID_PIPE;
4886 4883
4887 intel_dp->drrs_state.type = DRRS_NOT_SUPPORTED; 4884 dev_priv->drrs.type = DRRS_NOT_SUPPORTED;
4888 4885
4889 if (!is_edp(intel_dp)) 4886 if (!is_edp(intel_dp))
4890 return true; 4887 return true;
@@ -4933,7 +4930,6 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
4933 if ((scan->type & DRM_MODE_TYPE_PREFERRED)) { 4930 if ((scan->type & DRM_MODE_TYPE_PREFERRED)) {
4934 fixed_mode = drm_mode_duplicate(dev, scan); 4931 fixed_mode = drm_mode_duplicate(dev, scan);
4935 downclock_mode = intel_dp_drrs_init( 4932 downclock_mode = intel_dp_drrs_init(
4936 intel_dig_port,
4937 intel_connector, fixed_mode); 4933 intel_connector, fixed_mode);
4938 break; 4934 break;
4939 } 4935 }
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 30e968f8c55e..bd4d5148d27e 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -595,17 +595,6 @@ struct intel_hdmi {
595struct intel_dp_mst_encoder; 595struct intel_dp_mst_encoder;
596#define DP_MAX_DOWNSTREAM_PORTS 0x10 596#define DP_MAX_DOWNSTREAM_PORTS 0x10
597 597
598/**
599 * HIGH_RR is the highest eDP panel refresh rate read from EDID
600 * LOW_RR is the lowest eDP panel refresh rate found from EDID
601 * parsing for same resolution.
602 */
603enum edp_drrs_refresh_rate_type {
604 DRRS_HIGH_RR,
605 DRRS_LOW_RR,
606 DRRS_MAX_RR, /* RR count */
607};
608
609struct intel_dp { 598struct intel_dp {
610 uint32_t output_reg; 599 uint32_t output_reg;
611 uint32_t aux_ch_ctl_reg; 600 uint32_t aux_ch_ctl_reg;
@@ -661,12 +650,6 @@ struct intel_dp {
661 bool has_aux_irq, 650 bool has_aux_irq,
662 int send_bytes, 651 int send_bytes,
663 uint32_t aux_clock_divider); 652 uint32_t aux_clock_divider);
664 struct {
665 enum drrs_support_type type;
666 enum edp_drrs_refresh_rate_type refresh_rate_type;
667 struct mutex mutex;
668 } drrs_state;
669
670}; 653};
671 654
672struct intel_digital_port { 655struct intel_digital_port {
@@ -1037,7 +1020,6 @@ void intel_edp_backlight_off(struct intel_dp *intel_dp);
1037void intel_edp_panel_vdd_on(struct intel_dp *intel_dp); 1020void intel_edp_panel_vdd_on(struct intel_dp *intel_dp);
1038void intel_edp_panel_on(struct intel_dp *intel_dp); 1021void intel_edp_panel_on(struct intel_dp *intel_dp);
1039void intel_edp_panel_off(struct intel_dp *intel_dp); 1022void intel_edp_panel_off(struct intel_dp *intel_dp);
1040void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate);
1041void intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector); 1023void intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector);
1042void intel_dp_mst_suspend(struct drm_device *dev); 1024void intel_dp_mst_suspend(struct drm_device *dev);
1043void intel_dp_mst_resume(struct drm_device *dev); 1025void intel_dp_mst_resume(struct drm_device *dev);