[PATCH] drm/amdgpu: For virtual_display feature, define a variable for vblank count of cpu vsync timer.

Deng, Emily Emily.Deng at amd.com
Fri Aug 12 02:00:15 UTC 2016


ping...
Anybody could help to review it?

> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf Of
> Emily Deng
> Sent: Thursday, August 11, 2016 11:47 AM
> To: amd-gfx at lists.freedesktop.org
> Cc: Deng, Emily <Emily.Deng at amd.com>
> Subject: [PATCH] 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.
> 
> Signed-off-by: Emily Deng <Emily.Deng at amd.com>
> ---
>  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(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> index 50aeccf..054653e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> @@ -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;  };
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index 2ce5f90..d616ab9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -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 *ad
>  		hrtimer_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)) {
> --
> 1.9.1
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list