From 680aab24bb74f33b4021e5ebd2a01884149feeaf Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 8 Aug 2014 21:33:02 +0200 Subject: misc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/state.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'src/state.c') diff --git a/src/state.c b/src/state.c index 4ca3a75..b4ec11a 100644 --- a/src/state.c +++ b/src/state.c @@ -46,7 +46,22 @@ size_t card_count = 0; drm_crtc_t* restrict crtcs = NULL; /** - * The number of elements in `crtcs` + * The software brightness setting on each connected CRT controller, on each channel + */ +double* restrict brightnesses[3]; + +/** + * The software contrast setting on each connected CRT controller, on each channel + */ +double* restrict contrasts[3]; + +/** + * The gamma correction on each connected CRT controller, on each channel + */ +double* restrict gammas[3]; + +/** + * The number of elements in `crtcs`, `brightnesses[]`, `contrasts[]` and `gammas[]` */ size_t crtc_count = 0; @@ -105,6 +120,21 @@ int acquire_video(void) } } + for (c = 0; c < 3; c++) + { + brightnesses[c] = malloc(crtc_count * sizeof(double)); + if (brightnesses[c] == NULL) + return -1; + + contrasts[c] = malloc(crtc_count * sizeof(double)); + if (contrasts[c] == NULL) + return -1; + + gammas[c] = malloc(crtc_count * sizeof(double)); + if (gammas[c] == NULL) + return -1; + } + return 0; } @@ -128,6 +158,13 @@ void release_video(void) fb_close(framebuffers + i); framebuffer_count = 0; + for (i = 0; i < 3; i++) + { + free(brightnesses[i]), brightnesses[i] = NULL; + free(contrasts[i]), contrasts[i] = NULL; + free(gammas[i]), gammas[i] = NULL; + } + free(crtcs), crtcs = NULL; free(cards), cards = NULL; free(framebuffers), framebuffers = NULL; -- cgit v1.2.3-70-g09d2