From: Seth Forshee <seth.forshee@canonical.com>
To: dri-devel@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
David Airlie <airlied@linux.ie>,
linux-kernel@vger.kernel.org,
Matthew Garrett <mjg59@srcf.ucam.org>,
Andreas Heider <andreas@meetr.de>
Subject: [RFC PATCH 3/5] drm/i915: register LVDS connector even if we can't get a panel mode
Date: Fri, 3 Aug 2012 11:02:19 -0500 [thread overview]
Message-ID: <1344009741-14248-4-git-send-email-seth.forshee@canonical.com> (raw)
In-Reply-To: <1344009741-14248-1-git-send-email-seth.forshee@canonical.com>
Some Apple hybrid graphics machines do not have the LVDS panel connected
to the integrated GPU at boot and also do not supply a VBT. The LVDS
connector is not registered as a result, making it impossible to support
graphics switching.
This patch changes intel_lvds_init() to register the connector even if
we can't find any panel modes. This makes it necessary to always check
intel_lvds->fixed_mode before use, as it could now be NULL.
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
drivers/gpu/drm/i915/intel_lvds.c | 48 +++++++++++++++----------------------
1 file changed, 19 insertions(+), 29 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 5069137..c1ab632 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -161,6 +161,8 @@ static int intel_lvds_mode_valid(struct drm_connector *connector,
struct intel_lvds *intel_lvds = intel_attached_lvds(connector);
struct drm_display_mode *fixed_mode = intel_lvds->fixed_mode;
+ if (!fixed_mode)
+ return MODE_PANEL;
if (mode->hdisplay > fixed_mode->hdisplay)
return MODE_PANEL;
if (mode->vdisplay > fixed_mode->vdisplay)
@@ -262,7 +264,8 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder,
* with the panel scaling set up to source from the H/VDisplay
* of the original mode.
*/
- intel_fixed_panel_mode(intel_lvds->fixed_mode, adjusted_mode);
+ if (intel_lvds->fixed_mode)
+ intel_fixed_panel_mode(intel_lvds->fixed_mode, adjusted_mode);
if (HAS_PCH_SPLIT(dev)) {
intel_pch_panel_fitting(dev, intel_lvds->fitting_mode,
@@ -461,12 +464,13 @@ static int intel_lvds_get_modes(struct drm_connector *connector)
{
struct intel_lvds *intel_lvds = intel_attached_lvds(connector);
struct drm_device *dev = connector->dev;
- struct drm_display_mode *mode;
+ struct drm_display_mode *mode = NULL;
if (intel_lvds->edid)
return drm_add_edid_modes(connector, intel_lvds->edid);
- mode = drm_mode_duplicate(dev, intel_lvds->fixed_mode);
+ if (intel_lvds->fixed_mode)
+ mode = drm_mode_duplicate(dev, intel_lvds->fixed_mode);
if (mode == NULL)
return 0;
@@ -1073,26 +1077,21 @@ bool intel_lvds_init(struct drm_device *dev)
*/
/* Ironlake: FIXME if still fail, not try pipe mode now */
- if (HAS_PCH_SPLIT(dev))
- goto failed;
-
- lvds = I915_READ(LVDS);
- pipe = (lvds & LVDS_PIPEB_SELECT) ? 1 : 0;
- crtc = intel_get_crtc_for_pipe(dev, pipe);
-
- if (crtc && (lvds & LVDS_PORT_EN)) {
- intel_lvds->fixed_mode = intel_crtc_mode_get(dev, crtc);
- if (intel_lvds->fixed_mode) {
- intel_lvds->fixed_mode->type |=
- DRM_MODE_TYPE_PREFERRED;
- goto out;
+ if (!HAS_PCH_SPLIT(dev)) {
+ lvds = I915_READ(LVDS);
+ pipe = (lvds & LVDS_PIPEB_SELECT) ? 1 : 0;
+ crtc = intel_get_crtc_for_pipe(dev, pipe);
+
+ if (crtc && (lvds & LVDS_PORT_EN)) {
+ intel_lvds->fixed_mode = intel_crtc_mode_get(dev, crtc);
+ if (intel_lvds->fixed_mode) {
+ intel_lvds->fixed_mode->type |=
+ DRM_MODE_TYPE_PREFERRED;
+ goto out;
+ }
}
}
- /* If we still don't have a mode after all that, give up. */
- if (!intel_lvds->fixed_mode)
- goto failed;
-
out:
/*
* Unlock registers and just
@@ -1116,13 +1115,4 @@ out:
intel_panel_setup_backlight(dev);
return true;
-
-failed:
- DRM_DEBUG_KMS("No LVDS modes found, disabling.\n");
- dev_priv->int_lvds_connector = NULL;
- drm_connector_cleanup(connector);
- drm_encoder_cleanup(encoder);
- kfree(intel_lvds);
- kfree(intel_connector);
- return false;
}
--
1.7.9.5
next prev parent reply other threads:[~2012-08-03 16:02 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-03 16:02 [RFC PATCH 0/5] i915 changes for hybrid graphics support on Macbooks Seth Forshee
2012-08-03 16:02 ` [RFC PATCH 1/5] drm/i915: Add support for vga_switcheroo reprobe Seth Forshee
2012-08-03 16:02 ` [RFC PATCH 2/5] drm/i915: separate out code to get EDID from LVDS panel Seth Forshee
2012-08-03 16:02 ` Seth Forshee [this message]
2012-08-03 16:14 ` [RFC PATCH 3/5] drm/i915: register LVDS connector even if we can't get a panel mode Matthew Garrett
2012-08-03 16:24 ` Seth Forshee
2012-08-03 16:27 ` Matthew Garrett
2012-08-04 16:57 ` Seth Forshee
2012-08-05 21:14 ` Daniel Vetter
2012-08-05 21:18 ` Matthew Garrett
2012-08-05 21:40 ` Daniel Vetter
2012-08-05 21:44 ` Dave Airlie
2012-08-05 23:20 ` Alex Deucher
2012-08-06 4:51 ` Seth Forshee
2012-08-20 15:30 ` Seth Forshee
2012-08-20 15:30 ` [RFC PATCH 1/7] vga_switcheroo: Add support for switching only the DDC Seth Forshee
2012-08-20 15:30 ` [RFC PATCH 2/7] vga_switcheroo: Add helper function to get the active client Seth Forshee
2012-08-20 15:31 ` [RFC PATCH 3/7] vga_switcheroo: Add notifier call chain for switcheroo events Seth Forshee
2012-08-20 15:31 ` [RFC PATCH 4/7] apple-gmux: Add switch_ddc support Seth Forshee
2012-08-20 15:31 ` [RFC PATCH 5/7] drm/edid: Switch DDC when reading the EDID Seth Forshee
2012-08-20 15:31 ` [RFC PATCH 6/7] drm/pci: Add drm_put_pci_dev() Seth Forshee
2012-08-20 15:31 ` [RFC PATCH 7/7] drm/pci: Defer initialization of secondary graphics devices until switcheroo is ready Seth Forshee
2012-08-20 15:36 ` Matthew Garrett
2012-08-20 15:56 ` Seth Forshee
2012-08-20 15:57 ` Matthew Garrett
2012-08-20 16:24 ` Seth Forshee
2012-08-20 16:28 ` Matthew Garrett
2012-08-10 22:19 ` [RFC PATCH 3/5] drm/i915: register LVDS connector even if we can't get a panel mode Seth Forshee
2012-08-06 12:23 ` Matthew Garrett
2012-08-06 20:16 ` Seth Forshee
2012-08-03 16:02 ` [RFC PATCH 4/5] drm/i915: make intel_lvds_get_edid() more robust Seth Forshee
2012-08-03 16:02 ` [RFC PATCH 5/5] drm/i915: check LVDS for EDID on GPU switches Seth Forshee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1344009741-14248-4-git-send-email-seth.forshee@canonical.com \
--to=seth.forshee@canonical.com \
--cc=airlied@linux.ie \
--cc=andreas@meetr.de \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mjg59@srcf.ucam.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®