[MOD][Kernel] K-Lapse : A kernel-level livedisplay module [GPLv2]

Search This thread

tanish2k09

Senior Member
Jun 21, 2014
1,812
2,201
Canada
manku.dev


klapse.png


K-Lapse : A kernel level livedisplay module



Intro - What is K-Lapse?

Kernel-based Lapse ("K-Lapse") is a linear RGB scaling module that 'shifts' RGB based on time (of the day/selected by the user), or (since v2.0) brightness. This concept is inspired by LineageOS (formerly known as 'CyanogenMod') ROM's feature "Livedisplay" which also changes the display settings (RGB, hue, temperature, etc) based on time. This is very very similar to f.lux for desktop too.

Why did I decide to make this? (A short story)

I (personally) am a big fan of the Livedisplay feature found on LineageOS. I used it every single day, since Android Lollipop. Starting from Android Nougat, a native night mode solution was added to AOSP and it felt like Livedisplay was still way superior, thanks to its various options (you could say it spoiled me, sure). I also maintained a kernel (Venom kernel) for the device I was using at that time. It was all good until the OEM dropped support for the device at Android M, and XDA being XDA, was already working on N ROMs. The issue was, these ROMs weren't LineageOS or based on it, so Livedisplay was... gone. I decided I'll try to bring that feature to every other ROM. How would I do that? Of course! The kernel! It worked on every single ROM, it was the key! I started to work on it ASAP and here it is, up on GitHub, licensed under GPL (check klapse.c), open to everyone :)

How does it work?

Think of it like a fancy night mode, but not really. Klapse is dependent on an RGB interface (like Gamma on MTK and KCAL on SD chipsets). In mode 1, it fetches time from the kernel, converts it to local time, and selects and RGB set based on the time. The result is really smooth shifting of RGB over time. Mode 2 uses the current brightness level to scale RGB, with the concept behind it being that lower brightness usually implies a dark environment, so a slight color temperature shift should help with eye strain.

There's also an option for a "brightness factor" that can reduce your brightness down to 80% below the minimum brightness that your phone allows. The catch is, it doesn't actually reduce the brightness, but rather uses a clever trick to fade away the RGB of the screen by the same amount so it "appears" to be lower brightness.

How does it really work (dev)?

Klapse mode 1 (time-based scaling) uses a method void klapse_pulse(unsigned long data) that should ideally be called every minute. This is done using a kernel timer, that is asynchronous so it should be handled with care, which I did. The pulse function fetches the current time and makes calculations based on the current hour and the values of the tunables listed down below.

Klapse mode 2 (brightness-based scaling) uses a method void set_rgb_slider(<type> bl_lvl) where type is the data type of the brightness level used in your kernel source. (OnePlus 6 uses u32 data type for bl_lvl) set_rgb_slider needs to be called/injected inside a function that sets brightness for your device. (OnePlus 6 uses dsi_panel.c for that, check out the diff for that file in op6 branch)

What all stuff can it do?

  1. Emulate night mode with the proper RGB settings
  2. Smoothly scale from one set of RGB to another set of RGB in integral intervals over time.
  3. Reduce perceived brightness using brightness_factor by reducing the amount of color on screen. Allows lower apparent brightness than system permits.
  4. Scale RGB based on brightness of display (low brightness usually implies a dark environment, where yellowness is probably useful).
  5. Automate the perceived brightness independent of whether klapse is enabled, using its own set of start and stop hours.
  6. Theoretically more efficient, faster by residing inside the kernel instead of having to use the HWC HAL like android's night mode. This is unproven and probably has no practical significance.
  7. (On older devices) Reduce stuttering or frame lags caused by native night mode.
  8. An easier solution against overlay-based apps that run as service in userspace/Android and sometimes block apps asking for permissions.
  9. Give you a Livedisplay alternative if it doesn't work in your ROM.
  10. Impress your crush so you can get a date (Hey, don't forget to credit me if it works).

Alright, so this is a replacement for night mode?
NO! Kinda, but no. Lemme explain. One can say this is an alternative for LineageOS' Livedisplay, but inside a kernel. Night mode is a sub-function of both Livedisplay and KLapse. Most comparisons here were made with night mode because that's what an average user uses, and will relate to the most. There is absolutely no reason for your Android kernel to not have KLapse. Go ahead and add it or ask your kernel maintainer to. It's super-easy!

What can it NOT do (yet)?
  1. Calculate scaling to the level of minutes, like "Start from 5:37pm till 7:19am". --TODO
  2. Make coffee for you.
  3. Fly you to the moon.
  4. Get you a monthly subscription of free food, cereal and milk included.

I want more! Tell me what can I customize!

All these following tunables are found in their respective files in /sys/klapse/
Code:
1. enable_klapse : A switch to enable or disable klapse. Values : 0 = off, 1 = on (since v2.0, 2 = brightness-dependent mode)

2. klapse_start_hour : The hour at which klapse should start scaling the RGB values from daytime to target (see next points). Values : 0-23

3. klapse_stop_hour : The hour by which klapse should scale back the RGB values from target to daytime (see next points). Values : 0-23

4. daytime_r,g,b : The RGB set that must be used for all the time outside of start and stop hour range.

5. target_r,g,b : The RGB set that must be scaled towards for all the time inside of start and stop hour range.

6. klapse_scaling_rate : Controls how soon the RGB reaches from daytime to target inside of start and stop hour range. Once target is reached, it remains constant till fadeback_minutes (#13) before stop hour, where target RGB scales back to daytime RGB. (Pre-v4.2 value was a factor, now it is a minute value)

7. brightness_factor : From the name itself, this value has the ability to bend perception and make your display appear as if it is at a lesser brightness level than it actually is at. It works by reducing the RGB values by the same factor. Values : 2-10, (10 means accurate brightness, 5 means 50% of current brightness, you get it)

8. brightness_factor_auto : A switch that allows you to automatically set the brightness factor in a set time range. Value : 0 = off, 1 = on

9. brightness_factor_auto_start_hour : The hour at which brightness_factor should be applied. Works only if #8 is 1. Values : 0-23

10. brightness_factor_auto_stop_hour : The hour at which brightness_factor should be reverted to 10. Works only if #8 is 1. Values : 0-23

11. backlight_range : The brightness range within which klapse should scale from daytime to target_rgb. Works only if #1 is 2. Values : MIN_BRIGHTNESS-MAX_BRIGHTNESS

12. pulse_freq : The amount of milliseconds after which klapse_pulse is called. A more developer-targeted tunable. Only works when one or both of #1 and #8 are 1. Values : 1000-600000 (Represents 1sec to 10 minutes)

13. fadeback_minutes : The number of minutes before klapse_stop_hour when RGB should start going back to daytime_rgb. Only works when #1 is 1. Values : 0-minutes between #2 and #3

Impact on performance or battery...

Fortunately, as per practical testing there is absolutely no negative effect on performance or battery backup!

"I'm a kernel maintainer. How do I add it to my source?"

Note : I'm currently maintaining klapse for OnePlus6 (enchilada), using the snapshot branch.

The klapse.c file is pretty much generic, but depending on your device you may need to change some of the #define values
The klapse.h file should be edited in order to make the K_RED etc. defines point to the correct RGB interface variable. OnePlus 6 simply uses kcal_red, kcal_green and kcal_blue in sde. Some devices have a struct or pointers instead of a variable. Those devices must edit their kcal files to keep a copy of the address that klapse will access. An example of a source with struct-based kcal with klapse support is this: commit (thanks to @rupanshji for this commit)

The KCONFIG is pretty understandable too, but you may wanna remove the "DEPENDS" line for your device.
The Makefile is just one line, and so is enabling klapse in the defconfig.

Now you must change the file that provides the kcal/gamma (mtk) interface. Thanks to other developers, all I had to do on the OnePlus 6 was to remove the keyword "static" from the variable declaration.


Great work! Can I pay for your next meal?

I'm just a university CS student so sure, any amount is much appreciated! You can donate via PayPal here :
Donate




XDA:DevDB Information
K-Lapse, Kernel for all devices (see above for details)

Contributors
tanish2k09
Source Code: https://github.com/tanish2k09/KLapse-Livedisplay

Kernel Special Features: RGB shifting based on a context

Version Information
Status:
Stable
Current Stable Version: 4.3
Stable Release Date: 2019-03-02

Created 2019-03-04
Last Updated 2019-03-19
 
Last edited:

tanish2k09

Senior Member
Jun 21, 2014
1,812
2,201
Canada
manku.dev
TODO :
  1. Add custom-minute support
  2. Add full-smooth scaling algorithm that actually scales from node to node to make the shift smoother
  3. Add a third "intelligent" mode that uses both time-based and brightness-based values to magically come up with an RGB set that's perfect for that environment
  4. A grayscale feature, that maybe also would support a yellow tint over it, so it's like a grayscale night mode.

Telegram support?
Yeah yeah, I know. Telegram links are common now. In compliance with the xda rule of "Only one TG link per thread" that I saw on some other sub-forums, maybe a link would be fine but mods can remove it per will.
Here's the official klapse telegram group, with commit notifications too:
t.me/klapse or from within telegram you can just join klapse but with an @ in front of it (I didn't use it to prevent an unintended mention to some person)

Notes :
I'm open to any other contructive feedback or suggestions
Klapse doesn't conflict with night mode of Android. They both can work TOGETHER, the result would be an overlap of both their colors.

Credits :
I pretty much wrote all the code for k-lapse myself, but it would be useless without these awesome people who put it to use -
@pappschlumpf for getting k-lapse working for the first time on any snapdragon device, with Smurf kernel for OnePlus 6
@Eliminater74 for tips along the way, very helpful
@HolyAngel for a collab to add support to HolyDragon, and indirectly SkyDragon, and suggesting some tunable structuring
@rupanshji for the commit used for an example of a structured kcal implementation
@flar2 for debugging and adding k-lapse support to his app EX kernel manager, purchase the app here - EXKM
@franciscofranco for adding k-lapse support to his app Franco Kernel Manager, purchase the app here - FKM
 
Last edited:

tanish2k09

Senior Member
Jun 21, 2014
1,812
2,201
Canada
manku.dev
Screenshots

Screenshots from EXKM v4.04, Mixplorer and FKM v4.0 have been attached.

Note that these screenshots were taken while v4.3 was the active version. May change in future.
 

Attachments

  • Screenshot_20190303-183333.jpg
    Screenshot_20190303-183333.jpg
    215 KB · Views: 9,736
  • Screenshot_20190303-183402.jpg
    Screenshot_20190303-183402.jpg
    140.8 KB · Views: 9,721
  • franco_klapse.jpg
    franco_klapse.jpg
    197.8 KB · Views: 6,690
Last edited:

tanish2k09

Senior Member
Jun 21, 2014
1,812
2,201
Canada
manku.dev
It's pretty common now

@apophis9283 Seeing you're one of the mods here, would you please be kind enough to delete the other 3 clones of this thread that got created due to XDA request failure?

Also, in case this thread is in the wrong sub-forum, please feel free to move it to the correct one but notify me via PM or email. Many thanks :D
 
Last edited:

Tomatot-

Senior Member
May 11, 2012
1,663
1,602
OnePlus 6
Great alternative to night mode that does way more than that if you're interested in other features.

It's lightweight and won't bloat your system at all.

Any proper kernel should include this as there are only benefits and no drawbacks. 8)

As a last addition/compliment/support: it's been very well maintained and as you can tell just from reading OP, the dev is friendly and will help you if you have issues with it.
 

akiwiz

Senior Member
Mar 14, 2014
298
48
On Smurf kernel on op6. I have the gray scale option on digital wellbeing in the night and after switching on this mod (light mode) it automatically turns off the gray scale. Is it a bug?
 

tanish2k09

Senior Member
Jun 21, 2014
1,812
2,201
Canada
manku.dev
On Smurf kernel on op6. I have the gray scale option on digital wellbeing in the night and after switching on this mod (light mode) it automatically turns off the grayscale. Is it a bug?
It is not a bug, it's actually expected behaviour.
First of all, we both know that the screen can't be both grayscale AND have a yellow tint at the same time, because yellow isn't gray.
Only one of them can stay active. The fact that klapse works from the kernelspace makes klapse more powerful. As soon as klapse refreshes, which happens every 30 seconds by default, the grayscale RGB will be overridden.

It also depends on how digital wellbeing's grayscale option works. I'm assuming it uses the same HWC HAL that android uses, but I have not the slightest clue. In case I'm right, both klapse and grayscale will work together to give you a black-n-white + slight yellow tinted screen.

As an alternative, how about I add grayscale as a feature to klapse itself? I can't add it to klapse right away but I can mark it in my TODO post above. Sounds good? Maybe I can come up with a solution that overlaps the grayscale with the yellow tint to create a grayscale night mode?

I don't know about you but it seems like an amazing idea to me :D
 
Last edited:

akiwiz

Senior Member
Mar 14, 2014
298
48
It is not a bug, it's actually expected behaviour.
First of all, we both know that the screen can't be both grayscale AND have a yellow tint at the same time, because yellow isn't gray.
Only one of them can stay active. The fact that klapse works from the kernelspace makes klapse more powerful. As soon as klapse refreshes, which happens every 30 seconds by default, the grayscale RGB will be overridden.

It also depends on how digital wellbeing's grayscale option works. I'm assuming it uses the same HWC HAL that android uses, but I have not the slightest clue. In case I'm right, both klapse and grayscale will work together to give you a black-n-white + slight yellow tinted screen.

As an alternative, how about I add grayscale as a feature to klapse itself? I can't add it to klapse right away but I can mark it in my TODO post above. Sounds good? Maybe I can come up with a solution that overlaps the grayscale with the yellow tint to create a grayscale night mode?

I don't know about you but it seems like an amazing idea to me :D


Thank you for the explanation ? is there a way I can switch off klapse at night when grey scale from digital wellbeing kicks in? Also your alternative would be ideal if it's possible in future! Thanks again
 

tanish2k09

Senior Member
Jun 21, 2014
1,812
2,201
Canada
manku.dev
Thank you for the explanation ? is there a way I can switch off klapse at night when grey scale from digital wellbeing kicks in? Also your alternative would be ideal if it's possible in future! Thanks again
A tester just told me that klapse's yellow tint worked on gray-scale too.

But to answer your question, the only possible solution is to either disable Klapse or keep the schedule of start and stop outside the range of grayscale's schedule.

Btw I totally recommend you to use Klapse at night because yellow tint in the dark is better than grayscale to look at :)
 
  • Like
Reactions: akiwiz

akiwiz

Senior Member
Mar 14, 2014
298
48
A tester just told me that klapse's yellow tint worked on gray-scale too.

But to answer your question, the only possible solution is to either disable Klapse or keep the schedule of start and stop outside the range of grayscale's schedule.

Btw I totally recommend you to use Klapse at night because yellow tint in the dark is better than grayscale to look at :)
So I need EXM to set a schedule start?
 

tanish2k09

Senior Member
Jun 21, 2014
1,812
2,201
Canada
manku.dev
So I need EXM to set a schedule start?
EXKM is one way. You can create your own tunables in Franco kernel manager too like. Here's a couple screenshots of an example.

You can use those same paths in kernel adiutor too. I haven't talked to the dev for klapse support yet, maybe I should but next weekend probably.

You can also use a file manager to change those files. Remember that pretty much everything in /sys is rebuilt during each boot so all values reset. That's why an apply-on-boot method is used for fixing values.

Info for which file does what is in OP.
 

Attachments

  • Screenshot_20190303-235029.jpg
    Screenshot_20190303-235029.jpg
    205.8 KB · Views: 1,403
  • Screenshot_20190303-235034.jpg
    Screenshot_20190303-235034.jpg
    216.8 KB · Views: 1,399

maigre

Senior Member
Aug 9, 2012
527
145
This doesn't seem to work for me. OnePlus 6 with xXx NoLimits and Smurf Kernel. Latest stable versions for all. I have changed settings with EXKM and rebooted multiple times. /sys/klapse files accurately reflect the settings in EXKM. Setting K-Lapse alternately to time and light have failed to demonstrate any color changes as would be expected from the settings. I turned off the phone's night mode so that I can see more purely what K-Lapse does.

Thoughts?
 

tanish2k09

Senior Member
Jun 21, 2014
1,812
2,201
Canada
manku.dev
This doesn't seem to work for me. OnePlus 6 with xXx NoLimits and Smurf Kernel. Latest stable versions for all. I have changed settings with EXKM and rebooted multiple times. /sys/klapse files accurately reflect the settings in EXKM. Setting K-Lapse alternately to time and light have failed to demonstrate any color changes as would be expected from the settings. I turned off the phone's night mode so that I can see more purely what K-Lapse does.

Thoughts?
I'm guessing you're using the wrong display calibration mode.

On the OnePlus 6 stock ROM it only works with custom and adaptive display modes in settings.
 

majikfox

Senior Member
Oct 25, 2010
240
55
I can't find any settings for K-lapse in the latest EX Kernel Manager. I went through every section of the app. No K-lapse settings.
 

tanish2k09

Senior Member
Jun 21, 2014
1,812
2,201
Canada
manku.dev
I can't find any settings for K-lapse in the latest EX Kernel Manager. I went through every section of the app. No K-lapse settings.
I don't own EX kernel manager yet but I was given a v4.04 build to test, and it was under Graphics > Klapse-settings

They'll obviously only show up if the kernel supports it.
Also, some users reported that the update isn't live for them yet, so you may have to wait. That's not in my control either and flar2 handles EXKM.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 102


    klapse.png


    K-Lapse : A kernel level livedisplay module



    Intro - What is K-Lapse?

    Kernel-based Lapse ("K-Lapse") is a linear RGB scaling module that 'shifts' RGB based on time (of the day/selected by the user), or (since v2.0) brightness. This concept is inspired by LineageOS (formerly known as 'CyanogenMod') ROM's feature "Livedisplay" which also changes the display settings (RGB, hue, temperature, etc) based on time. This is very very similar to f.lux for desktop too.

    Why did I decide to make this? (A short story)

    I (personally) am a big fan of the Livedisplay feature found on LineageOS. I used it every single day, since Android Lollipop. Starting from Android Nougat, a native night mode solution was added to AOSP and it felt like Livedisplay was still way superior, thanks to its various options (you could say it spoiled me, sure). I also maintained a kernel (Venom kernel) for the device I was using at that time. It was all good until the OEM dropped support for the device at Android M, and XDA being XDA, was already working on N ROMs. The issue was, these ROMs weren't LineageOS or based on it, so Livedisplay was... gone. I decided I'll try to bring that feature to every other ROM. How would I do that? Of course! The kernel! It worked on every single ROM, it was the key! I started to work on it ASAP and here it is, up on GitHub, licensed under GPL (check klapse.c), open to everyone :)

    How does it work?

    Think of it like a fancy night mode, but not really. Klapse is dependent on an RGB interface (like Gamma on MTK and KCAL on SD chipsets). In mode 1, it fetches time from the kernel, converts it to local time, and selects and RGB set based on the time. The result is really smooth shifting of RGB over time. Mode 2 uses the current brightness level to scale RGB, with the concept behind it being that lower brightness usually implies a dark environment, so a slight color temperature shift should help with eye strain.

    There's also an option for a "brightness factor" that can reduce your brightness down to 80% below the minimum brightness that your phone allows. The catch is, it doesn't actually reduce the brightness, but rather uses a clever trick to fade away the RGB of the screen by the same amount so it "appears" to be lower brightness.

    How does it really work (dev)?

    Klapse mode 1 (time-based scaling) uses a method void klapse_pulse(unsigned long data) that should ideally be called every minute. This is done using a kernel timer, that is asynchronous so it should be handled with care, which I did. The pulse function fetches the current time and makes calculations based on the current hour and the values of the tunables listed down below.

    Klapse mode 2 (brightness-based scaling) uses a method void set_rgb_slider(<type> bl_lvl) where type is the data type of the brightness level used in your kernel source. (OnePlus 6 uses u32 data type for bl_lvl) set_rgb_slider needs to be called/injected inside a function that sets brightness for your device. (OnePlus 6 uses dsi_panel.c for that, check out the diff for that file in op6 branch)

    What all stuff can it do?

    1. Emulate night mode with the proper RGB settings
    2. Smoothly scale from one set of RGB to another set of RGB in integral intervals over time.
    3. Reduce perceived brightness using brightness_factor by reducing the amount of color on screen. Allows lower apparent brightness than system permits.
    4. Scale RGB based on brightness of display (low brightness usually implies a dark environment, where yellowness is probably useful).
    5. Automate the perceived brightness independent of whether klapse is enabled, using its own set of start and stop hours.
    6. Theoretically more efficient, faster by residing inside the kernel instead of having to use the HWC HAL like android's night mode. This is unproven and probably has no practical significance.
    7. (On older devices) Reduce stuttering or frame lags caused by native night mode.
    8. An easier solution against overlay-based apps that run as service in userspace/Android and sometimes block apps asking for permissions.
    9. Give you a Livedisplay alternative if it doesn't work in your ROM.
    10. Impress your crush so you can get a date (Hey, don't forget to credit me if it works).

    Alright, so this is a replacement for night mode?
    NO! Kinda, but no. Lemme explain. One can say this is an alternative for LineageOS' Livedisplay, but inside a kernel. Night mode is a sub-function of both Livedisplay and KLapse. Most comparisons here were made with night mode because that's what an average user uses, and will relate to the most. There is absolutely no reason for your Android kernel to not have KLapse. Go ahead and add it or ask your kernel maintainer to. It's super-easy!

    What can it NOT do (yet)?
    1. Calculate scaling to the level of minutes, like "Start from 5:37pm till 7:19am". --TODO
    2. Make coffee for you.
    3. Fly you to the moon.
    4. Get you a monthly subscription of free food, cereal and milk included.

    I want more! Tell me what can I customize!

    All these following tunables are found in their respective files in /sys/klapse/
    Code:
    1. enable_klapse : A switch to enable or disable klapse. Values : 0 = off, 1 = on (since v2.0, 2 = brightness-dependent mode)
    
    2. klapse_start_hour : The hour at which klapse should start scaling the RGB values from daytime to target (see next points). Values : 0-23
    
    3. klapse_stop_hour : The hour by which klapse should scale back the RGB values from target to daytime (see next points). Values : 0-23
    
    4. daytime_r,g,b : The RGB set that must be used for all the time outside of start and stop hour range.
    
    5. target_r,g,b : The RGB set that must be scaled towards for all the time inside of start and stop hour range.
    
    6. klapse_scaling_rate : Controls how soon the RGB reaches from daytime to target inside of start and stop hour range. Once target is reached, it remains constant till fadeback_minutes (#13) before stop hour, where target RGB scales back to daytime RGB. (Pre-v4.2 value was a factor, now it is a minute value)
    
    7. brightness_factor : From the name itself, this value has the ability to bend perception and make your display appear as if it is at a lesser brightness level than it actually is at. It works by reducing the RGB values by the same factor. Values : 2-10, (10 means accurate brightness, 5 means 50% of current brightness, you get it)
    
    8. brightness_factor_auto : A switch that allows you to automatically set the brightness factor in a set time range. Value : 0 = off, 1 = on
    
    9. brightness_factor_auto_start_hour : The hour at which brightness_factor should be applied. Works only if #8 is 1. Values : 0-23
    
    10. brightness_factor_auto_stop_hour : The hour at which brightness_factor should be reverted to 10. Works only if #8 is 1. Values : 0-23
    
    11. backlight_range : The brightness range within which klapse should scale from daytime to target_rgb. Works only if #1 is 2. Values : MIN_BRIGHTNESS-MAX_BRIGHTNESS
    
    12. pulse_freq : The amount of milliseconds after which klapse_pulse is called. A more developer-targeted tunable. Only works when one or both of #1 and #8 are 1. Values : 1000-600000 (Represents 1sec to 10 minutes)
    
    13. fadeback_minutes : The number of minutes before klapse_stop_hour when RGB should start going back to daytime_rgb. Only works when #1 is 1. Values : 0-minutes between #2 and #3

    Impact on performance or battery...

    Fortunately, as per practical testing there is absolutely no negative effect on performance or battery backup!

    "I'm a kernel maintainer. How do I add it to my source?"

    Note : I'm currently maintaining klapse for OnePlus6 (enchilada), using the snapshot branch.

    The klapse.c file is pretty much generic, but depending on your device you may need to change some of the #define values
    The klapse.h file should be edited in order to make the K_RED etc. defines point to the correct RGB interface variable. OnePlus 6 simply uses kcal_red, kcal_green and kcal_blue in sde. Some devices have a struct or pointers instead of a variable. Those devices must edit their kcal files to keep a copy of the address that klapse will access. An example of a source with struct-based kcal with klapse support is this: commit (thanks to @rupanshji for this commit)

    The KCONFIG is pretty understandable too, but you may wanna remove the "DEPENDS" line for your device.
    The Makefile is just one line, and so is enabling klapse in the defconfig.

    Now you must change the file that provides the kcal/gamma (mtk) interface. Thanks to other developers, all I had to do on the OnePlus 6 was to remove the keyword "static" from the variable declaration.


    Great work! Can I pay for your next meal?

    I'm just a university CS student so sure, any amount is much appreciated! You can donate via PayPal here :
    Donate




    XDA:DevDB Information
    K-Lapse, Kernel for all devices (see above for details)

    Contributors
    tanish2k09
    Source Code: https://github.com/tanish2k09/KLapse-Livedisplay

    Kernel Special Features: RGB shifting based on a context

    Version Information
    Status:
    Stable
    Current Stable Version: 4.3
    Stable Release Date: 2019-03-02

    Created 2019-03-04
    Last Updated 2019-03-19
    28
    TODO :
    1. Add custom-minute support
    2. Add full-smooth scaling algorithm that actually scales from node to node to make the shift smoother
    3. Add a third "intelligent" mode that uses both time-based and brightness-based values to magically come up with an RGB set that's perfect for that environment
    4. A grayscale feature, that maybe also would support a yellow tint over it, so it's like a grayscale night mode.

    Telegram support?
    Yeah yeah, I know. Telegram links are common now. In compliance with the xda rule of "Only one TG link per thread" that I saw on some other sub-forums, maybe a link would be fine but mods can remove it per will.
    Here's the official klapse telegram group, with commit notifications too:
    t.me/klapse or from within telegram you can just join klapse but with an @ in front of it (I didn't use it to prevent an unintended mention to some person)

    Notes :
    I'm open to any other contructive feedback or suggestions
    Klapse doesn't conflict with night mode of Android. They both can work TOGETHER, the result would be an overlap of both their colors.

    Credits :
    I pretty much wrote all the code for k-lapse myself, but it would be useless without these awesome people who put it to use -
    @pappschlumpf for getting k-lapse working for the first time on any snapdragon device, with Smurf kernel for OnePlus 6
    @Eliminater74 for tips along the way, very helpful
    @HolyAngel for a collab to add support to HolyDragon, and indirectly SkyDragon, and suggesting some tunable structuring
    @rupanshji for the commit used for an example of a structured kcal implementation
    @flar2 for debugging and adding k-lapse support to his app EX kernel manager, purchase the app here - EXKM
    @franciscofranco for adding k-lapse support to his app Franco Kernel Manager, purchase the app here - FKM
    15
    Screenshots

    Screenshots from EXKM v4.04, Mixplorer and FKM v4.0 have been attached.

    Note that these screenshots were taken while v4.3 was the active version. May change in future.
    9
    K-lapse v5.0 is out!

    Changelog:
    Code:
    - Introducing k-lapse "flow", a brightness-based scaling mode QOL enhancement that scales RGB points by 1 smoothly instant of instantly taking effect
    
    - Major code refactor to better match the Linux Kernel coding style (huge thanks to @kdrag0n for initial overall patch and general guidance)
    
    - Switched from SYS ATTR to module_param_cb and kernel param structs
    
    - Shortened the code from 1k lines to 0.6k without compromising any logic or feature
    
    - Changed tunable naming for sysfs to convey the idea of the function in a better way
    
    - Added minute-level support for automation. Yes, you can now start or stop at, say 16:49
    
    - Dimmer factor (previously known as brightness_factor) is now allowed to be set as a percentage value, ranging from 10 to 100
    
    - Updated README documentation to match v5.0 release
    
    - Integrated MDSS code with a switch in klapse.h (see kcal-mdss-demo branch for full implementation in older version)
    
    - Changed some default config values - Revised dimmer logic to fix "dimmer value multiplicative effect" for some users. The issue was changing brightness_factor values multiple times stacked them on top of each other, eventually causing the RGB to hit their minimum limit (usually 20 in KCAL), and not being able to restore full RGB without a pulse

    Source link: https://github.com/tanish2k09/KLapse-Livedisplay

    Branch in use: Snapshot

    Device tested with: OnePlus 6 with OOS9.0.5

    Current report: Stable
    7
    It looks like iOS has this feature called RWP (Reduce White Point) that works by basically reducing the display intensity, kinda like a dark filter.

    I think it works the same way k-lapse dimmer works, which is by reducing the RGB scales by the same proportion.

    Just throwing that out there. The more you know, right?

    I guess you could say k-lapse has the iOS RWP functionality as well