Skip to contentSkip to conversation

drm/i915: Do a better job at disabling primary plane in the noatomic case.

PATCH Superseded Maarten Lankhorst 5 participants 10 messages Nov 11, 2015 – Dec 10, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Do a better job at disabling primary plane in the noatomic case.

When disable_noatomic is called plane_mask is not reliable yet, and plane_state->visible = true even after disabling the primary plane.

Fix this by unsetting plane->visible if it was visible, and calling disable_planes with the primary plane as mask.

The other planes are already disabled in intel_sanitize_crtc, so they don't have to be handled here.

Cc: [email protected] #v4.3, v4.2?
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92655

---
 drivers/gpu/drm/i915/intel_display.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +3 -1
index b5f7493213b7..bc3282ab5ed2 100644
@@ -6267,9 +6267,11 @@ static void intel_crtc_disable_noatomic(struct drm_crtc *crtc)
 		WARN_ON(intel_crtc->unpin_work);
 
 		intel_pre_disable_primary(crtc);
+
+		intel_crtc_disable_planes(crtc, 1 << drm_plane_index(crtc->primary));
+		to_intel_plane_state(crtc->primary->state)->visible = false;
 	}
 
-	intel_crtc_disable_planes(crtc, crtc->state->plane_mask);
 	dev_priv->display.crtc_disable(crtc);
 	intel_crtc->active = false;
 	intel_update_watermarks(crtc);
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 2 lines · Maarten Lankhorst

When disable_noatomic is called plane_mask is not reliable yet, and plane_state->visible = true even after disabling the primary plane.

So the stale value of plane_state->visible causes a subsequent modeset to enable the primary again?

Quoted 21 lines

Fix this by unsetting plane->visible if it was visible, and calling disable_planes with the primary plane as mask.

The other planes are already disabled in intel_sanitize_crtc, so they don't have to be handled here.

Cc: [email protected] #v4.3, v4.2?
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92655

---
 drivers/gpu/drm/i915/intel_display.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index b5f7493213b7..bc3282ab5ed2 100644
@@ -6267,9 +6267,11 @@ static void intel_crtc_disable_noatomic(struct drm_crtc
 *crtc)

drivers/gpu/drm/i915/intel_display.c static void intel_crtc_disable_noatomic(struct drm_crtc · line 6274

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +3 -2
 		WARN_ON(intel_crtc->unpin_work);
 
 		intel_pre_disable_primary(crtc);
+
+		intel_crtc_disable_planes(crtc, 1 << drm_plane_index(crtc
->primary));
+		to_intel_plane_state(crtc->primary->state)->visible = false;
 	}
 
-	intel_crtc_disable_planes(crtc, crtc->state->plane_mask);

Can't we just make plane_mask reliable? We know whether the primary plane is enabled and all others were disabled prior to that. Or did I miss something.

Ander

Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c +0 -0
 	dev_priv->display.crtc_disable(crtc);
 	intel_crtc->active = false;
 	intel_update_watermarks(crtc);
#2 lore raw

Op 12-11-15 om 14:37 schreef Ander Conselvan De Oliveira:

Quoted 5 lines · Maarten Lankhorst
Quoted 2 lines

When disable_noatomic is called plane_mask is not reliable yet, and plane_state->visible = true even after disabling the primary plane.

So the stale value of plane_state->visible causes a subsequent modeset to enable the primary again?

Probably not because it would get recalculated in calc_changes, but it should really be set to false afterwards.

in intel_plane_atomic_calc_changes:
if (!was_crtc_enabled && WARN_ON(was_visible))
was_visible = false;

and in intel_sanitize_crtc when intel_check_plane_mapping fails, it gets set to true to disable it.

This is really a special case and it's for disable_noatomic only. As the name says it can't rely on the atomic state.

Quoted 30 lines
Quoted 30 lines

Fix this by unsetting plane->visible if it was visible, and calling disable_planes with the primary plane as mask.

The other planes are already disabled in intel_sanitize_crtc, so they don't have to be handled here.

Cc: [email protected] #v4.3, v4.2?
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92655

---
 drivers/gpu/drm/i915/intel_display.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +3 -1
index b5f7493213b7..bc3282ab5ed2 100644
@@ -6267,9 +6267,11 @@ static void intel_crtc_disable_noatomic(struct drm_crtc
 *crtc)
 		WARN_ON(intel_crtc->unpin_work);
 
 		intel_pre_disable_primary(crtc);
+
+		intel_crtc_disable_planes(crtc, 1 << drm_plane_index(crtc
->primary));
+		to_intel_plane_state(crtc->primary->state)->visible = false;
 	}
 
Quoted 4 lines

drivers/gpu/drm/i915/intel_display.c static void intel_crtc_disable_noatomic(struct drm_crtc *crtc) · line 6272

Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +0 -1
-	intel_crtc_disable_planes(crtc, crtc->state->plane_mask);

Can't we just make plane_mask reliable? We know whether the primary plane is enabled and all others were disabled prior to that. Or did I miss something.

In the case of hardware readout you can't. The plane_mask gets set only if we can preserve the initial framebuffer else the primary plane gets disabled.

~Maarten

#3 lore raw
Quoted 9 lines · Maarten Lankhorst

Op 12-11-15 om 14:37 schreef Ander Conselvan De Oliveira:

Quoted 6 lines · Maarten Lankhorst
Quoted 2 lines

When disable_noatomic is called plane_mask is not reliable yet, and plane_state->visible = true even after disabling the primary plane.

So the stale value of plane_state->visible causes a subsequent modeset to enable
the primary again?

Probably not because it would get recalculated in calc_changes, but it should really be set to false afterwards.

So basically I didn't understand how the wrong value of plane_state->visible causes the bug that was mentioned. I think a brief explanation in the commit message would be good.

Quoted 43 lines

in intel_plane_atomic_calc_changes:
if (!was_crtc_enabled && WARN_ON(was_visible))
was_visible = false;

and in intel_sanitize_crtc when intel_check_plane_mapping fails, it gets set to true to disable it.

This is really a special case and it's for disable_noatomic only. As the name says it can't rely on the atomic state.

Quoted 32 lines
Quoted 32 lines

Fix this by unsetting plane->visible if it was visible, and calling disable_planes with the primary plane as mask.

The other planes are already disabled in intel_sanitize_crtc, so they don't have to be handled here.

Cc: [email protected] #v4.3, v4.2?
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92655

---
 drivers/gpu/drm/i915/intel_display.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index b5f7493213b7..bc3282ab5ed2 100644
@@ -6267,9 +6267,11 @@ static void intel_crtc_disable_noatomic(struct

drm_crtc
*crtc)

drivers/gpu/drm/i915/intel_display.c +3 -1
 		WARN_ON(intel_crtc->unpin_work);
 
 		intel_pre_disable_primary(crtc);
+
+		intel_crtc_disable_planes(crtc, 1 << drm_plane_index(crtc
->primary));
+		to_intel_plane_state(crtc->primary->state)->visible =

false;
}

Quoted 7 lines
Quoted 4 lines

drivers/gpu/drm/i915/intel_display.c static void intel_crtc_disable_noatomic(struct drm_crtc *crtc) · line 6272

Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +0 -1
-	intel_crtc_disable_planes(crtc, crtc->state->plane_mask);

Can't we just make plane_mask reliable? We know whether the primary plane is enabled and all others were disabled prior to that. Or did I miss something.

In the case of hardware readout you can't. The plane_mask gets set only if we can preserve the initial framebuffer
else the primary plane gets disabled.

What I meant to say is that before a call to disable_noatomic but after we disabled all other planes, plane_mask could have the appropriate value. As in we could set plane_mask to 0 or drm_plane_index(primary) in readout_plane_state. It would have to be update in disable_noatomic() though, the same way as 'visible' is.

Anyway, I think the code is fine either way.

Ander

#4 lore raw

PATCH v2 1/1 drm/i915: Do a better job at disabling primary plane in the noatomic case.

Op 13-11-15 om 14:28 schreef Ander Conselvan De Oliveira:

Quoted 5 lines · Maarten Lankhorst
Quoted 4 lines

Op 12-11-15 om 14:37 schreef Ander Conselvan De Oliveira:

Quoted 3 lines · Maarten Lankhorst
Quoted 2 lines

When disable_noatomic is called plane_mask is not reliable yet, and plane_state->visible = true even after disabling the primary plane.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

So the stale value of plane_state->visible causes a subsequent modeset to enable
the primary again?

Probably not because it would get recalculated in calc_changes, but it should really be set to false afterwards.

So basically I didn't understand how the wrong value of plane_state->visible causes the bug that was mentioned. I think a brief explanation in the commit message would be good.

Well, apply with git am --scissors. Same patch but mentioning this.

Is this better?
---->8-----

When disable_noatomic is called plane_mask is not correct yet, and plane_state->visible = true is left as true after disabling the primary plane.

Other planes are already disabled as part of crtc sanitization, only the primary is left active. But the plane_mask is not updated here. It gets updated during fb takeover in modeset_gem_init, or set to the new value on resume.

This means that to disable the primary plane 1 << drm_plane_index(primary) needs to be used.

Afterwards because the crtc is no longer active it's forbidden to keep plane_state->visible set, or a WARN_ON in intel_plane_atomic_calc_changes triggers. There are other code points that rely on accurate plane_state->visible too, so make sure the bool is cleared.

The other planes are already disabled in intel_sanitize_crtc, so they don't have to be handled here.

Cc: [email protected] #v4.3, v4.2?
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92655

---
 drivers/gpu/drm/i915/intel_display.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +3 -1
index b5f7493213b7..bc3282ab5ed2 100644
@@ -6267,9 +6267,11 @@ static void intel_crtc_disable_noatomic(struct drm_crtc *crtc)
 		WARN_ON(intel_crtc->unpin_work);
 
 		intel_pre_disable_primary(crtc);
+
+		intel_crtc_disable_planes(crtc, 1 << drm_plane_index(crtc->primary));
+		to_intel_plane_state(crtc->primary->state)->visible = false;
 	}
 
-	intel_crtc_disable_planes(crtc, crtc->state->plane_mask);
 	dev_priv->display.crtc_disable(crtc);
 	intel_crtc->active = false;
 	intel_update_watermarks(crtc);

-- 2.1.0

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

maintainer
#5 lore raw
Quoted 9 lines · Maarten Lankhorst

Op 13-11-15 om 14:28 schreef Ander Conselvan De Oliveira:

Quoted 8 lines · Maarten Lankhorst
Quoted 7 lines

Op 12-11-15 om 14:37 schreef Ander Conselvan De Oliveira:

Quoted 6 lines · Maarten Lankhorst
Quoted 2 lines

When disable_noatomic is called plane_mask is not reliable yet, and plane_state->visible = true even after disabling the primary plane.

So the stale value of plane_state->visible causes a subsequent modeset to enable
the primary again?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Probably not because it would get recalculated in calc_changes, but it should really be set to false afterwards.

So basically I didn't understand how the wrong value of plane_state->visible causes the bug that was mentioned. I think a brief explanation in the commit message would be good.

Well, apply with git am --scissors. Same patch but mentioning this.

Is this better?

Ander, ping?

BR,
Jani.

Quoted 53 lines

---->8-----

When disable_noatomic is called plane_mask is not correct yet, and plane_state->visible = true is left as true after disabling the primary plane.

Other planes are already disabled as part of crtc sanitization, only the primary is left active. But the plane_mask is not updated here. It gets updated during fb takeover in modeset_gem_init, or set to the new value on resume.

This means that to disable the primary plane 1 << drm_plane_index(primary) needs to be used.

Afterwards because the crtc is no longer active it's forbidden to keep plane_state->visible set, or a WARN_ON in intel_plane_atomic_calc_changes triggers. There are other code points that rely on accurate plane_state->visible too, so make sure the bool is cleared.

The other planes are already disabled in intel_sanitize_crtc, so they don't have to be handled here.

Cc: [email protected] #v4.3, v4.2?
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92655

---
 drivers/gpu/drm/i915/intel_display.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +3 -2
index b5f7493213b7..bc3282ab5ed2 100644
@@ -6267,9 +6267,11 @@ static void intel_crtc_disable_noatomic(struct drm_crtc *crtc)
 		WARN_ON(intel_crtc->unpin_work);
 
 		intel_pre_disable_primary(crtc);
+
+		intel_crtc_disable_planes(crtc, 1 << drm_plane_index(crtc->primary));
+		to_intel_plane_state(crtc->primary->state)->visible = false;
 	}
 
-	intel_crtc_disable_planes(crtc, crtc->state->plane_mask);
 	dev_priv->display.crtc_disable(crtc);
 	intel_crtc->active = false;
 	intel_update_watermarks(crtc);
-- 2.1.0

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

Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#6 lore raw

Hello,

Is there any special reason this has not been merged yet?

Regards

Tomas

Quoted 87 lines · Jani Nikula
Quoted 6 lines · Maarten Lankhorst

Op 13-11-15 om 14:28 schreef Ander Conselvan De Oliveira:

Quoted 5 lines · Maarten Lankhorst
Quoted 4 lines

Op 12-11-15 om 14:37 schreef Ander Conselvan De Oliveira:

Quoted 3 lines · Maarten Lankhorst
Quoted 2 lines

When disable_noatomic is called plane_mask is not reliable yet, and plane_state->visible = true even after disabling the primary

plane.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

So the stale value of plane_state->visible causes a subsequent

modeset to

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

enable
the primary again?

Probably not because it would get recalculated in calc_changes, but it

should

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

really be set to false afterwards.

So basically I didn't understand how the wrong value of

plane_state->visible

Quoted 1 line
Quoted 1 line

causes the bug that was mentioned. I think a brief explanation in the

commit

Quoted 4 lines
Quoted 1 line

message would be good.

Well, apply with git am --scissors. Same patch but mentioning this.

Is this better?

Ander, ping?

BR,
Jani.

Quoted 8 lines

---->8-----

When disable_noatomic is called plane_mask is not correct yet, and plane_state->visible = true is left as true after disabling the primary plane.

Other planes are already disabled as part of crtc sanitization, only the primary is left active. But the plane_mask is not updated here. It gets

updated

Quoted 1 line

during fb takeover in modeset_gem_init, or set to the new value on

resume.

Quoted 2 lines

This means that to disable the primary plane 1 <<

drm_plane_index(primary)

Quoted 5 lines

needs to be used.

Afterwards because the crtc is no longer active it's forbidden to keep plane_state->visible set, or a WARN_ON in intel_plane_atomic_calc_changes triggers. There are other code points that rely on accurate

plane_state->visible

Quoted 8 lines

too, so make sure the bool is cleared.

The other planes are already disabled in intel_sanitize_crtc, so they don't have to be handled here.

Cc: [email protected] #v4.3, v4.2?
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92655

Review

Quoted 7 lines
---
 drivers/gpu/drm/i915/intel_display.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_display.c

drivers/gpu/drm/i915/intel_display.c static void intel_crtc_disable_noatomic(struct

Quoted 4 lines

index b5f7493213b7..bc3282ab5ed2 100644

drivers/gpu/drm/i915/intel_display.c +0 -0
@@ -6267,9 +6267,11 @@ static void intel_crtc_disable_noatomic(struct

drm_crtc *crtc)

drivers/gpu/drm/i915/intel_display.c static void intel_crtc_disable_noatomic(struct drm_crtc *crtc)

Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +2 -0
              WARN_ON(intel_crtc->unpin_work);
 
              intel_pre_disable_primary(crtc);
+
+             intel_crtc_disable_planes(crtc, 1 <<

drm_plane_index(crtc->primary));

drivers/gpu/drm/i915/intel_display.c static void intel_crtc_disable_noatomic(struct · line 6272

Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +1 -0
+             to_intel_plane_state(crtc->primary->state)->visible =

false;

Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +0 -2
      }
 
-     intel_crtc_disable_planes(crtc, crtc->state->plane_mask);
      dev_priv->display.crtc_disable(crtc);
      intel_crtc->active = false;
      intel_update_watermarks(crtc);
-- 2.1.0
Quoted 8 lines
Quoted 4 lines

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

--
Jani Nikula, Intel Open Source Technology Center

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

maintainer
#7 lore raw
Quoted 3 lines · Tomas M

Hello,

Is there any special reason this has not been merged yet?

No special reason. There's just the ordinary reason there is no review on the patch yet.

BR,
Jani.

Quoted 103 lines

Regards

Tomas

Quoted 95 lines · Jani Nikula
Quoted 6 lines · Maarten Lankhorst

Op 13-11-15 om 14:28 schreef Ander Conselvan De Oliveira:

Quoted 5 lines · Maarten Lankhorst
Quoted 4 lines

Op 12-11-15 om 14:37 schreef Ander Conselvan De Oliveira:

Quoted 3 lines · Maarten Lankhorst
Quoted 2 lines

When disable_noatomic is called plane_mask is not reliable yet, and plane_state->visible = true even after disabling the primary

plane.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

So the stale value of plane_state->visible causes a subsequent

modeset to

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

enable
the primary again?

Probably not because it would get recalculated in calc_changes, but it

should

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

really be set to false afterwards.

So basically I didn't understand how the wrong value of

plane_state->visible

Quoted 1 line
Quoted 1 line

causes the bug that was mentioned. I think a brief explanation in the

commit

Quoted 4 lines
Quoted 1 line

message would be good.

Well, apply with git am --scissors. Same patch but mentioning this.

Is this better?

Ander, ping?

BR,
Jani.

Quoted 8 lines

---->8-----

When disable_noatomic is called plane_mask is not correct yet, and plane_state->visible = true is left as true after disabling the primary plane.

Other planes are already disabled as part of crtc sanitization, only the primary is left active. But the plane_mask is not updated here. It gets

updated

Quoted 1 line

during fb takeover in modeset_gem_init, or set to the new value on

resume.

Quoted 2 lines

This means that to disable the primary plane 1 <<

drm_plane_index(primary)

Quoted 5 lines

needs to be used.

Afterwards because the crtc is no longer active it's forbidden to keep plane_state->visible set, or a WARN_ON in intel_plane_atomic_calc_changes triggers. There are other code points that rely on accurate

plane_state->visible

Quoted 8 lines

too, so make sure the bool is cleared.

The other planes are already disabled in intel_sanitize_crtc, so they don't have to be handled here.

Cc: [email protected] #v4.3, v4.2?
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92655

Review

Quoted 7 lines
---
 drivers/gpu/drm/i915/intel_display.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_display.c

drivers/gpu/drm/i915/intel_display.c static void intel_crtc_disable_noatomic(struct

Quoted 4 lines

index b5f7493213b7..bc3282ab5ed2 100644

drivers/gpu/drm/i915/intel_display.c +0 -0
@@ -6267,9 +6267,11 @@ static void intel_crtc_disable_noatomic(struct

drm_crtc *crtc)

drivers/gpu/drm/i915/intel_display.c static void intel_crtc_disable_noatomic(struct drm_crtc *crtc)

Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +2 -0
              WARN_ON(intel_crtc->unpin_work);
 
              intel_pre_disable_primary(crtc);
+
+             intel_crtc_disable_planes(crtc, 1 <<

drm_plane_index(crtc->primary));

drivers/gpu/drm/i915/intel_display.c static void intel_crtc_disable_noatomic(struct · line 6272

Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +1 -0
+             to_intel_plane_state(crtc->primary->state)->visible =

false;

Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +0 -2
      }
 
-     intel_crtc_disable_planes(crtc, crtc->state->plane_mask);
      dev_priv->display.crtc_disable(crtc);
      intel_crtc->active = false;
      intel_update_watermarks(crtc);
-- 2.1.0
Quoted 4 lines

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

--
Jani Nikula, Intel Open Source Technology Center

Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#8 lore raw
In reply to Maarten Lankhorst
Quoted 27 lines · Maarten Lankhorst

Op 13-11-15 om 14:28 schreef Ander Conselvan De Oliveira:

Quoted 5 lines · Maarten Lankhorst
Quoted 4 lines

Op 12-11-15 om 14:37 schreef Ander Conselvan De Oliveira:

Quoted 3 lines · Maarten Lankhorst
Quoted 2 lines

When disable_noatomic is called plane_mask is not reliable yet, and plane_state->visible = true even after disabling the primary plane.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

So the stale value of plane_state->visible causes a subsequent modeset to enable
the primary again?

Probably not because it would get recalculated in calc_changes, but it should really be set to false afterwards.

So basically I didn't understand how the wrong value of plane_state->visible causes the bug that was mentioned. I think a brief explanation in the commit message would be good.

Well, apply with git am --scissors. Same patch but mentioning this.

Is this better?
---->8-----

When disable_noatomic is called plane_mask is not correct yet, and plane_state->visible = true is left as true after disabling the primary plane.

Other planes are already disabled as part of crtc sanitization, only the primary is left active. But the plane_mask is not updated here. It gets updated during fb takeover in modeset_gem_init, or set to the new value on resume.

Quoted 7 lines

This means that to disable the primary plane 1 << drm_plane_index(primary) needs to be used.

Afterwards because the crtc is no longer active it's forbidden to keep plane_state->visible set, or a WARN_ON in intel_plane_atomic_calc_changes triggers. There are other code points that rely on accurate plane_state->visible too, so make sure the bool is cleared.

Oh dear is this a mess :(

As a bugfix this is Reviewed-by: Daniel Vetter <[email protected]>

But we need to bring a _lot_ more sanity to this in -next. Would probably be better if we keep the primary plane state all consistent, and then clear both visible and plane_mask when fb reconstruction fails.

Also, some WARN_ON to bitch about inconsistency between plane_mask and ->visible in the disable code paths would be good I think. -Daniel

Quoted 36 lines

The other planes are already disabled in intel_sanitize_crtc, so they don't have to be handled here.

Cc: [email protected] #v4.3, v4.2?
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92655

---
 drivers/gpu/drm/i915/intel_display.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +3 -2
index b5f7493213b7..bc3282ab5ed2 100644
@@ -6267,9 +6267,11 @@ static void intel_crtc_disable_noatomic(struct drm_crtc *crtc)
 		WARN_ON(intel_crtc->unpin_work);
 
 		intel_pre_disable_primary(crtc);
+
+		intel_crtc_disable_planes(crtc, 1 << drm_plane_index(crtc->primary));
+		to_intel_plane_state(crtc->primary->state)->visible = false;
 	}
 
-	intel_crtc_disable_planes(crtc, crtc->state->plane_mask);
 	dev_priv->display.crtc_disable(crtc);
 	intel_crtc->active = false;
 	intel_update_watermarks(crtc);
-- 2.1.0

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

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
maintainer Applied
#9 lore raw
Quoted 31 lines · Daniel Vetter
Quoted 30 lines · Maarten Lankhorst

Op 13-11-15 om 14:28 schreef Ander Conselvan De Oliveira:

Quoted 5 lines · Maarten Lankhorst
Quoted 4 lines

Op 12-11-15 om 14:37 schreef Ander Conselvan De Oliveira:

Quoted 3 lines · Maarten Lankhorst
Quoted 2 lines

When disable_noatomic is called plane_mask is not reliable yet, and plane_state->visible = true even after disabling the primary plane.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

So the stale value of plane_state->visible causes a subsequent modeset to enable
the primary again?

Probably not because it would get recalculated in calc_changes, but it should really be set to false afterwards.

So basically I didn't understand how the wrong value of plane_state->visible causes the bug that was mentioned. I think a brief explanation in the commit message would be good.

Well, apply with git am --scissors. Same patch but mentioning this.

Is this better?
---->8-----

When disable_noatomic is called plane_mask is not correct yet, and plane_state->visible = true is left as true after disabling the primary plane.

Other planes are already disabled as part of crtc sanitization, only the primary is left active. But the plane_mask is not updated here. It gets updated during fb takeover in modeset_gem_init, or set to the new value on resume.

This means that to disable the primary plane 1 << drm_plane_index(primary) needs to be used.

Quoted 8 lines
Quoted 4 lines

Afterwards because the crtc is no longer active it's forbidden to keep plane_state->visible set, or a WARN_ON in intel_plane_atomic_calc_changes triggers. There are other code points that rely on accurate plane_state->visible too, so make sure the bool is cleared.

Oh dear is this a mess :(

As a bugfix this is Reviewed-by: Daniel Vetter <[email protected]>

Pushed to drm-intel-fixes, thanks for the patch and review.

BR,
Jani.

Quoted 45 lines

But we need to bring a _lot_ more sanity to this in -next. Would probably be better if we keep the primary plane state all consistent, and then clear both visible and plane_mask when fb reconstruction fails.

Also, some WARN_ON to bitch about inconsistency between plane_mask and ->visible in the disable code paths would be good I think. -Daniel

Quoted 36 lines

The other planes are already disabled in intel_sanitize_crtc, so they don't have to be handled here.

Cc: [email protected] #v4.3, v4.2?
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92655

---
 drivers/gpu/drm/i915/intel_display.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +3 -2
index b5f7493213b7..bc3282ab5ed2 100644
@@ -6267,9 +6267,11 @@ static void intel_crtc_disable_noatomic(struct drm_crtc *crtc)
 		WARN_ON(intel_crtc->unpin_work);
 
 		intel_pre_disable_primary(crtc);
+
+		intel_crtc_disable_planes(crtc, 1 << drm_plane_index(crtc->primary));
+		to_intel_plane_state(crtc->primary->state)->visible = false;
 	}
 
-	intel_crtc_disable_planes(crtc, crtc->state->plane_mask);
 	dev_priv->display.crtc_disable(crtc);
 	intel_crtc->active = false;
 	intel_update_watermarks(crtc);
-- 2.1.0

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

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