OSDN Git Service

drm/vkms: Fix RGB565 pixel conversion
authorMaíra Canal <mcanal@igalia.com>
Fri, 12 May 2023 10:40:45 +0000 (07:40 -0300)
committerMaíra Canal <mairacanal@riseup.net>
Mon, 15 May 2023 13:58:11 +0000 (10:58 -0300)
commitab87f558dcfb2562c3497e89600dec798a446665
treebdd21cd5b142a897bc5e3d2b3e25870cb1f29441
parent8b25320887d7feac98875546ea0f521628b745bb
drm/vkms: Fix RGB565 pixel conversion

Currently, the pixel conversion isn't rounding the fixed-point values
before assigning it to the RGB coefficients, which is causing the IGT
pixel-format tests to fail. So, use the drm_fixp2int_round() fixed-point
helper to round the values when assigning it to the RGB coefficients.

Tested with igt@kms_plane@pixel-format and igt@kms_plane@pixel-format-source-clamping.

[v2]:
    * Use drm_fixp2int_round() to fix the pixel conversion instead of
      casting the values to s32 (Melissa Wen).

Fixes: 89b03aeaef16 ("drm/vkms: fix 32bit compilation error by replacing macros")
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Reviewed-by: Arthur Grillo <arthurgrillo@riseup.net>
Signed-off-by: Maíra Canal <mairacanal@riseup.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20230512104044.65034-2-mcanal@igalia.com
drivers/gpu/drm/vkms/vkms_formats.c