Bug 409052 - High GPU Usage
Summary: High GPU Usage
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: OpenGL Canvas (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Other macOS
: NOR normal
Target Milestone: ---
Assignee: vanyossi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-22 19:58 UTC by zoltron
Modified: 2019-07-08 14:59 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
High GPU Usage (886.93 KB, video/mp4)
2019-06-22 19:58 UTC, zoltron
Details

Note You need to log in before you can comment on or make changes to this bug.
Description zoltron 2019-06-22 19:58:14 UTC
Created attachment 121082 [details]
High GPU Usage

Each simple task uses too much GPU. It causes warming up on macbook pro 2016.

Similar softwares I've tried doesn't cause warming up.

Opentoonz.
Tupi.
Pencil 2D.
Autodesk SketchBook

SESSION: 22 Jun 2019 22:15:30 +0300. Executing /Users/haz/Applications/krita.app/Contents/MacOS/krita

Krita

 Version: 4.3.0-prealpha (git 9b2dd2e)
 Languages: en_US
 Hidpi: true

Qt

  Version (compiled): 5.12.4
  Version (loaded): 5.12.4

OS Information

  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: darwin
  Kernel Version: 18.6.0
  Pretty Productname: macOS Mojave (10.14)
  Product Type: osx
  Product Version: 10.14


Hardware Information

  GPU Acceleration: auto
  Memory: 16384 Mb
  Number of Cores: 8
  Swap Location: /Users/haz/Library/Application Support/krita/swap


OpenGL Info
 
  Vendor:  "ATI Technologies Inc." 
  Renderer:  "AMD Radeon Pro 455 OpenGL Engine" 
  Version:  "4.1 ATI-2.9.26" 
  Shading language:  "4.10" 
  Requested format:  QSurfaceFormat(version 3.2, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CoreProfile) 
  Current format:    QSurfaceFormat(version 4.1, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples 0, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CoreProfile) 
     Version: 4.1
     Supports deprecated functions false 
     is OpenGL ES: false 

QPA OpenGL Detection Info 
  supportsDesktopGL: true 
  supportsOpenGLES: false 
  isQtPreferOpenGLES: false 
== log ==
 Supported renderers: QFlags(0x2) 
Surface format preference list: 
* QSurfaceFormat(version 3.2, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CoreProfile) 
    QSurfaceFormat::OpenGL 
* QSurfaceFormat(version 3.2, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CoreProfile) 
    QSurfaceFormat::OpenGLES 
Probing format... QSurfaceFormat::DefaultColorSpace QSurfaceFormat::OpenGL 
Found format: QSurfaceFormat(version 3.2, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CoreProfile) 
    QSurfaceFormat::OpenGL 
 
== end log == 
================================================================================
Comment 1 vanyossi 2019-06-23 05:45:18 UTC
Could you be more specific? With so little information it is almost impossible to start figuring out what could be happening.

Some tools use your full CPU cores by default and that will fire up the fans of your macbook after some painting (this is good). About GPU, I see you have an ATI card, afaik we do not have a ATI card equiped macOS system for testing, only intel based ones.
Comment 2 zoltron 2019-06-23 14:57:38 UTC
(In reply to vanyossi from comment #1)
> Could you be more specific? With so little information it is almost
> impossible to start figuring out what could be happening.
> 
> Some tools use your full CPU cores by default and that will fire up the fans
> of your macbook after some painting (this is good). About GPU, I see you
> have an ATI card, afaik we do not have a ATI card equiped macOS system for
> testing, only intel based ones.

my advice, as a workaround krita must detect and use integrated Intel GPU on dual graphic cards macbooks.
OpenGL is dead for macos and macbooks
Apple are stopped OpenGL support since 4.1 version, you can use Metal API and MoltenVk or drop MacOS support.
Comment 3 vanyossi 2019-06-23 16:23:17 UTC
could you answer what specific operations you refer with this? -> "Each simple task."

AFAIK: We only use openGL rendering for the canvas and shader for the healing brush. Do you experiment the warming up if you only rotate or zoom the canvas? (no painting, no filters being rendered, no nothing, just rotate or zoom) Painting uses your full processor by default, that is CPU not GPU, and yes it is expected to warm up. 

macbooks love to be quiet and before turning the fans up they wait until the laptop is extremely hot to start spinning fast. If you dont like that just set your fans to manual at a good speed and the macbook will never heat up.
Comment 4 zoltron 2019-06-23 18:26:22 UTC
(In reply to vanyossi from comment #3)
> could you answer what specific operations you refer with this? -> "Each
> simple task."
> 
> AFAIK: We only use openGL rendering for the canvas and shader for the
> healing brush. Do you experiment the warming up if you only rotate or zoom
> the canvas? (no painting, no filters being rendered, no nothing, just rotate
> or zoom) Painting uses your full processor by default, that is CPU not GPU,
> and yes it is expected to warm up. 
> 
> macbooks love to be quiet and before turning the fans up they wait until the
> laptop is extremely hot to start spinning fast. If you dont like that just
> set your fans to manual at a good speed and the macbook will never heat up.

I put it as an attachment video. Didn't you watch? almost everything that uses GPU

the following uses a 100 percent GPU ( AMD radeon Pro 455.)

-animation play
-panning, zooming
-every slider in GUI
-drawing with brush
Comment 5 zoltron 2019-06-23 18:39:53 UTC
I want to use Krita, but that's why I use Pencil2D. If you are taking this problem seriously I can put a detailed video on youtube.
Comment 6 vanyossi 2019-06-24 03:45:23 UTC
I can confirm this does not happen with intel GPU. Qt 5.12.3, krita master.

It seems there could be something wrong going on with OpenGL and thATI card, but i can't personally take care of this since I have no hardware to reproduce the issue. 

Moving towards MoltenVK is something Im studying atm, but without solid knowledge on the subject I doubt I will come up with something soon.

as for taking it seriouly, i am, but I had to ask first, im sorry I didn't catch the video sooner, the attachments are not very prominent design wise in bugzilla. Video can get us up to a centain point, however I see you are running krita from compiled sources… Let me ask the other devs, maybe we can come up with a patch for you to compile krita with that could give us some insight on what is going on and perhaps come up with a solution.

I'm confirming this and assinging myself to keep track of this bug
Comment 7 Halla Rempt 2019-06-24 07:10:04 UTC
I went for the cheaper option, too, when I got my macbook pro in 2015, and didn't get one with a dual gpu. Of course we're not going to spend time and/or money on porting Krita to Metal. It's a proprietary API available only on a minority platform. I also don't intend to spend Krita money on getting a mac with an AMD GPU: Apple just doesn't sell any hardware worth the asking price at the moment.

MoltenVK would only work if we'd port Krita's opengl to Vulkan, which is also not planned. If Angle would get support for Metal, then that would be an option.
Comment 8 vanyossi 2019-06-24 12:55:57 UTC
You might find this usefull for testing purposes

https://discussions.apple.com/thread/8646824
Comment 9 zoltron 2019-06-24 18:42:26 UTC
if you send Krita running on Integrated Intel GPU, I can test it. If you are considering an AMD hotfix, I believe it will not work because this is Apple GPU driver problem.
maybe it helps; 
https://developer.apple.com/library/archive/qa/qa1734/_index.html
https://apple.stackexchange.com/questions/217928/how-does-os-x-decide-when-to-switch-graphics-processors

I've come across a Krita version that works with Intel before.
I'm not a programmer, but I think it's gonna work. thanks.
Comment 10 zoltron 2019-06-24 19:01:41 UTC
i dont't want to use gfxCardStatus. this App is unstable and incompatible with macOS Mojave
Comment 11 Halla Rempt 2019-06-24 21:21:13 UTC
No, that link only tells us that there's no way we, as application developers, can determine whether to run the application on Intel or on AMD.
Comment 12 Halla Rempt 2019-06-25 06:03:30 UTC
Hm, this page is interesting: https://developer.apple.com/library/archive/qa/qa1734/_index.html

I'll try that for the next nightly build.
Comment 14 Halla Rempt 2019-06-25 06:19:03 UTC
Git commit 27fb28ff907a49bd3072e0760f40371e9f382c8d by Boudewijn Rempt.
Committed on 25/06/2019 at 06:17.
Pushed by rempt into branch 'master'.

Add NSSupportsAutomaticGraphicsSwitching to the Info.plist

https://developer.apple.com/library/archive/qa/qa1734/_index.html
suggests that this will make it possible for Krita to use the
integrated Intel GPU instead of the discrete AMD GPU. AMD drivers
on macOS are the pits, using Intel should be preferred for Krita

M  +2    -0    krita/Info.plist.template

https://invent.kde.org/kde/krita/commit/27fb28ff907a49bd3072e0760f40371e9f382c8d
Comment 15 Halla Rempt 2019-06-25 13:39:50 UTC
I made a special nightly with that flag set: 

https://files.kde.org/krita/osx/krita-nightly_2f68711.dmg 


Could you check whether macOS still honors the flag and runs Krita on the integrated gpu? Of course, this won't help people with newer macbook pro's that only have an AMD GPU...
Comment 16 zoltron 2019-06-25 14:52:25 UTC
(In reply to Boudewijn Rempt from comment #15)
> I made a special nightly with that flag set: 
> 
> https://files.kde.org/krita/osx/krita-nightly_2f68711.dmg 
> 
> 
> Could you check whether macOS still honors the flag and runs Krita on the
> integrated gpu? Of course, this won't help people with newer macbook pro's
> that only have an AMD GPU...

it works thanks, here is gpu usage, it can be better optimized, but not bad.
https://i.hizliresim.com/lQyLnQ.png
Comment 17 Halla Rempt 2019-06-26 05:36:06 UTC
That image link gives me a 403. But in any case, I guess we can close this as fixed for now.
Comment 18 zoltron 2019-06-26 15:35:35 UTC
ok thanks. usage is normal. beetween %0 - %80, up-and-down.
Comment 19 Halla Rempt 2019-07-08 14:59:29 UTC
Git commit 1b1936b97e01c2b12eb844c9a07c5941031bf082 by Boudewijn Rempt.
Committed on 08/07/2019 at 14:59.
Pushed by rempt into branch 'krita/4.2'.

Add NSSupportsAutomaticGraphicsSwitching to the Info.plist

https://developer.apple.com/library/archive/qa/qa1734/_index.html
suggests that this will make it possible for Krita to use the
integrated Intel GPU instead of the discrete AMD GPU. AMD drivers
on macOS are the pits, using Intel should be preferred for Krita

M  +2    -0    krita/Info.plist.template

https://invent.kde.org/kde/krita/commit/1b1936b97e01c2b12eb844c9a07c5941031bf082