From: Ville Syrjälä <ville.syrj...@linux.intel.com>

If there's no VBT mode not EDID, just read out the current SDVO output
timings, and use the result as the preferred mode for the display.

Signed-off-by: Ville Syrjälä <ville.syrj...@linux.intel.com>
---

This patch is a total shot in the dark since you didn't provide logs. But
in theory it might do something useful if there's no VBT or EDID available
on the system.

 drivers/gpu/drm/i915/intel_sdvo.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_sdvo.c 
b/drivers/gpu/drm/i915/intel_sdvo.c
index 95bdfb3..e9f326c 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -759,6 +759,13 @@ static bool intel_sdvo_get_input_timing(struct intel_sdvo 
*intel_sdvo,
                                     SDVO_CMD_GET_INPUT_TIMINGS_PART1, dtd);
 }
 
+static bool intel_sdvo_get_output_timing(struct intel_sdvo *intel_sdvo,
+                                        struct intel_sdvo_dtd *dtd)
+{
+       return intel_sdvo_get_timing(intel_sdvo,
+                                    SDVO_CMD_GET_OUTPUT_TIMINGS_PART1, dtd);
+}
+
 static bool
 intel_sdvo_create_preferred_input_timing(struct intel_sdvo *intel_sdvo,
                                         uint16_t clock,
@@ -1922,6 +1929,26 @@ static void intel_sdvo_get_tv_modes(struct drm_connector 
*connector)
                }
 }
 
+static struct drm_display_mode *intel_sdvo_get_output_mode(struct 
drm_connector *connector)
+{
+       struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector);
+       struct drm_display_mode *mode;
+       struct intel_sdvo_dtd dtd;
+
+       if (!intel_sdvo_get_output_timing(intel_sdvo, &dtd)) {
+               DRM_DEBUG_DRIVER("failed to retrieve SDVO DTD\n");
+               return NULL;
+       }
+
+       mode = drm_mode_create(connector->dev);
+       if (!mode)
+               return NULL;
+
+       intel_sdvo_get_mode_from_dtd(mode, &dtd);
+
+       return mode;
+}
+
 static void intel_sdvo_get_lvds_modes(struct drm_connector *connector)
 {
        struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector);
@@ -1953,6 +1980,17 @@ static void intel_sdvo_get_lvds_modes(struct 
drm_connector *connector)
         */
        intel_ddc_get_modes(connector, &intel_sdvo->ddc);
 
+       /* If there's nothing else try the current output timings */
+       if (list_empty(&connector->probed_modes)) {
+               newmode = intel_sdvo_get_output_mode(connector);
+               if (newmode != NULL) {
+                       /* Guarantee the mode is preferred */
+                       newmode->type = (DRM_MODE_TYPE_PREFERRED |
+                                        DRM_MODE_TYPE_DRIVER);
+                       drm_mode_probed_add(connector, newmode);
+               }
+       }
+
        list_for_each_entry(newmode, &connector->probed_modes, head) {
                if (newmode->type & DRM_MODE_TYPE_PREFERRED) {
                        intel_sdvo->sdvo_lvds_fixed_mode =
-- 
1.8.3.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to