FBInk icon indicating copy to clipboard operation
FBInk copied to clipboard

MXCFB_SEND_UPDATE_V2: Operation not permitted!

Open tux-linux opened this issue 3 years ago • 4 comments

Hello, Got the usual xdamage/FBInk bundle compiled on my Libra today for running X11 (I want to set up a portable computer with a RPi as hardware and the Kobo as the screen), but it seems that something doesn't want to work. When I first try to print 'hello' on the screen, no problem encountered, all's good. Then, I start fbink_xdamage (which works) but after a couple of minutes, it starts to spit out some "Operation not permitted" errors. I have no idea why. Then I try to print 'hello' on the screen again, but it doesn't work either:

[FBInk] Couldn't find a Kobo version tag (onboard unmounted or not running on a Kobo?)!
[FBInk] Detected a Kobo Libra H2O (384 => Storm @ Mark 7)
[FBInk] Enabled Kobo Mark 7 quirks
[FBInk] Clock tick frequency appears to be 100 Hz
[FBInk] Screen density set to 300 dpi
[FBInk] Variable fb info: 1680x1264, 32bpp @ rotation: 3 (Counter Clockwise, 270°)
[FBInk] Fixed fb info: ID is "mxc_epdc_fb", length of fb mem: 9175040 bytes & line length: 6784 bytes
[FBInk] Canonical rotation: 3 (Counter Clockwise, 270°)
[FBInk] Fontsize set to 32x32 (IBM base glyph size: 8x8)
[FBInk] Line length: 52 cols, Page size: 39 rows
[FBInk] Vertical fit isn't perfect, shifting rows down by 8 pixels
[FBInk] Pen colors set to #000000 for the foreground and #FFFFFF for the background
Printing string 'hello' @ column 0 + 0px, row 0 + 0px (overlay: N, no BG: N, no FG: N, inverted: N, flashing: N, centered: N, halfway: N, left padded: N, right padded: N, clear screen: N, waveform: AUTO, dithering: PASSTHROUGH, nightmode: N, skip refresh: N, font: 0, font scaling: x0)
[FBInk] [refresh_kobo_mk7] MXCFB_SEND_UPDATE_V2: Operation not permitted!
[FBInk] [fbink_print] Failed to refresh the screen!
[CLI] Failed to print that string!

Here's the stack trace, I bet it will be more useful than what I pasted above:

strace FBInk/Release/fbink hello
execve("FBInk/Release/fbink", ["FBInk/Release/fbink", "hello"], 0x7e9e7e54 /* 9 vars */) = 0
set_tls(0x76f80400)                     = 0
set_tid_address(0x76f7f7cc)             = 5775
brk(NULL)                               = 0x55926000
brk(0x55928000)                         = 0x55928000
mmap2(0x55926000, 4096, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x55926000
mprotect(0x54bd3000, 4096, PROT_READ)   = 0
open("/dev/fb0", O_RDWR|O_LARGEFILE|O_CLOEXEC) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
open("/mnt/onboard/.kobo/version", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
writev(2, [{iov_base="", iov_len=0}, {iov_base="[FBInk] Couldn't find a Kobo ver"..., iov_len=88}], 2[FBInk] Couldn't find a Kobo version tag (onboard unmounted or not running on a Kobo?)!
) = 88
open("/dev/mmcblk0", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 4
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x76f7d000
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
_llseek(4, 524288, [524288], SEEK_SET)  = 0
readv(4, [{iov_base="HW CONFIG v3.1\0", iov_len=15}, {iov_base="FW\32\0\0\10\0\0\16\3\25'\6\2\t\n\4\3\2\0\2\2\1h\2\344\0\0\n\1\5\0"..., iov_len=1024}], 2) = 1039
ioctl(4, BLKGETSIZE64, [7818182656])    = 0
_llseek(4, -953, [524374], SEEK_CUR)    = 0
close(4)                                = 0
munmap(0x76f7d000, 4096)                = 0
writev(2, [{iov_base="[FBInk] Detected a Kobo Libra H2"..., iov_len=58}, {iov_base=NULL, iov_len=0}], 2[FBInk] Detected a Kobo Libra H2O (384 => Storm @ Mark 7)
) = 58
writev(2, [{iov_base="", iov_len=0}, {iov_base="[FBInk] Enabled Kobo Mark 7 quir"..., iov_len=35}], 2[FBInk] Enabled Kobo Mark 7 quirks
) = 35
writev(2, [{iov_base="[FBInk] Clock tick frequency app"..., iov_len=50}, {iov_base=NULL, iov_len=0}], 2[FBInk] Clock tick frequency appears to be 100 Hz
) = 50
writev(2, [{iov_base="[FBInk] Screen density set to 30"..., iov_len=38}, {iov_base=NULL, iov_len=0}], 2[FBInk] Screen density set to 300 dpi
) = 38
ioctl(3, FBIOGET_VSCREENINFO, 0x54bd4120) = 0
writev(2, [{iov_base="[FBInk] Variable fb info: 1680x1"..., iov_len=58}, {iov_base="Counter Clockwise, 270\302\260", iov_len=24}], 2[FBInk] Variable fb info: 1680x1264, 32bpp @ rotation: 3 (Counter Clockwise, 270°) = 82
writev(2, [{iov_base=")\n", iov_len=2}, {iov_base=NULL, iov_len=0}], 2)
) = 2
ioctl(3, FBIOGET_FSCREENINFO, 0x54bd40d4) = 0
writev(2, [{iov_base="[FBInk] Fixed fb info: ID is \"mx"..., iov_len=69}, {iov_base=" bytes & line length: ", iov_len=22}], 2[FBInk] Fixed fb info: ID is "mxc_epdc_fb", length of fb mem: 9175040 bytes & line length: ) = 91
writev(2, [{iov_base="6784 bytes\n", iov_len=11}, {iov_base=NULL, iov_len=0}], 26784 bytes
) = 11
writev(2, [{iov_base="[FBInk] Canonical rotation: 3 (C"..., iov_len=57}, {iov_base=NULL, iov_len=0}], 2[FBInk] Canonical rotation: 3 (Counter Clockwise, 270°)
) = 57
writev(2, [{iov_base="[FBInk] Fontsize set to 32x32 (I"..., iov_len=57}, {iov_base=NULL, iov_len=0}], 2[FBInk] Fontsize set to 32x32 (IBM base glyph size: 8x8)
) = 57
writev(2, [{iov_base="[FBInk] Line length: 52 cols, Pa"..., iov_len=49}, {iov_base=NULL, iov_len=0}], 2[FBInk] Line length: 52 cols, Page size: 39 rows
) = 49
writev(2, [{iov_base="[FBInk] Vertical fit isn't perfe"..., iov_len=67}, {iov_base=NULL, iov_len=0}], 2[FBInk] Vertical fit isn't perfect, shifting rows down by 8 pixels
) = 67
writev(2, [{iov_base="[FBInk] Pen colors set to #00000"..., iov_len=64}, {iov_base=" for the background\n", iov_len=20}], 2[FBInk] Pen colors set to #000000 for the foreground and #FFFFFF for the background
) = 84
writev(2, [{iov_base="", iov_len=0}, {iov_base=NULL, iov_len=0}], 2) = 0
ioctl(1, TIOCGWINSZ, {ws_row=37, ws_col=167, ws_xpixel=0, ws_ypixel=0}) = 0
writev(1, [{iov_base="Printing string 'hello' @ column"..., iov_len=284}, {iov_base=")\n", iov_len=2}], 2Printing string 'hello' @ column 0 + 0px, row 0 + 0px (overlay: N, no BG: N, no FG: N, inverted: N, flashing: N, centered: N, halfway: N, left padded: N, right padded: N, clear screen: N, waveform: AUTO, dithering: PASSTHROUGH, nightmode: N, skip refresh: N, font: 0, font scaling: x0)
) = 286
mmap2(NULL, 9175040, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = 0x76636000
getpid()                                = 5775
ioctl(3, _IOC(_IOC_WRITE, 0x46, 0x2e, 0x48), 0x7eea89cc) = -1 EPERM (Operation not permitted)
writev(2, [{iov_base="[FBInk] [refresh_kobo_mk7] MXCFB"..., iov_len=74}, {iov_base=NULL, iov_len=0}], 2[FBInk] [refresh_kobo_mk7] MXCFB_SEND_UPDATE_V2: Operation not permitted!
) = 74
writev(2, [{iov_base="[FBInk] [fbink_print] Failed to "..., iov_len=52}, {iov_base=NULL, iov_len=0}], 2[FBInk] [fbink_print] Failed to refresh the screen!
) = 52
writev(2, [{iov_base="", iov_len=0}, {iov_base="[CLI] Failed to print that strin"..., iov_len=35}], 2[CLI] Failed to print that string!
) = 35
munmap(0x76636000, 9175040)             = 0
close(3)                                = 0
exit_group(-1)                          = ?
+++ exited with 255 +++

tux-linux avatar Jun 06 '21 14:06 tux-linux

Huh, what? I had x11vnc (serving the Kobo's X server) running in another tty, I stopped it and then it worked again. Any idea why?

tux-linux avatar Jun 06 '21 14:06 tux-linux

The kernel logs would be more helpful, but unfortunately I don't think they're built verbose enough to actually print what's actually happening.

(There are a few -EPERM returns in the EPDC, but I couldn't tell you why X11 might be screwing with that specifically).

NiLuJe avatar Jun 06 '21 15:06 NiLuJe

Namely:

  • HW not ready
  • EPDC not ready (or FB is blanked, that might be the ticket here)
  • OOM

NiLuJe avatar Jun 06 '21 15:06 NiLuJe

The kernel logs would be more helpful, but unfortunately I don't think they're built verbose enough to actually print what's actually happening.

(There are a few -EPERM returns in the EPDC, but I couldn't tell you why X11 might be screwing with that specifically).

From what I had looked at, it was just a bunch of PMU/watchdog warnings, nothing related to the FB... Maybe the problem is related to the fact that the VNC server on the Kobo was displaying a VNC window of my computer (thus creating a never-ending loop)? But that would be kind of surprising... As soon as I stopped x11vnc server, everything worked again, so yeah, can't really tell what happened... I think your 2nd guess would be the most plausible.

tux-linux avatar Jun 06 '21 15:06 tux-linux

Oh, hey, old issue is old ;).

  • EPDC not ready (or FB is blanked, that might be the ticket here)

Was the culprit. X11's screensaver handling involves a blank phase (c.f., BlankTime in xorg.conf(5)).

NiLuJe avatar Sep 18 '23 16:09 NiLuJe

Hmm, we tried that on inkbox and had to resort to calling the BLANK ioctl every few seconds to make it work, on our side, editing xorg.conf didn't do anything

tux-linux avatar Sep 18 '23 16:09 tux-linux

Might be worth checking if something doesn't mess wiht it at runtime.

Speaking of runtime, this can also be controlled via xset:

xset s off

Ditching DPMS (which makes no sense here, but who knows) might also be required:

xset -dpms

NiLuJe avatar Sep 18 '23 18:09 NiLuJe

DPMS

Completely unrelated, but on a desktop, especially one that stays on 24/7, being able to control this is extremely convenient.

I have a "gn" shell alias that basically does xset dpms force off (with an optional DISPLAY override, so it can be run over ssh) which I run before going AFK/to bed.

NiLuJe avatar Sep 18 '23 18:09 NiLuJe