All of lore.kernel.org
 help / color / mirror / Atom feed
* Switcheroo support in i915
@ 2014-09-06 13:01 Tom Pitcher
  2014-09-08  8:06 ` Chris Wilson
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Pitcher @ 2014-09-06 13:01 UTC (permalink / raw)
  To: intel-gfx

[-- Attachment #1: Type: text/plain, Size: 1547 bytes --]

I've been attempting to solve a bug with i915 & switcheroo on many Macbook 
Pros (some with nvidia discrete cards, others radeon), report here:

https://bugs.freedesktop.org/show_bug.cgi?id=61115

Basically, after switching to i915 using switcheroo the display isn't 
connected. It was mentioned that some kind of reprobing was needed, so I tried 
the following:

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index d443441..fbc0d1c 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1281,6 +1281,13 @@ static void i915_switcheroo_set_state(struct pci_dev 
*pdev, enum vga_switcheroo_
 	}
 }
 
+static void
+i915_switcheroo_reprobe(struct pci_dev *pdev)
+{
+	struct drm_device *dev = pci_get_drvdata(pdev);
+	intel_fbdev_output_poll_changed(dev);
+}
+
 static bool i915_switcheroo_can_switch(struct pci_dev *pdev)
 {
 	struct drm_device *dev = pci_get_drvdata(pdev);
@@ -1295,7 +1302,7 @@ static bool i915_switcheroo_can_switch(struct pci_dev 
*pdev)
 
 static const struct vga_switcheroo_client_ops i915_switcheroo_ops = {
 	.set_gpu_state = i915_switcheroo_set_state,
-	.reprobe = NULL,
+	.reprobe = i915_switcheroo_reprobe,
 	.can_switch = i915_switcheroo_can_switch,
 };
 
Unfortunately that hasn't solved it. I've attached my dmesg too, since I think 
the following line is related to the problem:

[Firmware Bug]: ACPI(GFX0) defines _DOD but not _DOS

I'd be very grateful if somebody with a better understanding of this could 
take a look - I'll happily test any patches.

[-- Attachment #2: dmesg.gz --]
[-- Type: application/gzip, Size: 23017 bytes --]

[-- Attachment #3: Type: text/plain, Size: 159 bytes --]

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Switcheroo support in i915
  2014-09-06 13:01 Switcheroo support in i915 Tom Pitcher
@ 2014-09-08  8:06 ` Chris Wilson
  2014-09-08 21:41   ` Tom Pitcher
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Wilson @ 2014-09-08  8:06 UTC (permalink / raw)
  To: Tom Pitcher; +Cc: intel-gfx

On Sat, Sep 06, 2014 at 02:01:31PM +0100, Tom Pitcher wrote:
> I've been attempting to solve a bug with i915 & switcheroo on many Macbook 
> Pros (some with nvidia discrete cards, others radeon), report here:
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=61115
> 
> Basically, after switching to i915 using switcheroo the display isn't 
> connected. It was mentioned that some kind of reprobing was needed, so I tried 
> the following:

Right, I guess the output states do need to be repolled as well. But we
need to effectively re-initialised the LVDS (and possibly all the other
connectors, but it is likely to only be the panel connectors that are
muxed).

This will require some rejigging of intel_lvds_init(), though it should
be safe enough to destroy and attempt to recreate it here:

for_each_connector_safe()
  if (connector->type == DRM_MODE_CONNECOR_LVDS)
     drm_connector_destroy(connector);

for_each_encoder_safe()
  if (encoder->type == DRM_MODE_ENCODER_LVDS)
     drm_encoder_destroy(encoder);

intel_lvds_init();
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Switcheroo support in i915
  2014-09-08  8:06 ` Chris Wilson
@ 2014-09-08 21:41   ` Tom Pitcher
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Pitcher @ 2014-09-08 21:41 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Monday 08 Sep 2014 09:06:50 Chris Wilson wrote:
> On Sat, Sep 06, 2014 at 02:01:31PM +0100, Tom Pitcher wrote:
> > I've been attempting to solve a bug with i915 & switcheroo on many Macbook
> > Pros (some with nvidia discrete cards, others radeon), report here:
> > 
> > https://bugs.freedesktop.org/show_bug.cgi?id=61115
> > 
> > Basically, after switching to i915 using switcheroo the display isn't
> > connected. It was mentioned that some kind of reprobing was needed, so I
> > tried
> > the following:
> Right, I guess the output states do need to be repolled as well. But we
> need to effectively re-initialised the LVDS (and possibly all the other
> connectors, but it is likely to only be the panel connectors that are
> muxed).
> 
> This will require some rejigging of intel_lvds_init(), though it should
> be safe enough to destroy and attempt to recreate it here:
> 
> for_each_connector_safe()
>   if (connector->type == DRM_MODE_CONNECOR_LVDS)
>      drm_connector_destroy(connector);
> 
> for_each_encoder_safe()
>   if (encoder->type == DRM_MODE_ENCODER_LVDS)
>      drm_encoder_destroy(encoder);
> 
> intel_lvds_init();
> -Chris

Thanks Chris, I turned what you provided into this:

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index d443441..edcecc9 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1281,6 +1281,26 @@ static void i915_switcheroo_set_state(struct pci_dev 
*pdev, enum vga_switcheroo_
 	}
 }
 
+static void
+i915_switcheroo_reprobe(struct pci_dev *pdev)
+{
+	struct drm_device *dev = pci_get_drvdata(pdev);
+	struct drm_encoder *encoder, *encoder_tmp;
+	struct drm_connector *connector, *connector_tmp;
+
+	intel_fbdev_output_poll_changed(dev);
+
+	list_for_each_entry_safe(connector, connector_tmp, &dev-
>mode_config.connector_list, head)
+		if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)
+			connector->funcs->destroy(connector);
+
+	list_for_each_entry_safe(encoder, encoder_tmp, &dev-
>mode_config.encoder_list, head)
+		if (encoder->encoder_type == DRM_MODE_ENCODER_LVDS)
+			intel_encoder_destroy(encoder);
+
+	intel_lvds_init(dev);
+}
+
 static bool i915_switcheroo_can_switch(struct pci_dev *pdev)
 {
 	struct drm_device *dev = pci_get_drvdata(pdev);
@@ -1295,7 +1315,7 @@ static bool i915_switcheroo_can_switch(struct pci_dev 
*pdev)
 
 static const struct vga_switcheroo_client_ops i915_switcheroo_ops = {
 	.set_gpu_state = i915_switcheroo_set_state,
-	.reprobe = NULL,
+	.reprobe = i915_switcheroo_reprobe,
 	.can_switch = i915_switcheroo_can_switch,
 };
 
This doesn't seem to have altered the behaviour - though my code is probably 
bad. Any ideas?

(Apologies if this message comes through twice - my mail host is playing up).

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Switcheroo support in i915
@ 2014-09-06 17:50 Tom Pitcher
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Pitcher @ 2014-09-06 17:50 UTC (permalink / raw)
  To: intel-gfx

[-- Attachment #1: Type: text/plain, Size: 1547 bytes --]

I've been attempting to solve a bug with i915 & switcheroo on many Macbook 
Pros (some with nvidia discrete cards, others radeon), report here:

https://bugs.freedesktop.org/show_bug.cgi?id=61115

Basically, after switching to i915 using switcheroo the display isn't 
connected. It was mentioned that some kind of reprobing was needed, so I tried 
the following:

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index d443441..fbc0d1c 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1281,6 +1281,13 @@ static void i915_switcheroo_set_state(struct pci_dev 
*pdev, enum vga_switcheroo_
 	}
 }
 
+static void
+i915_switcheroo_reprobe(struct pci_dev *pdev)
+{
+	struct drm_device *dev = pci_get_drvdata(pdev);
+	intel_fbdev_output_poll_changed(dev);
+}
+
 static bool i915_switcheroo_can_switch(struct pci_dev *pdev)
 {
 	struct drm_device *dev = pci_get_drvdata(pdev);
@@ -1295,7 +1302,7 @@ static bool i915_switcheroo_can_switch(struct pci_dev 
*pdev)
 
 static const struct vga_switcheroo_client_ops i915_switcheroo_ops = {
 	.set_gpu_state = i915_switcheroo_set_state,
-	.reprobe = NULL,
+	.reprobe = i915_switcheroo_reprobe,
 	.can_switch = i915_switcheroo_can_switch,
 };
 
Unfortunately that hasn't solved it. I've attached my dmesg too, since I think 
the following line is related to the problem:

[Firmware Bug]: ACPI(GFX0) defines _DOD but not _DOS

I'd be very grateful if somebody with a better understanding of this could 
take a look - I'll happily test any patches.

[-- Attachment #2: dmesg.gz --]
[-- Type: application/gzip, Size: 23017 bytes --]

[-- Attachment #3: Type: text/plain, Size: 159 bytes --]

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-08 21:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-06 13:01 Switcheroo support in i915 Tom Pitcher
2014-09-08  8:06 ` Chris Wilson
2014-09-08 21:41   ` Tom Pitcher
2014-09-06 17:50 Tom Pitcher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.