aboutsummaryrefslogtreecommitdiffstats
path: root/src/gamma-linux-drm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gamma-linux-drm.c')
-rw-r--r--src/gamma-linux-drm.c60
1 files changed, 49 insertions, 11 deletions
diff --git a/src/gamma-linux-drm.c b/src/gamma-linux-drm.c
index f6b40a8..f33e07a 100644
--- a/src/gamma-linux-drm.c
+++ b/src/gamma-linux-drm.c
@@ -22,6 +22,9 @@
#include "gamma-linux-drm.h"
#include "libgamma-error.h"
+#include "gamma-helper.h"
+
+#include <errno.h>
/**
@@ -31,6 +34,30 @@
*/
void libgamma_linux_drm_method_capabilities(libgamma_method_capabilities_t* restrict this)
{
+ this->crtc_information = CRTC_INFO_EDID
+ | CRTC_INFO_WIDTH_MM
+ | CRTC_INFO_HEIGHT_MM
+ | CRTC_INFO_WIDTH_MM_EDID
+ | CRTC_INFO_HEIGHT_MM_EDID
+ | CRTC_INFO_GAMMA_SIZE
+ | CRTC_INFO_GAMMA_DEPTH
+ | CRTC_INFO_SUBPIXEL_ORDER
+ | CRTC_INFO_CONNECTOR_NAME
+ | CRTC_INFO_CONNECTOR_TYPE
+ | CRTC_INFO_GAMMA;
+ this->default_site_known = NULL;
+ this->multiple_sites = 0;
+ this->multiple_partitions = 1;
+ this->multiple_crtcs = 1;
+ this->partitions_are_graphics_cards = 1;
+ this->site_restore = 0;
+ this->partition_restore = 0;
+ this->crtc_restore = 0;
+ this->identical_gamma_sizes = 1;
+ this->fixed_gamma_size = 0;
+ this->fixed_gamma_depth = 1;
+ this->real = 1;
+ this->fake = 0;
}
@@ -72,6 +99,8 @@ void libgamma_linux_drm_site_destroy(libgamma_site_state_t* restrict this)
*/
int libgamma_linux_drm_site_restore(libgamma_site_state_t* restrict this)
{
+ (void) this;
+ return errno = ENOTSUP, LIBGAMMA_ERRNO_SET;
}
@@ -102,17 +131,6 @@ void libgamma_linux_drm_partition_destroy(libgamma_partition_state_t* restrict t
/**
- * Release all resources held by a partition state
- * and free the partition state pointer
- *
- * @param this The partition state
- */
-void libgamma_linux_drm_partition_free(libgamma_partition_state_t* restrict this)
-{
-}
-
-
-/**
* Restore the gamma ramps all CRTCS with a partition to the system settings
*
* @param this The partition state
@@ -121,6 +139,8 @@ void libgamma_linux_drm_partition_free(libgamma_partition_state_t* restrict this
*/
int libgamma_linux_drm_partition_restore(libgamma_partition_state_t* restrict this)
{
+ (void) this;
+ return errno = ENOTSUP, LIBGAMMA_ERRNO_SET;
}
@@ -170,6 +190,8 @@ void libgamma_linux_drm_crtc_free(libgamma_crtc_state_t* restrict this)
*/
int libgamma_linux_drm_crtc_restore(libgamma_crtc_state_t* restrict this)
{
+ (void) this;
+ return errno = ENOTSUP, LIBGAMMA_ERRNO_SET;
}
@@ -228,6 +250,8 @@ int libgamma_linux_drm_crtc_set_gamma_ramps(libgamma_crtc_state_t* restrict this
int libgamma_linux_drm_crtc_get_gamma_ramps32(libgamma_crtc_state_t* restrict this,
libgamma_gamma_ramps32_t* restrict ramps)
{
+ return libgamma_translated_ramp_get(this, ramps, 32, 16,
+ libgamma_linux_drm_crtc_get_gamma_ramps);
}
@@ -242,6 +266,8 @@ int libgamma_linux_drm_crtc_get_gamma_ramps32(libgamma_crtc_state_t* restrict th
int libgamma_linux_drm_crtc_set_gamma_ramps32(libgamma_crtc_state_t* restrict this,
libgamma_gamma_ramps32_t ramps)
{
+ return libgamma_translated_ramp_set(this, ramps, 32, 16,
+ libgamma_linux_drm_crtc_set_gamma_ramps);
}
@@ -257,6 +283,8 @@ int libgamma_linux_drm_crtc_set_gamma_ramps32(libgamma_crtc_state_t* restrict th
int libgamma_linux_drm_crtc_get_gamma_ramps64(libgamma_crtc_state_t* restrict this,
libgamma_gamma_ramps64_t* restrict ramps)
{
+ return libgamma_translated_ramp_get(this, ramps, 64, 16,
+ libgamma_linux_drm_crtc_get_gamma_ramps);
}
@@ -271,6 +299,8 @@ int libgamma_linux_drm_crtc_get_gamma_ramps64(libgamma_crtc_state_t* restrict th
int libgamma_linux_drm_crtc_set_gamma_ramps64(libgamma_crtc_state_t* restrict this,
libgamma_gamma_ramps64_t ramps)
{
+ return libgamma_translated_ramp_set(this, ramps, 64, 16,
+ libgamma_linux_drm_crtc_set_gamma_ramps);
}
@@ -286,6 +316,8 @@ int libgamma_linux_drm_crtc_set_gamma_ramps64(libgamma_crtc_state_t* restrict th
int libgamma_linux_drm_crtc_get_gamma_rampsf(libgamma_crtc_state_t* restrict this,
libgamma_gamma_rampsf_t* restrict ramps)
{
+ return libgamma_translated_ramp_get(this, ramps, -1, 16,
+ libgamma_linux_drm_crtc_get_gamma_ramps);
}
@@ -300,6 +332,8 @@ int libgamma_linux_drm_crtc_get_gamma_rampsf(libgamma_crtc_state_t* restrict thi
int libgamma_linux_drm_crtc_set_gamma_rampsf(libgamma_crtc_state_t* restrict this,
libgamma_gamma_rampsf_t ramps)
{
+ return libgamma_translated_ramp_set(this, ramps, -1, 16,
+ libgamma_linux_drm_crtc_set_gamma_ramps);
}
@@ -314,6 +348,8 @@ int libgamma_linux_drm_crtc_set_gamma_rampsf(libgamma_crtc_state_t* restrict thi
int libgamma_linux_drm_crtc_get_gamma_rampsd(libgamma_crtc_state_t* restrict this,
libgamma_gamma_rampsd_t* restrict ramps)
{
+ return libgamma_translated_ramp_get(this, ramps, -2, 16,
+ libgamma_linux_drm_crtc_get_gamma_ramps);
}
@@ -328,5 +364,7 @@ int libgamma_linux_drm_crtc_get_gamma_rampsd(libgamma_crtc_state_t* restrict thi
int libgamma_linux_drm_crtc_set_gamma_rampsd(libgamma_crtc_state_t* restrict this,
libgamma_gamma_rampsd_t ramps)
{
+ return libgamma_translated_ramp_set(this, ramps, -2, 16,
+ libgamma_linux_drm_crtc_set_gamma_ramps);
}