aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2010-10-21 11:43:08 -0400
committerBen Skeggs <bskeggs@redhat.com>2010-11-17 23:38:41 -0500
commit01db363979e96115a895f35c823303660f0f328d (patch)
tree4f95a91259be2fb2f81e310bc7e8998132efae9f /drivers/gpu
parent5794b5fdb579abf7be2c27c6e0d6106f391a26e4 (diff)
drm/nouveau: Use "force" to decide if analog load detection is ok or not.
Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_connector.c69
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_connector.h3
-rw-r--r--drivers/gpu/drm/nouveau/nv04_crtc.c5
3 files changed, 28 insertions, 49 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 6208eedc0970..9ec2b8a81344 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -213,6 +213,24 @@ nouveau_connector_set_encoder(struct drm_connector *connector,
213 } 213 }
214} 214}
215 215
216static bool
217nouveau_connector_poll_allowed(struct drm_connector *connector)
218{
219 struct drm_device *dev = connector->dev;
220 struct drm_nouveau_private *dev_priv = dev->dev_private;
221 struct drm_crtc *crtc;
222 bool spare_crtc = false;
223
224 if (dev_priv->card_type >= NV_50) {
225 return true;
226 } else {
227 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
228 spare_crtc |= !crtc->enabled;
229
230 return spare_crtc;
231 }
232}
233
216static enum drm_connector_status 234static enum drm_connector_status
217nouveau_connector_detect(struct drm_connector *connector, bool force) 235nouveau_connector_detect(struct drm_connector *connector, bool force)
218{ 236{
@@ -281,7 +299,8 @@ detect_analog:
281 nv_encoder = find_encoder_by_type(connector, OUTPUT_ANALOG); 299 nv_encoder = find_encoder_by_type(connector, OUTPUT_ANALOG);
282 if (!nv_encoder && !nouveau_tv_disable) 300 if (!nv_encoder && !nouveau_tv_disable)
283 nv_encoder = find_encoder_by_type(connector, OUTPUT_TV); 301 nv_encoder = find_encoder_by_type(connector, OUTPUT_TV);
284 if (nv_encoder) { 302 if (nv_encoder &&
303 (force || nouveau_connector_poll_allowed(connector))) {
285 struct drm_encoder *encoder = to_drm_encoder(nv_encoder); 304 struct drm_encoder *encoder = to_drm_encoder(nv_encoder);
286 struct drm_encoder_helper_funcs *helper = 305 struct drm_encoder_helper_funcs *helper =
287 encoder->helper_private; 306 encoder->helper_private;
@@ -724,44 +743,6 @@ nouveau_connector_best_encoder(struct drm_connector *connector)
724 return NULL; 743 return NULL;
725} 744}
726 745
727void
728nouveau_connector_set_polling(struct drm_connector *connector)
729{
730 struct drm_device *dev = connector->dev;
731 struct drm_nouveau_private *dev_priv = dev->dev_private;
732 struct drm_crtc *crtc;
733 bool spare_crtc = false;
734
735 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
736 spare_crtc |= !crtc->enabled;
737
738 connector->polled = 0;
739
740 switch (connector->connector_type) {
741 case DRM_MODE_CONNECTOR_VGA:
742 case DRM_MODE_CONNECTOR_TV:
743 if (dev_priv->card_type >= NV_50 ||
744 (nv_gf4_disp_arch(dev) && spare_crtc))
745 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
746 break;
747
748 case DRM_MODE_CONNECTOR_DVII:
749 case DRM_MODE_CONNECTOR_DVID:
750 case DRM_MODE_CONNECTOR_HDMIA:
751 case DRM_MODE_CONNECTOR_DisplayPort:
752 case DRM_MODE_CONNECTOR_eDP:
753 if (dev_priv->card_type >= NV_50)
754 connector->polled = DRM_CONNECTOR_POLL_HPD;
755 else if (connector->connector_type == DRM_MODE_CONNECTOR_DVID ||
756 spare_crtc)
757 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
758 break;
759
760 default:
761 break;
762 }
763}
764
765static const struct drm_connector_helper_funcs 746static const struct drm_connector_helper_funcs
766nouveau_connector_helper_funcs = { 747nouveau_connector_helper_funcs = {
767 .get_modes = nouveau_connector_get_modes, 748 .get_modes = nouveau_connector_get_modes,
@@ -892,6 +873,9 @@ nouveau_connector_create(struct drm_device *dev, int index)
892 case DCB_CONNECTOR_TV_1: 873 case DCB_CONNECTOR_TV_1:
893 case DCB_CONNECTOR_TV_3: 874 case DCB_CONNECTOR_TV_3:
894 nv_connector->scaling_mode = DRM_MODE_SCALE_NONE; 875 nv_connector->scaling_mode = DRM_MODE_SCALE_NONE;
876
877 if (nv_gf4_disp_arch(dev))
878 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
895 break; 879 break;
896 default: 880 default:
897 nv_connector->scaling_mode = DRM_MODE_SCALE_FULLSCREEN; 881 nv_connector->scaling_mode = DRM_MODE_SCALE_FULLSCREEN;
@@ -903,11 +887,14 @@ nouveau_connector_create(struct drm_device *dev, int index)
903 dev->mode_config.dithering_mode_property, 887 dev->mode_config.dithering_mode_property,
904 nv_connector->use_dithering ? 888 nv_connector->use_dithering ?
905 DRM_MODE_DITHERING_ON : DRM_MODE_DITHERING_OFF); 889 DRM_MODE_DITHERING_ON : DRM_MODE_DITHERING_OFF);
890
891 if (dev_priv->card_type >= NV_50)
892 connector->polled = DRM_CONNECTOR_POLL_HPD;
893 else
894 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
906 break; 895 break;
907 } 896 }
908 897
909 nouveau_connector_set_polling(connector);
910
911 drm_sysfs_connector_add(connector); 898 drm_sysfs_connector_add(connector);
912 dcb->drm = connector; 899 dcb->drm = connector;
913 return dcb->drm; 900 return dcb->drm;
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.h b/drivers/gpu/drm/nouveau/nouveau_connector.h
index c21ed6b16f88..711b1e9203af 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.h
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.h
@@ -52,9 +52,6 @@ static inline struct nouveau_connector *nouveau_connector(
52struct drm_connector * 52struct drm_connector *
53nouveau_connector_create(struct drm_device *, int index); 53nouveau_connector_create(struct drm_device *, int index);
54 54
55void
56nouveau_connector_set_polling(struct drm_connector *);
57
58int 55int
59nouveau_connector_bpp(struct drm_connector *); 56nouveau_connector_bpp(struct drm_connector *);
60 57
diff --git a/drivers/gpu/drm/nouveau/nv04_crtc.c b/drivers/gpu/drm/nouveau/nv04_crtc.c
index 5b49cec528ee..40e180741629 100644
--- a/drivers/gpu/drm/nouveau/nv04_crtc.c
+++ b/drivers/gpu/drm/nouveau/nv04_crtc.c
@@ -158,7 +158,6 @@ nv_crtc_dpms(struct drm_crtc *crtc, int mode)
158{ 158{
159 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 159 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
160 struct drm_device *dev = crtc->dev; 160 struct drm_device *dev = crtc->dev;
161 struct drm_connector *connector;
162 unsigned char seq1 = 0, crtc17 = 0; 161 unsigned char seq1 = 0, crtc17 = 0;
163 unsigned char crtc1A; 162 unsigned char crtc1A;
164 163
@@ -213,10 +212,6 @@ nv_crtc_dpms(struct drm_crtc *crtc, int mode)
213 NVVgaSeqReset(dev, nv_crtc->index, false); 212 NVVgaSeqReset(dev, nv_crtc->index, false);
214 213
215 NVWriteVgaCrtc(dev, nv_crtc->index, NV_CIO_CRE_RPC1_INDEX, crtc1A); 214 NVWriteVgaCrtc(dev, nv_crtc->index, NV_CIO_CRE_RPC1_INDEX, crtc1A);
216
217 /* Update connector polling modes */
218 list_for_each_entry(connector, &dev->mode_config.connector_list, head)
219 nouveau_connector_set_polling(connector);
220} 215}
221 216
222static bool 217static bool