diff options
author | Mattias Andrée <m@maandree.se> | 2025-03-23 13:21:19 +0100 |
---|---|---|
committer | Mattias Andrée <m@maandree.se> | 2025-03-23 14:16:10 +0100 |
commit | 86433cea917715559d496ad0561d6b10bc89d7e5 (patch) | |
tree | 0216fd2d2d37c094d2c97584301f3434d5a4677b /src/common.h | |
parent | Update todo list (diff) | |
download | redshift-ng-86433cea917715559d496ad0561d6b10bc89d7e5.tar.gz redshift-ng-86433cea917715559d496ad0561d6b10bc89d7e5.tar.bz2 redshift-ng-86433cea917715559d496ad0561d6b10bc89d7e5.tar.xz |
Rewrite gamma-randr.c and gamma-vidmode.c to use libgamma
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'src/common.h')
-rw-r--r-- | src/common.h | 88 |
1 files changed, 80 insertions, 8 deletions
diff --git a/src/common.h b/src/common.h index b7cf872..e79c6f4 100644 --- a/src/common.h +++ b/src/common.h @@ -62,6 +62,7 @@ # include <time.h> #endif +#include <libgamma.h> #include <libred.h> @@ -1178,6 +1179,77 @@ extern int use_fade; extern int verbose; +/* backend-direct.c */ + +/** + * Create an initialised state object for direct gamma adjustments + * + * @param state_out Output parameter for the state object + * @return 0 on success, -1 on failure + * + * `*state_out` is set (potentially to `NULL`) on failure + */ +int direct_create(GAMMA_STATE **state_out, int method, const char *method_name); + +/** + * Select partitions to apply adjustments to using direct gamma adjustments + * + * @param state State object for the adjustment method + * @param key Option to configure + * @param value Option value to set + * @return 0 on success, -1 on failure + */ +int direct_set_partitions(GAMMA_STATE *state, const char *key, const char *value); + +/** + * Select CRTCs to apply adjustments to using direct gamma adjustments + * + * @param state State object for the adjustment method + * @param key Option to configure + * @param value Option value to set + * @return 0 on success, -1 on failure + */ +int direct_set_crtcs(GAMMA_STATE *state, const char *key, const char *value); + +/** + * Finalise option-dependent initialisation and connections + * for direct gamma adjustments + * + * @param state State object for the adjustment method + * @return 0 on success, -1 on failure + */ +int direct_start(GAMMA_STATE *state); + +/** + * Apply colour settings using direct gamma adjustments + * + * @param state State object for the adjustment method + * @param settings The colour settings to apply + * @param preserve Whether currently applied adjustments (assumed + * to be colour calibration) shall remain applied + * @return 0 on success, -1 on failure + */ +int direct_apply(GAMMA_STATE *state, const struct colour_setting *setting, int preserve); + +/** + * Restore the adjustments to the `.state` before start was called + * using direct gamma adjustments + * + * @param state State object for the adjustment method + */ +void direct_restore(GAMMA_STATE *state); + +/** + * Close connections and deallocate all state resources + * for direct gamma adjustments + * + * @param state The state to terminate + * + * The pointer `state` will become invalid + */ +void direct_free(GAMMA_STATE *state); + + /* colour.c */ /** @@ -1203,14 +1275,14 @@ GCC_ONLY(__attribute__((__pure__))) int colour_setting_diff_is_major(const struct colour_setting *a, const struct colour_setting *b); #define LIST_RAMPS_STOP_VALUE_TYPES(X, D)\ - X(u8, uint8_t, UINT8_MAX, 8) D\ - X(u16, uint16_t, UINT16_MAX, 16) D\ - X(u32, uint32_t, UINT32_MAX, 32) D\ - X(u64, uint64_t, UINT64_MAX, 64) D\ - X(float, float, 1, -1) D\ - X(double, double, 1, -2) - -#define X(SUFFIX, TYPE, MAX, DEPTH)\ + X(u8, ramps8, uint8_t, UINT8_MAX, 8) D \ + X(u16, ramps16, uint16_t, UINT16_MAX, 16) D\ + X(u32, ramps32, uint32_t, UINT32_MAX, 32) D\ + X(u64, ramps64, uint64_t, UINT64_MAX, 64) D\ + X(float, rampsf, float, 1, -1) D\ + X(double, rampsd, double, 1, -2) + +#define X(SUFFIX, RAMPS, TYPE, MAX, DEPTH)\ /** * Fill the gamma ramps * |