1303e9bf1SHarry Wentland /* SPDX-License-Identifier: GPL-2.0+ */ 2303e9bf1SHarry Wentland 3303e9bf1SHarry Wentland #ifndef _VKMS_COMPOSER_H_ 4303e9bf1SHarry Wentland #define _VKMS_COMPOSER_H_ 5303e9bf1SHarry Wentland 6303e9bf1SHarry Wentland #include <kunit/visibility.h> 7303e9bf1SHarry Wentland #include "vkms_drv.h" 8303e9bf1SHarry Wentland 9cb500b4cSHarry Wentland /* 10cb500b4cSHarry Wentland * This enum is related to the positions of the variables inside 11cb500b4cSHarry Wentland * `struct drm_color_lut`, so the order of both needs to be the same. 12cb500b4cSHarry Wentland */ 13cb500b4cSHarry Wentland enum lut_channel { 14cb500b4cSHarry Wentland LUT_RED = 0, 15cb500b4cSHarry Wentland LUT_GREEN, 16cb500b4cSHarry Wentland LUT_BLUE, 17cb500b4cSHarry Wentland LUT_RESERVED 18cb500b4cSHarry Wentland }; 19cb500b4cSHarry Wentland 20303e9bf1SHarry Wentland #if IS_ENABLED(CONFIG_KUNIT) 21303e9bf1SHarry Wentland u16 lerp_u16(u16 a, u16 b, s64 t); 22303e9bf1SHarry Wentland s64 get_lut_index(const struct vkms_color_lut *lut, u16 channel_value); 23cb500b4cSHarry Wentland u16 apply_lut_to_channel_value(const struct vkms_color_lut *lut, u16 channel_value, 24cb500b4cSHarry Wentland enum lut_channel channel); 25*f03bf05cSHarry Wentland void apply_3x4_matrix(struct pixel_argb_s32 *pixel, const struct drm_color_ctm_3x4 *matrix); 26303e9bf1SHarry Wentland #endif 27303e9bf1SHarry Wentland 28303e9bf1SHarry Wentland #endif /* _VKMS_COMPOSER_H_ */ 29