This repository has been archived by the owner on Oct 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
libgamma.h
2784 lines (2381 loc) · 80.3 KB
/
libgamma.h
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* See LICENSE file for copyright and license details. */
#ifndef LIBGAMMA_H
#define LIBGAMMA_H
#include <sys/types.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#ifdef __GNUC__
# define LIBGAMMA_GCC_ONLY__(X) X
#else
# define LIBGAMMA_GCC_ONLY__(X)
#endif
/* Some functions have been new signatures, the old ones are still
* available at link time */
#define libgamma_method_capabilities libgamma_method_capabilities__new
#define libgamma_get_crtc_information libgamma_get_crtc_information__new
#define libgamma_crtc_set_gamma_ramps8 libgamma_crtc_set_gamma_ramps8__new
#define libgamma_crtc_set_gamma_ramps16 libgamma_crtc_set_gamma_ramps16__new
#define libgamma_crtc_set_gamma_ramps32 libgamma_crtc_set_gamma_ramps32__new
#define libgamma_crtc_set_gamma_ramps64 libgamma_crtc_set_gamma_ramps64__new
#define libgamma_crtc_set_gamma_rampsf libgamma_crtc_set_gamma_rampsf__new
#define libgamma_crtc_set_gamma_rampsd libgamma_crtc_set_gamma_rampsd__new
/**
* `errno` has be set with a standard error number
* to indicate the what has gone wrong
*/
#define LIBGAMMA_ERRNO_SET (-1)
/**
* The selected adjustment method does not exist
* or has been excluded at compile-time
*/
#define LIBGAMMA_NO_SUCH_ADJUSTMENT_METHOD (-2)
/**
* The selected site does not exist
*/
#define LIBGAMMA_NO_SUCH_SITE (-3)
/**
* The selected partition does not exist
*/
#define LIBGAMMA_NO_SUCH_PARTITION (-4)
/**
* The selected CRTC does not exist
*/
#define LIBGAMMA_NO_SUCH_CRTC (-5)
/**
* Counter overflowed when counting the number
* of available items
*/
#define LIBGAMMA_IMPOSSIBLE_AMOUNT (-6)
/**
* The selected connector is disabled, it does
* not have a CRTC
*/
#define LIBGAMMA_CONNECTOR_DISABLED (-7)
/**
* The selected CRTC could not be opened,
* reason unknown
*/
#define LIBGAMMA_OPEN_CRTC_FAILED (-8)
/**
* The CRTC information field is not supported
* by the adjustment method
*/
#define LIBGAMMA_CRTC_INFO_NOT_SUPPORTED (-9)
/**
* Failed to read the current gamma ramps for
* the selected CRTC, reason unknown
*/
#define LIBGAMMA_GAMMA_RAMP_READ_FAILED (-10)
/**
* Failed to write the current gamma ramps for
* the selected CRTC, reason unknown
*/
#define LIBGAMMA_GAMMA_RAMP_WRITE_FAILED (-11)
/**
* The specified ramp sizes does not match the
* ramps sizes returned by the adjustment methods
* in response to the query/command
*/
#define LIBGAMMA_GAMMA_RAMP_SIZE_CHANGED (-12)
/**
* The specified ramp sizes are not identical
* which is required by the adjustment method
*
* (Only returned in debug mode)
*/
#define LIBGAMMA_MIXED_GAMMA_RAMP_SIZE (-13)
/**
* The specified ramp sizes are not supported
* by the adjustment method
*
* (Only returned in debug mode)
*/
#define LIBGAMMA_WRONG_GAMMA_RAMP_SIZE (-14)
/**
* The adjustment method reported that the gamma
* ramps size is 1, or perhaps even zero or negative
*/
#define LIBGAMMA_SINGLETON_GAMMA_RAMP (-15)
/**
* The adjustment method failed to list
* available CRTC:s, reason unknown
*/
#define LIBGAMMA_LIST_CRTCS_FAILED (-16)
/**
* Failed to acquire mode resources from the
* adjustment method
*/
#define LIBGAMMA_ACQUIRING_MODE_RESOURCES_FAILED (-17)
/**
* The adjustment method reported that a negative
* number of partitions exists in the site
*/
#define LIBGAMMA_NEGATIVE_PARTITION_COUNT (-18)
/**
* The adjustment method reported that a negative
* number of CRTC:s exists in the partition
*/
#define LIBGAMMA_NEGATIVE_CRTC_COUNT (-19)
/**
* Device cannot be access becauses of
* insufficient permissions
*/
#define LIBGAMMA_DEVICE_RESTRICTED (-20)
/**
* Device cannot be access, reason unknown
*/
#define LIBGAMMA_DEVICE_ACCESS_FAILED (-21)
/**
* Device cannot be access, membership of the
* `libgamma_group_gid` (named by `libgamma_group_name`
* (can be `NULL`, if so `errno` may have been set
* to tell why)) is required
*/
#define LIBGAMMA_DEVICE_REQUIRE_GROUP (-22)
/**
* The graphics card appear to have been removed
*/
#define LIBGAMMA_GRAPHICS_CARD_REMOVED (-23)
/**
* The state of the requested information is unknown
*/
#define LIBGAMMA_STATE_UNKNOWN (-24)
/**
* Failed to determine which connector the
* CRTC belongs to
*/
#define LIBGAMMA_CONNECTOR_UNKNOWN (-25)
/**
* The detected connector type is not listed
* in this library and has to be updated
*/
#define LIBGAMMA_CONNECTOR_TYPE_NOT_RECOGNISED (-26)
/**
* The detected subpixel order is not listed
* in this library and has to be updated
*/
#define LIBGAMMA_SUBPIXEL_ORDER_NOT_RECOGNISED (-27)
/**
* The length of the EDID does not match that
* of any supported EDID structure revision
*/
#define LIBGAMMA_EDID_LENGTH_UNSUPPORTED (-28)
/**
* The magic number in the EDID does not match
* that of any supported EDID structure revision
*/
#define LIBGAMMA_EDID_WRONG_MAGIC_NUMBER (-29)
/**
* The EDID structure revision used by the
* monitor is not supported
*/
#define LIBGAMMA_EDID_REVISION_UNSUPPORTED (-30)
/**
* The gamma characteristics field in the EDID
* is left unspecified
*
* (This could be considered a non-error)
*/
#define LIBGAMMA_GAMMA_NOT_SPECIFIED (-31)
/**
* The checksum in the EDID is incorrect, all
* request information has been provided
* by you cannot count on it
*/
#define LIBGAMMA_EDID_CHECKSUM_ERROR (-32)
/**
* Both of the errors `LIBGAMMA_GAMMA_NOT_SPECIFIED`
* and `LIBGAMMA_EDID_CHECKSUM_ERROR` have occurred
*/
#define LIBGAMMA_GAMMA_NOT_SPECIFIED_AND_EDID_CHECKSUM_ERROR (-33)
/**
* Failed to query the gamma ramps size from the
* adjustment method, reason unknown
*/
#define LIBGAMMA_GAMMA_RAMPS_SIZE_QUERY_FAILED (-34)
/**
* The selected partition could not be opened,
* reason unknown
*/
#define LIBGAMMA_OPEN_PARTITION_FAILED (-35)
/**
* The selected site could not be opened,
* reason unknown
*/
#define LIBGAMMA_OPEN_SITE_FAILED (-36)
/**
* Failed to query the adjustment method for
* its protocol version, reason unknown
*/
#define LIBGAMMA_PROTOCOL_VERSION_QUERY_FAILED (-37)
/**
* The adjustment method's version of its
* protocol is not supported
*/
#define LIBGAMMA_PROTOCOL_VERSION_NOT_SUPPORTED (-38)
/**
* The adjustment method failed to list
* available partitions, reason unknown
*/
#define LIBGAMMA_LIST_PARTITIONS_FAILED (-39)
/**
* Partition exists by index, but the partition
* at that index does not exist
*/
#define LIBGAMMA_NULL_PARTITION (-40)
/**
* There is not monitor connected to the
* connector of the selected CRTC
*/
#define LIBGAMMA_NOT_CONNECTED (-41)
/**
* Data extraction from a reply from the
* adjustment method failed, reason unknown
*/
#define LIBGAMMA_REPLY_VALUE_EXTRACTION_FAILED (-42)
/**
* No EDID property was found on the output
*/
#define LIBGAMMA_EDID_NOT_FOUND (-43)
/**
* Failed to list properties on the output,
* reason unknown
*/
#define LIBGAMMA_LIST_PROPERTIES_FAILED (-44)
/**
* Failed to query a property's value from
* the output, reason unknown
*/
#define LIBGAMMA_PROPERTY_VALUE_QUERY_FAILED (-45)
/**
* A request for information on an output
* failed, reason unknown
*/
#define LIBGAMMA_OUTPUT_INFORMATION_QUERY_FAILED (-46)
/* DEVELOPERS: Remember to update LIBGAMMA_ERROR_MIN below and LIST_ERRORS in common.h when adding errors */
/**
* The number of the libgamma error with the
* lowest number in the version of the library
* that the program is compiled against
*/
#define LIBGAMMA_ERROR_MIN (-46)
/**
* The number of the libgamma error with the
* lowest number in the version of the library
* that the program is linked against
*/
extern const int libgamma_error_min;
/**
* The identifier for the dummy adjustment method
*
* This method can be configured and is useful for
* testing your program's ability to handle errors
*/
#define LIBGAMMA_METHOD_DUMMY 0
/**
* The identifier for the adjustment method with
* uses the RandR protocol under the X display server
*/
#define LIBGAMMA_METHOD_X_RANDR 1
/**
* The identifier for the adjustment method with
* uses the VidMode protocol under the X display server
*
* This is an older alternative to RandR that can
* work on some drivers that are not supported by RandR,
* however it can only control the primary CRTC per
* screen (partition)
*/
#define LIBGAMMA_METHOD_X_VIDMODE 2
/**
* The identifier for the Direct Rendering Manager
* adjustment method that is available in Linux
* (built in to the Linux kernel with a userland
* library for access) and is a part of the
* Direct Rendering Infrastructure.
*
* This adjustment method will work when you are
* in non-graphical mode; however a display server
* cannot be started while this is running, but it
* can be started while a display server is running
*/
#define LIBGAMMA_METHOD_LINUX_DRM 3
/**
* The identifier for the Graphics Device Interface
* adjustment method that is available in Windows
*
* This method is not well tested; it can be compiled
* to be available under X.org using a translation layer
*/
#define LIBGAMMA_METHOD_W32_GDI 4
/**
* The identifier for the CoreGraphics adjustment
* method that is available in Mac OS X that can
* adjust gamma ramps under the Quartz display server
*
* This method is not well tested; it can be compiled
* to be available under X.org using a translation layer
*/
#define LIBGAMMA_METHOD_QUARTZ_CORE_GRAPHICS 5
/* DEVELOPERS: Remember to update LIBGAMMA_METHOD_COUNT below and LIST_METHODS in common.h when adding methods */
/**
* The number adjustment methods provided by the
* version this library the program is compiled
* against
*
* This number includes both compile-time enabled
* and compile-time disabled adjustment methods
*/
#define LIBGAMMA_METHOD_COUNT 6
/**
* The number adjustment methods provided by the
* version this library the program is linked
* against
*
* This number includes both compile-time enabled
* and compile-time disabled adjustment methods
*/
extern const int libgamma_method_count;
/**
* Types for connectors
*/
enum libgamma_connector_type {
/**
* The adjustment method does not know the connector's type
*
* (This could be considered an error)
*/
LIBGAMMA_CONNECTOR_TYPE_Unknown = 0,
/**
* Video Graphics Array (VGA)
*/
LIBGAMMA_CONNECTOR_TYPE_VGA,
/**
* Digital Visual Interface, unknown type
*/
LIBGAMMA_CONNECTOR_TYPE_DVI,
/**
* Digital Visual Interface, integrated (DVI-I)
*/
LIBGAMMA_CONNECTOR_TYPE_DVII,
/**
* Digital Visual Interface, digital only (DVI-D)
*/
LIBGAMMA_CONNECTOR_TYPE_DVID,
/**
* Digital Visual Interface, analogue only (DVI-A)
*/
LIBGAMMA_CONNECTOR_TYPE_DVIA,
/**
* Composite video
*/
LIBGAMMA_CONNECTOR_TYPE_Composite,
/**
* Separate Video (S-video)
*/
LIBGAMMA_CONNECTOR_TYPE_SVIDEO,
/**
* Low-voltage differential signaling (LVDS)
*/
LIBGAMMA_CONNECTOR_TYPE_LVDS,
/**
* Component video, usually separate cables for each channel
*/
LIBGAMMA_CONNECTOR_TYPE_Component,
/**
* 9 pin DIN (Deutsches Institut für Normung) connector
*/
LIBGAMMA_CONNECTOR_TYPE_9PinDIN,
/**
* DisplayPort
*/
LIBGAMMA_CONNECTOR_TYPE_DisplayPort,
/**
* High-Definition Multimedia Interface (HDMI), unknown type
*/
LIBGAMMA_CONNECTOR_TYPE_HDMI,
/**
* High-Definition Multimedia Interface, type A (HDMI-A)
*/
LIBGAMMA_CONNECTOR_TYPE_HDMIA,
/**
* High-Definition Multimedia Interface, type B (HDMI-B)
*/
LIBGAMMA_CONNECTOR_TYPE_HDMIB,
/**
* Television, unknown connector
*/
LIBGAMMA_CONNECTOR_TYPE_TV,
/**
* Embedded DisplayPort (eDP)
*/
LIBGAMMA_CONNECTOR_TYPE_eDP,
/**
* A virtual connector
*/
LIBGAMMA_CONNECTOR_TYPE_VIRTUAL,
/**
* Display Serial Interface (DSI)
*/
LIBGAMMA_CONNECTOR_TYPE_DSI,
/**
* LFP connector
*
* (TODO What is a LFP connector?)
*/
LIBGAMMA_CONNECTOR_TYPE_LFP,
/**
* DPI connector
*
* (TODO What is a DPI connector?)
*/
LIBGAMMA_CONNECTOR_TYPE_DPI,
/**
* A writeback connector
*
* (TODO What is the difference between Virtual and Writeback?)
*/
LIBGAMMA_CONNECTOR_TYPE_WRITEBACK,
/**
* SPI connector
*
* (TODO What is an SPI connector?)
*/
LIBGAMMA_CONNECTOR_TYPE_SPI
/* DEVELOPERS: Remember to update LIBGAMMA_CONNECTOR_TYPE_COUNT below
* and LIST_CONNECTOR_TYPES in common.h when adding methods */
};
/**
* The number of values defined in `libgamma_connector_type_t`
* in the version of the library the program is compiled against
*/
#define LIBGAMMA_CONNECTOR_TYPE_COUNT 23
/**
* The number of values defined in `libgamma_connector_type_t`
* in the version of the library the program is linked against
*/
extern const int libgamma_connector_type_count;
/**
* Orders for subpixels
*
* Currently the possible values are very biased
* to LCD, Plasma and monochrome monitors
*/
enum libgamma_subpixel_order {
/**
* The adjustment method does not know the order of the subpixels
*
* (This could be considered an error)
*/
LIBGAMMA_SUBPIXEL_ORDER_UNKNOWN = 0,
/**
* There are no subpixels in the monitor
*/
LIBGAMMA_SUBPIXEL_ORDER_NONE,
/**
* The subpixels are ordered red, green and then blue, from left to right
*/
LIBGAMMA_SUBPIXEL_ORDER_HORIZONTAL_RGB,
/**
* The subpixels are ordered blue, green and then red, from left to right
*/
LIBGAMMA_SUBPIXEL_ORDER_HORIZONTAL_BGR,
/**
* The subpixels are ordered red, green and then blue, from the top down
*/
LIBGAMMA_SUBPIXEL_ORDER_VERTICAL_RGB,
/**
* The subpixels are ordered blue, green and then red, from the top down
*/
LIBGAMMA_SUBPIXEL_ORDER_VERTICAL_BGR
/* DEVELOPERS: Remember to update LIBGAMMA_SUBPIXEL_ORDER_COUNT below
* and LIST_SUBPIXEL_ORDERS in common.h when adding methods */
};
/**
* The number of values defined in `libgamma_subpixel_order_t`
* in the version of the library the program is compiled against
*/
#define LIBGAMMA_SUBPIXEL_ORDER_COUNT 6
/**
* The number of values defined in `libgamma_subpixel_order_t`
* in the version of the library the program is linked against
*/
extern const int libgamma_subpixel_order_count;
/**
* Answer enum to a decision problem
*/
enum libgamma_decision {
/**
* The answer is negative
*/
LIBGAMMA_NO = 0,
/**
* The answer is unknown
*/
LIBGAMMA_MAYBE = 1,
/**
* The answer is positive
*/
LIBGAMMA_YES = 2
};
/**
* Capabilities of adjustment methods
*/
struct libgamma_method_capabilities {
/**
* OR of the CRTC information fields in `libgamma_crtc_information_t`
* that may (but can fail) be read successfully
*
* @since Always, deprecated as of .struct_version==1, replaced by .crtc_information
*/
int32_t crtc_information__old;
/**
* Whether the default site is known, if true the site is integrated
* to the system or can be determined using environment variables
*
* @since Always
*/
unsigned default_site_known : 1;
/**
* Whether the adjustment method supports multiple sites rather
* than just the default site
*
* @since Always
*/
unsigned multiple_sites : 1;
/**
* Whether the adjustment method supports multiple partitions
* per site
*
* @since Always
*/
unsigned multiple_partitions : 1;
/**
* Whether the adjustment method supports multiple CRTC:s
* per partition per site
*
* @since Always
*/
unsigned multiple_crtcs : 1;
/**
* Whether the partition to graphics card is a bijection
*
* @since Always
*/
unsigned partitions_are_graphics_cards : 1;
/**
* Whether the adjustment method supports `libgamma_site_restore`
*
* @since Always
*/
unsigned site_restore : 1;
/**
* Whether the adjustment method supports `libgamma_partition_restore`
*
* @since Always
*/
unsigned partition_restore : 1;
/**
* Whether the adjustment method supports `libgamma_crtc_restore`
*
* @since Always
*/
unsigned crtc_restore : 1;
/**
* Whether the `red_gamma_size`, `green_gamma_size` and `blue_gamma_size`
* fields in `libgamma_crtc_information_t` will always have the same
* values as each other for the adjustment method
*
* @since Always
*/
unsigned identical_gamma_sizes : 1;
/**
* Whether the `red_gamma_size`, `green_gamma_size` and `blue_gamma_size`
* fields in `libgamma_crtc_information_t` will always be filled with the
* same value for the adjustment method
*
* @since Always
*/
unsigned fixed_gamma_size : 1;
/**
* Whether the `gamma_depth` field in `libgamma_crtc_information_t`
* will always be filled with the same value for the adjustment method
*
* @since Always
*/
unsigned fixed_gamma_depth : 1;
/**
* Whether the adjustment method will actually perform adjustments
*
* @since Always
*/
unsigned real : 1;
/**
* Whether the adjustment method is implement using a translation layer
*
* @since Always
*/
unsigned fake : 1;
/**
* Whether adjustments are undone when the process disconnects from
* the display server
*
* @since Always
*/
unsigned auto_restore : 1;
/**
* Set by the library to inform the program which fields
* have been set
*
* @since .struct_version==1 (version 0.8 of the library, which made
* `libgamma_method_capabilities` a 3-parameter function)
*/
int struct_version;
/**
* OR of the CRTC information fields in `libgamma_crtc_information_t`
* that may (but can fail) be read successfully
*
* @since .struct_version==1, replaces .crtc_information__old (previously named .crtc_information)
*/
unsigned long long crtc_information;
};
/**
* The number the version of the library the program is
* compiled against will set the `struct_version` field
* in `libgamma_method_capabilities_t` to; note that the
* version of the library the program is linked against
* may set it to another value
*/
#define LIBGAMMA_METHOD_CAPABILITIES_STRUCT_VERSION 1
/**
* Site state
*
* On operating systems that integrate a graphical environment
* there is usually just one site. However, one systems with
* pluggable graphics, like Unix-like systems such as Linux
* and the BSD:s, there can usually be any (feasible) number
* of sites. In X.org parlance they are called displays.
*/
struct libgamma_site_state {
/**
* Adjustment method implementation specific data
*
* You as a user of this library should not touch this
*/
void *data;
/**
* This field specifies, for the methods if this library,
* which adjustment method (display server and protocol)
* is used to adjust the gamma ramps
*/
int method;
/**
* The site identifier. It can either be `NULL` or a string.
* `NULL` indicates the default site. On systems like the
* Unix-like systems, where the graphics are pluggable, this
* is usually resolved by an environment variable, such as
* "DISPLAY" for X.org.
*/
char *site;
/**
* The number of partitions that is available on this site.
* Probably the majority of display server only one partition
* per site. However, X.org can, and traditional used to have
* on multi-headed environments, multiple partitions per site.
* In X.org partitions are called 'screens'. It is not to be
* confused with monitor. A screen is a collection of monitors,
* and the mapping from monitors to screens is a surjection.
* On hardware-level adjustment methods, such as Direct
* Rendering Manager, a partition is a graphics card.
*/
size_t partitions_available;
};
/**
* Partition state
*
* Probably the majority of display server only one partition
* per site. However, X.org can, and traditional used to have
* on multi-headed environments, multiple partitions per site.
* In X.org partitions are called 'screens'. It is not to be
* confused with monitor. A screen is a collection of monitors,
* and the mapping from monitors to screens is a surjection.
* On hardware-level adjustment methods, such as Direct
* Rendering Manager, a partition is a graphics card.
*/
struct libgamma_partition_state {
/**
* Adjustment method implementation specific data
*
* You as a user of this library should not touch this
*/
void *data;
/**
* The site this partition belongs to
*/
struct libgamma_site_state *site;
/**
* The index of the partition
*/
size_t partition;
/**
* The number of CRTC:s that are available
* under this partition
*
* Note that the CRTC:s are not necessarily
* online
*/
size_t crtcs_available;
};
/**
* Cathode ray tube controller state
*
* The CRTC controls the gamma ramps for the
* monitor that is plugged in to the connector
* that the CRTC belongs to
*/
struct libgamma_crtc_state {
/**
* Adjustment method implementation specific data
*
* You as a user of this library should not touch this
*/
void *data;
/**
* The partition this CRTC belongs to
*/
struct libgamma_partition_state *partition;
/**
* The index of the CRTC within its partition
*/
size_t crtc;
};
/**
* Cathode ray tube controller information data structure
*/
struct libgamma_crtc_information {
/**
* For a `libgamma_crtc_information_t` fill in the values for
* `edid` and `edid_length` and report errors to `edid_error`
*/
#define LIBGAMMA_CRTC_INFO_EDID (1ULL << 0)
/**
* The Extended Display Identification Data associated with
* the attached monitor.
*
* This is raw byte array that is usually 128 bytes long.
* It is not NUL-terminate, rather its length is stored in
* `edid_length`.
*
* @since Always
*/
unsigned char *edid;
/**
* The length of `edid`
*
* @since Always
*/
size_t edid_length;
/**
* Zero on success, positive it holds the value `errno` had
* when the reading failed, otherwise (negative) the value
* of an error identifier provided by this library
*
* @since Always
*/
int edid_error;
/**
* For a `libgamma_crtc_information_t` fill in the value
* for `width_mm` and report errors to `width_mm_error`
*/
#define LIBGAMMA_CRTC_INFO_WIDTH_MM (1ULL << 1)
/**
* The phyical width, in millimetres, of the viewport of the
* attached monitor, as reported by the adjustment method
*
* This value may be incorrect, which is a known issue with
* the X server where it is the result of the X server
* attempting the estimate the size on its own
*
* Zero means that its is not applicable, which is the case
* for projectors
*
* @since Always
*/
size_t width_mm;
/**
* Zero on success, positive it holds the value `errno` had
* when the reading failed, otherwise (negative) the value
* of an error identifier provided by this library
*
* @since Always
*/
int width_mm_error;
/**
* For a `libgamma_crtc_information_t` fill in the value
* for `height_mm` and report errors to `height_mm_error`
*/
#define LIBGAMMA_CRTC_INFO_HEIGHT_MM (1ULL << 2)
/**
* The phyical height, in millimetres, of the viewport of the
* attached monitor, as reported by the adjustment method
*
* This value may be incorrect, which is a known issue with
* the X server where it is the result of the X server
* attempting the estimate the size on its own
*
* Zero means that its is not applicable, which is the case
* for projectors
*
* @since Always
*/
size_t height_mm;
/**
* Zero on success, positive it holds the value `errno` had
* when the reading failed, otherwise (negative) the value
* of an error identifier provided by this library
*
* @since Always
*/
int height_mm_error;