drm/amdgpu: For virtual_display feature, define a variable for vblank count of cpu vsync timer.
Subsystems (2)
PATCH 1/1 drm/amdgpu: For virtual_display feature, define a variable for vblank count of cpu vsync timer.
The adev->ddev->vblank[crtc].count couldn't be used here, so define another variable to compute the vblank count.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 + drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +1 -0
@@ -370,6 +370,7 @@ struct amdgpu_mode_info {int disp_priority;const struct amdgpu_display_funcs *funcs;struct hrtimer vblank_timer; +u32 timer_vblank_count;enum amdgpu_interrupt_state vsync_timer_enabled; };
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +4 -6
@@ -58,7 +58,7 @@ static u32 dce_virtual_vblank_get_counter(struct amdgpu_device *adev, int crtc)if (crtc >= adev->mode_info.num_crtc)return 0 ;else -return adev->ddev->vblank[crtc].count; +return adev->mode_info.timer_vblank_count; } static void dce_virtual_page_flip(struct amdgpu_device *adev,
@@ -353,7 +353,6 @@ static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)static int dce_virtual_early_init (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; - adev->mode_info.vsync_timer_enabled =AMDGPU_IRQ_STATE_DISABLE ;dce_virtual_set_display_funcs (adev);dce_virtual_set_irq_funcs (adev);
@@ -361,6 +360,7 @@ static int dce_virtual_early_init(void *handle) adev->mode_info.num_crtc =1 ; adev->mode_info.num_hpd =1 ; adev->mode_info.num_dig =1 ; + adev->mode_info.timer_vblank_count =0 ;return 0 ; }
@@ -653,7 +653,7 @@ static enum hrtimer_restart dce_virtual_vblank_timer_handle(struct hrtimer *vbla struct amdgpu_mode_info *mode_info = container_of(vblank_timer, struct amdgpu_mode_info ,vblank_timer); struct amdgpu_device *adev = container_of(mode_info, struct amdgpu_device ,mode_info);unsigned crtc =0 ; - adev->ddev->vblank[0 ].count++; + adev->mode_info.timer_vblank_count++;drm_handle_vblank (adev->ddev, crtc);dce_virtual_pageflip_irq (adev,NULL ,NULL );hrtimer_start (vblank_timer,ktime_set (0 ,DCE_VIRTUAL_VBLANK_PERIOD ),HRTIMER_MODE_REL );
@@ -680,8 +680,6 @@ static void dce_virtual_set_crtc_vblank_interrupt_state(struct amdgpu_device *adhrtimer_cancel (&adev->mode_info.vblank_timer); } -if (!state || (state && !adev->mode_info.vsync_timer_enabled)) - adev->ddev->vblank[0 ].count =0 ; adev->mode_info.vsync_timer_enabled = state;DRM_DEBUG ("[FM]set crtc %d vblank interrupt state %d\n" , crtc, state); }
@@ -718,7 +716,7 @@ static int dce_virtual_crtc_irq(struct amdgpu_device *adev,unsigned crtc =0 ;unsigned irq_type =AMDGPU_CRTC_IRQ_VBLANK1 ; - adev->ddev->vblank[crtc].count++; + adev->mode_info.timer_vblank_count++;dce_virtual_crtc_vblank_int_ack (adev, crtc);if (amdgpu_irq_enabled (adev, source, irq_type)) {
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1470887198-3465-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org
ping...
Anybody could help to review it?
Quoted 96 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Emily Deng
Sent: Thursday, August 11, 2016 11:47 AM
To: [email protected]
Cc: Deng, Emily <[email protected]>
Subject: [PATCH] drm/amdgpu: Forvirtual_displayfeature, define a variable for vblank count of cpu vsync timer.The adev->ddev->vblank[crtc].count couldn't be used here, so define another variable to compute the vblank count.
Signed-off-by Emily Deng <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 + drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +1
-0@@ -370,6 +370,7 @@ struct amdgpu_mode_info {int disp_priority;const struct amdgpu_display_funcs *funcs;struct hrtimer vblank_timer; +u32 timer_vblank_count;enum amdgpu_interrupt_state vsync_timer_enabled; };drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1
-1@@ -58,7 +58,7 @@ static u32 dce_virtual_vblank_get_counter(struct amdgpu_device *adev, int crtc) if (crtc >= adev->mode_info.num_crtc) return 0; else - return adev->ddev->vblank[crtc].count; + return adev->mode_info.timer_vblank_count; }static void dce_virtual_page_flip(struct
amdgpu_device*adev, @@ -353,7
+353,6 @@ static intdce_virtual_crtc_init(struct amdgpu_device *adev, int index)static intdce_virtual_early_init(void *handle){drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0
-1struct amdgpu_device *adev = (struct amdgpu_device *)handle; - adev->mode_info.vsync_timer_enabled =
AMDGPU_IRQ_STATE_DISABLE;drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1
-0dce_virtual_set_display_funcs (adev);dce_virtual_set_irq_funcs (adev);@@ -361,6 +360,7 @@ static int dce_virtual_early_init(void *handle) adev->mode_info.num_crtc =1 ; adev->mode_info.num_hpd =1 ; adev->mode_info.num_dig =1 ; + adev->mode_info.timer_vblank_count =0 ;return 0 ; }@@ -653,7 +653,7 @@ static enum hrtimer_restartdce_virtual_vblank_timer_handle(struct hrtimer *vbla
structamdgpu_mode_info*mode_info= container_of(vblank_timer,
structamdgpu_mode_info,vblank_timer);
structamdgpu_device*adev = container_of(mode_info, structamdgpu_device,mode_info);drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1
-1unsigned crtc =0 ; - adev->ddev->vblank[0 ].count++; + adev->mode_info.timer_vblank_count++;drm_handle_vblank (adev->ddev, crtc);dce_virtual_pageflip_irq (adev,NULL ,NULL ); hrtimer_start(vblank_timer, ktime_set(0,
DCE_VIRTUAL_VBLANK_PERIOD),HRTIMER_MODE_REL); @@ -680,8 +680,6 @@ static void dce_virtual_set_crtc_vblank_interrupt_state(structamdgpu_device*addrivers/gpu/drm/amd/amdgpu/dce_virtual.c +0
-2hrtimer_cancel (&adev->mode_info.vblank_timer); } -if (!state || (state && !adev->mode_info.vsync_timer_enabled)) - adev->ddev->vblank[0 ].count =0 ; adev->mode_info.vsync_timer_enabled = state; DRM_DEBUG("[FM]set crtc %d vblank interrupt state %d\n", crtc,state); } @@ -718,7 +716,7 @@ static int dce_virtual_crtc_irq(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1
-2unsigned crtc =0 ;unsigned irq_type =AMDGPU_CRTC_IRQ_VBLANK1 ; - adev->ddev->vblank[crtc].count++; + adev->mode_info.timer_vblank_count++;dce_virtual_crtc_vblank_int_ack (adev, crtc);if (amdgpu_irq_enabled (adev, source, irq_type)) { --1.9.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): DM5PR12MB1659D06D606338121D353F128F1F0-2J9CzHegvk/[email protected]
Ping ... again.
Quoted 110 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Deng, Emily
Sent: Friday, August 12, 2016 10:00 AM
To: [email protected]
Subject: RE: [PATCH] drm/amdgpu: Forvirtual_displayfeature, define a variable for vblank count of cpu vsync timer.ping...
Anybody could help to review it?Quoted 49 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Emily Deng
Sent: Thursday, August 11, 2016 11:47 AM
To: [email protected]
Cc: Deng, Emily <[email protected]>
Subject: [PATCH] drm/amdgpu: Forvirtual_displayfeature, define a variable for vblank count of cpu vsync timer.The adev->ddev->vblank[crtc].count couldn't be used here, so define another variable to compute the vblank count.
Signed-off-by Emily Deng <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 + drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +1
-0@@ -370,6 +370,7 @@ struct amdgpu_mode_info {int disp_priority;const struct amdgpu_display_funcs *funcs;struct hrtimer vblank_timer; +u32 timer_vblank_count;enum amdgpu_interrupt_state vsync_timer_enabled; };drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1
-1@@ -58,7 +58,7 @@ static u32 dce_virtual_vblank_get_counter(struct amdgpu_device *adev, int crtc) if (crtc >= adev->mode_info.num_crtc) return 0; else - return adev->ddev->vblank[crtc].count; + return adev->mode_info.timer_vblank_count; }static void dce_virtual_page_flip(struct
amdgpu_device*adev, @@
-353,7
+353,6 @@ static int dce_virtual_crtc_init(structamdgpu_device*adev, +int
index) static intdce_virtual_early_init(void *handle){drivers/gpu/drm/amd/amdgpu/dce_virtual.c static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0
-1struct amdgpu_device *adev = (struct amdgpu_device *)handle; - adev->mode_info.vsync_timer_enabled =
AMDGPU_IRQ_STATE_DISABLE;Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1
-0dce_virtual_set_display_funcs (adev);dce_virtual_set_irq_funcs (adev);@@ -361,6 +360,7 @@ static int dce_virtual_early_init(void *handle) adev->mode_info.num_crtc =1 ; adev->mode_info.num_hpd =1 ; adev->mode_info.num_dig =1 ; + adev->mode_info.timer_vblank_count =0 ;return 0 ; }@@ -653,7 +653,7 @@ static enum hrtimer_restartdce_virtual_vblank_timer_handle(struct hrtimer *vbla
structamdgpu_mode_info*mode_info= container_of(vblank_timer,
structamdgpu_mode_info,vblank_timer);
structamdgpu_device*adev = container_of(mode_info, structamdgpu_device,mode_info);drivers/gpu/drm/amd/amdgpu/dce_virtual.c static enum hrtimer_restart dce_virtual_vblank_timer_handle(struct hrtimer *vbla
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1
-1unsigned crtc =0 ; - adev->ddev->vblank[0 ].count++; + adev->mode_info.timer_vblank_count++;drm_handle_vblank (adev->ddev, crtc);dce_virtual_pageflip_irq (adev,NULL ,NULL ); hrtimer_start(vblank_timer, ktime_set(0,
DCE_VIRTUAL_VBLANK_PERIOD),Quoted 23 lines
HRTIMER_MODE_REL); @@ -680,8 +680,6 @@ static void dce_virtual_set_crtc_vblank_interrupt_state(structamdgpu_device*addrivers/gpu/drm/amd/amdgpu/dce_virtual.c +0
-2hrtimer_cancel (&adev->mode_info.vblank_timer); } -if (!state || (state && !adev->mode_info.vsync_timer_enabled)) - adev->ddev->vblank[0 ].count =0 ; adev->mode_info.vsync_timer_enabled = state; DRM_DEBUG("[FM]set crtc %d vblank interrupt state %d\n", crtc,state); } @@ -718,7 +716,7 @@ static int dce_virtual_crtc_irq(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1
-2unsigned crtc =0 ;unsigned irq_type =AMDGPU_CRTC_IRQ_VBLANK1 ; - adev->ddev->vblank[crtc].count++; + adev->mode_info.timer_vblank_count++;dce_virtual_crtc_vblank_int_ack (adev, crtc);if (amdgpu_irq_enabled (adev, source, irq_type)) { --1.9.1
Quoted 8 lines
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[ Adding the dri-devel list ]
Quoted 4 lines · Emily Deng
The adev->ddev->vblank[crtc].count couldn't be used here, so define another variable to compute the vblank count.
Signed-off-by Emily Deng <[email protected]>
[...]
drivers/gpu/drm/amd/amdgpu/dce_virtual.c static u32 dce_virtual_vblank_get_counter(struct amdgpu_device *adev, int crtc) · line 62
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1
-1@@ -58,7 +58,7 @@ static u32 dce_virtual_vblank_get_counter(struct amdgpu_device *adev, int crtc)if (crtc >= adev->mode_info.num_crtc)return 0 ;else -return adev->ddev->vblank[crtc].count; +return adev->mode_info.timer_vblank_count; }
AFAIK the vblank_get_counter hook is supposed to always return 0 when there's no hardware frame counter which can be used. That's what drm_vblank_no_hw_counter was created for.
You mentioned internally that you ran into trouble when trying this though. Please provide more information about that, e.g.: Which base kernel version did you test it with? What values did the DRM_IOCTL_WAIT_VBLANK ioctl return to userspace? ...
drivers/gpu/drm/amd/amdgpu/dce_virtual.c static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index) · line 358
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0
-1@@ -353,7 +353,6 @@ static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)static int dce_virtual_early_init (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; - adev->mode_info.vsync_timer_enabled =AMDGPU_IRQ_STATE_DISABLE ;dce_virtual_set_display_funcs (adev);dce_virtual_set_irq_funcs (adev);
BTW, this hunk would break the kernel coding style.
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1
-1@@ -653,7 +653,7 @@ static enum hrtimer_restart dce_virtual_vblank_timer_handle(struct hrtimer *vbla struct amdgpu_mode_info *mode_info = container_of(vblank_timer, struct amdgpu_mode_info ,vblank_timer); struct amdgpu_device *adev = container_of(mode_info, struct amdgpu_device ,mode_info);unsigned crtc =0 ; - adev->ddev->vblank[0 ].count++; + adev->mode_info.timer_vblank_count++;drm_handle_vblank (adev->ddev, crtc);dce_virtual_pageflip_irq (adev,NULL ,NULL );hrtimer_start (vblank_timer,ktime_set (0 ,DCE_VIRTUAL_VBLANK_PERIOD ),HRTIMER_MODE_REL );
[...]
drivers/gpu/drm/amd/amdgpu/dce_virtual.c static int dce_virtual_crtc_irq(struct amdgpu_device *adev, · line 722
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1
-1@@ -718,7 +716,7 @@ static int dce_virtual_crtc_irq(struct amdgpu_device *adev,unsigned crtc =0 ;unsigned irq_type =AMDGPU_CRTC_IRQ_VBLANK1 ; - adev->ddev->vblank[crtc].count++; + adev->mode_info.timer_vblank_count++;dce_virtual_crtc_vblank_int_ack (adev, crtc);if (amdgpu_irq_enabled (adev, source, irq_type)) {
Wouldn't this result in adev->mode_info.timer_vblank_count getting incremented twice every time the virtual interrupt timer fires?
Anyway, this approach means that the virtual interrupt timer can never be disabled, even while userspace isn't using the vblank functionality, which is undesirable.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 6b517057-1e45-d040-a51b-a1b21cbfee99-otUistvHUpPR7s880joybQ@public.gmane.org
Quoted 28 lines
-----Original Message-----
From: Michel Dänzer [mailto:[email protected]]
Sent: Monday, August 15, 2016 9:46 AM
To: Deng, Emily <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Forvirtual_displayfeature, define a variable for vblank count of cpu vsync timer.[ Adding the dri-devel list ]
Quoted 4 lines · Emily Deng
The adev->ddev->vblank[crtc].count couldn't be used here, so define another variable to compute the vblank count.
Signed-off-by Emily Deng <[email protected]>[...]
drivers/gpu/drm/amd/amdgpu/dce_virtual.c static u32 dce_virtual_vblank_get_counter(struct
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0
-0@@ -58,7 +58,7 @@ static u32 dce_virtual_vblank_get_counter(struct
amdgpu_device*adev, int crtc)
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c static u32 dce_virtual_vblank_get_counter(struct amdgpu_device *adev, int crtc) · line 62
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1
-1if (crtc >= adev->mode_info.num_crtc)return 0 ;else -return adev->ddev->vblank[crtc].count; +return adev->mode_info.timer_vblank_count; }AFAIK the
vblank_get_counterhook is supposed to always return 0 when there's no hardware frame counter which can be used. That's whatdrm_vblank_no_hw_counterwas created for.
[[EmilyD]] Sorry, I don't know much about drm_vblank_no_hw_counter, can it support vsync when return to 0?
Quoted 6 lines
You mentioned internally that you ran into trouble when trying this though. Please provide more information about that, e.g.: Which base kernel version did you test it with? What values did the
DRM_IOCTL_WAIT_VBLANKioctl return to userspace? ...
[[EmilyD]] I run the driver on kernel version 4.6, and run glxgears with vsync enabled. It is hard to detail the issue, I will try my best to description the issue I found.
After I double checked, it is not segment fault in libGL.so when run glxgears with vsync, but the glxgears will be stucked in waiting for the before swap buffers to complete. This is because when enable vsync, every time swap buffers, the DDX driver will call DRM_IOCTL_WAIT_VBLANK to queue the vblank event, and the vbl.request.sequence will be set to current_vblank_count + swap_interval. Then in kernel driver, when timer interrupt occurs, it will call drm_handle_vblank_events, it will call drm_vblank_count_and_time to get current seq, and only seq >= vbl.request.sequence, then will call send_vblank_event. So it will never call send_vblank_event.
For example, the DDX driver call DRM_IOCTL_WAIT_VBLANK , then kernel driver will call drm_queue_vblank_event, and current vblank_count is 1 (As we only return 0 in vblank_get_counter, so the vblank_count will never change except calling drm_reset_vblank_timestamp which will make adev->ddev->vblank[crtc].count++), and swap_interval is 1, then vbl.request.sequence will be 2, but the drm_vblank_count_and_time will always
return 1 except calling drm_reset_vblank_timestamp(The function drm_reset_vblank_timestamp will only be called in drm_vblank_post_modeset and drm_vblank_on ), so the send_vblank_event will never be called, and swap buffers won't complete, so the glxgears will be stucked.
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index)
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0
-0@@ -353,7 +353,6 @@ static int dce_virtual_crtc_init(struct
amdgpu_device*adev, int index) static intdce_virtual_early_init(void *handle){drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0
-1struct amdgpu_device *adev = (struct amdgpu_device *)handle; - adev->mode_info.vsync_timer_enabled =
AMDGPU_IRQ_STATE_DISABLE;
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index) · line 358
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0
-0dce_virtual_set_display_funcs (adev);dce_virtual_set_irq_funcs (adev);BTW, this hunk would break the kernel coding style.
[[EmilyD]] Thanks, I will modify this.
Quoted 27 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c static enum hrtimer_restart
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0
-0@@ -653,7 +653,7 @@ static enum hrtimer_restartdce_virtual_vblank_timer_handle(struct hrtimer *vbla
drivers/gpu/drm/amd/amdgpu/dce_virtual.c static enum hrtimer_restart · line 653
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0
-0struct amdgpu_mode_info *mode_info = container_of(vblank_timer,struct
amdgpu_mode_info,vblank_timer);drivers/gpu/drm/amd/amdgpu/dce_virtual.c static enum hrtimer_restart · line 654
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0
-0struct amdgpu_device *adev = container_of(mode_info, struct
amdgpu_device,mode_info);drivers/gpu/drm/amd/amdgpu/dce_virtual.c static enum hrtimer_restart dce_virtual_vblank_timer_handle(struct hrtimer *vbla
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1
-1unsigned crtc =0 ; - adev->ddev->vblank[0 ].count++; + adev->mode_info.timer_vblank_count++;drm_handle_vblank (adev->ddev, crtc);dce_virtual_pageflip_irq (adev,NULL ,NULL ); hrtimer_start(vblank_timer, ktime_set(0,
DCE_VIRTUAL_VBLANK_PERIOD),Quoted 1 line
HRTIMER_MODE_REL);[...]
drivers/gpu/drm/amd/amdgpu/dce_virtual.c static int dce_virtual_crtc_irq(struct amdgpu_device
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0
-0@@ -718,7 +716,7 @@ static int dce_virtual_crtc_irq(struct amdgpu_device*adev,
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1
-1unsigned crtc =0 ;unsigned irq_type =AMDGPU_CRTC_IRQ_VBLANK1 ; - adev->ddev->vblank[crtc].count++; + adev->mode_info.timer_vblank_count++;dce_virtual_crtc_vblank_int_ack (adev, crtc);
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c static int dce_virtual_crtc_irq(struct amdgpu_device *adev, · line 722
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0
-0if (amdgpu_irq_enabled (adev, source, irq_type)) {Wouldn't this result in
adev->mode_info.timer_vblank_countgetting incremented twice every time the virtual interrupt timer fires?
[[EmilyD]] Sorry, I don't think so, the dce_virtual_crtc_irq will only be called when hardware vsync timer interrupt occurs.
Quoted 4 lines
Anyway, this approach means that the virtual interrupt timer can never be disabled, even while userspace isn't using the vblank functionality, which is undesirable.
[[EmilyD]] No, it could be disabled by calling dce_virtual_set_crtc_vblank_interrupt_state.
Quoted 4 lines
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): DM5PR12MB165919E6217B9C49998009F08F120-2J9CzHegvk/[email protected]
Quoted 28 lines · Emily
Quoted 17 lines
From: Michel Dänzer [mailto:[email protected]]
Sent: Monday, August 15, 2016 9:46 AMQuoted 4 lines · Emily Deng
The adev->ddev->vblank[crtc].count couldn't be used here, so define another variable to compute the vblank count.
Signed-off-by Emily Deng <[email protected]>[...]
drivers/gpu/drm/amd/amdgpu/dce_virtual.c static u32 dce_virtual_vblank_get_counter(struct
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0
-0@@ -58,7 +58,7 @@ static u32 dce_virtual_vblank_get_counter(struct
amdgpu_device*adev, int crtc)Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c static u32 dce_virtual_vblank_get_counter(struct amdgpu_device *adev, int crtc) · line 62
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1
-1if (crtc >= adev->mode_info.num_crtc)return 0 ;else -return adev->ddev->vblank[crtc].count; +return adev->mode_info.timer_vblank_count; }AFAIK the
vblank_get_counterhook is supposed to always return 0 when there's no hardware frame counter which can be used. That's whatdrm_vblank_no_hw_counterwas created for.
Quoted 2 lines
[[EmilyD]] Sorry, I don't know much about
drm_vblank_no_hw_counter, can it support vsync when return to 0?
That's its purpose. BTW, I realized in the meantime that we can't use drm_vblank_no_hw_counter directly, because there's a single struct drm_driver used by all amdgpu driver instances.
Quoted 5 lines
Quoted 5 lines
You mentioned internally that you ran into trouble when trying this though. Please provide more information about that, e.g.: Which base kernel version did you test it with? What values did the
DRM_IOCTL_WAIT_VBLANKioctl return to userspace? ...
Quoted 12 lines
[[EmilyD]] I run the driver on kernel version 4.6, and run glxgears with vsync enabled. It is hard to detail the issue, I will try my best to description the issue I found.
After I double checked, it is not segment fault in libGL.so when run glxgears with vsync, but the glxgears will be stucked in waiting for the before swap buffers to complete. This is because when enable vsync, every time swap buffers, the DDX driver will callDRM_IOCTL_WAIT_VBLANKto queue the vblank event, and the vbl.request.sequence will be set tocurrent_vblank_count+swap_interval. Then in kernel driver, when timer interrupt occurs, it will calldrm_handle_vblank_events, it will calldrm_vblank_count_and_timeto get current seq, and only seq >= vbl.request.sequence, then will callsend_vblank_event. So it will never callsend_vblank_event.
For example, the DDX driver callDRM_IOCTL_WAIT_VBLANK, then kernel driver will calldrm_queue_vblank_event, and currentvblank_countis 1 (As we only return 0 invblank_get_counter, so thevblank_countwill never change except callingdrm_reset_vblank_timestampwhich will make adev->ddev->vblank[crtc].count++), andswap_intervalis 1, then vbl.request.sequence will be 2, but thedrm_vblank_count_and_timewill always
return 1 except calling drm_reset_vblank_timestamp(The functiondrm_reset_vblank_timestampwill only be called indrm_vblank_post_modesetanddrm_vblank_on), so thesend_vblank_eventwill never be called, and swap buffers won't complete, so the glxgears will be stucked.
Looking at the drm_update_vblank_count() code, you also need to do the following in the virtual DCE case:
* Set dev->max_vblank_count = 0
* Make amdgpu_get_vblank_timestamp_kms either return values based on when the virtual vblank interrupt timer last fired, or just return a negative error code immediately, instead of calling drm_calc_vbltimestamp_from_scanoutpos
* Make amdgpu_get_vblank_counter_kms take the else path (or just return 0 immediately), not run any of the scanout position related code
Signature · 7 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 6c149642-3e82-834a-9e8f-8a1affcc1ee7-otUistvHUpPR7s880joybQ@public.gmane.org
Hi Michel,
Thanks, I still couldn't see the issue that use a variable to calculate the vblank count when vsync timer interrupt occurs. I just think it only emulates the hardware behavior. And
the code change will only in virtual display files which won't touch drm layer. I incline to not modify the code in drm layer or amdgpu other codes, because it may lead to other issues .
Best Wishes,
Emily Deng
Quoted 88 lines
-----Original Message-----
From: Michel Dänzer [mailto:[email protected]]
Sent: Tuesday, August 16, 2016 11:12 AM
To: Deng, Emily <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Forvirtual_displayfeature, define a variable for vblank count of cpu vsync timer.Quoted 28 lines · Emily
Quoted 17 lines
From: Michel Dänzer [mailto:[email protected]]
Sent: Monday, August 15, 2016 9:46 AM On 11/08/16 12:46 PM, EmilyQuoted 4 lines · Deng
The adev->ddev->vblank[crtc].count couldn't be used here, so define another variable to compute the vblank count.
Signed-off-by Emily Deng <[email protected]>[...]
drivers/gpu/drm/amd/amdgpu/dce_virtual.c static u32 dce_virtual_vblank_get_counter(struct
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0
-0@@ -58,7 +58,7 @@ static u32 dce_virtual_vblank_get_counter(struct
amdgpu_device*adev, int crtc)Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c static u32 dce_virtual_vblank_get_counter(struct · line 62
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1
-1if (crtc >= adev->mode_info.num_crtc)return 0 ;else -return adev->ddev->vblank[crtc].count; +return adev->mode_info.timer_vblank_count; }AFAIK the
vblank_get_counterhook is supposed to always return 0 when there's no hardware frame counter which can be used. That's whatdrm_vblank_no_hw_counterwas created for.Quoted 2 lines
[[EmilyD]] Sorry, I don't know much about
drm_vblank_no_hw_counter, can it support vsync when return to 0?That's its purpose. BTW, I realized in the meantime that we can't use
drm_vblank_no_hw_counterdirectly, because there's a single structdrm_driverused by all amdgpu driver instances.Quoted 7 lines
Quoted 5 lines
You mentioned internally that you ran into trouble when trying this though. Please provide more information about that, e.g.: Which base kernel version did you test it with? What values did the
DRM_IOCTL_WAIT_VBLANKioctl return to userspace? ...[[EmilyD]] I run the driver on kernel version 4.6, and run glxgears with vsync enabled. It is hard to detail the issue, I will try my best to
description the issue I found.
Quoted 5 lines
After I double checked, it is not segment fault in libGL.so when run glxgears with vsync, but the glxgears will be stucked in waiting for the before swap buffers to complete. This is because when enable vsync, every time swap buffers, the DDX driver will call
DRM_IOCTL_WAIT_VBLANKto queue the vblank event, and thevbl.request.sequence will be set to
current_vblank_count+swap_interval. Then in kernel driver, when timer interrupt occurs, it will calldrm_handle_vblank_events, it will calldrm_vblank_count_and_timeto get current seq, and only seq >= vbl.request.sequence, then will callsend_vblank_event. So it will never callsend_vblank_event.Quoted 9 lines
For example, the DDX driver call
DRM_IOCTL_WAIT_VBLANK, then kernel driver will calldrm_queue_vblank_event, and currentvblank_countis 1 (As we only return 0 invblank_get_counter, so thevblank_countwill never change except callingdrm_reset_vblank_timestampwhich will make adev->ddev->vblank[crtc].count++), andswap_intervalis 1, thenadev->ddev->vbl.request.sequencewill be 2, but theadev->ddev->drm_vblank_count_and_timewill always
return 1 except calling drm_reset_vblank_timestamp(The functiondrm_reset_vblank_timestampwill only be called in
drm_vblank_post_modesetanddrm_vblank_on), so thesend_vblank_eventwill never be called, and swap buffers won't complete, so the glxgears will be stucked.Looking at the
drm_update_vblank_count()code, you also need to do the following in the virtual DCE case:* Set
dev->max_vblank_count= 0
* Makeamdgpu_get_vblank_timestamp_kmseither return values based on when the virtual vblank interrupt timer last fired, or just return a negative error code immediately, instead of callingdrm_calc_vbltimestamp_from_scanoutpos
* Makeamdgpu_get_vblank_counter_kmstake the else path (or just return 0 immediately), not run any of the scanout position related code
Quoted 3 lines
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): DM5PR12MB16590BBC53DA15179AAA7DBD8F130-2J9CzHegvk/[email protected]
Quoted 6 lines · Emily
Hi Michel, Thanks, I still couldn't see the issue that use a variable to calculate the vblank count when vsync timer interrupt occurs. I just think it only emulates the hardware behavior. And the code change will only in virtual display files which won't touch drm layer. I incline to not modify the code in drm layer or amdgpu other codes, because it may lead to other issues .
I see it basically the other way around: We are currently pretending to the DRM core code that we have a reliable hardware vblank counter and timing even in the virtual DCE case, when we really don't. We should stop pretending and instead communicate the lack of these hardware facilities in the virtual DCE case as intended, otherwise we'll probably run into issues sooner or later.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): c43417fa-f177-e65c-76b2-2ed0296090d8-otUistvHUpPR7s880joybQ@public.gmane.org
Quoted 16 lines
-----Original Message-----
From: Michel Dänzer [mailto:[email protected]]
Sent: Tuesday, August 16, 2016 12:01 PM
To: Deng, Emily <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Forvirtual_displayfeature, define a variable for vblank count of cpu vsync timer.Quoted 6 lines · Emily
Hi Michel, Thanks, I still couldn't see the issue that use a variable to calculate the vblank count when vsync timer interrupt occurs. I just think it only emulates the hardware behavior. And the code change will only in virtual display files which won't touch drm layer. I incline to not modify the code in drm layer or amdgpu other codes, because it may lead to other issues .
Quoted 6 lines
I see it basically the other way around: We are currently pretending to the DRM core code that we have a reliable hardware vblank counter and timing even in the virtual DCE case, when we really don't. We should stop pretending and instead communicate the lack of these hardware facilities in the virtual DCE case as intended, otherwise we'll probably run into issues sooner or later.
[[EmilyD]] Hi Michel, yes, you are right, we are pretending a hardware vblank counter in virtual DCE case to drm layer. But can you specific some cases that we must communicate with drm layer that we don't have the vblank counter.
Quoted 4 lines
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 10 lines · Emily
Quoted 10 lines
From: Michel Dänzer [mailto:[email protected]]
Sent: Tuesday, August 16, 2016 12:01 PMQuoted 6 lines · Emily
Hi Michel, Thanks, I still couldn't see the issue that use a variable to calculate the vblank count when vsync timer interrupt occurs. I just think it only emulates the hardware behavior. And the code change will only in virtual display files which won't touch drm layer. I incline to not modify the code in drm layer or amdgpu other codes, because it may lead to other issues .
Quoted 8 lines
Quoted 6 lines
I see it basically the other way around: We are currently pretending to the DRM core code that we have a reliable hardware vblank counter and timing even in the virtual DCE case, when we really don't. We should stop pretending and instead communicate the lack of these hardware facilities in the virtual DCE case as intended, otherwise we'll probably run into issues sooner or later.
[[EmilyD]] Hi Michel, yes, you are right, we are pretending a hardware vblank counter in virtual DCE case to drm layer. But can you specific some cases that we must communicate with drm layer that we don't have the vblank counter.
I described all the necessary steps (that I know of; there may be more) in https://lists.freedesktop.org/archives/amd-gfx/2016-August/001342.html .
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 531e4e95-1350-3cc4-a354-89bdbb0c6309-otUistvHUpPR7s880joybQ@public.gmane.org
Quoted 27 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel D?nzer
Sent: Tuesday, August 16, 2016 2:43 PM
To: Deng, Emily <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Forvirtual_displayfeature, define a variable for vblank count of cpu vsync timer.Quoted 10 lines · Emily
Quoted 10 lines
From: Michel Dänzer [mailto:[email protected]]
Sent: Tuesday, August 16, 2016 12:01 PM On 16/08/16 12:49 PM, Deng,Quoted 6 lines · Emily
Hi Michel, Thanks, I still couldn't see the issue that use a variable to calculate the vblank count when vsync timer interrupt occurs. I just think it only emulates the hardware behavior. And the code change will only in virtual display files which won't touch drm layer. I incline to not modify the code in drm layer or amdgpu other codes, because it may lead to other issues .
Quoted 5 lines
Quoted 5 lines
I see it basically the other way around: We are currently pretending to the DRM core code that we have a reliable hardware vblank counter and timing even in the virtual DCE case, when we really don't. We should stop pretending and instead communicate the lack of these hardware facilities in the virtual DCE case as intended, otherwise we'll
probably run into issues sooner or later.
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 2 lines
[[EmilyD]] Hi Michel, yes, you are right, we are pretending a hardware vblank counter in virtual DCE case to drm layer. But can you specific some
cases that we must communicate with drm layer that we don't have the vblank counter.
I described all the necessary steps (that I know of; there may be more) in
https://lists.freedesktop.org/archives/amd-gfx/2016-August/001342.html .
[[EmilyD]] Hi Michel, I means can you detail the reasons or cases that we should communicate with drm layer when don't have the vblank counter instead of pretending a hardware vblank counter in virtual DCE case.
Quoted 8 lines
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): DM5PR12MB1659A85C4EDDA59E5BF3CC7E8F130-2J9CzHegvk/[email protected]
Quoted 23 lines · Emily
Quoted 23 lines
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel D?nzer
Sent: Tuesday, August 16, 2016 2:43 PMQuoted 10 lines · Emily
Quoted 10 lines
From: Michel Dänzer [mailto:[email protected]]
Sent: Tuesday, August 16, 2016 12:01 PM On 16/08/16 12:49 PM, Deng,Quoted 6 lines · Emily
Hi Michel, Thanks, I still couldn't see the issue that use a variable to calculate the vblank count when vsync timer interrupt occurs. I just think it only emulates the hardware behavior. And the code change will only in virtual display files which won't touch drm layer. I incline to not modify the code in drm layer or amdgpu other codes, because it may lead to other issues .
Quoted 5 lines
Quoted 5 lines
I see it basically the other way around: We are currently pretending to the DRM core code that we have a reliable hardware vblank counter and timing even in the virtual DCE case, when we really don't. We should stop pretending and instead communicate the lack of these hardware facilities in the virtual DCE case as intended, otherwise we'll
probably run into issues sooner or later.
Quoted 3 lines
Quoted 1 line
[[EmilyD]] Hi Michel, yes, you are right, we are pretending a hardware vblank counter in virtual DCE case to drm layer. But can you specific some
Quoted 8 lines
Quoted 6 lines
cases that we must communicate with drm layer that we don't have the vblank counter.
I described all the necessary steps (that I know of; there may be more) in
https://lists.freedesktop.org/archives/amd-gfx/2016-August/001342.html .[[EmilyD]] Hi Michel, I means can you detail the reasons or cases that we should communicate with drm layer when don't have the vblank counter instead of pretending a hardware vblank counter in virtual DCE case.
The DRM core code expects the get_vblank_counter hook to use a reliable hardware counter. If that is not the case, it should always return 0.
Similarly, drm_calc_vbltimestamp_from_scanoutpos expects the get_scanout_position hook to return accurate scanout position values based on reliable hardware registers.
If we pretend to return accurate values from these when we actually can't, the DRM core code may provide incorrect vblank counter / timestamp values to userspace, or worse.
Those are just off the top of my head, there may be more along the same lines.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 3bbe3fc7-86cb-d077-6679-64bd37ecff12-otUistvHUpPR7s880joybQ@public.gmane.org
Hi Michel and Daniel,
Return the fake vblank count or return 0 in vblank_get_counter is only the virtual display feature's behavior, and the virtual display feature need to be enabled by set module parameter,
so won't affect normal case. And I think the vblank counter will be increased every time when the vsync timer interrupt occurs in virtual display feature is reasonable, so that the 3D app about vblank count could work normally. For the time stamp could be set to limitations for virtual display feature.
Best Wishes,
Emily Deng
Quoted 56 lines
-----Original Message-----
From: Michel Dänzer [mailto:[email protected]]
Sent: Tuesday, August 16, 2016 3:18 PM
To: Deng, Emily <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Forvirtual_displayfeature, define a variable for vblank count of cpu vsync timer.Quoted 22 lines · Emily
Quoted 22 lines
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel D?nzer
Sent: Tuesday, August 16, 2016 2:43 PM On 16/08/16 03:28 PM, Deng,Quoted 10 lines · Emily
Quoted 10 lines
From: Michel Dänzer [mailto:[email protected]]
Sent: Tuesday, August 16, 2016 12:01 PM On 16/08/16 12:49 PM, Deng,Quoted 6 lines · Emily
Hi Michel, Thanks, I still couldn't see the issue that use a variable to calculate the vblank count when vsync timer interrupt occurs. I just think it only emulates the hardware behavior. And the code change will only in virtual display files which won't touch drm layer. I incline to not modify the code in drm layer or amdgpu other codes, because it may lead to other issues .
Quoted 6 lines
Quoted 6 lines
I see it basically the other way around: We are currently pretending to the DRM core code that we have a reliable hardware vblank counter and timing even in the virtual DCE case, when we really don't. We should stop pretending and instead communicate the lack of these hardware facilities in the virtual DCE case as intended, otherwise we'll
probably run into issues sooner or later.
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
[[EmilyD]] Hi Michel, yes, you are right, we are pretending a hardware vblank counter in virtual DCE case to drm layer. But can you specific some
cases that we must communicate with drm layer that we don't have the vblank counter.
I described all the necessary steps (that I know of; there may be more) in https://lists.freedesktop.org/archives/amd-gfx/2016-
August/001342.html .
Quoted 3 lines
Quoted 1 line
[[EmilyD]] Hi Michel, I means can you detail the reasons or cases that we should communicate with drm layer when don't have the vblank counter
instead of pretending a hardware vblank counter in virtual DCE case.
The DRM core code expects the
get_vblank_counterhook to use a reliable hardware counter. If that is not the case, it should always return 0.Similarly,
drm_calc_vbltimestamp_from_scanoutposexpects theget_scanout_positionhook to return accurate scanout position values based on reliable hardware registers.If we pretend to return accurate values from these when we actually can't, the DRM core code may provide incorrect vblank counter / timestamp values to userspace, or worse.
Quoted 6 lines
Those are just off the top of my head, there may be more along the same lines.
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): DM5PR12MB16597DC3495CA22D1FC61FA38F130-2J9CzHegvk/[email protected]
Hi Michel and Daniel,
I just tryed Michel's advice: return 0 in vblank_get_counter, and set dev->max_vblank_count = 0 ,
and found the adev->ddev->vblank[crtc].count also can increase which makes the 3D app with vsync can work properly as well. But I don't know the principle. Anyway I will take Michel's advice about vblank count, and send a patch later.
Best Wishes,
Emily Deng
Quoted 81 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Deng, Emily
Sent: Tuesday, August 16, 2016 5:14 PM
To: Michel Dänzer <[email protected]>; Daniel Vetter <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH] drm/amdgpu: Forvirtual_displayfeature, define a variable for vblank count of cpu vsync timer.Hi Michel and Daniel,
Return the fake vblank count or return 0 invblank_get_counteris only the
virtual display feature's behavior, and the virtual display feature need to be enabled by set module parameter, so won't affect normal case. And I think the vblank counter will be increased every time when the vsync timer interrupt occurs in virtual display feature is reasonable, so that the 3D app about vblank count could work normally. For the time stamp could be set to limitations for virtual display feature.Best Wishes,
Emily DengQuoted 60 lines
-----Original Message-----
From: Michel Dänzer [mailto:[email protected]]
Sent: Tuesday, August 16, 2016 3:18 PM
To: Deng, Emily <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Forvirtual_displayfeature, define a variable for vblank count of cpu vsync timer.Quoted 22 lines · Emily
Quoted 22 lines
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel D?nzer
Sent: Tuesday, August 16, 2016 2:43 PM On 16/08/16 03:28 PM, Deng,Quoted 10 lines · Emily
Quoted 10 lines
From: Michel Dänzer [mailto:[email protected]]
Sent: Tuesday, August 16, 2016 12:01 PM On 16/08/16 12:49 PM,Quoted 6 lines · Emily
Hi Michel, Thanks, I still couldn't see the issue that use a variable to calculate the vblank count when vsync timer interrupt occurs. I just think it only emulates the hardware behavior. And the code change will only in virtual display files which won't touch drm layer. I incline to not modify the code in drm layer or amdgpu other codes, because it may lead to other issues .
Quoted 6 lines
Quoted 6 lines
I see it basically the other way around: We are currently pretending to the DRM core code that we have a reliable hardware vblank counter and timing even in the virtual DCE case, when we really don't. We should stop pretending and instead communicate the lack of these hardware facilities in the virtual DCE case as intended, otherwise we'll
probably run into issues sooner or later.
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
[[EmilyD]] Hi Michel, yes, you are right, we are pretending a hardware vblank counter in virtual DCE case to drm layer. But can you specific some
cases that we must communicate with drm layer that we don't have the vblank counter.
I described all the necessary steps (that I know of; there may be more) in https://lists.freedesktop.org/archives/amd-gfx/2016-
August/001342.html .
Quoted 4 lines
Quoted 1 line
[[EmilyD]] Hi Michel, I means can you detail the reasons or cases that we should communicate with drm layer when don't have the vblank counter
instead of pretending a hardware vblank counter in virtual DCE case.
The DRM core code expects the
get_vblank_counterhook to use a reliable hardware counter. If that is not the case, it should always return 0.Similarly,
drm_calc_vbltimestamp_from_scanoutposexpects theget_scanout_positionhook to return accurate scanout position values based on reliable hardware registers.If we pretend to return accurate values from these when we actually can't, the DRM core code may provide incorrect vblank counter / timestamp values to userspace, or worse.
Those are just off the top of my head, there may be more along the same lines.
Quoted 7 lines
Quoted 3 lines
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 11 lines · Michel Dänzer
Quoted 10 lines · Emily
Quoted 10 lines
From: Michel Dänzer [mailto:[email protected]]
Sent: Tuesday, August 16, 2016 12:01 PMQuoted 6 lines · Emily
Hi Michel, Thanks, I still couldn't see the issue that use a variable to calculate the vblank count when vsync timer interrupt occurs. I just think it only emulates the hardware behavior. And the code change will only in virtual display files which won't touch drm layer. I incline to not modify the code in drm layer or amdgpu other codes, because it may lead to other issues .
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
I see it basically the other way around: We are currently pretending to the DRM core code that we have a reliable hardware vblank counter and timing even in the virtual DCE case, when we really don't. We should stop pretending and instead communicate the lack of these hardware facilities in the virtual DCE case as intended, otherwise we'll probably run into issues sooner or later.
Yes please don't lie to the vblank core. In the future we might depend more on this, and that might lead to surprises.
Quoted 5 lines
Quoted 2 lines
[[EmilyD]] Hi Michel, yes, you are right, we are pretending a hardware vblank counter in virtual DCE case to drm layer. But can you specific some cases that we must communicate with drm layer that we don't have the vblank counter.
I described all the necessary steps (that I know of; there may be more) in https://lists.freedesktop.org/archives/amd-gfx/2016-August/001342.html .
Yeah I missed the accurate timestamp part, since on i915 on gen2 we can still do that part. Your todo list looks accurate from what I can tell. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel