aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-08-04 01:15:35 +0200
committerMattias Andrée <maandree@kth.se>2016-08-04 01:15:35 +0200
commita2728d045a5a9ca442851639ad85d186451a0802 (patch)
tree8c0bd454570e5190b2f6ebb1b5247ac061f2a10d
parentFix bugs (diff)
downloadlibcoopgamma-a2728d045a5a9ca442851639ad85d186451a0802.tar.gz
libcoopgamma-a2728d045a5a9ca442851639ad85d186451a0802.tar.bz2
libcoopgamma-a2728d045a5a9ca442851639ad85d186451a0802.tar.xz
Prepare for supporting the update to get-gamma-info: colourspace information
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--doc/man/libcoopgamma.h.077
-rw-r--r--doc/man/libcoopgamma_get_gamma_info_recv.364
-rw-r--r--doc/man/libcoopgamma_get_gamma_info_sync.364
-rw-r--r--src/libcoopgamma.c22
-rw-r--r--src/libcoopgamma.h107
5 files changed, 334 insertions, 0 deletions
diff --git a/doc/man/libcoopgamma.h.0 b/doc/man/libcoopgamma.h.0
index 15fb38f..73a0b8a 100644
--- a/doc/man/libcoopgamma.h.0
+++ b/doc/man/libcoopgamma.h.0
@@ -120,6 +120,30 @@ Only remove the filter when it is explicitly requested.
The
.B <libcoopgamma.h>
header defines
+.I "enum libcoopgamma_colourspace"
+with the alias
+.I libcoopgamma_colourspace_t
+and the following distinct values:
+.TP
+.BR LIBCOOPGAMMA_UNKNOWN " = 0"
+The monitor's colourspace is unknown.
+.TP
+.BR LIBCOOPGAMMA_SRGB " > 0"
+The monitor uses sRGB as its colourspace.
+.TP
+.BR LIBCOOPGAMMA_RGB " > 0"
+The monitor uses an RGB colourspace other than sRGB.
+.TP
+.BR LIBCOOPGAMMA_NON_RGB " > 0"
+The monitor uses a non-RGB multicolour colourspace.
+.TP
+.BR LIBCOOPGAMMA_GREY " > 0"
+The monitor uses a singlecolour scale colourspace,
+possibility greyscale, or is monochrome.
+.P
+The
+.B <libcoopgamma.h>
+header defines
.I "struct libcoopgamma_ramps8"
.RI ( libcoopgamma_ramps8_t ),
.I "struct libcoopgamma_ramps16"
@@ -250,6 +274,59 @@ The number of stops in the green ramp.
.TP
.B "size_t blue_size"
The number of stops in the blue ramp.
+.TP
+.B "enum libcoopgamma_colourspace colourspace"
+The monitor's colurspace.
+.TP
+.B "int have_gamut"
+Is the gamut of the monitor known?
+If, and only if, so,
+.IR .red_x ,
+.IR .red_y ,
+.IR .green_x ,
+.IR .green_y ,
+.IR .blue_x ,
+.IR .blue_y ,
+.IR .white_x ,
+and
+.IR .white_y
+are set. Unless the monitor uses an
+RGB colourspace, this value should
+be false, but there is no guarantee
+of this, you have to check that the
+colourspace is an RGB colourspace.
+.TP
+.B "unsigned red_x"
+The x-value (CIE xyY) of the monitor's
+red colour, multiplied by 1024.
+.TP
+.B "unsigned red_y"
+The y-value (CIE xyY) of the monitor's
+red colour, multiplied by 1024.
+.TP
+.B "unsigned green_x"
+The x-value (CIE xyY) of the monitor's
+green colour, multiplied by 1024.
+.TP
+.B "unsigned green_y"
+The y-value (CIE xyY) of the monitor's
+green colour, multiplied by 1024.
+.TP
+.B "unsigned blue_x"
+The x-value (CIE xyY) of the monitor's
+blue colour, multiplied by 1024.
+.TP
+.B "unsigned blue_y"
+The y-value (CIE xyY) of the monitor's
+blue colour, multiplied by 1024.
+.TP
+.B "unsigned white_x"
+The x-value (CIE xyY) of the monitor's
+default white point, multiplied by 1024.
+.TP
+.B "unsigned white_y"
+The y-value (CIE xyY) of the monitor's
+default white point, multiplied by 1024.
.P
The
.B <libcoopgamma.h>
diff --git a/doc/man/libcoopgamma_get_gamma_info_recv.3 b/doc/man/libcoopgamma_get_gamma_info_recv.3
index b9822f2..1307fe5 100644
--- a/doc/man/libcoopgamma_get_gamma_info_recv.3
+++ b/doc/man/libcoopgamma_get_gamma_info_recv.3
@@ -59,6 +59,70 @@ The number of stops on the blue gamma ramp.
.TP
.I info->depth
Describes the gamma ramp types used for the CRTC.
+.P
+The
+.BR libcoopgamma_get_gamma_info_recv ()
+will also store monitor's colourspace information in
+.IR *info .
+In particular,
+.I info->colourspace
+will be set to
+.IR LIBCOOPGAMMA_SRGB ,
+.IR LIBCOOPGAMMA_RGB ,
+.IR LIBCOOPGAMMA_NON_RGB ,
+.IR LIBCOOPGAMMA_GREY ,
+or
+.IR LIBCOOPGAMMA_UNKNOWN ,
+and
+.I info->have_gamut
+will be set to 1 or 0.
+.I info->have_gamut
+should be set to 0 unless
+.I info->colourspace
+is set to
+.I LIBCOOPGAMMA_SRGB
+or
+.IR LIBCOOPGAMMA_RGB ,
+and it should be set to 1 if
+.I info->colourspace
+is set to
+.I LIBCOOPGAMMA_SRGB ,
+however there are no guarantees that
+this is true. If
+.I info->have_gamut
+is non-zero, the following will also be set:
+.TP
+.I info->red_x
+The x-value (CIE xyY) of the monitor's
+red colour, multiplied by 1024.
+.TP
+.I info->red_y
+The y-value (CIE xyY) of the monitor's
+red colour, multiplied by 1024.
+.TP
+.I info->green_x
+The x-value (CIE xyY) of the monitor's
+green colour, multiplied by 1024.
+.TP
+.I info->green_y
+The y-value (CIE xyY) of the monitor's
+green colour, multiplied by 1024.
+.TP
+.I info->blue_x
+The x-value (CIE xyY) of the monitor's
+blue colour, multiplied by 1024.
+.TP
+.I info->blue_y
+The y-value (CIE xyY) of the monitor's
+blue colour, multiplied by 1024.
+.TP
+.I info->white_x
+The x-value (CIE xyY) of the monitor's
+default white point, multiplied by 1024.
+.TP
+.I info->white_y
+The y-value (CIE xyY) of the monitor's
+default white point, multiplied by 1024.
.SH "RETURN VALUES"
Upon successful completion, the
.BR libcoopgamma_get_gamma_info_recv ()
diff --git a/doc/man/libcoopgamma_get_gamma_info_sync.3 b/doc/man/libcoopgamma_get_gamma_info_sync.3
index b4df1f6..3187231 100644
--- a/doc/man/libcoopgamma_get_gamma_info_sync.3
+++ b/doc/man/libcoopgamma_get_gamma_info_sync.3
@@ -53,6 +53,70 @@ The number of stops on the blue gamma ramp.
.TP
.I info->depth
Describes the gamma ramp types used for the CRTC.
+.P
+The
+.BR libcoopgamma_get_gamma_info_sync ()
+will also store monitor's colourspace information in
+.IR *info .
+In particular,
+.I info->colourspace
+will be set to
+.IR LIBCOOPGAMMA_SRGB ,
+.IR LIBCOOPGAMMA_RGB ,
+.IR LIBCOOPGAMMA_NON_RGB ,
+.IR LIBCOOPGAMMA_GREY ,
+or
+.IR LIBCOOPGAMMA_UNKNOWN ,
+and
+.I info->have_gamut
+will be set to 1 or 0.
+.I info->have_gamut
+should be set to 0 unless
+.I info->colourspace
+is set to
+.I LIBCOOPGAMMA_SRGB
+or
+.IR LIBCOOPGAMMA_RGB ,
+and it should be set to 1 if
+.I info->colourspace
+is set to
+.I LIBCOOPGAMMA_SRGB ,
+however there are no guarantees that
+this is true. If
+.I info->have_gamut
+is non-zero, the following will also be set:
+.TP
+.I info->red_x
+The x-value (CIE xyY) of the monitor's
+red colour, multiplied by 1024.
+.TP
+.I info->red_y
+The y-value (CIE xyY) of the monitor's
+red colour, multiplied by 1024.
+.TP
+.I info->green_x
+The x-value (CIE xyY) of the monitor's
+green colour, multiplied by 1024.
+.TP
+.I info->green_y
+The y-value (CIE xyY) of the monitor's
+green colour, multiplied by 1024.
+.TP
+.I info->blue_x
+The x-value (CIE xyY) of the monitor's
+blue colour, multiplied by 1024.
+.TP
+.I info->blue_y
+The y-value (CIE xyY) of the monitor's
+blue colour, multiplied by 1024.
+.TP
+.I info->white_x
+The x-value (CIE xyY) of the monitor's
+default white point, multiplied by 1024.
+.TP
+.I info->white_y
+The y-value (CIE xyY) of the monitor's
+default white point, multiplied by 1024.
.SH "RETURN VALUES"
Upon successful completion, the
.BR libcoopgamma_get_gamma_info_recv ()
diff --git a/src/libcoopgamma.c b/src/libcoopgamma.c
index 1beeb8a..726ee8c 100644
--- a/src/libcoopgamma.c
+++ b/src/libcoopgamma.c
@@ -410,12 +410,23 @@ size_t libcoopgamma_crtc_info_marshal(const libcoopgamma_crtc_info_t* restrict t
marshal_version(LIBCOOPGAMMA_CRTC_INFO_VERSION);
marshal_version(LIBCOOPGAMMA_DEPTH_VERSION);
marshal_version(LIBCOOPGAMMA_SUPPORT_VERSION);
+ marshal_version(LIBCOOPGAMMA_COLOURSPACE_VERSION);
marshal_prim(this->cooperative, int);
marshal_prim(this->depth, libcoopgamma_depth_t);
marshal_prim(this->red_size, size_t);
marshal_prim(this->green_size, size_t);
marshal_prim(this->blue_size, size_t);
marshal_prim(this->supported, libcoopgamma_support_t);
+ marshal_prim(this->colourspace, libcoopgamma_colourspace_t);
+ marshal_prim(this->have_gamut, int);
+ marshal_prim(this->red_x, unsigned);
+ marshal_prim(this->red_y, unsigned);
+ marshal_prim(this->green_x, unsigned);
+ marshal_prim(this->green_y, unsigned);
+ marshal_prim(this->blue_x, unsigned);
+ marshal_prim(this->blue_y, unsigned);
+ marshal_prim(this->white_x, unsigned);
+ marshal_prim(this->white_y, unsigned);
MARSHAL_EPILOGUE;
}
@@ -436,12 +447,23 @@ int libcoopgamma_crtc_info_unmarshal(libcoopgamma_crtc_info_t* restrict this,
unmarshal_version(LIBCOOPGAMMA_CRTC_INFO_VERSION);
unmarshal_version(LIBCOOPGAMMA_DEPTH_VERSION);
unmarshal_version(LIBCOOPGAMMA_SUPPORT_VERSION);
+ unmarshal_version(LIBCOOPGAMMA_COLOURSPACE_VERSION);
unmarshal_prim(this->cooperative, int);
unmarshal_prim(this->depth, libcoopgamma_depth_t);
unmarshal_prim(this->red_size, size_t);
unmarshal_prim(this->green_size, size_t);
unmarshal_prim(this->blue_size, size_t);
unmarshal_prim(this->supported, libcoopgamma_support_t);
+ unmarshal_prim(this->colourspace, libcoopgamma_colourspace_t);
+ unmarshal_prim(this->have_gamut, int);
+ unmarshal_prim(this->red_x, unsigned);
+ unmarshal_prim(this->red_y, unsigned);
+ unmarshal_prim(this->green_x, unsigned);
+ unmarshal_prim(this->green_y, unsigned);
+ unmarshal_prim(this->blue_x, unsigned);
+ unmarshal_prim(this->blue_y, unsigned);
+ unmarshal_prim(this->white_x, unsigned);
+ unmarshal_prim(this->white_y, unsigned);
UNMARSHAL_EPILOGUE;
}
diff --git a/src/libcoopgamma.h b/src/libcoopgamma.h
index 657592b..a4a21e5 100644
--- a/src/libcoopgamma.h
+++ b/src/libcoopgamma.h
@@ -97,6 +97,13 @@
/**
* Number used to identify implementation
+ * version of `libcoopgamma_colourspace_t`, if it
+ * is ever modified, this number is increased
+ */
+#define LIBCOOPGAMMA_COLOURSPACE_VERSION 0
+
+/**
+ * Number used to identify implementation
* version of `libcoopgamma_ramps*_t`, if they
* are ever modified, this number is increased
*/
@@ -263,6 +270,42 @@ typedef enum libcoopgamma_lifespan
/**
+ * Colourspaces
+ */
+typedef enum libcoopgamma_colourspace
+{
+ /**
+ * The colourspace is unknown
+ *
+ * This value will always be 0
+ */
+ LIBCOOPGAMMA_UNKNOWN = 0,
+
+ /**
+ * sRGB (Standard RGB)
+ */
+ LIBCOOPGAMMA_SRGB = 1,
+
+ /**
+ * RGB other than sRGB
+ */
+ LIBCOOPGAMMA_RGB = 2,
+
+ /**
+ * Non-RGB multicolour
+ */
+ LIBCOOPGAMMA_NON_RGB = 3,
+
+ /**
+ * Monochrome, greyscale, or some
+ * other singlecolour scale
+ */
+ LIBCOOPGAMMA_GREY = 4
+
+} libcoopgamma_colourspace_t;
+
+
+/**
* Define a gamma ramp structure
*
* @param suffix:identifier The end of the name of the `struct`
@@ -471,6 +514,70 @@ typedef struct libcoopgamma_crtc_info
*/
size_t blue_size;
+ /**
+ * The monitor's colurspace
+ */
+ libcoopgamma_colourspace_t colourspace;
+
+ /**
+ * Whether `.red_x`, `.red_y`, `.green_x`,
+ * `.green_y`, `.blue_x`, `.blue_y`,
+ * `.white_x`, and `.white_y` are set.
+ *
+ * If this is true, but the colourspace
+ * is not RGB (or sRGB), there is something
+ * wrong. Please also check the colourspace.
+ */
+ int have_gamut;
+
+ /**
+ * The x-value (CIE xyY) of the monitor's
+ * red colour, multiplied by 1024
+ */
+ unsigned red_x;
+
+ /**
+ * The y-value (CIE xyY) of the monitor's
+ * red colour, multiplied by 1024
+ */
+ unsigned red_y;
+
+ /**
+ * The x-value (CIE xyY) of the monitor's
+ * green colour, multiplied by 1024
+ */
+ unsigned green_x;
+
+ /**
+ * The y-value (CIE xyY) of the monitor's
+ * green colour, multiplied by 1024
+ */
+ unsigned green_y;
+
+ /**
+ * The x-value (CIE xyY) of the monitor's
+ * blue colour, multiplied by 1024
+ */
+ unsigned blue_x;
+
+ /**
+ * The y-value (CIE xyY) of the monitor's
+ * blue colour, multiplied by 1024
+ */
+ unsigned blue_y;
+
+ /**
+ * The x-value (CIE xyY) of the monitor's
+ * default white point, multiplied by 1024
+ */
+ unsigned white_x;
+
+ /**
+ * The y-value (CIE xyY) of the monitor's
+ * default white point, multiplied by 1024
+ */
+ unsigned white_y;
+
} libcoopgamma_crtc_info_t;