summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/blueshift_drm.pyx8
-rw-r--r--src/monitor.py15
2 files changed, 20 insertions, 3 deletions
diff --git a/src/blueshift_drm.pyx b/src/blueshift_drm.pyx
index 001ec41..3576744 100644
--- a/src/blueshift_drm.pyx
+++ b/src/blueshift_drm.pyx
@@ -157,12 +157,12 @@ def drm_get_gamma_ramps(int connection, int crtc_index, int gamma_size):
return None
-def drm_set_gamma_ramps(int connection, int crtc_index, int gamma_size, r_curve, g_curve, b_curve):
+def drm_set_gamma_ramps(int connection, crtc_indices, int gamma_size, r_curve, g_curve, b_curve):
'''
Set the gamma ramps of the of a monitor
@param connection The identifier for the connection to the card
- @param crtc_index The index of the CRTC to read from
+ @param crtc_index:list<int> The index of the CRTC to read from
@param gamma_size The size a gamma ramp
@param r_curve:list<unsigned short int> The red gamma ramp
@param g_curve:list<unsigned short int> The green gamma ramp
@@ -181,7 +181,9 @@ def drm_set_gamma_ramps(int connection, int crtc_index, int gamma_size, r_curve,
r[i] = r_curve[i] & 0xFFFF
g[i] = g_curve[i] & 0xFFFF
b[i] = b_curve[i] & 0xFFFF
- rc = blueshift_drm_set_gamma_ramps(connection, crtc_index, gamma_size, r, g, b)
+ rc = 0
+ for crtc_index in crtc_indices:
+ rc |= blueshift_drm_set_gamma_ramps(connection, crtc_index, gamma_size, r, g, b)
free(r)
free(g)
free(b)
diff --git a/src/monitor.py b/src/monitor.py
index 01c70d0..3947435 100644
--- a/src/monitor.py
+++ b/src/monitor.py
@@ -197,6 +197,21 @@ def vidmode(*crtcs, screen = 0):
pass # Happens on exit by TERM signal
+def drm(*crtcs, card = 0):
+ '''
+ Applies colour curves using DRM
+
+ @param crtcs:*int The CRT controllers to use, all are used if none are specified
+ @param card:int The card that the monitors belong to
+ '''
+ connection = drm_manager.open_card(card)
+ (R_curve, G_curve, B_curve) = translate_to_integers()
+ try:
+ drm_set_gamma_ramps(connection, list(crtcs), i_size, R_curve, G_curve, B_curve)
+ except OverflowError:
+ pass # Happens on exit by TERM signal
+
+
def print_curves(*crtcs, screen = 0, compact = False):
'''
Prints the curves to stdout