1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 3 #ifndef _VKMS_COMPOSER_H_ 4 #define _VKMS_COMPOSER_H_ 5 6 #include <kunit/visibility.h> 7 #include "vkms_drv.h" 8 9 /* 10 * This enum is related to the positions of the variables inside 11 * `struct drm_color_lut`, so the order of both needs to be the same. 12 */ 13 enum lut_channel { 14 LUT_RED = 0, 15 LUT_GREEN, 16 LUT_BLUE, 17 LUT_RESERVED 18 }; 19 20 #if IS_ENABLED(CONFIG_KUNIT) 21 u16 lerp_u16(u16 a, u16 b, s64 t); 22 s64 get_lut_index(const struct vkms_color_lut *lut, u16 channel_value); 23 u16 apply_lut_to_channel_value(const struct vkms_color_lut *lut, u16 channel_value, 24 enum lut_channel channel); 25 void apply_3x4_matrix(struct pixel_argb_s32 *pixel, const struct drm_color_ctm_3x4 *matrix); 26 #endif 27 28 #endif /* _VKMS_COMPOSER_H_ */ 29