eInk update modes

Search This thread

Renate

Recognized Contributor / Inactive Recognized Dev
There seems to be very little actual documentation on the various eInk update modes.
Most of the information seems to have been extracted from working code.
Some of that code does not seem to be optimal in any case.

I'd like to start this thread on a discussion of the update modes.

You can look at all the code posted, but the bottom line is that eInk mode is configured by passing six discrete pieces of information to the EPD driver.
These six pieces may be wrapped up into a single static entity.

  1. Name of entity requesting change (for logging purposes only)
  2. Region, one of enumRegion[] (Region 4-7)
  3. A rectangle, normally {0, 0, 600, 800}
  4. Wave, one of enumWave[] (GC, GU, DU, A2, GL16, AUTO)
  5. Mode, one of enumMode[] (INACTIVE, ACTIVE, ONESHOT, CLEAR, ACTIVE_ALL, ONESHOT_ALL, CLEAR_ALL)
  6. Threshold, an int 1-15, only applies to A2 mode

A2 is the one bit, fast drawing method. It leaves ghosting behind.
In some applications, you would like to enable faster scrolling in A2 mode and then have it revert to "normal" upon completion.
I have an application with a full screen scroll.
After experimenting with the values, these two configs seem to do the job nicely.

Code:
      configA2Enter = makeConfig(rpc, waveEnums[WAVE_A2], regionEnums[REGION_6], modeEnums[MODE_ACTIVE_ALL], THRESHOLD);
      configA2Exit = makeConfig(rpc, waveEnums[WAVE_AUTO], regionEnums[REGION_6], modeEnums[MODE_ACTIVE_ALL], 0);

No user intervention is necessary, it scrolls quickly and redraws a clean image when done.
(A view.invalidate() is necessary after you invoke configA2Exit)

Does anybody have any further insight into these values or suggestions for improving them?
 
Last edited:

Renate

Recognized Contributor / Inactive Recognized Dev
Some additional information on the A2 ("no refresh", 1 bit) mode.

Some of the other modes can be selectively applied to portions of the screen.
The A2 mode may only be applied to the entire screen.

The threshold value, which some may construe as "brightness" or "contrast"
is the cutoff threshold between black and white of the original image.
A value of 1 will only generate black in the darkest areas of the original image.
A value of 15 will only generate white in the whitest areas of the original image.
That is, 1 will give you a light image, 15 a dark image.
 
Last edited:

marspeople

Senior Member
Jul 7, 2011
70
100
Some additional information on the A2 ("no refresh", 1 bit) mode.

Some of the other modes can be selectively applied to portions of the screen.
The A2 mode may only be applied to the entire screen.

The threshold value, which some may construe as "brightness" or "contrast"
is the cutoff threshold between black and white of the original image.
A value of 1 will only generate black in the darkest areas of the original image.
A value of 15 will only generate white in the whitest areas of the original image.
That is, 1 will give you a dark image, 15 a light image.

Nice find! I didn't know that was a B/W threshold. But I think you meant "1 gives a light image and 15 a dark image".

I've just tried using this in NoRefreshToggle, but the result was not as good as before. The image is much more just solid black and white because you can't see the dither patterns that represent grey (they appear only at very specific white levels, which would be nice to tweak too).

What I actually use for "contrast" adjustment in NoRefreshToggle is a different approach. Using a fixed threshold of 14 (dark image), I've managed to lower the black level (turning it more greyish) to achieve a smaller color range. This way, the dither patterns appear more often. However, my technique to achieve this effect is not so elegant: I overlay the entire screen with a semi-transparent white pane. This has the inconvenient of controlling the pane visibility: whenever A2 mode is turned off (by user or system), I need to hide the pane View.

If I could temporarily avoid the automatic changing of screen modes by the system, this would be much simpler. I've had no success at this issue so far.
 
  • Like
Reactions: smayonak and Renate

Renate

Recognized Contributor / Inactive Recognized Dev
I think you meant "1 gives a light image and 15 a dark image".

Yup, good catch. The preceding two sentences were correct. I edited the third.
I have a demo panning grayscales. It's easy to see where the threshold is occurring. Shown below.

Oh! I did see something about the dither modes.
They would certainly be useful for video, less so for text.

I think a system-wide use of A2 would be a bit counterproductive.
The fonts look better with 16 shades.
The best use would be to have browsers and viewers use A2 for panning and zooming.

And another thing:

I don't know how you are getting the dither in there, but since you are doing an overlay anyway,
maybe you should try a halftone screen approach to see how it would work.
The simplest halftone screen would be a checkerboard with two different transparencies.
That wouldn't sacrifice too much resolution.
 

Attachments

  • demo.jpg
    demo.jpg
    26.8 KB · Views: 658
Last edited:

mrWax

Senior Member
Jan 31, 2012
147
24
I think a system-wide use of A2 would be a bit counterproductive.

i seems to me that n-r mode would be much more usefull if would could regulate when its on a and when off. Its quite pain running the app again and again. it seems to me that quicker reaction is much better than nicer pictures in average use - pdf reading, browsing, video, managing system...
 

staylo

Member
May 10, 2011
28
4
I've just tried using this in NoRefreshToggle, but the result was not as good as before. The image is much more just solid black and white because you can't see the dither patterns that represent grey (they appear only at very specific white levels, which would be nice to tweak too)

I don't think the dithering can be 'tweaked' as such. It's caused by the reduction of 24-bit color images to the 16-bit colorspace of the OS. Dithering is performed by the graphics hardware to prevent obvious colour banding, and there's no OpenGL functions to control dithering parameters.

The A2 mode seems to choose a threshold value for black in the 16-bit colorspace. Values above this are white. In order to obtain black and white dithering we have to pick values in the 24-bit colorspace which all lie in the same 16-bit band.

The easiest way I've found is to keep the R and G values at 255 and vary the B value. I think the default threshold lies at 255,255,198. If you start at that and increase the B value you get 7 dithered grey shades before you reach white.
 

domi.nos

Senior Member
Jan 5, 2011
490
89
Warszawa
Guys, as far as i know, eink display is build of tiny capsules, much smaller that one pixel is, and a chip is joining them into pixels. So mayby there is a way to divide single pixel into 2 or even 4? It is much much work, but it would make us easier draw some tones of monochrome? Example: to get dark gray, instead of displaying one of five black pixels white, we can make one's "subpixels" 3/4 black, 1/4 white.


Does it make sense/do you get it?
 
Last edited:

marspeople

Senior Member
Jul 7, 2011
70
100
I think a system-wide use of A2 would be a bit counterproductive.
The fonts look better with 16 shades.
The best use would be to have browsers and viewers use A2 for panning and zooming.

I agree with you. But having temporary exclusive control of A2 mode would make my application more efficient. I don't intend to use A2 system-wide.

And another thing:

I don't know how you are getting the dither in there, but since you are doing an overlay anyway,
maybe you should try a halftone screen approach to see how it would work.
The simplest halftone screen would be a checkerboard with two different transparencies.
That wouldn't sacrifice too much resolution.

I just tried this but I've got nothing more than a simply darker and checkered image. I don't understand how it would be better.
 

Renate

Recognized Contributor / Inactive Recognized Dev
I don't understand how it would be better.
Well, halftone screens have been around forever.
Think of it this way, it would give you two different thresholds.
With a bigger pattern you would get more thresholds but a coarser pattern.
That is always the way with dithering or halftone.
Probably a screen would not work well with an underlying dither.
 

staylo

Member
May 10, 2011
28
4
A useful observation from http://xdaforums.com/showthread.php?t=1502723&page=11 is that by listening to the screen you can hear screen activity.

After a quick test I suspect ONESHOT mode allows the screen to enter a power saving mode (in which the screen is completely silent) after a few hundred ms of inactivity, while ACTIVE prevents it. No idea whether there are other issues involved.
 
  • Like
Reactions: Renate

staylo

Member
May 10, 2011
28
4
In an overnight test with the nook screensaver / lock screen mode inhibited by my application and no screen updates, I obtained power consumption of 0.75% / hour with ONESHOT mode. In a previous test with ACTIVE mode I got ~7% / hour with the same scenario(!)

With fast screen updates of ~ 1Hz ONESHOT does not appear to give any power saving benefit over ACTIVE mode, and a quiet hiss can be heard from the screen at all times in both modes at this refresh rate. I think this indicates the ONESHOT mode allows the screen to enter a power saving mode after a period of inactivity.

Neither of these were scientific tests but I strongly suggest trying ONESHOT mode in favour of ACTIVE whenever using A2 mode.
 

Renate

Recognized Contributor / Inactive Recognized Dev
Well, there must be some benefit sometime to the ACTIVE mode or they wouldn't have it.
It's hard to differentiate the different modes, but it seem that ACTIVE responds quicker with less delay.

I switch to ACTIVE_ALL, A2 for panning and switch back to ONESHOT_ALL, AUTO afterwards.
(I don't use full-time A2).

See my demo of panning: http://xdaforums.com/showthread.php?t=1563645

I'm running about 7%/hour drain. My Nook is not suspending when I do a simple power button click. I don't know why.
 

Renate

Recognized Contributor / Inactive Recognized Dev
A few folks seem to be using EpdController in a useful manner.
Their use of Java reflection is clever, but it's not supposed to be that difficult.

I wrote a Java stub (basically declarations) for EpdController and wrapped it in a jar.
If you just put this jar in your compilation classpath with your normal android.jar
then you will be able to use the EpdController without all the fuss and muss.

For example, in my latest (unreleased) version of UsbMode I want the blinker to go on and off cleanly:

Code:
EpdController.setRegion("UsbMode", EpdController.Region.APP_3, blinker, EpdController.Wave.DU);

That's it, one line, no initialization.
The EpdController class was designed to handle such trivial uses.

Note: This jar itself has no functionality, all the method bodies are {}.
You will have to import android.hardware.EpdController
 
Last edited:

Renate

Recognized Contributor / Inactive Recognized Dev
The 1.2 update uses a different EpdController and has a new EpdRegionParams.
This may or may not break code written for previous versions.

The best way to write code to use EpdController is to have it detect if there is no Epd
(i.e. for other devices), the old version or the new version.
Wrap a try/catch around a Class.forName("android.hardware.EpdController").
Wrap a try/catch around a Class.forName("android.hardware.EpdRegionParams").

The new epd.jar in the signature will allow you to compile without using redirection both the old and the new.

For details on the changes, see: http://xdaforums.com/showpost.php?p=35390192&postcount=8
 

Renate

Recognized Contributor / Inactive Recognized Dev
Bump & additional info.

By experimenting and reading documentation for other eInk controllers I've figured out the following:

Controllers support different algorithms for updating the pixels depending on the precision of the gray scale required and the compensation for previous ghosting.
On the Nook, we have the choice of waveform modes:
  • GC
  • GU (gray update)
  • DU (direct update)
  • A2
  • GL16
  • AUTO (auto selection of algorithm)

The screen can be divided up into regions where different algorithms may be used.
Some controllers support 15 regions, ours supports 8.
4 of these regions are earmarked for system usage, specifically:
  • Toast (popups)
  • Keyboard (soft keyboard layout)
  • Dialog (popups)
  • Overlay
The remaining 4 regions are left for the user.
Note: "HwRegion" is an enum for the complete 8 regions, "Region" is an enum for the 4 user regions.

An example: In my audio recorder I have two regions set aside for the VU bar graphs.
By setting these two regions to DU I get rid of update clutter and the response is quicker.

Currently, the EpdController in the Nook only operates with portrait coordinates.
If you wish to use this while in landscape mode you will have to rotate the coordinates first yourself.

It's sometimes hard to see exactly what/if some EPD setting is doing.
A good way to check it is to set a region for one half the width of whatever active graphic element you are trying to improve.
The difference can be very clear.
 

p42

Member
May 12, 2013
26
19
Manchester
www.treblig.org
There seems to be very little actual documentation on the various eInk update modes.
Most of the information seems to have been extracted from working code.
Some of that code does not seem to be optimal in any case.

I'd like to start this thread on a discussion of the update modes.

You can look at all the code posted, but the bottom line is that eInk mode is configured by passing six discrete pieces of information to the EPD driver.
These six pieces may be wrapped up into a single static entity.

  1. Name of entity requesting change (for logging purposes only)
  2. Region, one of enumRegion[] (Region 4-7)
  3. A rectangle, normally {0, 0, 600, 800}
  4. Wave, one of enumWave[] (GC, GU, DU, A2, GL16, AUTO)
  5. Mode, one of enumMode[] (INACTIVE, ACTIVE, ONESHOT, CLEAR, ACTIVE_ALL, ONESHOT_ALL, CLEAR_ALL)
  6. Threshold, an int 1-15, only applies to A2 mode

A2 is the one bit, fast drawing method. It leaves ghosting behind.
In some applications, you would like to enable faster scrolling in A2 mode and then have it revert to "normal" upon completion.
I have an application with a full screen scroll.
After experimenting with the values, these two configs seem to do the job nicely.

Code:
      configA2Enter = makeConfig(rpc, waveEnums[WAVE_A2], regionEnums[REGION_6], modeEnums[MODE_ACTIVE_ALL], THRESHOLD);
      configA2Exit = makeConfig(rpc, waveEnums[WAVE_AUTO], regionEnums[REGION_6], modeEnums[MODE_ACTIVE_ALL], 0);

No user intervention is necessary, it scrolls quickly and redraws a clean image when done.
(A view.invalidate() is necessary after you invoke configA2Exit)

Does anybody have any further insight into these values or suggestions for improving them?

Excellent work! Do you happen to understand/can write up what the various fast mode/no refresh hacks do/how they use these different modes?
I've had X 'running' on my nook but only by triggering a full refresh every few seconds, and wondered how I could be more selective.
My reading of Norefresh was that it was doing something like parsing android log structures for areas that have changed.

Is there an easy way to trigger a refresh of part of the display from userspace, preferably directly on the driver or fb?

As for where the dithering is done, my guesswork is this is done by a blob running on the DSP module within the OMAP (which is perhaps the only interesting use of it I've seen).

Dave
 

p42

Member
May 12, 2013
26
19
Manchester
www.treblig.org
Just done some playing writing directly to the entires in /sys/class/graphics/fb0 ; so for example:

echo -n 100,100,200,200,0,14 > epd_area
echo 2 > epd_refresh

causes the square 100,100->200,200 to be refreshed
the 14 being REGION(8)+CLEAR(4)+ONESHOT(2)
the 0 is wvfid+threshold*65536 I think.

I've put some code that runs under X to trigger updates; here (actually the comment is wrong, it's currently using oneshot+clear);
I never managed to get active to work.

http://xdaforums.com/showthread.php?p=42393733#post42393733
Dave
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    There seems to be very little actual documentation on the various eInk update modes.
    Most of the information seems to have been extracted from working code.
    Some of that code does not seem to be optimal in any case.

    I'd like to start this thread on a discussion of the update modes.

    You can look at all the code posted, but the bottom line is that eInk mode is configured by passing six discrete pieces of information to the EPD driver.
    These six pieces may be wrapped up into a single static entity.

    1. Name of entity requesting change (for logging purposes only)
    2. Region, one of enumRegion[] (Region 4-7)
    3. A rectangle, normally {0, 0, 600, 800}
    4. Wave, one of enumWave[] (GC, GU, DU, A2, GL16, AUTO)
    5. Mode, one of enumMode[] (INACTIVE, ACTIVE, ONESHOT, CLEAR, ACTIVE_ALL, ONESHOT_ALL, CLEAR_ALL)
    6. Threshold, an int 1-15, only applies to A2 mode

    A2 is the one bit, fast drawing method. It leaves ghosting behind.
    In some applications, you would like to enable faster scrolling in A2 mode and then have it revert to "normal" upon completion.
    I have an application with a full screen scroll.
    After experimenting with the values, these two configs seem to do the job nicely.

    Code:
          configA2Enter = makeConfig(rpc, waveEnums[WAVE_A2], regionEnums[REGION_6], modeEnums[MODE_ACTIVE_ALL], THRESHOLD);
          configA2Exit = makeConfig(rpc, waveEnums[WAVE_AUTO], regionEnums[REGION_6], modeEnums[MODE_ACTIVE_ALL], 0);

    No user intervention is necessary, it scrolls quickly and redraws a clean image when done.
    (A view.invalidate() is necessary after you invoke configA2Exit)

    Does anybody have any further insight into these values or suggestions for improving them?
    3
    Bump & additional info.

    By experimenting and reading documentation for other eInk controllers I've figured out the following:

    Controllers support different algorithms for updating the pixels depending on the precision of the gray scale required and the compensation for previous ghosting.
    On the Nook, we have the choice of waveform modes:
    • GC
    • GU (gray update)
    • DU (direct update)
    • A2
    • GL16
    • AUTO (auto selection of algorithm)

    The screen can be divided up into regions where different algorithms may be used.
    Some controllers support 15 regions, ours supports 8.
    4 of these regions are earmarked for system usage, specifically:
    • Toast (popups)
    • Keyboard (soft keyboard layout)
    • Dialog (popups)
    • Overlay
    The remaining 4 regions are left for the user.
    Note: "HwRegion" is an enum for the complete 8 regions, "Region" is an enum for the 4 user regions.

    An example: In my audio recorder I have two regions set aside for the VU bar graphs.
    By setting these two regions to DU I get rid of update clutter and the response is quicker.

    Currently, the EpdController in the Nook only operates with portrait coordinates.
    If you wish to use this while in landscape mode you will have to rotate the coordinates first yourself.

    It's sometimes hard to see exactly what/if some EPD setting is doing.
    A good way to check it is to set a region for one half the width of whatever active graphic element you are trying to improve.
    The difference can be very clear.
    2
    Some additional information on the A2 ("no refresh", 1 bit) mode.

    Some of the other modes can be selectively applied to portions of the screen.
    The A2 mode may only be applied to the entire screen.

    The threshold value, which some may construe as "brightness" or "contrast"
    is the cutoff threshold between black and white of the original image.
    A value of 1 will only generate black in the darkest areas of the original image.
    A value of 15 will only generate white in the whitest areas of the original image.
    That is, 1 will give you a light image, 15 a dark image.
    2
    Some additional information on the A2 ("no refresh", 1 bit) mode.

    Some of the other modes can be selectively applied to portions of the screen.
    The A2 mode may only be applied to the entire screen.

    The threshold value, which some may construe as "brightness" or "contrast"
    is the cutoff threshold between black and white of the original image.
    A value of 1 will only generate black in the darkest areas of the original image.
    A value of 15 will only generate white in the whitest areas of the original image.
    That is, 1 will give you a dark image, 15 a light image.

    Nice find! I didn't know that was a B/W threshold. But I think you meant "1 gives a light image and 15 a dark image".

    I've just tried using this in NoRefreshToggle, but the result was not as good as before. The image is much more just solid black and white because you can't see the dither patterns that represent grey (they appear only at very specific white levels, which would be nice to tweak too).

    What I actually use for "contrast" adjustment in NoRefreshToggle is a different approach. Using a fixed threshold of 14 (dark image), I've managed to lower the black level (turning it more greyish) to achieve a smaller color range. This way, the dither patterns appear more often. However, my technique to achieve this effect is not so elegant: I overlay the entire screen with a semi-transparent white pane. This has the inconvenient of controlling the pane visibility: whenever A2 mode is turned off (by user or system), I need to hide the pane View.

    If I could temporarily avoid the automatic changing of screen modes by the system, this would be much simpler. I've had no success at this issue so far.
    1
    A useful observation from http://xdaforums.com/showthread.php?t=1502723&page=11 is that by listening to the screen you can hear screen activity.

    After a quick test I suspect ONESHOT mode allows the screen to enter a power saving mode (in which the screen is completely silent) after a few hundred ms of inactivity, while ACTIVE prevents it. No idea whether there are other issues involved.