Skip to contentSkip to conversation

drm/vkms: fix warning in vkms_get_vblank_timestamp

PATCH Superseded Sidong Yang 2 participants 3 messages Aug 25, 2020 – Aug 27, 2020

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/vkms: fix warning in vkms_get_vblank_timestamp

From: Sidong Yang <[email protected]>, Haneen Mohammed <[email protected]>

When vkms_get_vblank_timestamp() is called very first time without enabling vblank before, vblank time has just intial value and it makes warning message. this patch prevents warning message by setting vblank time to current time.

Cc Daniel Vetter <[email protected]>
Cc Rodrigo Siqueira <[email protected]>
Cc Haneen Mohammed <[email protected]>
Cc Melissa Wen <[email protected]>
---
 drivers/gpu/drm/vkms/vkms_crtc.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/vkms/vkms_crtc.c +5 -0
index ac85e17428f8..09c012d54d58 100644
@@ -86,6 +86,11 @@ static bool vkms_get_vblank_timestamp(struct drm_crtc *crtc,
 	struct vkms_output *output = &vkmsdev->output;
 	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
 
+	if (!READ_ONCE(vblank->enabled)) {
+		*vblank_time = ktime_get();
+		return true;
+	}
+
 	*vblank_time = READ_ONCE(output->vblank_hrtimer.node.expires);
 
 	if (WARN_ON(*vblank_time == vblank->time))
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
reviewer Reviewed-by on v1 1/1
#1 lore raw

Hi Sidong,

Thanks for this patch.

The code looks good to me; however, I see some issues in the patch format and commit message. Please, see inline comments.

Quoted 1 line · Sidong Yang

From: Sidong Yang <[email protected]>, Haneen Mohammed <[email protected]>

You need to fix the Author name.

Quoted 5 lines

When vkms_get_vblank_timestamp() is called very first time without enabling vblank before, vblank time has just intial value and it makes warning message. this patch prevents warning message by setting vblank time to current time.

I consider *fix* a somewhat strong term to this change. In my opinion, it would be better to choose another term in the commit message like *avoid* timestamp warning when vblanks aren't enabled.

In the body of the commit message, I think interesting to include the exactly warning message that this patch addresses. You could also describe the initial values that triggers this warning and why this approach is reasonable, as VKMS has fake clocks.

Quoted 16 lines
Cc Daniel Vetter <[email protected]>
Cc Rodrigo Siqueira <[email protected]>
Cc Haneen Mohammed <[email protected]>
Cc Melissa Wen <[email protected]>
---
 drivers/gpu/drm/vkms/vkms_crtc.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/vkms/vkms_crtc.c +0 -0
index ac85e17428f8..09c012d54d58 100644

drivers/gpu/drm/vkms/vkms_crtc.c static bool vkms_get_vblank_timestamp(struct drm_crtc *crtc, · line 93

Quoted 8 lines
drivers/gpu/drm/vkms/vkms_crtc.c +5 -0
@@ -86,6 +86,11 @@ static bool vkms_get_vblank_timestamp(struct drm_crtc *crtc,
 	struct vkms_output *output = &vkmsdev->output;
 	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
 
+	if (!READ_ONCE(vblank->enabled)) {
+		*vblank_time = ktime_get();
+		return true;
+	}
+

Apart from issues in commit message and format, I checked the code and it works fine.

Quoted 6 lines
drivers/gpu/drm/vkms/vkms_crtc.c +0 -0
 	*vblank_time = READ_ONCE(output->vblank_hrtimer.node.expires);
 
 	if (WARN_ON(*vblank_time == vblank->time))
Signature · 1 line
2.17.1
#2 lore raw

On Wed, Aug 26, 2020 at 05:49:54PM -0300, Melissa Wen wrote:

Hi Melissa!
Thanks for review.

Quoted 11 lines

Hi Sidong,

Thanks for this patch.

The code looks good to me; however, I see some issues in the patch format and commit message. Please, see inline comments.

Quoted 1 line · Sidong Yang

From: Sidong Yang <[email protected]>, Haneen Mohammed <[email protected]>

You need to fix the Author name.

Oops.

Quoted 9 lines
Quoted 5 lines

When vkms_get_vblank_timestamp() is called very first time without enabling vblank before, vblank time has just intial value and it makes warning message. this patch prevents warning message by setting vblank time to current time.

I consider *fix* a somewhat strong term to this change. In my opinion, it would be better to choose another term in the commit message like *avoid* timestamp warning when vblanks aren't enabled.

It's good to me. Next patch need to be more explicit.

Quoted 5 lines

In the body of the commit message, I think interesting to include the exactly warning message that this patch addresses. You could also describe the initial values that triggers this warning and why this approach is reasonable, as VKMS has fake clocks.

Yeah, It will be more comprehensive patch if there is description in detail. I'll work for next patch!

Thanks.
-Sidong

Quoted 29 lines
Quoted 17 lines
Cc Daniel Vetter <[email protected]>
Cc Rodrigo Siqueira <[email protected]>
Cc Haneen Mohammed <[email protected]>
Cc Melissa Wen <[email protected]>
---
 drivers/gpu/drm/vkms/vkms_crtc.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/vkms/vkms_crtc.c +0 -0
index ac85e17428f8..09c012d54d58 100644

drivers/gpu/drm/vkms/vkms_crtc.c static bool vkms_get_vblank_timestamp(struct drm_crtc *crtc, · line 93

Quoted 8 lines
drivers/gpu/drm/vkms/vkms_crtc.c +5 -0
@@ -86,6 +86,11 @@ static bool vkms_get_vblank_timestamp(struct drm_crtc *crtc,
 	struct vkms_output *output = &vkmsdev->output;
 	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
 
+	if (!READ_ONCE(vblank->enabled)) {
+		*vblank_time = ktime_get();
+		return true;
+	}
+

Apart from issues in commit message and format, I checked the code and it works fine.

Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/vkms/vkms_crtc.c +0 -0
 	*vblank_time = READ_ONCE(output->vblank_hrtimer.node.expires);
 
 	if (WARN_ON(*vblank_time == vblank->time))
Signature · 1 line
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel