Skip to contentSkip to conversation

drm/i915: take a power domain ref only when needed during HDMI detect

PATCH In review Imre Deak 4 participants 14 messages Nov 19, 2015 – Nov 24, 2015

Subsystems (2)
lore
Share & tools
lore

Imre Deak

author
#0 lore raw

PATCH 1/2 drm/i915: take a power domain ref only when needed during HDMI detect

Suggested by Ville.

---
 drivers/gpu/drm/i915/intel_hdmi.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +4 -3
index fd86cef..17ced03 100644
@@ -1351,14 +1351,15 @@ intel_hdmi_set_edid(struct drm_connector *connector, bool force)
 	struct edid *edid = NULL;
 	bool connected = false;
 
-	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
+	if (force) {
+		intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
 
-	if (force)
 		edid = drm_get_edid(connector,
 				    intel_gmbus_get_adapter(dev_priv,
 				    intel_hdmi->ddc_bus));
 
-	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
+		intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
+	}
 
 	to_intel_connector(connector)->detect_edid = edid;
 	if (edid && edid->input & DRM_EDID_INPUT_DIGITAL) {
Signature · 6 lines
2.5.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#1 lore raw

PATCH 2/2 drm/i915: take a power domain reference while checking the HDMI live status

There are platforms that don't need the full GMBUS power domain (PCH, BXT) while others do (VLV/CHV). For optimizing this we would need to add a new power domain, but it's not clear how much we would benefit given the short time we hold the reference. So for now let's keep things simple.

---
 drivers/gpu/drm/i915/intel_hdmi.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/intel_hdmi.c +4 -0
index 17ced03..bdd462e 100644
@@ -1393,6 +1393,8 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
+	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
+
 	while (!live_status && --retry) {
 		live_status = intel_digital_port_connected(dev_priv,
 				hdmi_to_dig_port(intel_hdmi));
@@ -1412,6 +1414,8 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
 	} else
 		status = connector_status_disconnected;
 
+	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
+
 	return status;
 }
 
Signature · 6 lines
2.5.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/i915: take a power domain reference while checking the HDMI live status

Quoted 5 lines · Imre Deak

There are platforms that don't need the full GMBUS power domain (PCH, BXT) while others do (VLV/CHV). For optimizing this we would need to add a new power domain, but it's not clear how much we would benefit given the short time we hold the reference. So for now let's keep things simple.

Actually on PCH platforms the gmbus domain means just just an rpm ref since the gmbus hw lives in the PCH. And IIRC on BXT gmbus lives in pw0 so same deal really.

And for vlv/chv we should just need the disp2d well, which is exactly what we get with the gmbus domain.

So I don't think there's actually anything to optimize here with current platforms.

Both patches look fine to me:

Quoted 35 lines
---
 drivers/gpu/drm/i915/intel_hdmi.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/intel_hdmi.c +4 -0
index 17ced03..bdd462e 100644
@@ -1393,6 +1393,8 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
+	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
+
 	while (!live_status && --retry) {
 		live_status = intel_digital_port_connected(dev_priv,
 				hdmi_to_dig_port(intel_hdmi));
@@ -1412,6 +1414,8 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
 	} else
 		status = connector_status_disconnected;
 
+	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
+
 	return status;
 }
 
Signature · 6 lines
2.5.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#3 lore raw

Re: [PATCH 2/2] drm/i915: take a power domain reference while checking the HDMI live status

Quoted 11 lines · Ville Syrjälä
Quoted 7 lines · Imre Deak

There are platforms that don't need the full GMBUS power domain (PCH, BXT) while others do (VLV/CHV). For optimizing this we would need to add a new power domain, but it's not clear how much we
would benefit given the short time we hold the reference. So for now
let's keep things simple.

Actually on PCH platforms the gmbus domain means just just an rpm ref since the gmbus hw lives in the PCH.

Ah right.

Quoted 1 line

And IIRC on BXT gmbus lives in pw0 so same deal really.

It's in PW2 there. I'll fix the commit message.

Quoted 44 lines

And for vlv/chv we should just need the disp2d well, which is exactly what we get with the gmbus domain.

So I don't think there's actually anything to optimize here with current platforms.

Both patches look fine to me:

Quoted 35 lines

---
 drivers/gpu/drm/i915/intel_hdmi.c | 4 ++++

 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/intel_hdmi.c +0 -0
index 17ced03..bdd462e 100644
@@ -1393,6 +1393,8 @@ intel_hdmi_detect(struct drm_connector
 *connector, bool force)
  	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
  		      connector->base.id, connector->name);

drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
+

  while (!live_status && --retry) { live_status = intel_digital_port_connected(dev_priv, hdmi_to_dig_port(intel_hdmi));

drivers/gpu/drm/i915/intel_hdmi.c +0 -0
@@ -1412,6 +1414,8 @@ intel_hdmi_detect(struct drm_connector
 *connector, bool force)
  	} else
  		status = connector_status_disconnected;

drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
+

  return status;
 }

Signature · 1 line
2.5.0
Quoted 5 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Re: [PATCH 2/2] drm/i915: take a power domain reference while checking the HDMI live status

Quoted 10 lines · Imre Deak
Quoted 9 lines · Ville Syrjälä
Quoted 7 lines · Imre Deak

There are platforms that don't need the full GMBUS power domain (PCH, BXT) while others do (VLV/CHV). For optimizing this we would need to add a new power domain, but it's not clear how much we
would benefit given the short time we hold the reference. So for now
let's keep things simple.

Quoted 8 lines
Quoted 2 lines

Actually on PCH platforms the gmbus domain means just just an rpm ref since the gmbus hw lives in the PCH.

Ah right.

Quoted 1 line

And IIRC on BXT gmbus lives in pw0 so same deal really.

It's in PW2 there. I'll fix the commit message.

Doh. Not sure where I got the PW0 zero idea. Maybe I confused gmbus with hpd. But yes, you're right about that.

Quoted 50 lines
Quoted 50 lines

And for vlv/chv we should just need the disp2d well, which is exactly what we get with the gmbus domain.

So I don't think there's actually anything to optimize here with current platforms.

Both patches look fine to me:

Quoted 39 lines

---
 drivers/gpu/drm/i915/intel_hdmi.c | 4 ++++

 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/intel_hdmi.c +0 -0
index 17ced03..bdd462e 100644
@@ -1393,6 +1393,8 @@ intel_hdmi_detect(struct drm_connector
 *connector, bool force)
  	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
  		      connector->base.id, connector->name);

drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
+

  while (!live_status && --retry) { live_status = intel_digital_port_connected(dev_priv, hdmi_to_dig_port(intel_hdmi));

drivers/gpu/drm/i915/intel_hdmi.c +0 -0
@@ -1412,6 +1414,8 @@ intel_hdmi_detect(struct drm_connector
 *connector, bool force)
  	} else
  		status = connector_status_disconnected;

drivers/gpu/drm/i915/intel_hdmi.c +2 -0
+	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
+

  return status;
 }

Signature · 6 lines
2.5.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#5 lore raw

Re: [PATCH 2/2] drm/i915: take a power domain reference while checking the HDMI live status

Quoted 16 lines · Ville Syrjälä
Quoted 15 lines · Imre Deak
Quoted 13 lines · Ville Syrjälä
Quoted 9 lines · Imre Deak

There are platforms that don't need the full GMBUS power domain (PCH, BXT) while others do (VLV/CHV). For optimizing this we would need to add a new power domain, but it's not clear how much
we
would benefit given the short time we hold the reference. So for
now
let's keep things simple.

Actually on PCH platforms the gmbus domain means just just an rpm ref since the gmbus hw lives in the PCH.

Quoted 18 lines
Quoted 5 lines

Ah right.

Quoted 1 line

And IIRC on BXT gmbus lives in pw0 so same deal really.

It's in PW2 there. I'll fix the commit message.

Doh. Not sure where I got the PW0 zero idea. Maybe I confused gmbus with hpd. But yes, you're right about that.

Quoted 9 lines
Quoted 9 lines

And for vlv/chv we should just need the disp2d well, which is exactly what we get with the gmbus domain.

So I don't think there's actually anything to optimize here with current platforms.

Both patches look fine to me:

Pushed 1/2 and 2/2 with the fixed commit message to dinq. Thanks for the review.

--Imre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

author
#6 lore raw

Re: [PATCH 2/2] drm/i915: take a power domain reference while checking the HDMI live status

Quoted 31 lines · Imre Deak
Quoted 30 lines · Ville Syrjälä
Quoted 13 lines · Imre Deak
Quoted 12 lines · Ville Syrjälä
Quoted 10 lines · Imre Deak

There are platforms that don't need the full GMBUS power domain
(PCH, BXT) while others do (VLV/CHV). For optimizing this we would need to add a new power domain, but it's not clear how much
we
would benefit given the short time we hold the reference. So for
now
let's keep things simple.

Quoted 8 lines
Quoted 2 lines

Actually on PCH platforms the gmbus domain means just just an rpm ref since the gmbus hw lives in the PCH.

Ah right.

Quoted 1 line

And IIRC on BXT gmbus lives in pw0 so same deal really.

It's in PW2 there. I'll fix the commit message.

Doh. Not sure where I got the PW0 zero idea. Maybe I confused gmbus with hpd. But yes, you're right about that.

Quoted 4 lines
Quoted 4 lines

And for vlv/chv we should just need the disp2d well, which is exactly what we get with the gmbus domain.

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

So I don't think there's actually anything to optimize here with current platforms.

Both patches look fine to me:

Pushed 1/2 and 2/2 with the fixed commit message to dinq. Thanks for the review.

I just noticed that 2/2 fixes the following commit which is in v4.4-rc1 already:

commit 237ed86c693d8a8e4db476976aeb30df4deac74b
Author: Sonika Jindal <[email protected]>
Date:   Tue Sep 15 09:44:20 2015 +0530

    drm/i915: Check live status before reading edid

so AFAIU this should've gone through -fixes. Jani can you still apply it there?

--Imre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

Re: [PATCH 2/2] drm/i915: take a power domain reference while checking the HDMI live status

Quoted 44 lines · Imre Deak
Quoted 31 lines · Imre Deak
Quoted 30 lines · Ville Syrjälä
Quoted 13 lines · Imre Deak
Quoted 12 lines · Ville Syrjälä
Quoted 10 lines · Imre Deak

There are platforms that don't need the full GMBUS power domain
(PCH, BXT) while others do (VLV/CHV). For optimizing this we would need to add a new power domain, but it's not clear how much
we
would benefit given the short time we hold the reference. So for
now
let's keep things simple.

Quoted 8 lines
Quoted 2 lines

Actually on PCH platforms the gmbus domain means just just an rpm ref since the gmbus hw lives in the PCH.

Ah right.

Quoted 1 line

And IIRC on BXT gmbus lives in pw0 so same deal really.

It's in PW2 there. I'll fix the commit message.

Doh. Not sure where I got the PW0 zero idea. Maybe I confused gmbus with hpd. But yes, you're right about that.

Quoted 4 lines
Quoted 4 lines

And for vlv/chv we should just need the disp2d well, which is exactly what we get with the gmbus domain.

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

So I don't think there's actually anything to optimize here with current platforms.

Both patches look fine to me:

Pushed 1/2 and 2/2 with the fixed commit message to dinq. Thanks for the review.

I just noticed that 2/2 fixes the following commit which is in v4.4-rc1 already:

Quoted 8 lines

commit 237ed86c693d8a8e4db476976aeb30df4deac74b
Author: Sonika Jindal <[email protected]>
Date:   Tue Sep 15 09:44:20 2015 +0530

    drm/i915: Check live status before reading edid

so AFAIU this should've gone through -fixes. Jani can you still apply it there?

Otherwise no problem but this has a dependency on

commit f0ab43e6c338896cadee64ced3fc30a5343890d9

Author: Ville Syrjälä <[email protected]>
Date:   Mon Nov 9 16:48:19 2015 +0100

drm/i915: Introduce a gmbus power domain

and didn't bother figuring out how deep the rabbit hole goes.

If you want this in -fixes, please either send a -fixes specific patch, or see how many commits would need to be backported.

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#8 lore raw

Re: [PATCH 2/2] drm/i915: take a power domain reference while checking the HDMI live status

Quoted 68 lines · Jani Nikula
Quoted 55 lines · Imre Deak
Quoted 39 lines · Imre Deak
Quoted 38 lines · Ville Syrjälä
Quoted 20 lines · Imre Deak
Quoted 15 lines · Ville Syrjälä
Quoted 5 lines · Imre Deak

There are platforms that don't need the full GMBUS power domain
(PCH, BXT) while others do (VLV/CHV). For optimizing this we
would need to add a new power domain, but it's not clear

Quoted 8 lines

how
much
we
would benefit given the short time we hold the reference. So
for
now
let's keep things simple.

Quoted 3 lines

Actually on PCH platforms the gmbus domain means just just an
rpm ref since the gmbus hw lives in the PCH.

Quoted 5 lines

Ah right.

Quoted 1 line

And IIRC on BXT gmbus lives in pw0 so same deal really.

It's in PW2 there. I'll fix the commit message.

Doh. Not sure where I got the PW0 zero idea. Maybe I confused gmbus
with hpd. But yes, you're right about that.

Quoted 7 lines
Quoted 7 lines

And for vlv/chv we should just need the disp2d well, which is exactly what we get with the gmbus domain.

So I don't think there's actually anything to optimize here with current platforms.

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Both patches look fine to me:

Pushed 1/2 and 2/2 with the fixed commit message to dinq. Thanks for
the review.

I just noticed that 2/2 fixes the following commit which is in v4.4-rc1
already:

commit 237ed86c693d8a8e4db476976aeb30df4deac74b
Author: Sonika Jindal <[email protected]>
Date:   Tue Sep 15 09:44:20 2015 +0530

Quoted 5 lines

    drm/i915: Check live status before reading edid

so AFAIU this should've gone through -fixes. Jani can you still apply
it there?

Otherwise no problem but this has a dependency on

commit f0ab43e6c338896cadee64ced3fc30a5343890d9
Author: Ville Syrjälä <[email protected]> Date:   Mon Nov 9 16:48:19 2015 +0100

Quoted 7 lines

    drm/i915: Introduce a gmbus power domain

and didn't bother figuring out how deep the rabbit hole goes.

If you want this in -fixes, please either send a -fixes specific patch,
or see how many commits would need to be backported.

Ok. I backported the 5 patches we'd need. The only issue with that AFAICS is to resolve any conflict between drm-intel-fixes and dinq, but that looks manageable. I did have to resolve one conflict in one of the patches while backporting, so I pushed them to
https://github.com/ideak/linux/commits/gmbus-fix-backport

I can also send the rebased versions to the list if needed.

--Imre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw
In reply to Imre Deak
Quoted 1 line · Imre Deak

Suggested by Ville.

Do you mind explaining why this is done at the hdmi level and not the gmbus level?
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#10 lore raw
Quoted 5 lines · Chris Wilson
Quoted 1 line · Imre Deak

Suggested by Ville.

Do you mind explaining why this is done at the hdmi level and not the gmbus level?

To reduce the on/off toggling, since we don't have delayed power-off implemented for power wells. gmbus_xfer also takes a ref to account for accesses from the i2c device node. The solution would be to implement delayed power-off I guess.

--Imre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw
Quoted 11 lines · Imre Deak
Quoted 5 lines · Chris Wilson
Quoted 1 line · Imre Deak

Suggested by Ville.

Do you mind explaining why this is done at the hdmi level and not the gmbus level?

To reduce the on/off toggling, since we don't have delayed power-off implemented for power wells. gmbus_xfer also takes a ref to account for accesses from the i2c device node. The solution would be to implement delayed power-off I guess.

As we chase ever finer grained wakelocks, yeah. Looking at the other users of gmbus, they are the old platforms (dvo, sdvo, crt, lvds) so not worth generalising the optimisation of holding the wakelock across the entire i2c operation, I guess?
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#12 lore raw
Quoted 8 lines · Chris Wilson
Quoted 7 lines · Imre Deak
Quoted 5 lines · Chris Wilson
Quoted 1 line · Imre Deak

Suggested by Ville.

Do you mind explaining why this is done at the hdmi level and not the gmbus level?

Quoted 6 lines
Quoted 4 lines

To reduce the on/off toggling, since we don't have delayed power-off implemented for power wells. gmbus_xfer also takes a ref to account for accesses from the i2c device node. The solution would be to implement delayed power-off I guess.

As we chase ever finer grained wakelocks, yeah.

Ok, the delayed-off stuff shouldn't be difficult, since in case of power wells we hold an RPM ref. So AFAICS we would only need to synchronize during system suspend and driver unload. And then find a good timeout value..

Quoted 3 lines

Looking at the other users of gmbus, they are the old platforms (dvo, sdvo, crt, lvds) so not worth generalising the optimisation of holding the wakelock across the entire i2c operation, I guess?

If you mean to take an extra ref around the higher level op in those places too: well in case of CRT it's also in new HW where it matters, so that's inconsistent and I think we should do it there too. For others it doesn't matter I think.

--Imre

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

author
#13 lore raw
Quoted 30 lines · Imre Deak
Quoted 17 lines · Chris Wilson
Quoted 8 lines · Imre Deak
Quoted 6 lines · Chris Wilson
Quoted 1 line · Imre Deak

Suggested by Ville.

Do you mind explaining why this is done at the hdmi level and not the
gmbus level?

Quoted 7 lines

To reduce the on/off toggling, since we don't have delayed power- off
implemented for power wells. gmbus_xfer also takes a ref to account for
accesses from the i2c device node. The solution would be to implement
delayed power-off I guess.

Quoted 1 line

As we chase ever finer grained wakelocks, yeah.

Ok, the delayed-off stuff shouldn't be difficult, since in case of power wells we hold an RPM ref. So AFAICS we would only need to synchronize during system suspend and driver unload. And then find a good timeout value..

Quoted 4 lines

Looking at the other users of gmbus, they are the old platforms (dvo,
sdvo, crt, lvds) so not worth generalising the optimisation of holding the wakelock across the entire i2c operation, I guess?

Quoted 4 lines

If you mean to take an extra ref around the higher level op in those places too: well in case of CRT it's also in new HW where it matters, so that's inconsistent and I think we should do it there too. For others it doesn't matter I think.

Err, we do take a ref in the CRT detect code, but it's the port power domain.

--Imre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx