Bug 383281 - OpenGL crash on systems with OpenGL 2.1
Summary: OpenGL crash on systems with OpenGL 2.1
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: OpenGL Canvas (show other bugs)
Version: 3.2.0-beta.2
Platform: Microsoft Windows Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: Alvin Wong
URL:
Keywords:
: 383700 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-08-08 14:41 UTC by Tanner H
Modified: 2017-08-21 15:47 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
kritacrash.log (17.52 KB, text/plain)
2017-08-08 14:41 UTC, Tanner H
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tanner H 2017-08-08 14:41:54 UTC
Created attachment 107155 [details]
kritacrash.log

These crashes are new to the 3.2 betas (and RC).  3.1 works fine.

On my Win 10 PC, creating a new image (via File > New), or opening any image file (kra, jpeg, png) from either the Open dialog or Open > Recent menu, causes Krita to crash.  

Backtrace attached.  Note that the backtrace looks roughly identical whether the crash occurs after File > New or File > Open.
Comment 1 Halla Rempt 2017-08-16 10:26:22 UTC
Weird... Since there's no difference in our opengl code between 3.1 and 3.2...

Does this still happen when you disable opengl? Have had any recent updates for your windows display driver?

Can you tell us which display chip you have, and the version of the driver? Please go to the help menu, select system information and paste the information from the dialog.
Comment 2 Tanner H 2017-08-16 13:20:52 UTC
Hi Boudewijn.  Thank you for following-up.

On 3.2 RC, if I disable OpenGL, the crash disappears.  

Just to confirm, I downloaded Krita 3.1.4 portable this morning onto this same PC.  Even with OpenGL enabled, there is no crash.  File > New and File > Open/Open Recent work flawlessly in 3.1.4, with or without OpenGL enabled.

As you can see from my System Info report (below), this PC is 6-7 years old and using its original integrated Intel display chip.  Windows lists the driver date as November 2012, and if you want, I can try and find an updated version to download.  (I didn't want to touch the driver yet, in case you needed details from this PC "as is").

Here is the full System Info report:

OS Information
  Build ABI: x86_64-little_endian-llp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: winnt
  Kernel Version: 10.0.15063
  Pretty Productname: Windows 10
  Product Type: windows
  Product Version: 10

OpenGL Info
  Vendor: Intel
  Renderer: Intel(R) HD Graphics
  Version: 2.1.0 - Build 8.15.10.2900
  Shading language: 1.20  - Intel Build 8.15.10.2900
   Version: 2.1
     Supports deprecated functions: true
Comment 3 Halla Rempt 2017-08-16 13:32:55 UTC
Hm... That definitely needs updating, but why it should crash... Could you also check whether the 4.0 pre-alpha crashes before updating the driver? I guess that the display chip is an HD3000?
Comment 4 Tanner H 2017-08-16 15:15:37 UTC Comment hidden (obsolete)
Comment 5 Tanner H 2017-08-16 19:00:01 UTC
I had a little spare time this afternoon, so I tried running 3.2 RC with OpenGL logging enabled.  The new crash log suggests qopenglfunctions_3_0.h as a possible culprit:

krita.exe caused an Access Violation at location 00007FF92E1AB76A in module libkritaui.dll Reading from location 0000000000000110.

AddrPC           Params
00007FF92E1AB76A 000000000F3730E0 000000B2000000F2 0000000002EAEE40  libkritaui.dll!renderCanvasGL  [C:/dev/i/include/QtGui/qopenglfunctions_3_0.h @ 953]
00007FF92E1AB891 00000000005F8BD0 0000000068A160D9 0000000012280F80  libkritaui.dll!paintGL  [C:/dev/krita-3.2.0-rc.1/libs/ui/opengl/kis_opengl_canvas2.cpp @ 342]

No idea if this helps, but perhaps narrows it to two related commits unique to 3.2:

https://github.com/KDE/krita/commit/331b4501488aaa02afbc964272164a34b86f5ef3
https://github.com/KDE/krita/commit/540dc93b4b73c2adde58e0bdf389c5448df7f3ab

(Apologies for linking direct to GitHub commit pages; I was using them to search potentially related commits.)
Comment 6 Alvin Wong 2017-08-17 09:02:54 UTC
The problem is probably with inheriting from the versioned QOpenGLFunctions_x_x instead of the more flexible QOpenGLFunctions. I can see how it might be fixable, but it would need to wait at least until 3.2.1.

But even then, the driver is just too old, it's so old that it's practically useless for today. I'm sure there is a "newer" one with at least OpenGL 3.0 support.

(Side note: I think even ANGLE wouldn't work with this integrated graphics because it doesn't support D3D11, which actually would be a nice candidate for testing how the Qt automatic OpenGL detection choose in cases like this.)
Comment 7 Alvin Wong 2017-08-19 09:30:48 UTC
Git commit 754ab2536610d2c4a6f5c8220cd294904b13cb33 by Alvin Wong.
Committed on 19/08/2017 at 09:19.
Pushed by alvinwong into branch 'krita/3.2'.

Attempt to restore OpenGL 2.1 support on non-OSX systems

Partially reverts d0a329fa4d83576d729baae5a0f65f5b7810f289 (D4506)
and reverts the effect of 96835a05b874abe85b95e1aff525faa4a91368a8.

`KisOpenGLCanvas2` inheritting from a versioned `QOpenGLFunctions_x_x`
isn't the best idea just to get `glLogicOp`, so I try to use an
alternative method to get it.

`glLogicOp` is supposed to be in OpenGL core functions since full
desktop OpenGL 1.0, just never had been a function in OpenGL ES 2.0 or
above, so it should be available even with `QOpenGLFunctions_1_0`. I
used `QOpenGLFunctions_2_1` just because that's the minimum version we
seem to supported before 3.2 release.
Related: bug 363770
Differential Revision: https://phabricator.kde.org/D7405

M  +3    -2    libs/ui/opengl/kis_opengl.cpp
M  +20   -0    libs/ui/opengl/kis_opengl_canvas2.cpp
M  +6    -3    libs/ui/opengl/kis_opengl_canvas2.h

https://commits.kde.org/krita/754ab2536610d2c4a6f5c8220cd294904b13cb33
Comment 8 Alvin Wong 2017-08-19 09:33:23 UTC
Git commit 6ddc51090990c7e270540d83f9e7a129132f4ccf by Alvin Wong.
Committed on 19/08/2017 at 09:32.
Pushed by alvinwong into branch 'master'.

Attempt to restore OpenGL 2.1 support on non-OSX systems

Partially reverts d0a329fa4d83576d729baae5a0f65f5b7810f289 (D4506)
and reverts the effect of 96835a05b874abe85b95e1aff525faa4a91368a8.

`KisOpenGLCanvas2` inheritting from a versioned `QOpenGLFunctions_x_x`
isn't the best idea just to get `glLogicOp`, so I try to use an
alternative method to get it.

`glLogicOp` is supposed to be in OpenGL core functions since full
desktop OpenGL 1.0, just never had been a function in OpenGL ES 2.0 or
above, so it should be available even with `QOpenGLFunctions_1_0`. I
used `QOpenGLFunctions_2_1` just because that's the minimum version we
seem to supported before 3.2 release.
Related: bug 363770
Differential Revision: https://phabricator.kde.org/D7405

M  +3    -2    libs/ui/opengl/kis_opengl.cpp
M  +20   -0    libs/ui/opengl/kis_opengl_canvas2.cpp
M  +6    -3    libs/ui/opengl/kis_opengl_canvas2.h

https://commits.kde.org/krita/6ddc51090990c7e270540d83f9e7a129132f4ccf
Comment 9 Halla Rempt 2017-08-19 14:54:33 UTC
*** Bug 383700 has been marked as a duplicate of this bug. ***
Comment 10 Alvin Wong 2017-08-19 14:58:25 UTC
@Tanner

Can you please try this nightly build and see if you can enable OpenGL without crashing? Also please provide the data from the system info dialog from this build just in case.

https://ci.appveyor.com/api/buildjobs/072b30c7u0pont6a/artifacts/krita-x64-appveyor.zip
Comment 11 Tanner H 2017-08-20 15:12:56 UTC
Hi Alvin.  I've just tested the latest nightly build (krita-x64-6c8f2b8-appveyor-0.1.1.221) with OpenGL enabled, and there is no crash!  Amazing work implementing a fix so quickly.

Here is the system data, in case it is helpful:

Krita
  Version: 4.0.0-pre-alpha (git 6c8f2b8)

OS Information
  Build ABI: x86_64-little_endian-llp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: winnt
  Kernel Version: 10.0.15063
  Pretty Productname: Windows 10
  Product Type: windows
  Product Version: 10

OpenGL Info 
  Vendor:  Intel 
  Renderer:  "Intel(R) HD Graphics" 
  Version:  2.1.0 - Build 8.15.10.2900 
  Shading language:  1.20  - Intel Build 8.15.10.2900 
  Requested format:  QSurfaceFormat(version 3.0, options QFlags(0x4), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior 2, swapInterval 0, profile  2) 
  Current format:    QSurfaceFormat(version 2.1, options QFlags(0x4), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior 2, swapInterval 1, profile  0) 
     Version: 2.1
     Supports deprecated functions true 

Per your comment #6, would it helpful for me to keep these out-of-date drivers on this system?  I am happy to test any future legacy OpenGL issues if need be.
Comment 12 Alvin Wong 2017-08-21 15:47:22 UTC
@Tanner

If you are willing to keep an old version of intel driver just to test Krita, then of course! Thanks for your help.