diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2009-10-14 02:00:42 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-10-14 20:30:23 -0400 |
commit | 8c2a6d730400e14bf28ccfa11b9bbf453db775ec (patch) | |
tree | e62b5d600ae2bee724568d63ad3c27c8e072db6c /drivers/gpu | |
parent | fb06ca8f8c61dfd7cbfa2092756577ff78a26dcd (diff) |
drm/radeon/kms: move active_device setup into encoder fixup()
radeon_encoder->active_device defines the active routing
between the encoder and connector. The encoder fixup and
dpms functions need to know the active_device to function
properly. Setting active_device in the prepare hook was
too late in some cases.
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_encoders.c | 19 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 17 |
2 files changed, 14 insertions, 22 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 10845f39124a..6cdef27be99d 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -194,6 +194,8 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder, | |||
194 | struct drm_device *dev = encoder->dev; | 194 | struct drm_device *dev = encoder->dev; |
195 | struct radeon_device *rdev = dev->dev_private; | 195 | struct radeon_device *rdev = dev->dev_private; |
196 | 196 | ||
197 | /* set the active encoder to connector routing */ | ||
198 | radeon_encoder_set_active_device(encoder); | ||
197 | drm_mode_set_crtcinfo(adjusted_mode, 0); | 199 | drm_mode_set_crtcinfo(adjusted_mode, 0); |
198 | 200 | ||
199 | if (radeon_encoder->rmx_type != RMX_OFF) | 201 | if (radeon_encoder->rmx_type != RMX_OFF) |
@@ -860,16 +862,9 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
860 | DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args; | 862 | DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args; |
861 | int index = 0; | 863 | int index = 0; |
862 | bool is_dig = false; | 864 | bool is_dig = false; |
863 | int devices; | ||
864 | 865 | ||
865 | memset(&args, 0, sizeof(args)); | 866 | memset(&args, 0, sizeof(args)); |
866 | 867 | ||
867 | /* on DPMS off we have no idea if active device is meaningful */ | ||
868 | if (mode != DRM_MODE_DPMS_ON && !radeon_encoder->active_device) | ||
869 | devices = radeon_encoder->devices; | ||
870 | else | ||
871 | devices = radeon_encoder->active_device; | ||
872 | |||
873 | DRM_DEBUG("encoder dpms %d to mode %d, devices %08x, active_devices %08x\n", | 868 | DRM_DEBUG("encoder dpms %d to mode %d, devices %08x, active_devices %08x\n", |
874 | radeon_encoder->encoder_id, mode, radeon_encoder->devices, | 869 | radeon_encoder->encoder_id, mode, radeon_encoder->devices, |
875 | radeon_encoder->active_device); | 870 | radeon_encoder->active_device); |
@@ -900,18 +895,18 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
900 | break; | 895 | break; |
901 | case ENCODER_OBJECT_ID_INTERNAL_DAC1: | 896 | case ENCODER_OBJECT_ID_INTERNAL_DAC1: |
902 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: | 897 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: |
903 | if (devices & (ATOM_DEVICE_TV_SUPPORT)) | 898 | if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) |
904 | index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl); | 899 | index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl); |
905 | else if (devices & (ATOM_DEVICE_CV_SUPPORT)) | 900 | else if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT)) |
906 | index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl); | 901 | index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl); |
907 | else | 902 | else |
908 | index = GetIndexIntoMasterTable(COMMAND, DAC1OutputControl); | 903 | index = GetIndexIntoMasterTable(COMMAND, DAC1OutputControl); |
909 | break; | 904 | break; |
910 | case ENCODER_OBJECT_ID_INTERNAL_DAC2: | 905 | case ENCODER_OBJECT_ID_INTERNAL_DAC2: |
911 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: | 906 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: |
912 | if (devices & (ATOM_DEVICE_TV_SUPPORT)) | 907 | if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) |
913 | index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl); | 908 | index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl); |
914 | else if (devices & (ATOM_DEVICE_CV_SUPPORT)) | 909 | else if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT)) |
915 | index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl); | 910 | index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl); |
916 | else | 911 | else |
917 | index = GetIndexIntoMasterTable(COMMAND, DAC2OutputControl); | 912 | index = GetIndexIntoMasterTable(COMMAND, DAC2OutputControl); |
@@ -1254,8 +1249,6 @@ static void radeon_atom_encoder_prepare(struct drm_encoder *encoder) | |||
1254 | { | 1249 | { |
1255 | radeon_atom_output_lock(encoder, true); | 1250 | radeon_atom_output_lock(encoder, true); |
1256 | radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); | 1251 | radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); |
1257 | |||
1258 | radeon_encoder_set_active_device(encoder); | ||
1259 | } | 1252 | } |
1260 | 1253 | ||
1261 | static void radeon_atom_encoder_commit(struct drm_encoder *encoder) | 1254 | static void radeon_atom_encoder_commit(struct drm_encoder *encoder) |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index 6ceb958fd194..3a75b5b6009b 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
@@ -107,8 +107,6 @@ static void radeon_legacy_lvds_prepare(struct drm_encoder *encoder) | |||
107 | else | 107 | else |
108 | radeon_combios_output_lock(encoder, true); | 108 | radeon_combios_output_lock(encoder, true); |
109 | radeon_legacy_lvds_dpms(encoder, DRM_MODE_DPMS_OFF); | 109 | radeon_legacy_lvds_dpms(encoder, DRM_MODE_DPMS_OFF); |
110 | |||
111 | radeon_encoder_set_active_device(encoder); | ||
112 | } | 110 | } |
113 | 111 | ||
114 | static void radeon_legacy_lvds_commit(struct drm_encoder *encoder) | 112 | static void radeon_legacy_lvds_commit(struct drm_encoder *encoder) |
@@ -192,6 +190,8 @@ static bool radeon_legacy_lvds_mode_fixup(struct drm_encoder *encoder, | |||
192 | { | 190 | { |
193 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 191 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
194 | 192 | ||
193 | /* set the active encoder to connector routing */ | ||
194 | radeon_encoder_set_active_device(encoder); | ||
195 | drm_mode_set_crtcinfo(adjusted_mode, 0); | 195 | drm_mode_set_crtcinfo(adjusted_mode, 0); |
196 | 196 | ||
197 | if (radeon_encoder->rmx_type != RMX_OFF) | 197 | if (radeon_encoder->rmx_type != RMX_OFF) |
@@ -218,7 +218,8 @@ static bool radeon_legacy_primary_dac_mode_fixup(struct drm_encoder *encoder, | |||
218 | struct drm_display_mode *mode, | 218 | struct drm_display_mode *mode, |
219 | struct drm_display_mode *adjusted_mode) | 219 | struct drm_display_mode *adjusted_mode) |
220 | { | 220 | { |
221 | 221 | /* set the active encoder to connector routing */ | |
222 | radeon_encoder_set_active_device(encoder); | ||
222 | drm_mode_set_crtcinfo(adjusted_mode, 0); | 223 | drm_mode_set_crtcinfo(adjusted_mode, 0); |
223 | 224 | ||
224 | return true; | 225 | return true; |
@@ -272,7 +273,6 @@ static void radeon_legacy_primary_dac_prepare(struct drm_encoder *encoder) | |||
272 | else | 273 | else |
273 | radeon_combios_output_lock(encoder, true); | 274 | radeon_combios_output_lock(encoder, true); |
274 | radeon_legacy_primary_dac_dpms(encoder, DRM_MODE_DPMS_OFF); | 275 | radeon_legacy_primary_dac_dpms(encoder, DRM_MODE_DPMS_OFF); |
275 | radeon_encoder_set_active_device(encoder); | ||
276 | } | 276 | } |
277 | 277 | ||
278 | static void radeon_legacy_primary_dac_commit(struct drm_encoder *encoder) | 278 | static void radeon_legacy_primary_dac_commit(struct drm_encoder *encoder) |
@@ -468,7 +468,6 @@ static void radeon_legacy_tmds_int_prepare(struct drm_encoder *encoder) | |||
468 | else | 468 | else |
469 | radeon_combios_output_lock(encoder, true); | 469 | radeon_combios_output_lock(encoder, true); |
470 | radeon_legacy_tmds_int_dpms(encoder, DRM_MODE_DPMS_OFF); | 470 | radeon_legacy_tmds_int_dpms(encoder, DRM_MODE_DPMS_OFF); |
471 | radeon_encoder_set_active_device(encoder); | ||
472 | } | 471 | } |
473 | 472 | ||
474 | static void radeon_legacy_tmds_int_commit(struct drm_encoder *encoder) | 473 | static void radeon_legacy_tmds_int_commit(struct drm_encoder *encoder) |
@@ -593,7 +592,8 @@ static bool radeon_legacy_tmds_ext_mode_fixup(struct drm_encoder *encoder, | |||
593 | struct drm_display_mode *mode, | 592 | struct drm_display_mode *mode, |
594 | struct drm_display_mode *adjusted_mode) | 593 | struct drm_display_mode *adjusted_mode) |
595 | { | 594 | { |
596 | 595 | /* set the active encoder to connector routing */ | |
596 | radeon_encoder_set_active_device(encoder); | ||
597 | drm_mode_set_crtcinfo(adjusted_mode, 0); | 597 | drm_mode_set_crtcinfo(adjusted_mode, 0); |
598 | 598 | ||
599 | return true; | 599 | return true; |
@@ -636,7 +636,6 @@ static void radeon_legacy_tmds_ext_prepare(struct drm_encoder *encoder) | |||
636 | else | 636 | else |
637 | radeon_combios_output_lock(encoder, true); | 637 | radeon_combios_output_lock(encoder, true); |
638 | radeon_legacy_tmds_ext_dpms(encoder, DRM_MODE_DPMS_OFF); | 638 | radeon_legacy_tmds_ext_dpms(encoder, DRM_MODE_DPMS_OFF); |
639 | radeon_encoder_set_active_device(encoder); | ||
640 | } | 639 | } |
641 | 640 | ||
642 | static void radeon_legacy_tmds_ext_commit(struct drm_encoder *encoder) | 641 | static void radeon_legacy_tmds_ext_commit(struct drm_encoder *encoder) |
@@ -735,7 +734,8 @@ static bool radeon_legacy_tv_dac_mode_fixup(struct drm_encoder *encoder, | |||
735 | struct drm_display_mode *mode, | 734 | struct drm_display_mode *mode, |
736 | struct drm_display_mode *adjusted_mode) | 735 | struct drm_display_mode *adjusted_mode) |
737 | { | 736 | { |
738 | 737 | /* set the active encoder to connector routing */ | |
738 | radeon_encoder_set_active_device(encoder); | ||
739 | drm_mode_set_crtcinfo(adjusted_mode, 0); | 739 | drm_mode_set_crtcinfo(adjusted_mode, 0); |
740 | 740 | ||
741 | return true; | 741 | return true; |
@@ -839,7 +839,6 @@ static void radeon_legacy_tv_dac_prepare(struct drm_encoder *encoder) | |||
839 | else | 839 | else |
840 | radeon_combios_output_lock(encoder, true); | 840 | radeon_combios_output_lock(encoder, true); |
841 | radeon_legacy_tv_dac_dpms(encoder, DRM_MODE_DPMS_OFF); | 841 | radeon_legacy_tv_dac_dpms(encoder, DRM_MODE_DPMS_OFF); |
842 | radeon_encoder_set_active_device(encoder); | ||
843 | } | 842 | } |
844 | 843 | ||
845 | static void radeon_legacy_tv_dac_commit(struct drm_encoder *encoder) | 844 | static void radeon_legacy_tv_dac_commit(struct drm_encoder *encoder) |