Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rm2fb waveforms don't support qtswikipedia #17

Open
raisjn opened this issue Nov 9, 2020 · 14 comments
Open

rm2fb waveforms don't support qtswikipedia #17

raisjn opened this issue Nov 9, 2020 · 14 comments
Labels
bug Something isn't working

Comments

@raisjn
Copy link
Collaborator

raisjn commented Nov 9, 2020

from @dps: remarkable-wikipedia doesn't show links correctly.

https://rmkit.dev/rm2fb/qtwikipedia <--- test binary with built in page
https://rmkit.dev/rm2fb/qtwikipedia.png <--- what is in the buffer

but what shows up on screen is that the link is invisible.

i tried using waveforms 0, 1, 2, 3 and none of them showed the link for me

@NiLuJe
Copy link

NiLuJe commented Nov 10, 2020

That would hint at A2/DU being used. GL16/GC16 should handle this just fine. And AUTO should make the right choice on its own, too.

Which probably indicates that something changed in the EPFrameBuffer API or something, because I assume the stock software does have the ability to display more than 2 or 4 shades of gray ;)?

@NiLuJe
Copy link

NiLuJe commented Nov 10, 2020

Has there been any communication on rM's part about an updated SDK for the rM2? So we'd get to see the new version of this.

@Eeems
Copy link
Collaborator

Eeems commented Nov 10, 2020

Yes, they've released it: reMarkable/linux#7. It doesn't have any libraries for interacting with the framebuffer. Just the old rM1 libraries.

@NiLuJe
Copy link

NiLuJe commented Nov 10, 2020

Huh, yeah, same old version of that header :/.

@raisjn
Copy link
Collaborator Author

raisjn commented Nov 10, 2020

reMarkable: ~/rm2fb/ bash run.sh ../qtwikipedia
STARTING RM2FB
ADDR: 21f54
EPD platform plugin loaded!
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Reading waveforms from /usr/share/remarkable/320_R299_AFC421_ED103TC2U2_VB3300-KCD_TC.wbf
Running INIT (111 phases)
SWTCON initialized \o/
INSTANCE ADDRESS: 0x41754
EPFramebuffer
Methods
2 "deleteLater" () ()
2 "clearScreen" () ()
2 "sendUpdate" ("rect", "waveform", "flags") ("QRect", "EPFramebuffer::WaveformMode", "EPFramebuffer::UpdateFlags")
2 "sendUpdate" ("rect", "waveform") ("QRect", "EPFramebuffer::WaveformMode")
2 "sendUpdate" ("rect", "waveform", "mode", "sync") ("QRect", "EPFramebuffer::WaveformMode", "EPFramebuffer::UpdateMode", "bool")
2 "sendUpdate" ("rect", "waveform", "mode") ("QRect", "EPFramebuffer::WaveformMode", "EPFramebuffer::UpdateMode")
2 "waitForLastUpdate" () ()
2 "sendUpdate" ("region", "waveform", "flags") ("QRegion", "EPFramebuffer::WaveformMode", "EPFramebuffer::UpdateFlags")
2 "sendUpdate" ("region", "waveform") ("QRegion", "EPFramebuffer::WaveformMode")
2 "clearGhosting" () ()
1404 1872 16
OPENED SHARED MEM: /dev/shm/swtfb.01 at 718b6000, errno: 0
WAITING FOR SEND UPDATE ON MSG Q
EPD platform plugin loaded!
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Creating window
qrc:/main.qml:39: TypeError: Cannot read property '1' of null
Framebuffer has wrong id: "mxcfb"
Framebuffer initialized: QImage(QSize(1404, 1872),format=7,depth=16,devicePixelRatio=1,bytesPerLine=2808,sizeInBytes=5256576) 5256576
Dirty Region: 0 0 1404 1872 3

two pieces of note are:

  1. dirty region's last parameter is the waveform mode - 3 - being sent through mxcfb_update. even if i try out hardcoding waveform mode to use, i can't seem to get the link to display. it seems only modes 0 to 3 are supported through sendUpdate API, i get an error if i use other numbers
  2. the list of methods look similar to the previous epframebuffer.h

in KOReader+rm2fb, book cover images look fine to me - but maybe i should try using a test image that i know what its supposed to look like.

@NiLuJe
Copy link

NiLuJe commented Nov 10, 2020

EPFramebuffer::UpdateFlags is new and nowhere to be seen in the "updated" SDK... :D.

@NiLuJe
Copy link

NiLuJe commented Nov 10, 2020

AFAICT, 0 shouldn't actually work. It's INIT, which should do a flashing clear to white or... something, it's generally not to be used outside of right after bringing the EPDC up.

You generally want 1 (DU), 2 (GC16) or 3 (GL16).

    enum WaveformMode {
        Initialize = INIT,
        Mono = DU,
        Grayscale = GL16,
        HighQualityGrayscale = GC16,
        Highlight = UNKNOWN
    };
322677   │  <3><535e5>: Abbrev Number: 5 (DW_TAG_enumerator)
322678   │     <535e6>   DW_AT_name        : (indirect string, offset: 0x1b389): Initialize
322679   │     <535ea>   DW_AT_const_value : 0
322680   │  <3><535eb>: Abbrev Number: 5 (DW_TAG_enumerator)
322681   │     <535ec>   DW_AT_name        : (indirect string, offset: 0x3da54): Mono
322682   │     <535f0>   DW_AT_const_value : 1
322683   │  <3><535f1>: Abbrev Number: 5 (DW_TAG_enumerator)
322684   │     <535f2>   DW_AT_name        : (indirect string, offset: 0x4d39c): Grayscale
322685   │     <535f6>   DW_AT_const_value : 3
322686   │  <3><535f7>: Abbrev Number: 5 (DW_TAG_enumerator)
322687   │     <535f8>   DW_AT_name        : (indirect string, offset: 0x4026d): HighQualityGrayscale
322688   │     <535fc>   DW_AT_const_value : 2
322689   │  <3><535fd>: Abbrev Number: 5 (DW_TAG_enumerator)
322690   │     <535fe>   DW_AT_name        : (indirect string, offset: 0x29c91): Highlight
322691   │     <53602>   DW_AT_const_value : 8

Which is consistent with the actual Waveform enum.

@NiLuJe
Copy link

NiLuJe commented Nov 10, 2020

@raisjn
Copy link
Collaborator Author

raisjn commented Nov 10, 2020

Dunno.

I'm able to use waveforms: 0, 1, 2, 3 and 8 (maybe 8 is debugging?).

0: slower than 1
1: DU
2: high quality (more colors)
3: less quality (less colors)
8: unsure

I thought UpdateMode -> UpdateFlags, but now not sure. If I set mode=8, updateFlags = 1, it flashes all the queued dirty regions on the screen when doing a repaint, and i can see 20 - 30 small regions (5x5) per update when drawing a line (which corresponds to the regions i'm sending over as dirty)

@NiLuJe
Copy link

NiLuJe commented Nov 10, 2020

You interpretation of 1, 2, 3 makes sense. 0 should be broke as all hell (or at best useless in practice), unless they fudge it internally to something else ( AUTO?).

I don't recall if we ever tested 8, but if we commented it out in FBInk, it was probably broken ;).

My best guess as far as UpdateFlags is concerned is that it's a wrapper around the EPDC_FLAG_ stuff, used e.g., for HW inversion or HW/SW dithering setup.

waitForLastUpdate probably does (did? ^^) a WAIT_FOR_UPDATE_COMPLETE on the last EPFrameBuffer update marker (which is probably what the sync bool does automatically for a specific sendUpdate).

@raisjn
Copy link
Collaborator Author

raisjn commented Dec 20, 2020

i checked master and the it still doesn't render links properly, even though multiple fixes were applied to waveform handling

@raisjn raisjn added the bug Something isn't working label Dec 24, 2020
@raisjn
Copy link
Collaborator Author

raisjn commented Jan 30, 2021

talking with bokluk the other day, we think that SWTCON is not properly drawing the blue channel (and ignoring some blue bits). one way to work around is to convert to grayscale before displaying in your app, the other is to fix SWTCON code itself (unlikely).

for this issue, i would consider it success when we fix qtswikipedia's links to show up

@Eeems
Copy link
Collaborator

Eeems commented Dec 2, 2023

@raisjn is this still an issue?

@Eeems
Copy link
Collaborator

Eeems commented Sep 9, 2024

@raisjn poke?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants