drm/mediatek: gamma: Improve and simplify HW LUT calculation
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Thu, 12 Oct 2023 09:57:24 +0000 (11:57 +0200)
committerChun-Kuang Hu <chunkuang.hu@kernel.org>
Sun, 15 Oct 2023 23:57:51 +0000 (23:57 +0000)
commitc18119dee1919ce60565efd85f63707ceae38420
tree5973c731f35682e90b052d1e812c1b8a92189edd
parentd243907bb42f6652d88f9f3023d1028a34971465
drm/mediatek: gamma: Improve and simplify HW LUT calculation

Use drm_color_lut_extract() to avoid open-coding the bits reduction
calculations for each color channel and use a struct drm_color_lut
to temporarily store the information instead of an array of u32.

Also, slightly improve the precision of the HW LUT calculation in the
LUT DIFF case by performing the subtractions on the 16-bits values and
doing the 10 bits conversion later.

Reviewed-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231012095736.100784-5-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
drivers/gpu/drm/mediatek/mtk_disp_gamma.c