format->cpp[] is only for legacy formats that do not have block height /
width defined, and is replaced by format->chars_per_block[]. Users should
use helpers that transparently handle the migration.

Switch to drm_format_info_min_pitch(), i.e. convert from format->cpp
to format->chars_per_block and block height / width for calculating
the length of each line in the buffer to clear. This makes it future
proof with respect to format block size additions.

Signed-off-by: Chen-Yu Tsai <[email protected]>
---
 drivers/gpu/drm/sysfb/drm_sysfb_modeset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c 
b/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c
index 99b13af4e391..acac94fdda7a 100644
--- a/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c
+++ b/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c
@@ -396,7 +396,7 @@ void drm_sysfb_plane_helper_atomic_disable(struct drm_plane 
*plane,
        offset = drm_fb_clip_offset(dst_pitch, dst_format, &dst_clip);
        for (i = 0; i < lines; ++i)
                iosys_map_memset(&sysfb->fb_addr, offset + dst_pitch * i, 0,
-                                linepixels * dst_format->cpp[0]);
+                                drm_format_info_min_pitch(dst_format, 0, 
linepixels));
 
        drm_dev_exit(idx);
 }
-- 
2.55.0.970.g62bdec98f9-goog

Reply via email to