diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-04-05 19:36:29 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-04-05 19:36:29 +0200 |
commit | 1f928c3d0a0ccf32b304db3607f71c0da1f95733 (patch) | |
tree | c0496e18d233c995bd3afb694686ac681d30bc40 | |
parent | m doc (diff) | |
download | blueshift-1f928c3d0a0ccf32b304db3607f71c0da1f95733.tar.gz blueshift-1f928c3d0a0ccf32b304db3607f71c0da1f95733.tar.bz2 blueshift-1f928c3d0a0ccf32b304db3607f71c0da1f95733.tar.xz |
remove crtc parameter from C and Cython functions for VidMode
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | src/blueshift_vidmode.pyx | 33 | ||||
-rw-r--r-- | src/blueshift_vidmode_c.c | 18 | ||||
-rw-r--r-- | src/blueshift_vidmode_c.h | 22 | ||||
-rw-r--r-- | src/monitor.py | 11 |
4 files changed, 34 insertions, 50 deletions
diff --git a/src/blueshift_vidmode.pyx b/src/blueshift_vidmode.pyx index 4133548..772befd 100644 --- a/src/blueshift_vidmode.pyx +++ b/src/blueshift_vidmode.pyx @@ -29,27 +29,24 @@ Start stage of colour curve control @return Zero on error, otherwise the size of colours curves ''' -cdef extern int blueshift_vidmode_read(int use_crtc, uint16_t* r_curve, uint16_t* g_curve, uint16_t* b_curve) +cdef extern int blueshift_vidmode_read(uint16_t* r_curve, uint16_t* g_curve, uint16_t* b_curve) ''' Gets the current colour curves -@param use_crtc The CRTC to use -@param r_gamma Storage location for the red colour curve -@param g_gamma Storage location for the green colour curve -@param b_gamma Storage location for the blue colour curve -@return Zero on success +@param r_gamma Storage location for the red colour curve +@param g_gamma Storage location for the green colour curve +@param b_gamma Storage location for the blue colour curve +@return Zero on success ''' -cdef extern int blueshift_vidmode_apply(unsigned long long int use_crtcs, - uint16_t* r_curve, uint16_t* g_curve, uint16_t* b_curve) +cdef extern int blueshift_vidmode_apply(uint16_t* r_curve, uint16_t* g_curve, uint16_t* b_curve) ''' Apply stage of colour curve control -@param use_crtcs Mask of CRTC:s to use -@param r_curve The red colour curve -@param g_curve The green colour curve -@param b_curve The blue colour curve -@return Zero on success +@param r_curve The red colour curve +@param g_curve The green colour curve +@param b_curve The blue colour curve +@return Zero on success ''' cdef extern void blueshift_vidmode_close() @@ -109,15 +106,14 @@ def vidmode_open(int use_screen, display): return vidmode_gamma_size > 1 -def vidmode_read(int use_crtc): +def vidmode_read(): ''' Gets the current colour curves - @param use_crtc The CRTC to use @return :(r:list<int>, g:list<int>, b:list<int>) The current red, green and blue colour curves ''' # Read the current curves - if not blueshift_vidmode_read(use_crtc, r_c, g_c, b_c) == 0: + if not blueshift_vidmode_read(r_c, g_c, b_c) == 0: raise Exception() # Convert to Python integer lists r, g, b = [], [], [] @@ -128,11 +124,10 @@ def vidmode_read(int use_crtc): return (r, g, b) -def vidmode_apply(unsigned long long use_crtcs, r_curve, g_curve, b_curve): +def vidmode_apply(r_curve, g_curve, b_curve): ''' Apply stage of colour curve control - @param use_crtcs Mask of CRTC:s to use @param r_curve:list<int> The red colour curve @param g_curve:list<int> The green colour curve @param b_curve:list<int> The blue colour curve @@ -144,7 +139,7 @@ def vidmode_apply(unsigned long long use_crtcs, r_curve, g_curve, b_curve): g_c[i] = g_curve[i] & 0xFFFF b_c[i] = b_curve[i] & 0xFFFF # Apply curves - return blueshift_vidmode_apply(use_crtcs, r_c, g_c, b_c) + return blueshift_vidmode_apply(r_c, g_c, b_c) def vidmode_close(): diff --git a/src/blueshift_vidmode_c.c b/src/blueshift_vidmode_c.c index b6d30f8..108f8c4 100644 --- a/src/blueshift_vidmode_c.c +++ b/src/blueshift_vidmode_c.c @@ -89,16 +89,13 @@ int blueshift_vidmode_open(int use_screen, char* display) /** * Gets the current colour curves * - * @param use_crtc The CRTC to use * @param r_gamma Storage location for the red colour curve * @param g_gamma Storage location for the green colour curve * @param b_gamma Storage location for the blue colour curve * @return Zero on success */ -int blueshift_vidmode_read(int use_crtc, uint16_t* r_gamma, uint16_t* g_gamma, uint16_t* b_gamma) +int blueshift_vidmode_read(uint16_t* r_gamma, uint16_t* g_gamma, uint16_t* b_gamma) { - (void) use_crtc; - /* Read curves */ if (XF86VidModeGetGammaRamp(connection, screen, curve_size, r_gamma, g_gamma, b_gamma) == 0) @@ -115,16 +112,13 @@ int blueshift_vidmode_read(int use_crtc, uint16_t* r_gamma, uint16_t* g_gamma, u /** * Apply stage of colour curve control * - * @param use_crtcs Mask of CRTC:s to use - * @param r_curve The red colour curve - * @param g_curve The green colour curve - * @param b_curve The blue colour curve - * @return Zero on success + * @param r_curve The red colour curve + * @param g_curve The green colour curve + * @param b_curve The blue colour curve + * @return Zero on success */ -int blueshift_vidmode_apply(uint64_t use_crtcs, uint16_t* r_curve, uint16_t* g_curve, uint16_t* b_curve) +int blueshift_vidmode_apply(uint16_t* r_curve, uint16_t* g_curve, uint16_t* b_curve) { - (void) use_crtcs; - /* Apply curves */ if (XF86VidModeSetGammaRamp(connection, screen, curve_size, r_curve, g_curve, b_curve) == 0) diff --git a/src/blueshift_vidmode_c.h b/src/blueshift_vidmode_c.h index c94a297..188db4a 100644 --- a/src/blueshift_vidmode_c.h +++ b/src/blueshift_vidmode_c.h @@ -39,24 +39,22 @@ int blueshift_vidmode_open(int use_screen, char* display); /** * Gets the current colour curves * - * @param use_crtc The CRTC to use - * @param r_gamma Storage location for the red colour curve - * @param g_gamma Storage location for the green colour curve - * @param b_gamma Storage location for the blue colour curve - * @return Zero on success + * @param r_gamma Storage location for the red colour curve + * @param g_gamma Storage location for the green colour curve + * @param b_gamma Storage location for the blue colour curve + * @return Zero on success */ -int blueshift_vidmode_read(int use_crtc, uint16_t* r_gamma, uint16_t* g_gamma, uint16_t* b_gamma); +int blueshift_vidmode_read(uint16_t* r_gamma, uint16_t* g_gamma, uint16_t* b_gamma); /** * Apply stage of colour curve control * - * @param use_crtcs Mask of CRTC:s to use - * @param r_curve The red colour curve - * @param g_curve The green colour curve - * @param b_curve The blue colour curve - * @return Zero on success + * @param r_curve The red colour curve + * @param g_curve The green colour curve + * @param b_curve The blue colour curve + * @return Zero on success */ -int blueshift_vidmode_apply(uint64_t use_crtcs, uint16_t* r_curve, uint16_t* g_curve, uint16_t* b_curve); +int blueshift_vidmode_apply(uint16_t* r_curve, uint16_t* g_curve, uint16_t* b_curve); /** * Resource freeing stage of colour curve control diff --git a/src/monitor.py b/src/monitor.py index e58836b..e94c1e8 100644 --- a/src/monitor.py +++ b/src/monitor.py @@ -105,7 +105,7 @@ def vidmode_get(crtc = 0, screen = 0, display = None): ''' Gets the current colour curves using the X11 extension VidMode - @param crtc:int The CRTC of the monitor to read from + @param crtc:int The CRTC of the monitor to read from, dummy parameter @param screen:int The screen to which the monitors belong @param display:str? The display to which to connect, `None` for current display @return :()→void Function to invoke to apply the curves that was used when this function was invoked @@ -123,7 +123,7 @@ def vidmode_get(crtc = 0, screen = 0, display = None): else: raise Exception('Cannot open vidmode connection') # Read current curves and create function - return ramps_to_function(*(vidmode_read(crtc))) + return ramps_to_function(*(vidmode_read())) def drm_get(crtc = 0, screen = 0, display = None): @@ -178,15 +178,12 @@ def vidmode(*crtcs, screen = 0, display = None): ''' Applies colour curves using the X11 extension VidMode - @param crtcs:*int The CRT controllers to use, all are used if none are specified + @param crtcs:*int The CRT controllers to use, all are used if none are specified, dummy parameter @param screen:int The screen to which the monitors belong @param display:str? The display to which to connect, `None` for current display ''' from blueshift_vidmode import vidmode_open, vidmode_apply, vidmode_close global vidmode_opened - # Select CRTC:s - crtcs = sum([1 << i for i in crtcs]) if len(crtcs) > 0 else ((1 << 64) - 1) - # Convert curves to [0, 0xFFFF] integer lists (R_curve, G_curve, B_curve) = translate_to_integers() # Open new vidmode connection if non is open or one is open to the wrong screen or display @@ -201,7 +198,7 @@ def vidmode(*crtcs, screen = 0, display = None): raise Exception('Cannot open vidmode connection') try: # Apply adjustments - if not vidmode_apply(crtcs, R_curve, G_curve, B_curve) == 0: + if not vidmode_apply(R_curve, G_curve, B_curve) == 0: raise Exception('Cannot use vidmode to apply colour adjustments') except OverflowError: pass # Happens on exit by TERM signal |