From 67f479d05794592d7a2f1752c3da9c75418c3454 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 22 Mar 2014 19:46:11 +0100 Subject: Support for running Redshift without a graphical environment in Linux by using Direct Rendering Manager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/gamma-drm.h | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/gamma-drm.h (limited to 'src/gamma-drm.h') diff --git a/src/gamma-drm.h b/src/gamma-drm.h new file mode 100644 index 0000000..8ef0ba5 --- /dev/null +++ b/src/gamma-drm.h @@ -0,0 +1,58 @@ +/* gamma-drm.h -- DRM gamma adjustment header + This file is part of Redshift. + + Redshift is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Redshift is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Redshift. If not, see . + + Copyright (c) 2014 Mattias Andrée +*/ + +#ifndef _REDSHIFT_GAMMA_DRM_H +#define _REDSHIFT_GAMMA_DRM_H + +#include + +#include +#include + + +typedef struct { + int crtc_num; + int crtc_id; + int gamma_size; + uint16_t* r_gamma; + uint16_t* g_gamma; + uint16_t* b_gamma; +} drm_crtc_state_t; + +typedef struct { + int card_num; + int crtc_num; + int fd; + drmModeRes* res; + drm_crtc_state_t* crtcs; +} drm_state_t; + + +int drm_init(drm_state_t *state); +int drm_start(drm_state_t *state); +void drm_free(drm_state_t *state); + +void drm_print_help(FILE *f); +int drm_set_option(drm_state_t *state, const char *key, const char *value); + +void drm_restore(drm_state_t *state); +int drm_set_temperature(drm_state_t *state, int temp, float brightness, const float gamma[3]); + + +#endif /* ! _REDSHIFT_GAMMA_DRM_H */ -- cgit v1.2.3-70-g09d2