mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
drm: Add consistency check for page-flipping
Driver implementations of the drm_crtc's .page_flip() function are required to update the crtc->fb field on success to reflect that the new framebuffer is now in use. This is important to keep reference counting on the framebuffers balanced. While at it, document this requirement to keep others from falling into the same trap. Suggested-by: Daniel Vetter <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Reviewed-by: Daniel Vetter <[email protected]>
This commit is contained in:
parent
c976cb37a9
commit
8cf1e98114
2 changed files with 13 additions and 0 deletions
|
|
@ -3792,6 +3792,13 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
|
|||
/* Keep the old fb, don't unref it. */
|
||||
old_fb = NULL;
|
||||
} else {
|
||||
/*
|
||||
* Warn if the driver hasn't properly updated the crtc->fb
|
||||
* field to reflect that the new framebuffer is now used.
|
||||
* Failing to do so will screw with the reference counting
|
||||
* on framebuffers.
|
||||
*/
|
||||
WARN_ON(crtc->fb != fb);
|
||||
/* Unref only the old framebuffer. */
|
||||
fb = NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue