Bug 346213 - Kdenlive won't start on dedicated GPU in a hybrid graphics enabled laptop
Summary: Kdenlive won't start on dedicated GPU in a hybrid graphics enabled laptop
Status: RESOLVED FIXED
Alias: None
Product: kdenlive
Classification: Applications
Component: User Interface (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR grave
Target Milestone: ---
Assignee: Jean-Baptiste Mardelle
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-15 10:38 UTC by Paul Konecny
Modified: 2016-01-06 22:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Prime backtrace with OpenGL kwin (6.82 KB, text/x-log)
2015-04-15 10:39 UTC, Paul Konecny
Details
Prime backtrace with Xrender kwin (6.82 KB, text/x-log)
2015-04-15 10:40 UTC, Paul Konecny
Details
trace for openglunderqml (3.91 KB, text/x-log)
2015-04-18 21:44 UTC, Paul Konecny
Details
Updated GDB trace for openglunderqml (12.18 KB, text/x-log)
2015-06-26 00:27 UTC, Paul Konecny
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Konecny 2015-04-15 10:38:46 UTC
Hi J-B, 
while investigating https://bugs.kde.org/show_bug.cgi?id=346184 I tried to run kdenlive on the radeon GPU in my laptop in hybrid graphics mode. Unfortunately kdenlive wouldn't even start. 
I tried it with kwin both in OpenGL 3.1 and Xrender mode. (both backtracks attached)

Reproducible: Always

Steps to Reproduce:
1.Set radeon as hybrid GPU with xrandr --setprovideroffloadsink radeon Intel
2.run gdb and kdenlive on the dedicated GPU with DRI_PRIME=1 gdb kdenlive
3.(gdb) set logging file prime.log
4.(gdb) set logging on
5.(gdb)run
6.Program received signal SIGABRT, Aborted.
7.rinse and repeat



Version 15.04.0 (rev. v15.03.97-218-g78616e7)
Comment 1 Paul Konecny 2015-04-15 10:39:53 UTC
Created attachment 92054 [details]
Prime backtrace with OpenGL kwin
Comment 2 Paul Konecny 2015-04-15 10:40:15 UTC
Created attachment 92055 [details]
Prime backtrace with Xrender kwin
Comment 3 Jean-Baptiste Mardelle 2015-04-18 15:47:46 UTC
This is a serious problem. I just found an old macbook with an ATI card and I am currently preparing it to test this problem. Just to be sure, which Qt version is installed on that machine ?
Comment 4 Paul Konecny 2015-04-18 16:06:10 UTC
Seems I'm quite adept at bumping into serious problems :D
qmake --version
QMake version 3.0
Using Qt version 5.4.1 in /usr/lib
Good Luck!
Comment 5 Jean-Baptiste Mardelle 2015-04-18 21:03:22 UTC
OpenGL and GPU effects/movit work fine on my test system with a radeon mobility x1600.
I think your issue is related to the hybrid config. The Qt5 examples provide a demo application running OpenGL in Qt. I need you to try it to check it if works. The sample app is called :
openglunderqml

In ubuntu, it is provided by a package called qtdeclarative5-examples and installed here:
/usr/lib/x86_64-linux-gnu/qt5/examples/quick/scenegraph/openglunderqml/openglunderqml

Can you tell me if this app works on your laptop ?
Comment 6 Paul Konecny 2015-04-18 21:32:14 UTC
Hello JB,
Unfortunately Arch does not officially package the qt5 examples.

Good news is, I found a package in the AUR and installed it https://aur.archlinux.org/packages/qt5-examples/
and I now find openglunderqml here /usr/share/doc/qt/examples/quick/scenegraph/openglunderqml/
Bad news is as far as I can tell those are just the source files.
doc  main.cpp  main.qml  openglunderqml.pro  openglunderqml.qrc  squircle.cpp  squircle.h
How do I compile this?

Another bad news is, that even with movit disabled kdenlive won't start on the second card. I can attach the trace if you want but I guess it's still the same error: 
QObject::connect: No such slot Bin::slotResetInfoMessage() in /home/paul/Downloads/kdenlive/test3/src/kdenlive/src/bin/bin.cpp:317
kdenlive: dri2.c:518: dri2_allocate_textures: Assertion `drawable->textures[statt]' failed.
Thanks!
Comment 7 Paul Konecny 2015-04-18 21:43:43 UTC
Nevermind. Just learned how to use qt-creator...

LANG=C DRI_PRIME=1 '/home/paul/hybrid test/build-openglunderqml-Desktop-Debug/openglunderqml' 
QML debugging is enabled. Only use this in a safe environment.
openglunderqml: dri2.c:518: dri2_allocate_textures: Assertion `drawable->textures[statt]' failed.
Same issue. I'll attach the trace.
Comment 8 Paul Konecny 2015-04-18 21:44:21 UTC
Created attachment 92115 [details]
trace for openglunderqml
Comment 9 Jean-Baptiste Mardelle 2015-04-18 22:13:36 UTC
Ok, then this has nothing to do with Kdenlive. 
I see 3 possibilities: 
1) there is a configuration problem on the system
2) a bug or lack of OpenGL support in the video driver
3) a bug in Qt5

You might want to check if there is a newer mesa version, otherwise let them know about the openglunderqml crash...
Comment 10 Paul Konecny 2015-04-18 22:24:49 UTC
Hello JB, 
ad 1, maybe but I wouldn't know where to look
ad 2, unlikely as Steam, 0ad, Supertuxcart and Xonotic work on the radeon.
ad 3, I'm guessing that's the case. Where should I report this?

I'm already running the newest stable mesa 10.5.3

Unfortunately this still does not resolve https://bugs.kde.org/show_bug.cgi?id=346184 as the machine I found it on (my desktop) only has one GPU and the three effects combined kill the kernel driver. At least "radeon ring 0 stalled for more than X millisenconds" sounds like a GPU lockup. I just thought that I can reproduce it on my notebook's radeon as well. That's when I stumbled over this bug here. 
Thanks!
Comment 11 Paul Konecny 2015-04-18 23:13:28 UTC
Just reported it. 
https://bugreports.qt.io/browse/QTBUG-45686
Could you or others vote on it so it will gain traction?
Being able to run kdenlive on a dedicated GPU is essential e.g. on mobile workstation or just offloading the hard work to a more powerful GPU.
Btw. I hope what we got is enough because I don't know if my debugging skills are sufficient for the whole of Qt. 

Anyway, big thanks J-B! 
(Should we mark this bug as Resolved / Upstream ? )
Comment 12 Jean-Baptiste Mardelle 2015-04-19 10:27:35 UTC
Paul, in the Qt bug report you should probably make it clear that openglunderqml is part of the official Qt examples. Also, it willbe helpful to developers to paste the output of the glxinfo command and to tell what exact graphic card is in your laptop.
Comment 13 Paul Konecny 2015-04-19 10:51:28 UTC
Done, thanks! Should this be sufficient now?
Comment 14 Paul Konecny 2015-06-26 00:27:24 UTC
Created attachment 93344 [details]
Updated GDB trace for openglunderqml

Hello JB, 
I've switched my Notebook to Kubuntu 15.04 with backports and I get far more debugging symbols here. I can confirm, that kdenlive 15.04.2 (of course without movit) runs on the dedicated card just fine. Unfortunately I don't know how to package for Debian (Arch is a bliss in this regard) but I was able to test openglunderqml again. This time the log is twice the size and contains way more information. I already posted this to the qt-project and freedesktop bug reports as well. I hope this helps!
Cheers!
Comment 15 Paul Konecny 2016-01-06 22:17:27 UTC
Hi, J-B i retested this on the latest Arch and got it working. 
Software kdenlive-git master 15.13 e43f3d4, mlt 0.98, movit-git master Qt 5.5.1, Plasma 5.5.3 , frameworks 5.17, Kernel 4.3, mesa 11.1

In the Qt bug report mentioned above it was still necessary to launch with
QT_OPENGL_NO_SANITY_CHECK=1
It works without it now. So this issue seems fixed :)
The only thing you have to do beforehand is switch kwin to xrender mode but this is an issue with DRI_PRIME and not kdenlive. 
Cheers!