After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 738670 - GL Context on NVIDIA
GL Context on NVIDIA
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-10-17 08:17 UTC by drago01
Modified: 2015-04-09 10:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdkglcontext-x11: Fix gl context (1.26 KB, patch)
2014-10-20 15:34 UTC, drago01
reviewed Details | Review
gdkglcontext-x11: Fix pixmap creation (1.61 KB, patch)
2014-10-20 15:34 UTC, drago01
committed Details | Review
gl context (1.03 KB, patch)
2014-10-28 09:54 UTC, Ignacio Casal Quinteiro (nacho)
needs-work Details | Review
glxinfo (260.58 KB, text/plain)
2014-10-28 15:33 UTC, Ignacio Casal Quinteiro (nacho)
  Details
xdpyinfo (67.63 KB, text/plain)
2014-10-28 15:33 UTC, Ignacio Casal Quinteiro (nacho)
  Details
GdkGLContextX11: Ensure we get the fbconfig with the exact same visual (2.96 KB, patch)
2014-10-28 16:00 UTC, Alexander Larsson
none Details | Review
X11: Pick better system and rgba visuals for GL (10.82 KB, patch)
2014-10-29 12:34 UTC, Alexander Larsson
committed Details | Review
Cache default gdk visuals in the GDK_VISUALS property on the root window (4.89 KB, patch)
2014-10-29 12:34 UTC, Alexander Larsson
committed Details | Review
Blurry and overly transparent window (216.53 KB, image/png)
2014-10-29 12:58 UTC, Garrett Regier
  Details
Output of the gthree performance run (5.65 KB, text/plain)
2014-11-06 15:29 UTC, drago01
  Details
system_visual selected by pick_better_visual_for_gl() (2.14 KB, text/plain)
2015-03-27 15:21 UTC, Evangelos Foutras
  Details
system_visual selected by pick_better_visual_for_gl() (2.14 KB, text/plain)
2015-03-27 15:28 UTC, Evangelos Foutras
  Details

Description drago01 2014-10-17 08:17:31 UTC
I have been playing with gdkgears on my NVIDIA system using the prop. NVIDIA drivers.

It does not seem to work at all. First it fails to create a GLX context.
Thats because the call in https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkglcontext-x11.c#n761 generates a BadMatch. Setting the drawable to None and moving that to an else branch fixes the context creation.

After fixing that it still does not work because the glXCreatePixmap call in glx_pixmap_get also triggers a BadMatch.

I had to change it to use GLX_TEXTURE_2D_EXT (why isn't it trying to use that anyway?) and GLX_TEXTURE_FORMAT_RGB_EXT to get it to work. But "work" means no crashing the gears are spinning but with a black background and the window controls are white (but react to mouse events).

At that point I decided to file a bug instead of digging deeper.
Comment 1 Alexander Larsson 2014-10-20 10:25:01 UTC
The 2D_EXT thing we should just switch by default, but i don't have an nvidia machine to test nvidia on in general :/
Comment 2 drago01 2014-10-20 15:34:32 UTC
Created attachment 288957 [details] [review]
gdkglcontext-x11: Fix gl context

Do not create the dummy drawable when we have glx => 1.3, this causes
a BadMath on NVIDIA's glx implementation.
Comment 3 drago01 2014-10-20 15:34:36 UTC
Created attachment 288958 [details] [review]
gdkglcontext-x11: Fix pixmap creation

1) Always use NPOT textures
2) Do not select a RGB fbconfig, we use RGBA for the texture format, mixing
both will cause BadMatch.
Comment 4 drago01 2014-10-20 15:36:11 UTC
(In reply to comment #1)
> The 2D_EXT thing we should just switch by default, but i don't have an nvidia
> machine to test nvidia on in general :/

I have debugged it some more. With the attached patches it now works for me on both NVIDIA and INTEL (haswell).

I can split the second patch into two if you prefer that (i.e one for NPOT and one for the RGBA fbconfig).
Comment 5 Emmanuele Bassi (:ebassi) 2014-10-20 15:59:34 UTC
Review of attachment 288957 [details] [review]:

if you don't have access to GLX ≥ 1.3 then you cannot call glXCreateWindow().

the old code I wrote (which was taken from the equivalent code I wrote in Clutter) created a X11 dummy window, and used its XID with the GLX API, if the GLX version was < 1.3. the glXCreateWindow() call, and its GLXWindow XID was used only with GLX ≥ 1.3, so you're mismatching GLX use.

::: gdk/x11/gdkglcontext-x11.c
@@ +762,3 @@
+	  info->dummy_glx = glXCreateWindow (dpy, config, info->dummy_xwin, NULL);
+	}
+			else

coding style: this `else` is way overindented.
Comment 6 Alexander Larsson 2014-10-21 11:49:08 UTC
Review of attachment 288957 [details] [review]:

Yeah, this seems pretty weird. 
Is NVidia GLX 1.3? If so we must have a glx window for it.
And for non-1.3 we can't have any glx window.
Comment 7 Alexander Larsson 2014-10-21 12:00:00 UTC
Review of attachment 288958 [details] [review]:

pushed this
Comment 8 Emmanuele Bassi (:ebassi) 2014-10-21 12:13:03 UTC
(In reply to comment #6)
> Review of attachment 288957 [details] [review]:
> 
> Yeah, this seems pretty weird. 
> Is NVidia GLX 1.3? If so we must have a glx window for it.
> And for non-1.3 we can't have any glx window.

the way I implemented dummy windows for unattached contexts was to have a dummy drawable associated with the GLX context; at the time, though, the GdkGLContext objects were associated with a GdkDisplay, not with a GdkWindow.
Comment 9 drago01 2014-10-21 19:02:16 UTC
(In reply to comment #6)
> Review of attachment 288957 [details] [review]:
> 
> Yeah, this seems pretty weird. 

Yeah that patch is wrong it just fixed it because it got rid of the first glXCreateWindow call which triggers a BadMatch.

> Is NVidia GLX 1.3? 

Yes (actually 1.4).

> If so we must have a glx window for it. And for non-1.3 we can't have any glx window.

So the GLX < 1.3 path is already correct. The 1.3 one still is broken though. I am not sure if ebassi's old code worked (or got tested) but the code in cogl/clutter he based it on works just fine.
Comment 10 Alexander Larsson 2014-10-27 20:18:52 UTC
I updated some changes related to TEXTURE_2D vs TEXTURE_RECTANGLE_ARB. Can yo try nvidia on latest master?
Comment 11 drago01 2014-10-27 20:37:46 UTC
(In reply to comment #10)
> I updated some changes related to TEXTURE_2D vs TEXTURE_RECTANGLE_ARB. Can yo
> try nvidia on latest master?

I tested and as expected it does not work. Changes to the texture code won't make any difference as long as creating a gl context fails. The texturing issues I mentioned above where only visible after fixing the gl context creation.

This line: https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkglcontext-x11.c#n810

Triggers a bad match causing us to hit the trap here: https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkglcontext-x11.c#n816 and thus have no GL context to work with.

Removing that line and doing "info->glx_drawable = None" instead makes it work (see my first patch, the else branch was wrong though because we cannot do that on GLX 1.2).
Comment 12 drago01 2014-10-27 20:41:20 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > I updated some changes related to TEXTURE_2D vs TEXTURE_RECTANGLE_ARB. Can yo
> > try nvidia on latest master?
> 
> I tested and as expected it does not work. Changes to the texture code won't
> make any difference as long as creating a gl context fails. The texturing
> issues I mentioned above where only visible after fixing the gl context
> creation.
> 
> This line:
> https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkglcontext-x11.c#n810
> 
> Triggers a bad match causing us to hit the trap here:
> https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkglcontext-x11.c#n816 and thus
> have no GL context to work with.
> 
> Removing that line and doing "info->glx_drawable = None" instead makes it work
> (see my first patch, the else branch was wrong though because we cannot do that
> on GLX 1.2).

i.e this:

diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c
index accc8a5..a58d8ad 100644
--- a/gdk/x11/gdkglcontext-x11.c
+++ b/gdk/x11/gdkglcontext-x11.c
@@ -807,9 +807,7 @@ gdk_x11_window_create_gl_context (GdkWindow    *window,
 
       if (GDK_X11_DISPLAY (display)->glx_version >= 13)
        {
-         info->glx_drawable = glXCreateWindow (dpy, config,
-                                               gdk_x11_window_get_xid (window->impl_window),
-                                               NULL);
+         info->glx_drawable = None;
          info->dummy_glx = glXCreateWindow (dpy, config, info->dummy_xwin, NULL);
        }
 

is enough to make it work.
Comment 13 Ignacio Casal Quinteiro (nacho) 2014-10-28 09:54:57 UTC
Created attachment 289504 [details] [review]
gl context

In my case I needed this patch to make it work
Comment 14 Ignacio Casal Quinteiro (nacho) 2014-10-28 09:59:08 UTC
Another interesting crash:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
Missing separate debuginfos, use: debuginfo-install dbus-libs-1.6.12-9.fc20.x86_64 expat-2.1.0-7.fc20.x86_64 freetype-2.5.0-5.fc20.x86_64 glibc-2.18-16.fc20.x86_64 gmp-5.1.2-2.fc20.x86_64 gnutls-3.1.27-1.fc20.x86_64 keyutils-libs-1.5.9-1.fc20.x86_64 krb5-libs-1.11.5-11.fc20.x86_64 libICE-1.0.8-6.fc20.x86_64 libSM-1.2.1-6.fc20.x86_64 libX11-1.6.1-1.fc20.x86_64 libXau-1.0.8-2.fc20.x86_64 libXcomposite-0.4.4-4.fc20.x86_64 libXcursor-1.1.14-2.fc20.x86_64 libXdamage-1.1.4-4.fc20.x86_64 libXdmcp-1.1.1-5.fc20.x86_64 libXext-1.3.2-2.fc20.x86_64 libXfixes-5.0.1-2.fc20.x86_64 libXi-1.7.4-1.fc20.x86_64 libXinerama-1.1.3-2.fc20.x86_64 libXrandr-1.4.1-2.fc20.x86_64 libXrender-0.9.8-2.fc20.x86_64 libcom_err-1.42.8-3.fc20.x86_64 libdrm-2.4.54-1.fc20.x86_64 libffi-3.0.13-5.fc20.x86_64 libgcc-4.8.3-7.fc20.x86_64 libmodman-2.0.1-7.fc20.x86_64 libpng-1.6.6-3.fc20.x86_64 libproxy-0.4.11-8.fc20.x86_64 libselinux-2.2.1-6.fc20.x86_64 libstdc++-4.8.3-7.fc20.x86_64 libtasn1-3.8-2.fc20.x86_64 libuuid-2.24.2-1.fc20.x86_64 mesa-libEGL-10.1.5-1.20140607.fc20.x86_64 mesa-libgbm-10.1.5-1.20140607.fc20.x86_64 mesa-libglapi-10.1.5-1.20140607.fc20.x86_64 mesa-libwayland-egl-10.1.5-1.20140607.fc20.x86_64 nettle-2.7.1-3.fc20.x86_64 openssl-libs-1.0.1e-40.fc20.x86_64 pcre-8.33-6.fc20.x86_64 pixman-0.30.0-5.fc20.x86_64 systemd-libs-208-22.fc20.x86_64 trousers-0.3.13-1.fc20.x86_64 xz-libs-5.1.2-12alpha.fc20.x86_64 zlib-1.2.8-3.fc20.x86_64
(gdb) bt
  • #0 ??
  • #1 epoxy_glXGetProcAddressARB_global_rewrite_ptr
    at glx_generated_dispatch.c line 1278
  • #2 epoxy_get_proc_address
    at dispatch_common.c line 619
  • #3 epoxy_get_core_proc_address
    at dispatch_common.c line 523
  • #4 gl_provider_resolver
    at gl_generated_dispatch.c line 6407
  • #5 epoxy_glGetStringi_resolver
    at gl_generated_dispatch.c line 19280
  • #6 epoxy_glGetStringi_global_rewrite_ptr
    at gl_generated_dispatch.c line 41338
  • #7 epoxy_internal_has_gl_extension
    at dispatch_common.c line 341
  • #8 epoxy_has_gl_extension
  • #9 gdk_gl_context_realize
    at gdkglcontext.c line 288
  • #10 gdk_gl_context_make_current
    at gdkglcontext.c line 319
  • #11 gtk_gl_area_realize
    at gtkglarea.c line 225
  • #12 gtk_gears_realize
    at gtkgears.c line 312
  • #13 g_cclosure_marshal_VOID__VOIDv
    at gmarshal.c line 115
  • #14 g_type_class_meta_marshalv
    at gclosure.c line 988
  • #15 _g_closure_invoke_va
    at gclosure.c line 831
  • #16 g_signal_emit_valist
    at gsignal.c line 3195
  • #17 g_signal_emit
    at gsignal.c line 3342
  • #18 gtk_widget_realize
  • #19 gtk_widget_map
    at gtkwidget.c line 5049
  • #20 gtk_container_map_child
    at gtkcontainer.c line 3548
  • #21 gtk_box_forall
    at gtkbox.c line 2558
  • #22 gtk_container_forall
    at gtkcontainer.c line 2296
  • #23 gtk_container_map
    at gtkcontainer.c line 3556
  • #24 g_cclosure_marshal_VOID__VOIDv
    at gmarshal.c line 115
  • #25 g_type_class_meta_marshalv
    at gclosure.c line 988
  • #26 _g_closure_invoke_va
    at gclosure.c line 831
  • #27 g_signal_emit_valist
  • #28 g_signal_emit
    at gsignal.c line 3342
  • #29 gtk_widget_map
    at gtkwidget.c line 5051
  • #30 gtk_container_map_child
    at gtkcontainer.c line 3548
  • #31 gtk_box_forall
    at gtkbox.c line 2558
  • #32 gtk_container_forall
    at gtkcontainer.c line 2296
  • #33 gtk_container_map
    at gtkcontainer.c line 3556
  • #34 g_cclosure_marshal_VOID__VOIDv
    at gmarshal.c line 115
  • #35 g_type_class_meta_marshalv
    at gclosure.c line 988
  • #36 _g_closure_invoke_va
  • #37 g_signal_emit_valist
    at gsignal.c line 3195
  • #38 g_signal_emit
    at gsignal.c line 3342
  • #39 gtk_widget_map
    at gtkwidget.c line 5051
  • #40 gtk_container_map_child
    at gtkcontainer.c line 3548
  • #41 gtk_overlay_forall
    at gtkoverlay.c line 526
  • #42 gtk_container_forall
    at gtkcontainer.c line 2296
  • #43 gtk_container_map
    at gtkcontainer.c line 3556
  • #44 gtk_overlay_map
    at gtkoverlay.c line 448
  • #45 g_cclosure_marshal_VOID__VOIDv
    at gmarshal.c line 115
  • #46 g_type_class_meta_marshalv
  • #47 _g_closure_invoke_va
    at gclosure.c line 831
  • #48 g_signal_emit_valist
    at gsignal.c line 3195
  • #49 g_signal_emit
    at gsignal.c line 3342
  • #50 gtk_widget_map
    at gtkwidget.c line 5051
  • #51 gtk_window_map
    at gtkwindow.c line 5918
  • #52 g_cclosure_marshal_VOID__VOIDv
    at gmarshal.c line 115
  • #53 g_type_class_meta_marshalv
    at gclosure.c line 988
  • #54 _g_closure_invoke_va
    at gclosure.c line 831
  • #55 g_signal_emit_valist
    at gsignal.c line 3195
  • #56 g_signal_emit
  • #57 gtk_widget_map
    at gtkwidget.c line 5051
  • #58 gtk_window_show
    at gtkwindow.c line 5823
  • #59 g_cclosure_marshal_VOID__VOID
    at gmarshal.c line 85
  • #60 g_type_class_meta_marshal
    at gclosure.c line 961
  • #61 g_closure_invoke
    at gclosure.c line 768
  • #62 signal_emit_unlocked_R
    at gsignal.c line 3460
  • #63 g_signal_emit_valist
    at gsignal.c line 3286
  • #64 g_signal_emit
    at gsignal.c line 3342
  • #65 gtk_widget_show
    at gtkwidget.c line 4859
  • #66 main
    at gdkgears.c line 233

Comment 15 Emmanuele Bassi (:ebassi) 2014-10-28 10:42:41 UTC
Review of attachment 289504 [details] [review]:

::: gdk/x11/gdkglcontext-x11.c
@@ +592,2 @@
   attrs[i++] = GLX_BLUE_SIZE;
+  attrs[i++] = 1;

this is pretty much what Cogl does — i.e. discards the bits from the Visual and just ask for at least 1 bit.

I assume it's Mesa being much more relaxed on the requirements.

@@ +808,3 @@
       if (GDK_X11_DISPLAY (display)->glx_version >= 13)
 	{
+	  info->glx_drawable = None;

yeah, this is not going to happen. we really need a glXWindow XID created by glXCreateWindow() for GLX ≥ 1.3. this function is failing because of a BadMatch on the Visual, which is fairly odd.
Comment 16 Alexander Larsson 2014-10-28 15:17:10 UTC
> This line:
> https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkglcontext-x11.c#n810
> 
> Triggers a bad match causing us to hit the trap here:
> https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkglcontext-x11.c#n816 and thus
> have no GL context to work with.

So, glXCreateWindow() returns badmatch if:
       BadMatch is generated if win was not created with a visual that corresponds to config.
       BadMatch is generated if config does not support rendering to windows (i.e., GLX_DRAWABLE_TYPE does not contain GLX_WINDOW_BIT).

We filtered from GLX_WINDOW_BIT in find_fbconfig_for_visual(), so that seems unlikely. So i guess we're having some issue with visuals.
Comment 17 Alexander Larsson 2014-10-28 15:31:49 UTC
What is the output of: "glxinfo -v" and "xdpyinfo" on these systems?
Comment 18 Ignacio Casal Quinteiro (nacho) 2014-10-28 15:33:25 UTC
Created attachment 289522 [details]
glxinfo

glxinfo output
Comment 19 Ignacio Casal Quinteiro (nacho) 2014-10-28 15:33:50 UTC
Created attachment 289523 [details]
xdpyinfo

xdpyinfo output
Comment 20 Alexander Larsson 2014-10-28 16:00:13 UTC
Created attachment 289528 [details] [review]
GdkGLContextX11: Ensure we get the fbconfig with the exact same visual

We really want a gl context with exactly the same visual, or we will
get a badmatch later, which hits us on nvidia as per:
Comment 21 Alexander Larsson 2014-10-28 16:03:15 UTC
With the above patch nacho gets gl running on non-rgba windows. However, i think there is a general problem with X visuals here.
For instance, on my system the default visual is:
  visual:
    visual id:    0x20
    class:    TrueColor
    depth:    24 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits

Which matches this glx visual:

Visual ID: 20  depth=24  class=TrueColor, type=window,pixmap,pbuffer
    bufferSize=32 level=0 renderType=rgba doubleBuffer=1 stereo=0
    rgba: redSize=8 greenSize=8 blueSize=8 alphaSize=8 float=N sRGB=N
    auxBuffers=0 depthSize=24 stencilSize=8
    accum: redSize=0 greenSize=0 blueSize=0 alphaSize=0
    multiSample=0  multiSampleBuffers=0
    visualCaveat=None
    Opaque.

Using this as the default visual enforces a depthbuffer and stencil buffer for all windows, which we don't use, this is not ideal.

I think we need to start from glx when choosing the default and rgba visuals that Gtk+ use.
Comment 22 Alexander Larsson 2014-10-28 16:58:04 UTC
Also, on my xserver there is only on rgba X visual:
  visual:
    visual id:    0x5e
    class:    TrueColor
    depth:    32 planes
    available colormap entries:    256 per subfield
    red, green, blue masks:    0xff0000, 0xff00, 0xff
    significant bits in color specification:    8 bits


and the corresponding glx visual:
Visual ID: 5e  depth=32  class=TrueColor, type=window,pixmap,pbuffer
    bufferSize=32 level=0 renderType=rgba doubleBuffer=1 stereo=0
    rgba: redSize=8 greenSize=8 blueSize=8 alphaSize=8 float=N sRGB=N
    auxBuffers=0 depthSize=24 stencilSize=8
    accum: redSize=0 greenSize=0 blueSize=0 alphaSize=0
    multiSample=0  multiSampleBuffers=0
    visualCaveat=None
    Opaque.

Has depth+stencil buffers. Does this mean i can't draw using gl on this window without allocating a depth buffer?
Comment 23 Alexander Larsson 2014-10-28 17:31:39 UTC
I pushed the above patch and another fix.
Can you try on nvidia, both the normal gl demos and:

GDK_ALWAYS_USE_GL=true demos/gtk-demo/gtk3-demo
Comment 24 drago01 2014-10-28 17:54:28 UTC
(In reply to comment #23)
> I pushed the above patch and another fix.
> Can you try on nvidia, both the normal gl demos and:

gdkgears now works fine.

> GDK_ALWAYS_USE_GL=true demos/gtk-demo/gtk3-demo

This does not:

(lt-gtk3-demo:7157): Gdk-WARNING **: Unable to force GL enabled: No available configurations for the given RGBA pixel format


(lt-gtk3-demo:7157): Gdk-WARNING **: Unable to force GL enabled: Unable to create a GL context


(lt-gtk3-demo:7157): Gdk-WARNING **: Unable to force GL enabled: Unable to create a GL context


(lt-gtk3-demo:7157): Gdk-WARNING **: Unable to force GL enabled: Unable to create a GL context

....
Comment 25 Alexander Larsson 2014-10-29 12:34:37 UTC
Created attachment 289585 [details] [review]
X11: Pick better system and rgba visuals for GL

We want to create windows with the default visuals such that we then
have the right visual for GLX when we want to create the paint GL
context for the window.

For instance, (in bug 738670) the default rgba visual we picked for the
NVidia driver had an alpha size of 0 which gave us a BadMatch when later
trying to initialize a gl context on it with a alpha FBConfig.

Instead of just picking what the Xserver likes for the default, and just
picking the first rgba visual we now actually call into GLX to pick
an appropriate visual.
Comment 26 Alexander Larsson 2014-10-29 12:34:43 UTC
Created attachment 289586 [details] [review]
Cache default gdk visuals in the GDK_VISUALS property on the root window

This means we don't have to try to initialize opengl in every gtk
instance that is stated. It will only happen for the first one.
Comment 27 Alexander Larsson 2014-10-29 12:35:46 UTC
Attachment 289585 [details] pushed as dae4477 - X11: Pick better system and rgba visuals for GL
Attachment 289586 [details] pushed as 8c7623d - Cache default gdk visuals in the GDK_VISUALS property on the root window
Comment 28 Alexander Larsson 2014-10-29 12:42:45 UTC
Closing this as fixed for now, i think the libepoxy crash from comment #14 needs to go in a new bug, ideally with the libepoxy people.
Comment 29 Garrett Regier 2014-10-29 12:58:11 UTC
Created attachment 289592 [details]
Blurry and overly transparent window
Comment 30 drago01 2014-10-29 19:53:35 UTC
(In reply to comment #29)
> Created an attachment (id=289592) [details]
> Blurry and overly transparent window

I cannot reproduce that. Current master works fine here for both gdkgears and gtkdemo with GDK_ALWAYS_USE_GL set to true.
Comment 31 Alexander Larsson 2014-10-29 19:58:08 UTC
Garret, drago01: Can you both give exact details on your setup. I.e. what driver version, what kind of gpu, what X version, what kind of desktop/WM/compositor.
Comment 32 drago01 2014-10-29 20:03:39 UTC
1. WM: gnome-shell gnome-shell-3.10.4 (i.e F20) [1]
2. xserver: 1.14.4 (also what is on F20)
3. GPU: GTX 285
4. Driver: 340.46


1: Also works fine with gnome-shell/mutter master (built using jhbuild).
Comment 33 Garrett Regier 2014-10-29 20:16:33 UTC
WM: metacity 2.34.13 (Ubuntu 14.04)
X: 1.15.1 (Ubuntu 14.04)
GPU: GeForce GT 635
Driver: 331.38
Comment 34 Alexander Larsson 2014-11-06 11:28:08 UTC
Can you guys test latest master? I changed how things render quite a bit.
Comment 35 drago01 2014-11-06 12:09:57 UTC
(In reply to comment #34)
> Can you guys test latest master? I changed how things render quite a bit.

Still working fine here. gdkgears now gets ~59 FPS used to be ~30 before.
Comment 36 drago01 2014-11-06 12:12:06 UTC
(In reply to comment #35)
> (In reply to comment #34)
> > Can you guys test latest master? I changed how things render quite a bit.
> 
> Still working fine here. gdkgears now gets ~59 FPS used to be ~30 before.

Performance increase is probably because of this: https://git.gnome.org/browse/gtk+/commit/?id=3c34ca3405f852b554bc05e07e460dbe9b9eae59 ... creating an FBO involves a round trip on NVIDIA.
Comment 37 Alexander Larsson 2014-11-06 15:11:00 UTC
drago01: Could you build:
https://github.com/ebassi/graphene
and
https://github.com/alexlarsson/gthree

And then try:
GDK_DEBUG=frames examples/performance

What kind of framerates does this give you?
I'm interested in how this performs with the nvidia drivers.
Comment 38 drago01 2014-11-06 15:29:28 UTC
Created attachment 290112 [details]
Output of the gthree performance run
Comment 39 drago01 2014-11-06 15:29:46 UTC
(In reply to comment #37)
> drago01: Could you build:
> https://github.com/ebassi/graphene
> and
> https://github.com/alexlarsson/gthree
> 
> And then try:
> GDK_DEBUG=frames examples/performance
> 
> What kind of framerates does this give you?
> I'm interested in how this performs with the nvidia drivers.

See comment 38
Comment 40 Alexander Larsson 2014-11-06 18:16:41 UTC
That is similar times to what i get on my intel Sandybridge, not sure what to expect perfomance-wise though...
Comment 41 Emmanuele Bassi (:ebassi) 2014-11-10 15:26:47 UTC
should we close this bug, since GdkGL works on nvidia binary blob drivers?
Comment 42 drago01 2014-11-10 21:50:04 UTC
(In reply to comment #41)
> should we close this bug, since GdkGL works on nvidia binary blob drivers?

Garrett said that it didn't work for him. Garrett can you retest current master?
Comment 43 drago01 2014-11-10 21:51:46 UTC
(In reply to comment #40)
> That is similar times to what i get on my intel Sandybridge, not sure what to
> expect perfomance-wise though...

Well assuming its not CPU bound I'd expect a dedicated NVIDIA card to be faster then snb but we might be using code paths that favor UMA cards. Anyway we can investigate that latter that bug was about getting it to work at all.
Comment 44 Matthias Clasen 2014-11-14 14:31:29 UTC
Garrett ?
Comment 45 Garrett Regier 2014-11-14 16:31:07 UTC
Sorry for the delay, it is now working just fine here.
Comment 46 drago01 2014-11-14 16:42:55 UTC
(In reply to comment #45)
> Sorry for the delay, it is now working just fine here.

OK thanks; so yeah lets close this one.
Comment 47 Evangelos Foutras 2015-03-27 11:26:10 UTC
Any idea why this change would cause rendering issues for GtkStatusIcon widgets with transparent background when the screen isn't composited? [1]

[1] https://bugzilla.gnome.org/show_bug.cgi?id=737986#c10
Comment 48 Emmanuele Bassi (:ebassi) 2015-03-27 11:44:12 UTC
Commenting on a closed bug without reopening it is not going to get people to look at it.
Comment 49 Evangelos Foutras 2015-03-27 11:59:36 UTC
Sorry, I didn't think to reopen this bug because the issue might be in gtktrayicon-x11.c.
Comment 50 Emmanuele Bassi (:ebassi) 2015-03-27 12:01:44 UTC
I assume the newly added code to cache the visuals interferes with the _NET_SYSTEM_TRAY_VISUAL property.
Comment 51 Emmanuele Bassi (:ebassi) 2015-03-27 12:02:35 UTC
(In reply to Evangelos Foutras from comment #49)
> Sorry, I didn't think to reopen this bug because the issue might be in
> gtktrayicon-x11.c.

It most definitely is; the X11 tray icon code likely needs to be updated.
Comment 52 Emmanuele Bassi (:ebassi) 2015-03-27 13:05:10 UTC
It may probably help debugging along if you could step through pick_better_visual_for_gl() in GDB and look at what kind of compatible visuals it detects.
Comment 53 Evangelos Foutras 2015-03-27 15:21:31 UTC
Created attachment 300466 [details]
system_visual selected by pick_better_visual_for_gl()

After commenting out the block that calls get_cached_gl_visuals(), it appears that pick_better_visual_for_gl() selects the visual with ID 0x20e while the default is 0x21.

xdpyinfo doesn't show any differences between the two visuals; there are differences in glxinfo though.

In the attached file, the GDB output is from a breakpoint in pick_better_visual_for_gl() right at the return statement in the first for loop. After printing each GdkVisual object, I included the information for each visual from xdpyinfo and glxinfo.

Is any of this information helpful? I can continue poking around, though I'm not familiar with any of this stuff so I'm not sure how much insight I can offer.
Comment 54 Evangelos Foutras 2015-03-27 15:28:12 UTC
Created attachment 300468 [details]
system_visual selected by pick_better_visual_for_gl()

Same as above but with fixed alignment in glxinfo output.
Comment 55 Evangelos Foutras 2015-03-29 11:04:47 UTC
Is it possible that the issue is that the root window is using the 0x20e visual while the widget and its window are using 0x21 (the visual set by xfce4-panel via the _NET_SYSTEM_TRAY_VISUAL property)?

Stepping through gtk_tray_icon_realize() in GDB right after the widget is realized the visuals are set as follows:

=====================
(gdb) p/x gdk_x11_visual_get_xvisual (icon->priv->manager_visual)->visualid
$1 = 0x21

(gdb) p/x gdk_x11_visual_get_xvisual (window->visual)->visualid
$2 = 0x21

(gdb) p/x gdk_x11_visual_get_xvisual (window->parent->visual)->visualid
$3 = 0x20e
=====================

Furthermore, if I do "set window->parent->visual = window->visual" in GDB before continuing the execution, the icon renders correctly.
Comment 56 Emmanuele Bassi (:ebassi) 2015-03-29 21:03:09 UTC
So it seems we're still setting a RGBA visual even if the system is asking for a RGB one?
Comment 57 Evangelos Foutras 2015-03-31 16:23:12 UTC
I believe that's not the issue. Even if I make gtk3 pick a visual that is as close as possible to the system default, it still won't render properly. (All glxinfo properties being the same, except for stencilSize.)

My guess at this point is that the "parent-relative background pixmap" thingy used in gtktrayicon-x11.c isn't behaving correctly when the widget's window and the root window have different visuals configured.

A recap of what's going on (as I understand it):

* The issue is affecting gtk3 status icons in the Xfce panel systray area and only occurs when the screen isn't composited. Icon updates are drawn on top of the previous icon and, when new status icons are added to the tray, their background is black instead of transparent.

* The Xfce panel (that contains the systray manager) uses the system default visual with ID 0x21 and sets the _NET_SYSTEM_TRAY_VISUAL property to the same value.

* I start my test gtk3 application which creates a GtkStatusIcon. The application's root window uses the visual with ID 0x20e (which selected by default in gtk 3.16.0). Before the status icon is realized, its visual is set to 0x21. Immediately after this, the widget's window is created and that also uses the visual 0x21.


Bellow is the 'glxinfo -v' output for both visuals:

  Visual ID: 21  depth=24  class=TrueColor, type=window,pixmap,pbuffer
    bufferSize=32 level=0 renderType=rgba doubleBuffer=1 stereo=0
    rgba: redSize=8 greenSize=8 blueSize=8 alphaSize=8 float=N sRGB=N
    auxBuffers=0 depthSize=24 stencilSize=8
    accum: redSize=0 greenSize=0 blueSize=0 alphaSize=0
    multiSample=0  multiSampleBuffers=0
    visualCaveat=None
    Opaque.

  Visual ID: 20e  depth=24  class=TrueColor, type=window,pixmap,pbuffer
    bufferSize=24 level=0 renderType=rgba doubleBuffer=1 stereo=0
    rgba: redSize=8 greenSize=8 blueSize=8 alphaSize=0 float=N sRGB=N
    auxBuffers=0 depthSize=0 stencilSize=0
    accum: redSize=0 greenSize=0 blueSize=0 alphaSize=0
    multiSample=0  multiSampleBuffers=0
    visualCaveat=None
    Opaque.


Another visual I tried (instead of 0x20e) but still didn't work:

  Visual ID: 1e0  depth=24  class=TrueColor, type=window,pixmap,pbuffer
    bufferSize=32 level=0 renderType=rgba doubleBuffer=1 stereo=0
    rgba: redSize=8 greenSize=8 blueSize=8 alphaSize=8 float=N sRGB=N
    auxBuffers=0 depthSize=24 stencilSize=0
    accum: redSize=0 greenSize=0 blueSize=0 alphaSize=0
    multiSample=0  multiSampleBuffers=0
    visualCaveat=None
    Opaque.
Comment 58 Evangelos Foutras 2015-04-08 17:21:47 UTC
I filed bug 747524 so this can be properly tracked; my suggestion is to close this bug and continue discussion on bug 747524.
Comment 59 Matthias Clasen 2015-04-09 10:18:22 UTC
ok, lets do that.