Commit 5ce0183c authored by Amy Zhang's avatar Amy Zhang Committed by Alex Deucher

drm/amd/display: Framework for degamma and regramma through color module

Signed-off-by: default avatarAmy Zhang <Amy.Zhang@amd.com>
Reviewed-by: default avatarAric Cyr <Aric.Cyr@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b39474ef
......@@ -37,7 +37,7 @@ bool mod_color_find_predefined_gamut(
bool mod_color_find_predefined_white_point(
struct white_point_coodinates *out_white_point,
unsigned int index);
enum predefined_white_point_type type);
bool mod_color_find_white_point_from_temperature(
struct white_point_coodinates *out_white_point,
......
......@@ -30,6 +30,79 @@
#include "dm_services.h"
#include "color_helper.h"
enum color_transfer_func {
transfer_func_unknown,
transfer_func_srgb,
transfer_func_bt709,
transfer_func_pq2084,
transfer_func_pq2084_interim,
transfer_func_linear_0_1,
transfer_func_linear_0_125,
transfer_func_dolbyvision,
transfer_func_gamma_22,
transfer_func_gamma_26
};
enum color_color_space {
color_space_unsupported,
color_space_srgb,
color_space_bt601,
color_space_bt709,
color_space_xv_ycc_bt601,
color_space_xv_ycc_bt709,
color_space_xr_rgb,
color_space_bt2020,
color_space_adobe,
color_space_dci_p3,
color_space_sc_rgb_ms_ref,
color_space_display_native,
color_space_app_ctrl,
color_space_dolby_vision,
color_space_custom_coordinates
};
enum color_white_point_type {
color_white_point_type_unknown,
color_white_point_type_5000k_horizon,
color_white_point_type_6500k_noon,
color_white_point_type_7500k_north_sky,
color_white_point_type_9300k,
color_white_point_type_custom_coordinates
};
enum colorimetry_support_flag {
xv_ycc_bt601 = 0x01,
xv_ycc_bt709 = 0x02,
s_ycc_601 = 0x04,
adobe_ycc_601 = 0x08,
adobe_rgb = 0x10,
bt_2020_c_ycc = 0x20,
bt_2020_ycc = 0x40,
bt_2020_rgb = 0x80
};
enum hdr_tf_support_flag {
traditional_gamma_sdr = 0x01,
traditional_gamma_hdr = 0x02,
smpte_st2084 = 0x04
};
struct color_mastering_info {
unsigned int chromaticity_green_x;
unsigned int chromaticity_green_y;
unsigned int chromaticity_blue_x;
unsigned int chromaticity_blue_y;
unsigned int chromaticity_red_x;
unsigned int chromaticity_red_y;
unsigned int chromaticity_white_point_x;
unsigned int chromaticity_white_point_y;
unsigned int min_luminance;
unsigned int max_luminance;
unsigned int maximum_content_light_level;
unsigned int maximum_frame_average_light_level;
};
struct mod_color {
int dummy;
};
......@@ -86,12 +159,23 @@ struct color_range {
int max;
};
struct color_gamut_data {
enum color_color_space color_space;
enum color_white_point_type white_point;
struct color_space_coordinates gamut;
};
struct color_edid_caps {
unsigned int colorimetry_caps;
unsigned int hdr_caps;
};
struct mod_color *mod_color_create(struct dc *dc);
void mod_color_destroy(struct mod_color *mod_color);
bool mod_color_add_sink(struct mod_color *mod_color,
const struct dc_sink *sink);
const struct dc_sink *sink, struct color_edid_caps *edid_caps);
bool mod_color_remove_sink(struct mod_color *mod_color,
const struct dc_sink *sink);
......@@ -105,18 +189,29 @@ bool mod_color_set_white_point(struct mod_color *mod_color,
bool mod_color_adjust_source_gamut(struct mod_color *mod_color,
const struct dc_stream **streams, int num_streams,
struct gamut_space_coordinates *input_gamut_coordinates,
struct white_point_coodinates *input_white_point_coordinates);
struct color_gamut_data *input_gamut_data);
bool mod_color_adjust_destination_gamut(struct mod_color *mod_color,
const struct dc_stream **streams, int num_streams,
struct gamut_space_coordinates *input_gamut_coordinates,
struct white_point_coodinates *input_white_point_coordinates);
struct color_gamut_data *input_gamut_data);
bool mod_color_adjust_source_gamut_and_tf(struct mod_color *mod_color,
const struct dc_stream **streams, int num_streams,
struct color_gamut_data *input_gamut_data,
enum color_transfer_func input_transfer_func);
bool mod_color_get_user_enable(struct mod_color *mod_color,
const struct dc_sink *sink,
bool *user_enable);
bool mod_color_set_mastering_info(struct mod_color *mod_color,
const struct dc_stream **streams, int num_streams,
struct color_mastering_info *mastering_info);
bool mod_color_get_mastering_info(struct mod_color *mod_color,
const struct dc_sink *sink,
struct color_mastering_info *mastering_info);
bool mod_color_set_user_enable(struct mod_color *mod_color,
const struct dc_stream **streams, int num_streams,
bool user_enable);
......@@ -190,4 +285,14 @@ bool mod_color_is_rgb_limited_range_supported_for_timing(
const struct dc_sink *sink,
const struct dc_crtc_timing *timing);
bool mod_color_set_regamma(struct mod_color *mod_color,
const struct dc_stream **streams, int num_streams);
bool mod_color_set_degamma(struct mod_color *mod_color,
const struct dc_stream **streams, int num_streams,
enum color_transfer_func transfer_function);
bool mod_color_update_gamut_info(struct mod_color *mod_color,
const struct dc_stream **streams, int num_streams);
#endif /* MOD_COLOR_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment