Bug 99033

Summary: [NV67] Incomplete implementation of OpenGL 2.1
Product: Mesa Reporter: Илья Индиго <ilya>
Component: Drivers/DRI/nouveauAssignee: Nouveau Project <nouveau>
Status: RESOLVED MOVED QA Contact: Nouveau Project <nouveau>
Severity: major    
Priority: medium CC: ilya, mirh
Version: 13.0   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: nouveau
nvidia
kde-workspace-4.11.22.tar.xz

Description Илья Индиго 2016-12-09 11:09:44 UTC
Created attachment 128388 [details]
nouveau

openSUSE Tumbleweed x86_64 / nouveau Gallium 0.4 on NV67 (Nvidia GeForce 7000M) / OpenGL 2.1 / Mesa 13.0.2 / kernel 4.8.12-default / GCC 6.2 / LLVM 3.8.1

Not all OpenGL 2.1 extensions are implemented in the nouveau, compared to nvidia 304.131, which is why some of the effects of KDE4, using OpenGL 2.1, do not work correctly, and KDE5 constantly falling. Also, do not grip extensions reflected in the work of some emulators game consoles, such as yabause, which runs on nvidia and shows black screen on the nouveau.

Files with the following extensions for nvidia 304.131 and nouveau attached.
Comment 1 Илья Индиго 2016-12-09 11:10:30 UTC
Created attachment 128389 [details]
nvidia
Comment 2 Karol Herbst 2016-12-09 12:39:53 UTC
could you tell us which extensions are actually needed? I am sure you can understand, that we can't simply implement all of the missing ones in a wink of an eye, so we have to prefer the important ones
Comment 3 Pierre Moreau 2016-12-09 13:42:36 UTC
Looking at the OpenGL 2.1 specification, I haven’t been able to find any extension, that was promoted to a core feature in OpenGL <= 2.1, that is not implemented by Nouveau.

Some of the extensions exposed by NVIDIA are clearly not part of the OpenGL 2.1 specification, such as GL_ARB_shading_language_420pack [0], which was approved in 2011, whereas the OpenGL 2.1 specification is from Dec. 2006.
I had a quick look at about 10 extensions exposed by NVIDIA but not by Nouveau, and they were mostly approved >2008. One extension, GL_EXT_framebuffer_multisample [1], was approved in 2005, but it became a core feature only in OpenGL 3.0.

From what I understand (correct me if I am wrong), OpenGL extensions, as long as they haven’t been made into a core feature, are completely optional in order to support a given OpenGL version.

[0]: https://www.opengl.org/registry/specs/ARB/shading_language_420pack.txt
[1]: https://www.opengl.org/registry/specs/EXT/framebuffer_multisample.txt
Comment 4 Илья Индиго 2016-12-12 20:52:35 UTC
> could you tell us which extensions are actually needed?
In the source code, I spent kwin search for extensions by string ("GL_ and revealed the following files, which is held on the expansion test.

./kwin/effects/blur/blurshader.cpp
./kwin/eglonxbackend.cpp
./kwin/libkwineffects/kwinglplatform.cpp
./kwin/libkwineffects/kwingltexture.cpp
./kwin/libkwineffects/kwinglutils.cpp
./kwin/libkwineffects/kwinglutils_funcs.cpp
./kwin/scene_opengl.cpp

And determined the expansion are absent in nouveau, but there is nvidia.

GL_EXT_texture_format_BGRA8888
GL_ARB_framebuffer_object
GL_OES_mapbuffer
GL_OES_texture_3D

And also found that the extension is not in the nvidia, but there is in nouveau.

GL_OES_EGL_image

Problem effect is "Taskbar thumbnail"
./kwin/effects/taskbarthumbnail/*

When you mouse hover over a tab on the taskbar instead of the window shows a blank thumbnail translucent rectangle of the appropriate size.
When you switch on the OpenGL 1.2 kwin thumbnail is displayed.
Comment 5 Илья Индиго 2016-12-12 20:53:41 UTC
Created attachment 128441 [details]
kde-workspace-4.11.22.tar.xz
Comment 6 Ilia Mirkin 2016-12-12 20:59:43 UTC
(In reply to Ilya Indigo from comment #4)
> And determined the expansion are absent in nouveau, but there is nvidia.
> 
> GL_EXT_texture_format_BGRA8888
> GL_OES_mapbuffer
> GL_OES_texture_3D

These are ES extensions and not available in a desktop GL profile, on nvidia or nouveau. They should, however, be present on a mesa ES profile. See https://people.freedesktop.org/~imirkin/glxinfo/#p=es&v=Mesa%2010.6.0

> GL_ARB_framebuffer_object

Yeah, we don't support that one while NVIDIA does. It requires a lot of work-arounding to handle all the cases not supported by the HW. Tripping those up gets you off the fastpath in the blob driver and it slows down bigtime. We have no such fallbacks in nouveau.

However GL_EXT_framebuffer_object is supported, and doesn't allow the unsupportable conditions (like attachments of different sizes).

> Problem effect is "Taskbar thumbnail"
> ./kwin/effects/taskbarthumbnail/*
> 
> When you mouse hover over a tab on the taskbar instead of the window shows a
> blank thumbnail translucent rectangle of the appropriate size.
> When you switch on the OpenGL 1.2 kwin thumbnail is displayed.

That sounds like you're hitting a situation where you have a depth buffer that's incompatible with the color buffer. We're supposed to fall back in that situation, but don't. As a result, there's no depth, which can lead to no rendering. Once this is supported, we could probably look at supporting ARB_framebuffer_object, as similar mechanisms would be required.

Is there a link to the code I could glance at to see if that's likely the issue?
Comment 7 Илья Индиго 2016-12-12 21:06:37 UTC
> Looking at the OpenGL 2.1 specification, I haven’t been able to find any extension, that was promoted to a core feature in OpenGL <= 2.1, that is not implemented by Nouveau.

If this card is able to support later expansion, which should be implemented to the later video card, which shows a list of nvidia, why not add them to this card?

> could you tell us which extensions are actually needed? I am sure you can understand, that we can't simply implement all of the missing ones in a wink of an eye, so we have to prefer the important ones.

I thought, if in Mesa for nouveau declared support for OpenGL 4.1 at least, the increasingly younger expansion should be implemented already, just depending on the graphics card will connect them to a different set?

Or something I do not understand, and for each GPU you write from scratch every extension?
Comment 8 Илья Индиго 2016-12-12 21:19:04 UTC
> Is there a link to the code I could glance at to see if that's likely the issue?
You mean the source code kwin?
I have it attached.
https://bugs.freedesktop.org/attachment.cgi?id=128441
Comment 9 Ilia Mirkin 2016-12-12 21:22:00 UTC
(In reply to Ilya Indigo from comment #7)
> If this card is able to support later expansion, which should be implemented
> to the later video card, which shows a list of nvidia, why not add them to
> this card?

They are using software to work around the hardware's limitations. That software is not written for nouveau.

> I thought, if in Mesa for nouveau declared support for OpenGL 4.1 at least,

For GF100+ GPUs, yes. NV67 is a fair bit older.

> the increasingly younger expansion should be implemented already, just
> depending on the graphics card will connect them to a different set?
> 
> Or something I do not understand, and for each GPU you write from scratch
> every extension?

Each hardware generation supports what it supports. For NV67, which is effectively a NV4x, that's basically the DX9 feature set. ARB_framebuffer_object is, in essence, a DX10 feature, but NVIDIA was able to provide the software fallbacks for the cases in the ext that aren't handled, and fast-path the cases that are. Nouveau hasn't done this. Patches welcome.
Comment 10 Ilia Mirkin 2016-12-12 21:58:07 UTC
(In reply to Ilya Indigo from comment #8)
> > Is there a link to the code I could glance at to see if that's likely the issue?
> You mean the source code kwin?
> I have it attached.
> https://bugs.freedesktop.org/attachment.cgi?id=128441

https://github.com/KDE/kde-workspace/blob/KDE/4.11/kwin/effects/taskbarthumbnail/taskbarthumbnail.cpp

Unfortunately this is too abstract in order for me to tell how it works under the hood.

I might recommend building this with DEBUG_GLRENDERTARGET and seeing if you hit any issues. (At least in the code, this causes a bunch of error checking to be activated.)
Comment 11 GitLab Migration User 2019-09-18 20:44:15 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/1119.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.