drm: Remove plane hsub/vsub alignment requirement for core helpers
authorCarlos Eduardo Gallo Filho <gcarlos@disroot.org>
Tue, 26 Sep 2023 14:15:18 +0000 (11:15 -0300)
committerThomas Zimmermann <tzimmermann@suse.de>
Thu, 12 Oct 2023 07:51:19 +0000 (09:51 +0200)
commitf2f455981a34ce8ca88a41458c09494b387d344f
treec1ebcccfa2da094958fd9574f51c495a4740250a
parent052ddf7b86d2d9443bce77ef5b5b1ef61a3b79fc
drm: Remove plane hsub/vsub alignment requirement for core helpers

The drm_format_info_plane_{height,width} functions was implemented using
regular division for the plane size calculation, which cause issues [1][2]
when used on contexts where the dimensions are misaligned with relation
to the subsampling factors. So, replace the regular division by the
DIV_ROUND_UP macro.

This allows these functions to be used in more drivers, making further
work to bring more core presence on them possible.

[1] http://patchwork.freedesktop.org/patch/msgid/20170321181218.10042-3-ville.syrjala@linux.intel.com
[2] https://patchwork.freedesktop.org/patch/msgid/20211026225105.2783797-2-imre.deak@intel.com

Signed-off-by: Carlos Eduardo Gallo Filho <gcarlos@disroot.org>
Reviewed-by: André Almeida <andrealmeid@igalia.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230926141519.9315-2-gcarlos@disroot.org
include/drm/drm_fourcc.h