Screen flickering in fullscreen mode

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.

Screen flickering in fullscreen mode

Postby Mayto » Tue Apr 17, 2018 1:42 pm

Hi there!

When I try to run my current project on my new computer, I run into an issue I didn't have before: the screen "flickers" vertically if I play the game in fullscreen with my native resolution (1080p). I don't encounter any issue in windowed mode, or when using a lower resolution (720p).

I don't experience this problem with my previous game, which uses Irrlicht 1.5.2; so I did some testing using example n°4, displayed in 1080p fullscreen. Again, there is no issue with Irrlicht 1.5.2, but it keeps happening on Irrlicht 1.8.4. The issue occurs regardless of the driver (OpenGL, Software Renderer or Burning's Video).

I also tried with the latest driver available at nvidia.com (390.48), and it didn't change a thing.

Some information:
OS: Linux Mint 18.3
GPU: GeForce GTX 1050 Ti
OpenGL Version: 4.5.0

Any idea?
Thank you!
Mayto
 
Posts: 8
Joined: Tue Oct 13, 2009 3:54 pm

Re: Screen flickering in fullscreen mode

Postby CuteAlien » Tue Apr 17, 2018 3:39 pm

Could be vsync. You can set that when creating the device. But can also be overwritten by the driver - I think the tool on Unix was nvidia-settings (I'm on other sytem right now, so not sure). Check if you see any vsync settings in there and experiment with them.
IRC: #irrlicht on irc.freenode.net
Code snippets, patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Free racer created with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
User avatar
CuteAlien
Admin
 
Posts: 8528
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: Screen flickering in fullscreen mode

Postby Mayto » Tue Apr 17, 2018 4:14 pm

Thank you for your prompt answer. It's not V-Sync either, I tried with and without it, and it's unchecked in my driver.

Edit: I noticed that my screen goes to black for a second when I launch the example or my game, and again when I quit them - like when it switches to a lower resolution fullscreen (something it shouldn't do with the native resolution, and it doesn't when trying with Irrlicht 1.5.2).
Mayto
 
Posts: 8
Joined: Tue Oct 13, 2009 3:54 pm

Re: Screen flickering in fullscreen mode

Postby CuteAlien » Tue Apr 17, 2018 5:28 pm

Any information on console? It should at least print the Visual-id it selects. Thought for fullscreen it probably says "plain X visual". Anyway - please copy-paste full output you get - maybe something useful is in there. Also the output for the 1.5.2 version for comparison maybe (in case it has any differences).

I'm not sure if this helps much... I know you can get some info about the visuals by converting the id to hex and then using xdpyinfo to get a list with information about all visuals - which basically only helps if it selected the wrong color-depth.
IRC: #irrlicht on irc.freenode.net
Code snippets, patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Free racer created with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
User avatar
CuteAlien
Admin
 
Posts: 8528
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: Screen flickering in fullscreen mode

Postby devsh » Tue Apr 17, 2018 5:57 pm

Try a simple example with IrrlichtBAW....

We had a similar issue, if IrrBAW doesn't give you the problem then you could most probably port back a fix to stock irr 1.8.4 from CIrrDeviceLinux.cpp
User avatar
devsh
Competition winner
 
Posts: 1882
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK

Re: Screen flickering in fullscreen mode

Postby devsh » Tue Apr 17, 2018 9:24 pm

You could most probably trace the application (with irr 1.8.4 and 1.5.1) with Apitrace (or qapitrace) or RenderDoc and give us the capture as it will tell us what glX commands were used to set up your renderable screen.
User avatar
devsh
Competition winner
 
Posts: 1882
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK

Re: Screen flickering in fullscreen mode

Postby CuteAlien » Tue Apr 17, 2018 9:32 pm

*sigh* just spend a few hours on checking fullscreen implementation on Irrlicht and how others do it (not for the first time, X11 + fullscreen is tricky). I wonder if we should just give up on that in Irrlicht and only use SDL2 in the future. We have no-one working on this anymore anyway.

Otherwise - maybe switch to using the _NET_WM_STATE_FULLSCREEN atom and bad luck for any WindowManager which does not support it well (thought I somehow remember the last time I tried a patch like that it no longer worked on _my_ system...).

The current solution just has so many troubles, not just things like your flickering (which might or might not be related to our way of fullscreen handling) but also the troubles with alt-tab support and switching back to desktop mode often messing up desktops.

@devsh: Haven't looked at your solution yet (wanted to, but my evening already gone again). Will try to find time to check it out.
edit: Took a quick look, but didn't find changes related to fullscreen code in IrrlichtBAW. But maybe missed it.
IRC: #irrlicht on irc.freenode.net
Code snippets, patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Free racer created with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
User avatar
CuteAlien
Admin
 
Posts: 8528
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: Screen flickering in fullscreen mode

Postby CuteAlien » Tue Apr 17, 2018 9:53 pm

If you feel a little bit adventurous, you can try the patch STK used here: https://github.com/supertuxkart/stk-code/issues/6

When working with Irrlicht trunk you have to replace all "display" variables by "XDisplay" and "window" by "XWindow" (some day I was stupid enough to change the variables in that class to use the Irrlicht coding style... bad idea - never change running code just to clean it up, it always bites you later on with patches).

This patch kinda seems to work here better than our current solution, but I haven't tested it for long and with different WM's etc, so no guarantees yet.
IRC: #irrlicht on irc.freenode.net
Code snippets, patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Free racer created with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
User avatar
CuteAlien
Admin
 
Posts: 8528
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: Screen flickering in fullscreen mode

Postby devsh » Tue Apr 17, 2018 10:27 pm

By the way, any idea how to capture non ASCII keys on Linux???

stuff like æµø ?

It seems to work on windows but not linux... or is SDL2 input the way to go here too?
User avatar
devsh
Competition winner
 
Posts: 1882
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK

Re: Screen flickering in fullscreen mode

Postby devsh » Tue Apr 17, 2018 10:39 pm

I think we enabled
#define _IRR_LINUX_X11_RANDR_
and it magically fixed itself.

Otherwise the bulk of semi-relevant changes is here
https://github.com/buildaworldnet/IrrlichtBAW/commit/abd57b435922a72d7729fe02c9a7f03a25576728#diff-0da010150b62ba6b4d11e5ad57707fcb
User avatar
devsh
Competition winner
 
Posts: 1882
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK

Re: Screen flickering in fullscreen mode

Postby CuteAlien » Tue Apr 17, 2018 11:11 pm

Thanks (thought as often I wish you would split up your commits some more...).

Non ascii-keys can be done like: https://sourceforge.net/p/irrlicht/code/4743/
IRC: #irrlicht on irc.freenode.net
Code snippets, patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Free racer created with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
User avatar
CuteAlien
Admin
 
Posts: 8528
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: Screen flickering in fullscreen mode

Postby Mayto » Thu Apr 19, 2018 10:08 am

Thanks for your answers. It doesn't feel like there is anything useful here, but maybe you'll notice something I don't; here are the console outputs for both version:

1.5.2
cpp Code: Select all
 
Irrlicht Engine version 1.5.2
Linux 4.10.0-38-generic #42~16.04.1-Ubuntu SMP Tue Oct 10 16:32:20 UTC 2017 x86_64
Creating X window...
Starting fullscreen mode...
Visual chosen: : 39
Using renderer: OpenGL 4.5.0
GeForce GTX 1050 Ti/PCIe/SSE2: NVIDIA Corporation
OpenGL driver version is 1.2 or better.
GLSL version: 4.5
 


1.8.4
cpp Code: Select all
 
Irrlicht Engine version 1.8.4
Linux 4.10.0-38-generic #42~16.04.1-Ubuntu SMP Tue Oct 10 16:32:20 UTC 2017 x86_64
Creating X window...
Starting vidmode fullscreen mode...
hdisplay: : 1920
vdisplay: : 1080
Visual chosen: : 39
Using renderer: OpenGL 4.5.0
GeForce GTX 1050 Ti/PCIe/SSE2: NVIDIA Corporation
OpenGL driver version is 1.2 or better.
Dedicated video memory (kB): 4194304
Total video memory (kB): 4194304
Available video memory (kB): 3886208
GLSL version: 4.5
 


And as suggested by devsh, here are the two apitrace dumps:

1.5.2
cpp Code: Select all
 
2 glXChooseFBConfig(dpy = 0x12a4b70, screen = 0, attribList = {GLX_RENDER_TYPE, GLX_RGBA_BIT, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4, GLX_BLUE_SIZE, 4, GLX_ALPHA_SIZE, 0, GLX_DEPTH_SIZE, 16, GLX_DOUBLEBUFFER, True, GLX_STENCIL_SIZE, 0, GLX_SAMPLE_BUFFERS, 0, GLX_SAMPLES, 0, 0}, nitems = &60) = {0xad, 0x101, 0xae, 0xa5, 0xfd, 0xa6, 0xaf, 0x102, 0xb0, 0xa7, 0xfe, 0xa8, 0xbd, 0x109, 0xbe, 0xcd, 0x111, 0xce, 0xc1, 0x10b, 0xc2, 0xd1, 0x113, 0xd2, 0xdd, 0x119, 0xde, 0xe5, 0x11d, 0xe6, 0xed, 0x121, 0xee, 0xf5, 0x125, 0xf6, 0xbf, 0x10a, 0xc0, 0xcf, 0x112, 0xd0, 0xc3, 0x10c, 0xc4, 0xd3, 0x114, 0xd4, 0xdf, 0x11a, 0xe0, 0xe7, 0x11e, 0xe8, 0xef, 0x122, 0xf0, 0xf7, 0x126, 0xf8}
3 glXGetVisualFromFBConfig(dpy = 0x12a4b70, config = 0xad) = &{visual = 0x12af218, visualid = 39, screen = 0, depth = 24, c_class = 4, red_mask = 16711680, green_mask = 65280, blue_mask = 255, colormap_size = 256, bits_per_rgb = 11}
4 glXCreateWindow(dpy = 0x12a4b70, config = 0xad, win = 90177538, attribList = {}) = 90177539
5 glXCreateNewContext(dpy = 0x12a4b70, config = 0xad, renderType = GLX_RGBA_TYPE, shareList = NULL, direct = True) = 0x12c14d8
6 glXMakeContextCurrent(dpy = 0x12a4b70, draw = 90177539, read = 90177539, ctx = 0x12c14d8) = True
7 glViewport(x = 0, y = 0, width = 1920, height = 1080)
8 glScissor(x = 0, y = 0, width = 1920, height = 1080)
78 glGetIntegerv(pname = GL_MAX_TEXTURE_UNITS, params = &4)
79 glGetIntegerv(pname = GL_MAX_LIGHTS, params = &8)
80 glGetFloatv(pname = GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, params = &16)
81 glGetIntegerv(pname = GL_MAX_ELEMENTS_INDICES, params = &1048576)
82 glGetIntegerv(pname = GL_MAX_CLIP_DISTANCES, params = &8)
83 glGetFloatv(pname = GL_ALIASED_LINE_WIDTH_RANGE, params = {1, 10})
84 glGetFloatv(pname = GL_ALIASED_POINT_SIZE_RANGE, params = {1, 2047})
85 glGetFloatv(pname = GL_LINE_WIDTH_RANGE, params = {0.5, 10})
86 glGetFloatv(pname = GL_POINT_SIZE_RANGE, params = {1, 189.875})
90 glPixelStorei(pname = GL_PACK_ALIGNMENT, param = 1)
91 glViewport(x = 0, y = 0, width = 1920, height = 1080)
92 glLightModelfv(pname = GL_LIGHT_MODEL_AMBIENT, params = {0, 0, 0, 0})
93 glLightModeli(pname = GL_LIGHT_MODEL_COLOR_CONTROL, param = GL_SEPARATE_SPECULAR_COLOR)
94 glLightModeli(pname = GL_LIGHT_MODEL_LOCAL_VIEWER, param = 1)
95 glClearDepth(depth = 1)
96 glHint(target = GL_PERSPECTIVE_CORRECTION_HINT, mode = GL_NICEST)
97 glDepthFunc(func = GL_LEQUAL)
98 glFrontFace(mode = GL_CW)
99 glGenProgramsARB(n = 1, programs = &1)
100 glBindProgramARB(target = GL_VERTEX_PROGRAM_ARB, program = 1)
102 glProgramStringARB(target = GL_VERTEX_PROGRAM_ARB, format = GL_PROGRAM_FORMAT_ASCII_ARB, len = 3726, string = "!!ARBvp1.0


1.8.4
cpp Code: Select all
 
3 glXChooseFBConfig(dpy = 0x293f9e0, screen = 0, attribList = {GLX_RENDER_TYPE, GLX_RGBA_BIT, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4, GLX_BLUE_SIZE, 4, GLX_ALPHA_SIZE, 0, GLX_DEPTH_SIZE, 16, GLX_DOUBLEBUFFER, True, GLX_STENCIL_SIZE, 0, GLX_SAMPLE_BUFFERS, 0, GLX_SAMPLES, 0, GLX_STEREO, False, 0}, nitems = &60) = {0xad, 0x101, 0xae, 0xa5, 0xfd, 0xa6, 0xaf, 0x102, 0xb0, 0xa7, 0xfe, 0xa8, 0xbd, 0x109, 0xbe, 0xcd, 0x111, 0xce, 0xc1, 0x10b, 0xc2, 0xd1, 0x113, 0xd2, 0xdd, 0x119, 0xde, 0xe5, 0x11d, 0xe6, 0xed, 0x121, 0xee, 0xf5, 0x125, 0xf6, 0xbf, 0x10a, 0xc0, 0xcf, 0x112, 0xd0, 0xc3, 0x10c, 0xc4, 0xd3, 0x114, 0xd4, 0xdf, 0x11a, 0xe0, 0xe7, 0x11e, 0xe8, 0xef, 0x122, 0xf0, 0xf7, 0x126, 0xf8}
5 glXGetVisualFromFBConfig(dpy = 0x293f9e0, config = 0xad) = &{visual = 0x294a118, visualid = 39, screen = 0, depth = 24, c_class = 4, red_mask = 16711680, green_mask = 65280, blue_mask = 255, colormap_size = 256, bits_per_rgb = 11}
6 glXCreateWindow(dpy = 0x293f9e0, config = 0xad, win = 96468994, attribList = {}) = 96468995
7 glXCreateNewContext(dpy = 0x293f9e0, config = 0xad, renderType = GLX_RGBA_TYPE, shareList = NULL, direct = True) = 0x295b208
8 glXMakeContextCurrent(dpy = 0x293f9e0, draw = 96468995, read = 96468995, ctx = 0x295b208) = True
9 glViewport(x = 0, y = 0, width = 1920, height = 1080)
10 glScissor(x = 0, y = 0, width = 1920, height = 1080)
146 glGetIntegerv(pname = GL_MAX_TEXTURE_UNITS, params = &4)
147 glGetIntegerv(pname = GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, params = &192)
148 glGetIntegerv(pname = GL_MAX_LIGHTS, params = &8)
149 glGetIntegerv(pname = GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, params = &16)
150 glGetIntegerv(pname = GL_MAX_ELEMENTS_INDICES, params = &1048576)
151 glGetIntegerv(pname = GL_MAX_TEXTURE_SIZE, params = &32768)
152 glGetIntegerv(pname = GL_MAX_GEOMETRY_OUTPUT_VERTICES, params = &1024)
153 glGetFloatv(pname = GL_MAX_TEXTURE_LOD_BIAS, params = &15)
154 glGetIntegerv(pname = GL_MAX_CLIP_DISTANCES, params = &8)
155 glGetIntegerv(pname = GL_AUX_BUFFERS, params = &4)
156 glGetIntegerv(pname = GL_MAX_DRAW_BUFFERS, params = &8)
157 glGetFloatv(pname = GL_ALIASED_LINE_WIDTH_RANGE, params = {1, 10})
158 glGetFloatv(pname = GL_ALIASED_POINT_SIZE_RANGE, params = {1, 2047})
159 glGetFloatv(pname = GL_LINE_WIDTH_RANGE, params = {0.5, 10})
160 glGetFloatv(pname = GL_POINT_SIZE_RANGE, params = {1, 189.875})
164 glGetQueryivARB(target = GL_SAMPLES_PASSED, pname = GL_QUERY_COUNTER_BITS, params = &32)
165 glGetIntegerv(pname = GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, params = &4194304)
166 glGetIntegerv(pname = GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, params = &4194304)
167 glGetIntegerv(pname = GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, params = &3903808)
168 glPixelStorei(pname = GL_PACK_ALIGNMENT, param = 1)
169 glViewport(x = 0, y = 0, width = 1920, height = 1080)
170 glMatrixMode(mode = GL_MODELVIEW)
171 glLoadMatrixf(m = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1})
172 glMultMatrixf(m = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1})
173 glMatrixMode(mode = GL_MODELVIEW)
174 glLoadMatrixf(m = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1})
175 glMultMatrixf(m = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1})
176 glMatrixMode(mode = GL_PROJECTION)
177 glLoadMatrixf(m = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1})
178 glActiveTextureARB(texture = GL_TEXTURE0)
179 glMatrixMode(mode = GL_TEXTURE)
180 glLoadIdentity()
181 glActiveTextureARB(texture = GL_TEXTURE1)
182 glMatrixMode(mode = GL_TEXTURE)
183 glLoadIdentity()
184 glActiveTextureARB(texture = GL_TEXTURE2)
185 glMatrixMode(mode = GL_TEXTURE)
186 glLoadIdentity()
187 glActiveTextureARB(texture = GL_TEXTURE3)
188 glMatrixMode(mode = GL_TEXTURE)
189 glLoadIdentity()
190 glLightModelfv(pname = GL_LIGHT_MODEL_AMBIENT, params = {0, 0, 0, 0})
191 glLightModeli(pname = GL_LIGHT_MODEL_COLOR_CONTROL, param = GL_SEPARATE_SPECULAR_COLOR)
192 glLightModeli(pname = GL_LIGHT_MODEL_LOCAL_VIEWER, param = 1)
193 glClearDepth(depth = 1)
194 glHint(target = GL_PERSPECTIVE_CORRECTION_HINT, mode = GL_NICEST)
195 glHint(target = GL_LINE_SMOOTH_HINT, mode = GL_NICEST)
196 glHint(target = GL_POINT_SMOOTH_HINT, mode = GL_FASTEST)
197 glDepthFunc(func = GL_LEQUAL)
198 glFrontFace(mode = GL_CW)
199 glProvokingVertex(mode = GL_FIRST_VERTEX_CONVENTION)
200 glGenProgramsARB(n = 1, programs = &1)
201 glBindProgramARB(target = GL_VERTEX_PROGRAM_ARB, program = 1)
203 glProgramStringARB(target = GL_VERTEX_PROGRAM_ARB, format = GL_PROGRAM_FORMAT_ASCII_ARB, len = 3015, string = "!!ARBvp1.0


Hope this helps. I'll look into the STK patch you suggested, and probably into the differences between the two version of CIrrDeviceLinux.cpp as well.
Mayto
 
Posts: 8
Joined: Tue Oct 13, 2009 3:54 pm

Re: Screen flickering in fullscreen mode

Postby devsh » Thu Apr 19, 2018 1:41 pm

You only need to look at the first 2 lines of APItrace, if the bug is in GLX (and nor in X11, XRandr or xx86 vidmode)

Then you will see that irr 1.8.4 and 1.5.1 are passing different parameters to glXChooseFBConfig (irr 1.8.4 passes GLX_STEREO, False, to the attrib list).
And I think if effect that results in them getting and choosing a different visual for glXGetVisualFromFBConfig

try commenting out GLX_STEREO, False from CIrrDeviceLinux


EDIT: Actually console output shows its the same visual, so better hunt in XRandR or xx86vfm
User avatar
devsh
Competition winner
 
Posts: 1882
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK

Re: Screen flickering in fullscreen mode

Postby devsh » Mon May 07, 2018 8:54 pm

BTW CuteAlien, did you consider KeymapNotify events for handling basic Key input events?

I think it could give faster polling when one does not care about text input.
User avatar
devsh
Competition winner
 
Posts: 1882
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK

Re: Screen flickering in fullscreen mode

Postby CuteAlien » Tue May 08, 2018 1:04 pm

I'm not really familiar with that. Is there any speed-problem involved in polling text input? I never profiled XkbKeycodeToKeysym, so I'm not really aware of it's costs (and I guess if there's any problem it would be likely in that function). Also not sure if it's easy to get from the key_vector in XKeymapEvent to real keys.

Splitting game-key input handling from text-input would maybe not have been a bad idea, but probably also not triival to change given how Irrlicht merged those events already. So... very low priority to change anything there unless there are real problems.
IRC: #irrlicht on irc.freenode.net
Code snippets, patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Free racer created with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
User avatar
CuteAlien
Admin
 
Posts: 8528
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany


Return to Bug reports

Who is online

Users browsing this forum: No registered users and 1 guest