color: change has_parameters to count_parameters

A counter instead of a boolean should be useful when we add code
printing the parameters. This should help us to avoid printing unused
parameters.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
Leandro Ribeiro 2024-12-16 10:28:14 -03:00 committed by Pekka Paalanen
parent 5d7e2710a2
commit 277082dbd9
3 changed files with 18 additions and 23 deletions

View file

@ -311,8 +311,8 @@ weston_color_profile_param_builder_set_tf_named(struct weston_color_profile_para
return false;
builder->params.tf_info = weston_color_tf_info_from(compositor, tf);
weston_assert_false(builder->compositor,
builder->params.tf_info->has_parameters);
weston_assert_uint32_eq(builder->compositor,
builder->params.tf_info->count_parameters, 0);
builder->group_mask |= WESTON_COLOR_PROFILE_PARAMS_TF;

View file

@ -40,11 +40,6 @@
#include "color-management-v1-server-protocol.h"
enum tf_has_parameters {
YES_PARAMETERS = true,
NO_PARAMETERS = false,
};
static const struct weston_color_feature_info color_feature_info_table[] = {
{
.feature = WESTON_COLOR_FEATURE_ICC,
@ -265,90 +260,90 @@ static const struct weston_color_tf_info color_tf_info_table[] = {
.tf = WESTON_TF_LINEAR,
.desc = "Linear transfer function",
.protocol_tf = XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LINEAR,
.has_parameters = NO_PARAMETERS,
.count_parameters = 0,
},
{
.tf = WESTON_TF_GAMMA22,
.desc = "Assumed display gamma 2.2 transfer function",
.protocol_tf = XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_GAMMA22,
.has_parameters = NO_PARAMETERS,
.count_parameters = 0,
},
{
.tf = WESTON_TF_GAMMA28,
.desc = "Assumed display gamma 2.8 transfer function",
.protocol_tf = XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_GAMMA28,
.has_parameters = NO_PARAMETERS,
.count_parameters = 0,
},
{
.tf = WESTON_TF_SRGB,
.desc = "sRGB piece-wise transfer function",
.protocol_tf = XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_SRGB,
.has_parameters = NO_PARAMETERS,
.count_parameters = 0,
},
{
.tf = WESTON_TF_EXT_SRGB,
.desc = "Extended sRGB piece-wise transfer function",
.protocol_tf = XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_EXT_SRGB,
.has_parameters = NO_PARAMETERS,
.count_parameters = 0,
},
{
.tf = WESTON_TF_BT709,
.desc = "BT.709 transfer function",
.protocol_tf = XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_BT709,
.has_parameters = NO_PARAMETERS,
.count_parameters = 0,
},
{
.tf = WESTON_TF_BT1361,
.desc = "BT.1361 extended transfer function",
.protocol_tf = XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_BT1361,
.has_parameters = NO_PARAMETERS,
.count_parameters = 0,
},
{
.tf = WESTON_TF_ST240,
.desc = "SMPTE ST 240 transfer function",
.protocol_tf = XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST240,
.has_parameters = NO_PARAMETERS,
.count_parameters = 0,
},
{
.tf = WESTON_TF_ST428,
.desc = "SMPTE ST 428 transfer function",
.protocol_tf = XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST428,
.has_parameters = NO_PARAMETERS,
.count_parameters = 0,
},
{
.tf = WESTON_TF_ST2084_PQ,
.desc = "Perceptual quantizer transfer function",
.protocol_tf = XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST2084_PQ,
.has_parameters = NO_PARAMETERS,
.count_parameters = 0,
},
{
.tf = WESTON_TF_LOG_100,
.desc = "Logarithmic 100:1 transfer function",
.protocol_tf = XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LOG_100,
.has_parameters = NO_PARAMETERS,
.count_parameters = 0,
},
{
.tf = WESTON_TF_LOG_316,
.desc = "Logarithmic (100*Sqrt(10) : 1) transfer function",
.protocol_tf = XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LOG_316,
.has_parameters = NO_PARAMETERS,
.count_parameters = 0,
},
{
.tf = WESTON_TF_XVYCC,
.desc = "IEC 61966-2-4 transfer function",
.protocol_tf = XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_XVYCC,
.has_parameters = NO_PARAMETERS,
.count_parameters = 0,
},
{
.tf = WESTON_TF_HLG,
.desc = "Hybrid log-gamma transfer function",
.protocol_tf = XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_HLG,
.has_parameters = NO_PARAMETERS,
.count_parameters = 0,
},
{
.tf = WESTON_TF_POWER,
.desc = "Parameterized power-law transfer function",
.has_parameters = YES_PARAMETERS,
.count_parameters = 1,
},
};

View file

@ -112,7 +112,7 @@ struct weston_color_tf_info {
/* The protocol also has support for parameterized functions, i.e.
* certain known functions that clients can define passing arbitrary
* parameters. */
bool has_parameters;
bool count_parameters;
};
const struct weston_color_feature_info *