aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-06-01 05:38:58 +0200
committerMattias Andrée <maandree@operamail.com>2014-06-01 05:38:58 +0200
commit9f8c3fb80740d91074b4b08a2cd4e6a729c17086 (patch)
treeb7eec53a1fe4280e922607cfca46f6287e0c55e2
parentm + m fixes + doc (diff)
downloadlibgamma-9f8c3fb80740d91074b4b08a2cd4e6a729c17086.tar.gz
libgamma-9f8c3fb80740d91074b4b08a2cd4e6a729c17086.tar.bz2
libgamma-9f8c3fb80740d91074b4b08a2cd4e6a729c17086.tar.xz
m + m doc
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/lib/gamma-linux-drm.c23
-rw-r--r--src/lib/gamma-x-randr.c22
-rw-r--r--src/lib/gamma-x-vidmode.c6
-rw-r--r--src/lib/libgamma-method.h36
4 files changed, 63 insertions, 24 deletions
diff --git a/src/lib/gamma-linux-drm.c b/src/lib/gamma-linux-drm.c
index 36ba442..2644da8 100644
--- a/src/lib/gamma-linux-drm.c
+++ b/src/lib/gamma-linux-drm.c
@@ -88,29 +88,30 @@ typedef struct libgamma_drm_card_data
*/
void libgamma_linux_drm_method_capabilities(libgamma_method_capabilities_t* restrict this)
{
- this->crtc_information = LIBGAMMA_CRTC_INFO_EDID
- | LIBGAMMA_CRTC_INFO_WIDTH_MM
- | LIBGAMMA_CRTC_INFO_HEIGHT_MM
- | LIBGAMMA_CRTC_INFO_WIDTH_MM_EDID
- | LIBGAMMA_CRTC_INFO_HEIGHT_MM_EDID
- | LIBGAMMA_CRTC_INFO_GAMMA_SIZE
- | LIBGAMMA_CRTC_INFO_GAMMA_DEPTH
+ /* Support for all information except gamma ramp support. */
+ this->crtc_information = LIBGAMMA_CRTC_INFO_MACRO_EDID
+ | LIBGAMMA_CRTC_INFO_MACRO_VIEWPORT
+ | LIBGAMMA_CRTC_INFO_MACRO_RAMP
| LIBGAMMA_CRTC_INFO_SUBPIXEL_ORDER
| LIBGAMMA_CRTC_INFO_ACTIVE
- | LIBGAMMA_CRTC_INFO_CONNECTOR_NAME
- | LIBGAMMA_CRTC_INFO_CONNECTOR_TYPE
- | LIBGAMMA_CRTC_INFO_GAMMA;
+ | LIBGAMMA_CRTC_INFO_MACRO_CONNECTOR;
+ /* DRM supports multiple partitions and CRTC:s but not sites. */
this->default_site_known = 1;
this->multiple_sites = 0;
this->multiple_partitions = 1;
this->multiple_crtcs = 1;
+ /* Partitions are graphics cards in DRM. */
this->partitions_are_graphics_cards = 1;
+ /* Linux does not have system restore capabilities. */
this->site_restore = 0;
this->partition_restore = 0;
this->crtc_restore = 0;
+ /* Gamma ramp sizes are identical but not fixed. */
this->identical_gamma_sizes = 1;
this->fixed_gamma_size = 0;
+ /* Gamma ramp depths are fixed. */
this->fixed_gamma_depth = 1;
+ /* DRM is a real non-faked adjustment method */
this->real = 1;
this->fake = 0;
}
@@ -139,7 +140,7 @@ int libgamma_linux_drm_site_initialise(libgamma_site_state_t* restrict this,
return LIBGAMMA_NO_SUCH_SITE;
/* Count the number of available graphics cards by
- * stat:ing there existence in an API filesystem. */
+ stat:ing there existence in an API filesystem. */
this->partitions_available = 0;
for (;;)
{
diff --git a/src/lib/gamma-x-randr.c b/src/lib/gamma-x-randr.c
index ad07e97..f907cdd 100644
--- a/src/lib/gamma-x-randr.c
+++ b/src/lib/gamma-x-randr.c
@@ -132,33 +132,35 @@ static int translate_error(int error_code, int default_error, int return_errno)
void libgamma_x_randr_method_capabilities(libgamma_method_capabilities_t* restrict this)
{
char* display = getenv("DISPLAY");
- this->crtc_information = LIBGAMMA_CRTC_INFO_EDID
- | LIBGAMMA_CRTC_INFO_WIDTH_MM
- | LIBGAMMA_CRTC_INFO_HEIGHT_MM
- | LIBGAMMA_CRTC_INFO_WIDTH_MM_EDID
- | LIBGAMMA_CRTC_INFO_HEIGHT_MM_EDID
- | LIBGAMMA_CRTC_INFO_GAMMA_SIZE
- | LIBGAMMA_CRTC_INFO_GAMMA_DEPTH
+ /* Support for all information except active status and gamma ramp support. */
+ this->crtc_information = LIBGAMMA_CRTC_INFO_MACRO_EDID
+ | LIBGAMMA_CRTC_INFO_MACRO_VIEWPORT
+ | LIBGAMMA_CRTC_INFO_MACRO_RAMP
| LIBGAMMA_CRTC_INFO_SUBPIXEL_ORDER
- | LIBGAMMA_CRTC_INFO_CONNECTOR_NAME
- | LIBGAMMA_CRTC_INFO_CONNECTOR_TYPE
- | LIBGAMMA_CRTC_INFO_GAMMA;
+ | LIBGAMMA_CRTC_INFO_MACRO_CONNECTOR;
+ /* X RandR supports multiple sites, partitions and CRTC:s. */
this->default_site_known = (display && *display) ? 1 : 0;
this->multiple_sites = 1;
this->multiple_partitions = 1;
this->multiple_crtcs = 1;
+ /* Partitions are screens and not graphics cards in X. */
this->partitions_are_graphics_cards = 0;
+ /* X does not have system restore capabilities. */
this->site_restore = 0;
this->partition_restore = 0;
this->crtc_restore = 0;
+ /* Gamma ramp sizes are identical but not fixed. */
this->identical_gamma_sizes = 1;
this->fixed_gamma_size = 0;
+ /* Gamma ramp depths are fixed. */
this->fixed_gamma_depth = 1;
+ /* X RandR is a real non-faked adjustment method */
this->real = 1;
this->fake = 0;
}
+/* xcb violates the rule to never return struct:s. */
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Waggregate-return"
diff --git a/src/lib/gamma-x-vidmode.c b/src/lib/gamma-x-vidmode.c
index 170d3b4..654995c 100644
--- a/src/lib/gamma-x-vidmode.c
+++ b/src/lib/gamma-x-vidmode.c
@@ -38,11 +38,11 @@
void libgamma_x_vidmode_method_capabilities(libgamma_method_capabilities_t* restrict this)
{
char* restrict display = getenv("DISPLAY");
- /* Gamma ramps size anddepth can be queried. */
+ /* Gamma ramps size and depth can be queried. */
this->crtc_information = LIBGAMMA_CRTC_INFO_GAMMA_SIZE
| LIBGAMMA_CRTC_INFO_GAMMA_DEPTH;
- /* X VidMode supports multiple sits and partitions but not CRTC:s. */
- this->default_site_known = (display && *display);
+ /* X VidMode supports multiple sites and partitions but not CRTC:s. */
+ this->default_site_known = (display && *display) ? 1 : 0;
this->multiple_sites = 1;
this->multiple_partitions = 1;
this->multiple_crtcs = 0;
diff --git a/src/lib/libgamma-method.h b/src/lib/libgamma-method.h
index 8496631..df95f87 100644
--- a/src/lib/libgamma-method.h
+++ b/src/lib/libgamma-method.h
@@ -542,6 +542,42 @@ typedef enum libgamma_subpixel_order
*/
#define LIBGAMMA_CRTC_INFO_COUNT 13
+/**
+ * Macro for all `libgamma_crtc_information_t` fields
+ * that can be filled if the adjustment method have
+ * support for reading the monitors' Extended Display
+ * Information Data.
+ */
+#define LIBGAMMA_CRTC_INFO_MACRO_EDID ( LIBGAMMA_CRTC_INFO_EDID \
+ | LIBGAMMA_CRTC_INFO_WIDTH_MM_EDID \
+ | LIBGAMMA_CRTC_INFO_HEIGHT_MM_EDID \
+ | LIBGAMMA_CRTC_INFO_GAMMA )
+
+/**
+ * Macro for both `libgamma_crtc_information_t` fields
+ * that can specify the size of the monitors viewport
+ * is provided by the adjustment method without this
+ * library having to parse the monitor's Extended Display
+ * Information Data.
+ */
+#define LIBGAMMA_CRTC_INFO_MACRO_VIEWPORT (LIBGAMMA_CRTC_INFO_WIDTH_MM | LIBGAMMA_CRTC_INFO_HEIGHT_MM)
+
+/**
+ * Macro for the `libgamma_crtc_information_t` fields
+ * that specifies the CRTC's gamma ramp sizes and gamma
+ * ramp depth.
+ */
+#define LIBGAMMA_CRTC_INFO_MACRO_RAMP (LIBGAMMA_CRTC_INFO_GAMMA_SIZE | LIBGAMMA_CRTC_INFO_GAMMA_DEPTH)
+
+/**
+ * Macro for the `libgamma_crtc_information_t` fields
+ * that specifies the CRTC's connector type and the
+ * partition unique name of the connector.
+ */
+#define LIBGAMMA_CRTC_INFO_MACRO_CONNECTOR ( LIBGAMMA_CRTC_INFO_CONNECTOR_NAME \
+ | LIBGAMMA_CRTC_INFO_CONNECTOR_TYPE )
+
+
/**
* Cathode ray tube controller information data structure.