Re: [PATCH v2 03/12] drm/exynos/decon5433: fix vblank event handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/03/17 11:58 PM, Andrzej Hajda wrote:
> Current implementation of event handling assumes that vblank interrupt is
> always called at the right time. It is not true, it can be delayed due to
> various reasons. As a result different races can happen. The patch fixes
> the issue by using hardware frame counter present in DECON to serialize
> vblank and commit completion events.
> 
> Signed-off-by: Andrzej Hajda <a.hajda@xxxxxxxxxxx>
> ---
> v2:
>   - added internal decon_get_frame_count function,
>   - updated frame counter on flush,
>   - misc style fixes (thank Inki)

[...]

> @@ -579,6 +636,23 @@ static const struct component_ops decon_component_ops = {
>  	.unbind = decon_unbind,
>  };
>  
> +static void decon_handle_vblank(struct decon_context *ctx)
> +{
> +	u32 frm;
> +
> +	spin_lock(&ctx->vblank_lock);
> +
> +	frm = decon_get_frame_count(ctx, true);
> +
> +	if (frm != ctx->frame_id) {
> +		if (frm > ctx->frame_id)
> +			drm_crtc_handle_vblank(&ctx->crtc->base);

This comparison isn't safe WRT the counter value returned by
decon_get_frame_count wrapping around. If it goes all the way up to
0xffffffff before wrapping around to zero, it can be handled e.g. by

		if ((s32)(frm - ctx->frame_id) > 0)

otherwise it gets a bit more complicated.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux