Skip to contentSkip to conversation

drm/msm: Grab a vblank reference when waiting for commit_done

PATCH In review Sean Paul 2 participants 4 messages Oct 3, 2018 – Oct 9, 2018 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Sean Paul

author
#0 lore raw

PATCH 1/1 drm/msm: Grab a vblank reference when waiting for commit_done

From: Sean Paul <[email protected]>

Similar to the atomic helpers, we should enable vblank while we're waiting for the commit to finish. DPU needs this, MDP5 seems to work fine without it.

---
 drivers/gpu/drm/msm/msm_atomic.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/msm/msm_atomic.c +5 -0
index c1f1779c980f..2b7bb6e166d3 100644
@@ -32,7 +32,12 @@ static void msm_atomic_wait_for_commit_done(struct drm_device *dev,
 		if (!new_crtc_state->active)
 			continue;
 
+		if (drm_crtc_vblank_get(crtc))
+			continue;
+
 		kms->funcs->wait_for_crtc_commit_done(kms, crtc);
+
+		drm_crtc_vblank_put(crtc);
 	}
 }
 
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20181003202231.178601-1-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org

#2 lore raw
Quoted 8 lines · Sean Paul

From: Sean Paul <[email protected]>

Similar to the atomic helpers, we should enable vblank while we're waiting for the commit to finish. DPU needs this, MDP5 seems to work fine without it.

---

As such I dont see any issue with this patch but I have a question overall on chrome vblank handling. For a video mode panel, we will keep the HW resources enabled (including vsync related clocks) till device is suspended.

The vblank_get and vblank_put are only controlling the register/deregister of the vblank IRQ callback which send the events to the userspace and anything pending on vsync completion.

Does the chrome userspace turn ON/OFF the vblank using vblank_ctrl IOCTL Or does it guarantee it to be?

If so, is this patch just more of a safety check to make sure that vsync events remain ON till the frame is done?

Because HW wise it should be and this shouldnt be needed.

Quoted 10 lines
 drivers/gpu/drm/msm/msm_atomic.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/msm/msm_atomic.c +0 -0
index c1f1779c980f..2b7bb6e166d3 100644
@@ -32,7 +32,12 @@ static void msm_atomic_wait_for_commit_done(struct
 drm_device *dev,
 		if (!new_crtc_state->active)

drivers/gpu/drm/msm/msm_atomic.c static void msm_atomic_wait_for_commit_done(struct · line 43

Quoted 10 lines
drivers/gpu/drm/msm/msm_atomic.c +5 -0
 			continue;
 
+		if (drm_crtc_vblank_get(crtc))
+			continue;
+
 		kms->funcs->wait_for_crtc_commit_done(kms, crtc);
+
+		drm_crtc_vblank_put(crtc);
 	}
 }

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): b1d9ce5c2d638519916f57088dec68a0-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org

author
#4 lore raw
Quoted 15 lines · Abhinav Kumar
Quoted 8 lines · Sean Paul

From: Sean Paul <[email protected]>

Similar to the atomic helpers, we should enable vblank while we're waiting for the commit to finish. DPU needs this, MDP5 seems to work fine without it.

---

As such I dont see any issue with this patch but I have a question overall on chrome vblank handling.
For a video mode panel, we will keep the HW resources enabled (including vsync related clocks) till device
is suspended.

Quoted 7 lines

The vblank_get and vblank_put are only controlling the register/deregister of the vblank IRQ callback which
send the events to the userspace and anything pending on vsync completion.

Does the chrome userspace turn ON/OFF the vblank using vblank_ctrl IOCTL Or does it guarantee it to be?

No not explicitly. The issue I was seeing is that when userspace (this issue is not specific to chrome) does a commit we get a frame_done timeout. So while the hardware might still be active, the worker to signal frame_done is not unless the vblank_ref is > 0.

Quoted 4 lines

If so, is this patch just more of a safety check to make sure that vsync events remain ON till the frame is done?

Because HW wise it should be and this shouldnt be needed.

It is definitely needed, unless you want 60ms (the frame_done timeout) between frames :-)

Sean

Quoted 22 lines
Quoted 22 lines
 drivers/gpu/drm/msm/msm_atomic.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/msm/msm_atomic.c +5 -0
index c1f1779c980f..2b7bb6e166d3 100644
@@ -32,7 +32,12 @@ static void msm_atomic_wait_for_commit_done(struct
 drm_device *dev,
 		if (!new_crtc_state->active)
 			continue;
 
+		if (drm_crtc_vblank_get(crtc))
+			continue;
+
 		kms->funcs->wait_for_crtc_commit_done(kms, crtc);
+
+		drm_crtc_vblank_put(crtc);
 	}
 }
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
Reviewed-by
#5 lore raw
Quoted 32 lines · Sean Paul
Quoted 15 lines · Abhinav Kumar
Quoted 8 lines · Sean Paul

From: Sean Paul <[email protected]>

Similar to the atomic helpers, we should enable vblank while we're waiting for the commit to finish. DPU needs this, MDP5 seems to work fine without it.

---

As such I dont see any issue with this patch but I have a question overall on chrome vblank handling.
For a video mode panel, we will keep the HW resources enabled (including vsync related clocks) till device
is suspended.

Quoted 7 lines

The vblank_get and vblank_put are only controlling the register/deregister of the vblank IRQ callback which
send the events to the userspace and anything pending on vsync completion.

Does the chrome userspace turn ON/OFF the vblank using vblank_ctrl IOCTL Or does it guarantee it to be?

No not explicitly. The issue I was seeing is that when userspace (this issue is not specific to chrome) does a commit we get a frame_done timeout. So while the hardware might still be active, the worker to signal frame_done is not unless the vblank_ref is > 0.

Quoted 3 lines

If so, is this patch just more of a safety check to make sure that vsync events remain ON till the frame is done?

Quoted 7 lines
Quoted 1 line

Because HW wise it should be and this shouldnt be needed.

It is definitely needed, unless you want 60ms (the frame_done timeout) between frames :-)

Sean

Alright, in that case

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
 drivers/gpu/drm/msm/msm_atomic.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/msm/msm_atomic.c +0 -0
index c1f1779c980f..2b7bb6e166d3 100644
@@ -32,7 +32,12 @@ static void msm_atomic_wait_for_commit_done(struct
 drm_device *dev,
 		if (!new_crtc_state->active)
 			continue;
 
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/msm/msm_atomic.c static void msm_atomic_wait_for_commit_done(struct drm_device *dev, · line 42

Quoted 8 lines
drivers/gpu/drm/msm/msm_atomic.c +5 -0
+		if (drm_crtc_vblank_get(crtc))
+			continue;
+
 		kms->funcs->wait_for_crtc_commit_done(kms, crtc);
+
+		drm_crtc_vblank_put(crtc);
 	}
 }

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno