drm/fb-helper: Fix vertical damage clipping
authorThomas Zimmermann <tzimmermann@suse.de>
Wed, 9 Feb 2022 16:16:14 +0000 (17:16 +0100)
committerThomas Zimmermann <tzimmermann@suse.de>
Thu, 10 Feb 2022 13:49:02 +0000 (14:49 +0100)
commitaa15c677cc34e626789cb65b8e7375180851c03b
treebc4b8ad2c844b133985262b49ea3cf9928dcd082
parenta3c286dcef7f8bc576a20f5d1e80624f6b4b93ee
drm/fb-helper: Fix vertical damage clipping

Don't clip the damage rectangle against the viewport. This only
works if the viewport is located at the beginning of the video
memory and the video memory doesn't extend the screen (i.e., if
there's no overallocation).

Fbdev emulation transfers data from write operations into a
possible shadow buffer, then into a GEM buffer object, and finally
via graphics driver onto the screen.

If callers write outside the currently visible area, clipping the
damage rectangle against the viewport will loose these updates in
the shadow buffer and the fbdev's buffer object will contain stale
data. Panning the viewport to the stale area of the buffer will
display obsolete data.

Instead, mark all written areas as damaged, so that the damage
handler updates the buffer object from the shadow buffer for all
such areas. The graphics driver's later has the option of clipping
the damaged area against the viewport when updating the screen
from the buffer object.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220209161617.3553-3-tzimmermann@suse.de
drivers/gpu/drm/drm_fb_helper.c