MLK-17925: drm: imx: dcss: fix tearing
authorLaurentiu Palcu <laurentiu.palcu@nxp.com>
Mon, 4 Jun 2018 11:47:36 +0000 (14:47 +0300)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
commit74c09a23e7559a19c91f6ab6313394cdc4318df1
tree9ef7d18226dff4beba73e4d05d5a05ee74d66ea8
parent047c6166d979a91cc09fb32195187d543a9f49f0
MLK-17925: drm: imx: dcss: fix tearing

The video tearing appeared only when the application used 2 buffers.
That's because, sometimes, the context loader could be armed after the
DB event came in the frame trace. That made a buffer submitted in frame
N end up on screen in frame N+2 because the context loader waits for the
next DB event. Since vblank events are sent at the end of the frame, by
the time the buffer lands on screen, the application will reuse it while
it's being displayed, hence the tearing effect.

This patch moves the CTXLD trigger moment all the way to the end of the
frame trace, just before DB event arrives. This will leave the
application plenty of time to submit new buffers.

In the event that the trigger moment is missed (application submits a
buffer right at the end of a frame trace), then we're not signalling the
next VBLANK event to application. This way, application will know that
the buffer is still needed and will not submit a new one.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
drivers/gpu/drm/imx/dcss/dcss-crtc.c
drivers/gpu/imx/dcss/dcss-ctxld.c
drivers/gpu/imx/dcss/dcss-dpr.c
drivers/gpu/imx/dcss/dcss-dtg.c
drivers/gpu/imx/dcss/dcss-prv.h
drivers/gpu/imx/dcss/dcss-scaler.c
include/video/imx-dcss.h