Bug 355569 - kwin_wayland master doesn't display anything on the framebuffer
Summary: kwin_wayland master doesn't display anything on the framebuffer
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: platform-fbdev (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-19 03:14 UTC by bluescreenavenger
Modified: 2015-12-15 12:06 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 5.5.1
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bluescreenavenger 2015-11-19 03:14:22 UTC
Hi

I am trying to call kwin_wayland on the framebuffer, for virtual computers that don't have proper KMS support


I export KDE_FULL_SESSION=1, call 
kwin_wayland --framebuffer --libinput --xwayland xterm
I get a line that I think is interesting
"No screens avalible, assuming 24 bit color"
a whole bunch of lines about qpainter
and then the tty freezes. I can switch TTYs, and verify that xterm is running with ps -A

I can try to see if maybe http://quickgit.kde.org/?p=kwin.git&a=commit&h=eb81ddfb861f1a72a806687122fd56bd1b3ee70e is the cause, but it will take some time to recompile...


 

Thanks

Reproducible: Always




I get when I attach gdb and try a back trace:
#0  __call_pselect6 () at ../sysdeps/unix/sysv/linux/i386/call_pselect6.S:49
#1  0xb44e0cc3 in __pselect (nfds=44, readfds=0x8602928, writefds=0x8602b34, exceptfds=0x8602d40, timeout=0xbfd56020, 
    sigmask=0x0) at ../sysdeps/unix/sysv/linux/i386/../pselect.c:77
#2  0xb4b1ed2a in qt_safe_select(int, fd_set*, fd_set*, fd_set*, timespec const*) () from /opt/lib/libQt5Core.so.5
#3  0xb4b20613 in QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timespec*) ()
   from /opt/lib/libQt5Core.so.5
#4  0xb4b20ab5 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /opt/lib/libQt5Core.so.5
#5  0xb132798f in QUnixEventDispatcherQPA::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /opt/lib/i386-linux-gnu/plugins/platforms/KWinQpaPlugin.so
#6  0xb4acb043 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /opt/lib/libQt5Core.so.5
#7  0xb4acb47a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /opt/lib/libQt5Core.so.5
#8  0xb4ad34ea in QCoreApplication::exec() () from /opt/lib/libQt5Core.so.5
#9  0xb4df3aa1 in QGuiApplication::exec() () from /opt/lib/libQt5Gui.so.5
#10 0xb5442f74 in QApplication::exec() () from /opt/lib/libQt5Widgets.so.5
#11 0x080502b4 in main ()
Detaching from program: /opt/bin/kwin_wayland, process 4956
Comment 1 Martin Flöser 2015-11-19 07:24:46 UTC
please try to also
export KWIN_COMPOSE=Q
Comment 2 bluescreenavenger 2015-11-20 04:11:19 UTC
Seems to do the same thing with
export KWIN_COMPOSE=Q

reverting those commits did nothing. It must be something I'm doing wrong, or I haven't tested using the framebuffer in a while, so I'm not sure when it stopped working...
Comment 3 bluescreenavenger 2015-11-20 04:13:14 UTC
maybe it's trying to use the DRM backend? It does the same thing when I do --drm instead of --framebuffer, 
which doesn't work properly in QEMU
Comment 4 bluescreenavenger 2015-11-21 00:40:25 UTC
Hi

After more testing it seems the framebuffer backend IS being used, and that a recentish version of kwin, the framebuffer backend IS working on my laptop, that does have a /dev/dri/* . My VM does NOT have a /dev/dri/* and it's failing.... Could it be trying to use KMS to switch the mode or something?
Comment 5 Martin Flöser 2015-11-23 07:33:19 UTC
No, the fbdev backend doesn't do anything with /dev/dri/*
Comment 6 bluescreenavenger 2015-11-23 12:18:24 UTC
Any other things I can do to test why the Framebuffer backend fails on QEMU?
Comment 7 bluescreenavenger 2015-11-30 05:53:22 UTC
It seems comparing the strace output around the time kwin tries to access /dev/fb0 is similar, so I'm not sure where it is failing... ...how do I get kwin to output the debug output for the framebuffer backend, with qcdebug lines, I think it was an environment variable?
Comment 8 bluescreenavenger 2015-11-30 05:54:55 UTC
and I meant the qemu where nothing draws (the text in the TTY freezes), vs the physical Intel box where I force it to use the framebuffer, and it works. Sorry about the lack of clarity in the first comment
Comment 9 Martin Flöser 2015-11-30 08:14:29 UTC
> how do I get kwin to output the debug output for the framebuffer backend, with qcdebug lines,

you need to modify: ~/.config/QtProject/qtlogging.ini

It should look something like:

[Rules]
kwin_core=true
kwineffects=true
libkwineffects=true
libkwinglutils=true
libkwinxrenderutils=true
kwin_wayland_drm=true
kwin_wayland_framebuffer=true
kwin_wayland_hwcomposer=true
kwin_wayland_backend=true
kwin_wayland_x11windowed=true
kwin_libinput=true
kwin_tabbox=true
kwin_decorations=true
kwin_scripting=true
aurorae.debug=true

This will enable all debug output for KWin.
Comment 10 bluescreenavenger 2015-12-01 01:14:49 UTC
OK, Seems on the qemu box, the framebuffer backend behaves the same trying to access /dev/fb0, according to the log,
It tries to access the Framebuffer device with logind, fails, but then is successful in accessing it directly, because I have the UACCESS attrib set for framebuffer devices...


Only line that is different, and it doesn't seem to be logged by framebuffer backend itself:

QPainter::begin Paint device returned engine == 0, type 3
Comment 11 bluescreenavenger 2015-12-03 04:09:11 UTC
I tried to add the lines
    qCWarning(KWIN_FB) << "Alpha Length: " << m_alpha.length;    
    qCWarning(KWIN_FB) << "Alpha Offset: " << m_alpha.offset;    
    qCWarning(KWIN_FB) << "Red Length: "   << m_red.length;    
    qCWarning(KWIN_FB) << "Red Offset: "   << m_red.offset;
    qCWarning(KWIN_FB) << "Green Length: " << m_green.length;    
    qCWarning(KWIN_FB) << "Green Offset: " << m_green.offset;
    qCWarning(KWIN_FB) << "Blue Length: "  << m_blue.length;    
    qCWarning(KWIN_FB) << "Blue Offset: "  << m_blue.offset;
in FramebufferBackend::queryScreenInfo()

to see if a difference there could be the cause of the late:
   QPainter::begin Paint device returned engine == 0, type 3
which occurs sometime after Xwayland starts, which that line does not appear on my physical box when using the framebuffer at least. (if that even is related to the issue)

and they all seem to be correct for what FramebufferBackend::imageFormat() tries to match for in QEMU...
Alpha Length:0
Alpha Offset:0
Red Length: 8
Red Offset: 16
Green Length: 8
Green Offset: 8
Blue Length: 8
Blue Offset :0
Comment 12 Martin Flöser 2015-12-03 07:35:46 UTC
hmm, maybe the memory mapping to a QImage fails?
Comment 13 bluescreenavenger 2015-12-03 13:23:54 UTC
How should I go about testing that? I have realized that there are some issues with the way libvirt is passing CPU features, but It seems that kwin is working under the Wayland backend under Weston on QEMU...   
...It's usually breaking some things with LLVM, causing apps to crash, so it could be unrelated...  
So how's a good way for me to test why (or if) memory mapping for the qimage would be failing under just QEMU, only when using the framebuffer backend
Comment 14 Martin Flöser 2015-12-03 13:30:00 UTC
The QImage is created in scene_qpainter_fb_backend.cpp in the ctor directly. Maybe try add debug output there. What striked me as odd is the debug message about the paint device which could indicate that something with the QImage is wrong.
Comment 15 bluescreenavenger 2015-12-05 17:26:30 UTC
I added lines
+    qWarning() << "Bytes Per Line: " << backend->bytesPerLine();
+    qWarning() << "Buffer Size: " << backend->bufferSize();
+    qWarning() << "Bits Per Pixel: " << backend->bitsPerPixel();


in QEMU:
Bytes Per Line: 3072
Buffer Size: 2359296
Bits Per Pixel: 24

It also seems that that qpainter debug message happens with:
QPainter p(&m_backBuffer);
judging by the debug lines I threw into it.

On intel box
Bytes Per Line: 5120
Buffer Size: 4096000
Bits Per Pixel: 32

...and now for some reason this time after realizing I should set my Framebuffer to be 32 bits, it worked in QEMU too (I must have been mistaken somewhere, as I thought setting the framebuffer to 32 bits in QEMU still failed the first time...
Comment 16 bluescreenavenger 2015-12-06 20:09:03 UTC
For this I attempted to create https://git.reviewboard.kde.org/r/126262/
Comment 17 bluescreenavenger 2015-12-08 02:35:19 UTC
Well, I know why that patch fixed it on QEMU, but broke it on Intel, the virtual framebuffer device reports itself as 32 bits, but the alpha length, and the alpha offset are both 0, so with the tests I had it doing, it was selecting the 24 bit format...
...Is this a possible bug in the Intel driver?...
Comment 18 Martin Flöser 2015-12-15 12:06:47 UTC
Git commit 3247382752071f77b78fb714572f7d31f148e47a by Martin Gräßlin, on behalf of Nerdopolis Turfwalker.
Committed on 15/12/2015 at 12:05.
Pushed by graesslin into branch 'Plasma/5.5'.

[backends/fbdev] Support framebuffers with different color depths

Support more framebuffer color depths

REVIEW: 126262
FIXED-IN: 5.5.1

M  +34   -1    backends/fbdev/fb_backend.cpp

http://commits.kde.org/kwin/3247382752071f77b78fb714572f7d31f148e47a