aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcoopgamma.h
blob: e10117938bae8453bdf0add118a4dd00bee56f58 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/**
 * libcoopgamma -- Library for interfacing with cooperative gamma servers
 * Copyright (C) 2016  Mattias Andrée (maandree@kth.se)
 * 
 * This library 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.
 * 
 * This library 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 this library.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef LIBCOOPGAMMA_H
#define LIBCOOPGAMMA_H



#include <stddef.h>
#include <stdint.h>



typedef enum libcoopgamma_support
{
  LIBCOOPGAMMA_NO = 0,
  LIBCOOPGAMMA_MAYBE = 1,
  LIBCOOPGAMMA_YES = 2
} libcoopgamma_support_t;


typedef enum libcoopgamma_depth
{
  LIBCOOPGAMMA_UINT8 = 8,
  LIBCOOPGAMMA_UINT16 = 16,
  LIBCOOPGAMMA_UINT32 = 32,
  LIBCOOPGAMMA_UINT64 = 64,
  LIBCOOPGAMMA_FLOAT = -1,
  LIBCOOPGAMMA_DOUBLE = -2
} libcoopgamma_depth_t;


typedef enum libcoopgamma_lifespan
{
  LIBCOOPGAMMA_REMOVE = 0,
  LIBCOOPGAMMA_UNTIL_DEATH = 1,
  LIBCOOPGAMMA_UNTIL_REMOVAL = 2
} libcoopgamma_lifespan_t;


typedef struct libcoopgamma_context
{
  int fd;
} libcoopgamma_context_t;


#define LIBCOOPGAMMA_RAMPS__(suffix, type)	\
typedef struct libcoopgamma_ramps##suffix	\
{						\
  size_t red_size;				\
  size_t green_size;				\
  size_t blue_size;				\
  type* red;					\
  type* green;					\
  type* blue;					\
} libcoopgamma_ramps##suffix##_t;
LIBCOOPGAMMA_RAMPS__(8,  uint8_t);
LIBCOOPGAMMA_RAMPS__(16, uint16_t);
LIBCOOPGAMMA_RAMPS__(32, uint32_t);
LIBCOOPGAMMA_RAMPS__(64, uint64_t);
LIBCOOPGAMMA_RAMPS__(f,  float);
LIBCOOPGAMMA_RAMPS__(d,  double);


typedef struct libcoopgamma_filter
{
  libcoopgamma_depth_t depth;
  int64_t priority;
  char* crtc;
  char* class;
  libcoopgamma_lifespan_t lifespan;
  union
  {
    libcoopgamma_ramps8_t u8;
    libcoopgamma_ramps16_t u16;
    libcoopgamma_ramps32_t u32;
    libcoopgamma_ramps64_t u64;
    libcoopgamma_rampsf_t f;
    libcoopgamma_rampsd_t d;
  } ramps;
} libcoopgamma_filter_t;


typedef struct libcoopgamma_crtc_info
{
  int cooperative;
  libcoopgamma_depth_t depth;
  size_t red_size;
  size_t green_size;
  size_t blue_size;
  libcoopgamma_support_t supported;
} libcoopgamma_crtc_info_t;


typedef struct libcoopgamma_filter_query
{
  char* crtc;
  int coalesce;
  int64_t high_priority;
  int64_t low_priority;
} libcoopgamma_filter_query_t;


typedef struct libcoopgamma_queried_filter
{
  int64_t priority;
  char* class;
  union
  {
    libcoopgamma_ramps8_t u8;
    libcoopgamma_ramps16_t u16;
    libcoopgamma_ramps32_t u32;
    libcoopgamma_ramps64_t u64;
    libcoopgamma_rampsf_t f;
    libcoopgamma_rampsd_t d;
  } ramps;
} libcoopgamma_queried_filter_t;


typedef struct libcoopgamma_filter_table
{
  libcoopgamma_depth_t depth;
  size_t red_size;
  size_t green_size;
  size_t blue_size;
  size_t filter_count;
  libcoopgamma_queried_filter_t* filters;
} libcoopgamma_filter_table_t;


typedef struct libcoopgamma_error
{
  uint64_t number;
  int custom;
  char* description;
} libcoopgamma_error_t;



#endif