aboutsummaryrefslogtreecommitdiffstats
path: root/src/state.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-08-08 21:33:02 +0200
committerMattias Andrée <maandree@operamail.com>2014-08-08 21:33:02 +0200
commit680aab24bb74f33b4021e5ebd2a01884149feeaf (patch)
treef43b90b20a9aa2a57654f899b8a42b963d6b49d7 /src/state.c
parentm (diff)
downloadcrt-calibrator-680aab24bb74f33b4021e5ebd2a01884149feeaf.tar.gz
crt-calibrator-680aab24bb74f33b4021e5ebd2a01884149feeaf.tar.bz2
crt-calibrator-680aab24bb74f33b4021e5ebd2a01884149feeaf.tar.xz
misc
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/state.c39
1 files changed, 38 insertions, 1 deletions
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;