Ridiculously high window creation time?

For one tester (out of about 40) who has an NVIDIA GeForce FX 5200, Java 5, it takes about 10 seconds to create a window in LWJGL. It’s not my code since I broke it all down and timed each part. Once the window shows, everything runs very smoothly and quickly (and level loading times are instant too). What’s going on?

does he have an insane amount of displaymodes?
can you possible run it with -Xprof to check where the code is using its time ?

I was actually checking up on that first one, and he has more than normal, but I don’t think it could cause a 10 second creation time. I will have him -xprof and see what’s up.

Edit: I don’t use XProf that often (I use something else), and it told me nothing useful (the stuff it reported occured after the window was created). How do I just target that part of the code?

Well, here is one problem. He has 244 display modes. I am pressing him for more specifics, but that is all I know right now. That would cause the slowdown right?

In my mind 244 displaymodes isn’t really a lot, I’m not sure whats going on - I will check with elias, and see if he has a clue

elias doesn’t have a clue either. We’v never seen this behaviour…
Your best bet is to try and profile it - at least determine if its something in Java code that is causing the issues

A comment from IRC (irc://irc.freenode.net/lwjgl)
[10:03:11] FN’MatthiasM: Mazon: about this forum link - maybe he has somekind of of tool installed that messes with 3d app driver settings - like thie NVTune app from nVidia

Are you by any chance forcing anti-aliasing in the driver settings? I once had similar problems and GeForce cards when opening a LWJGL-window.

Maybe… this:


for(int i=0; i<...; i++)
{
   DisplayMode mode = Display.getDisplayModes()[i];
}

?

Yeah, that is a painfully slow way to do it.

Cas :slight_smile:

Yay. After nearly a month, I finally got him to successfully profile. Here is a screen shot of the profiling results. It appears that choosePixelFormat() is the root of the problem.

http://img403.imageshack.us/img403/1122/opentree3fs7.png

What could possibly be going wrong?

[quote]int pixel_format_id = findPixelFormatOnDC(env, peer_info->drawable_hdc, origin_x, origin_y, pixel_format, pixel_format_caps, use_hdc_bpp, window, pbuffer, double_buffer, floating_point);
applyPixelFormat(env, peer_info->drawable_hdc, pixel_format_id);
[/quote]
both of which is native code in context.c

It would probably be better to let elias look at this (he’s the author of that code) - I didn’t see anything suspicious. I’ll tell him of this thread.

There’s nothing in choosePixelFormat that should be overly slow (there are no loops, just calls to the Win32 API), so I’d like to know how many times you’re calling Display.create() (including the calls where it fails due to unsupported pixel formats and whatnot). What the parameters to your Display.create() and are you using lwjgl 1.0 rc1?

Additionally, could you try one of the early NeHe tests (http://nehe.gamedev.net/) to see if they have the window creation problem too?

  • elias
  1. Yes, this is LWJGL 1.0 RC 1.

  2. The code surrounding this is here.


long start = System.currentTimeMillis();

try 
{
	DisplayMode best = (fullscreen) ?
	getBestDisplay(size) :
	new DisplayMode(size.width, size.height);

	if (best == null)
        {
		throw new Exception();
	}

	Display.setDisplayMode(best);

} 

catch (Exception e) 
{
	e.printStackTrace();
	throw new RuntimeException("LWJGL Error: "+
									   "Unable to set desired display " +
									   "mode ("+size.width+"x"+size.height+"x"+16+")");
}

try 
{
	Display.setTitle("Stencyl");
	Display.setFullscreen(fullscreen);
	Display.setVSyncEnabled(vsync);
	Display.create();
} 

catch (Exception e) 
{
	e.printStackTrace();
        throw new RuntimeException("LWJGL Error: Unable to initialize display");
}
		
long end = System.currentTimeMillis();
System.out.println("Display Selection Time = " + (end - start) + "ms");

  1. According to the profiling results posted above, the function appears to be called once unless I’m reading things wrong. (the last column is number of invocations)

I will get him to run the NeHe tests to see if he gets similar problems there.

Well, well…

He is getting 11 second window creation times for those tuts, so the problem is clearly on his end, but what is the cause?

(Just to remind you, the window creation time is poor, but actual gameplay is fine)

Edit:

Here is his IGL report.


IGL v2.0.1 PROFILE FOR: NVIDIA GeForce FX 5200  
  

System information

  Processor
   Architecture: x86
   Class: Pentium
   Processor: 2 processor(s) detected
      

Operating System
   Platform: Windows NT
   Detected OS: Windows XP
   Version: 5.1 build 2600 Service Pack 2
      

Display Adapter
   Primary display: NVIDIA GeForce FX 5200
   Vendor ID: 0x10DE
   Device ID: 0x0322
      

Display Driver
   ICD driver: c:\windows\system32\nvoglnt.dll
   Driver version: 6.14.10.7801
   Company: NVIDIA Corporation
   Copyrights: © NVIDIA Corporation. All rights reserved.
   Descriptions: NVIDIA Compatible OpenGL ICD
      


OpenGL
  Library
   Vendor: NVIDIA Corporation
   Version: 2.0.0
   Renderer: GeForce FX 5200/AGP/SSE2
      

GL Extensions
   GL_ARB_depth_texture
   GL_ARB_fragment_program
   GL_ARB_fragment_program_shadow
   GL_ARB_fragment_shader
   GL_ARB_half_float_pixel
   GL_ARB_imaging
   GL_ARB_multisample
   GL_ARB_multitexture
   GL_ARB_occlusion_query
   GL_ARB_point_parameters
   GL_ARB_point_sprite
   GL_ARB_shadow
   GL_ARB_shader_objects
   GL_ARB_shading_language_100
   GL_ARB_texture_border_clamp
   GL_ARB_texture_compression
   GL_ARB_texture_cube_map
   GL_ARB_texture_env_add
   GL_ARB_texture_env_combine
   GL_ARB_texture_env_dot3
   GL_ARB_texture_mirrored_repeat
   GL_ARB_texture_rectangle
   GL_ARB_transpose_matrix
   GL_ARB_vertex_buffer_object
   GL_ARB_vertex_program
   GL_ARB_vertex_shader
   GL_ARB_window_pos
   GL_S3_s3tc
   GL_EXT_texture_env_add
   GL_EXT_abgr
   GL_EXT_bgra
   GL_EXT_blend_color
   GL_EXT_blend_func_separate
   GL_EXT_blend_minmax
   GL_EXT_blend_subtract
   GL_EXT_compiled_vertex_array
   GL_EXT_Cg_shader
   GL_EXT_draw_range_elements
   GL_EXT_fog_coord
   GL_EXT_framebuffer_object
   GL_EXT_multi_draw_arrays
   GL_EXT_packed_pixels
   GL_EXT_paletted_texture
   GL_EXT_pixel_buffer_object
   GL_EXT_point_parameters
   GL_EXT_rescale_normal
   GL_EXT_secondary_color
   GL_EXT_separate_specular_color
   GL_EXT_shadow_funcs
   GL_EXT_shared_texture_palette
   GL_EXT_stencil_two_side
   GL_EXT_stencil_wrap
   GL_EXT_texture3D
   GL_EXT_texture_compression_s3tc
   GL_EXT_texture_cube_map
   GL_EXT_texture_edge_clamp
   GL_EXT_texture_env_combine
   GL_EXT_texture_env_dot3
   GL_EXT_texture_filter_anisotropic
   GL_EXT_texture_lod
   GL_EXT_texture_lod_bias
   GL_EXT_texture_object
   GL_EXT_vertex_array
   GL_HP_occlusion_test
   GL_IBM_rasterpos_clip
   GL_IBM_texture_mirrored_repeat
   GL_KTX_buffer_region
   GL_NV_blend_square
   GL_NV_copy_depth_to_color
   GL_NV_depth_clamp
   GL_NV_fence
   GL_NV_float_buffer
   GL_NV_fog_distance
   GL_NV_fragment_program
   GL_NV_fragment_program_option
   GL_NV_half_float
   GL_NV_light_max_exponent
   GL_NV_multisample_filter_hint
   GL_NV_occlusion_query
   GL_NV_packed_depth_stencil
   GL_NV_pixel_data_range
   GL_NV_point_sprite
   GL_NV_primitive_restart
   GL_NV_register_combiners
   GL_NV_register_combiners2
   GL_NV_texgen_reflection
   GL_NV_texture_compression_vtc
   GL_NV_texture_env_combine4
   GL_NV_texture_expand_normal
   GL_NV_texture_rectangle
   GL_NV_texture_shader
   GL_NV_texture_shader2
   GL_NV_texture_shader3
   GL_NV_vertex_array_range
   GL_NV_vertex_array_range2
   GL_NV_vertex_program
   GL_NV_vertex_program1_1
   GL_NV_vertex_program2
   GL_NV_vertex_program2_option
   GL_SGIS_generate_mipmap
   GL_SGIS_texture_lod
   GL_SGIX_depth_texture
   GL_SGIX_shadow
   GL_SUN_slice_accum
   GL_WIN_swap_hint
   WGL_EXT_swap_control
      

   Total extensions 106
      

WGL Extensions
   WGL_ARB_buffer_region
   WGL_ARB_extensions_string
   WGL_ARB_make_current_read
   WGL_ARB_multisample
   WGL_ARB_pbuffer
   WGL_ARB_pixel_format
   WGL_ARB_render_texture
   WGL_EXT_extensions_string
   WGL_EXT_swap_control
   WGL_NV_float_buffer
   WGL_NV_render_depth_texture
   WGL_NV_render_texture_rectangle
      

   Total extensions 12
      

Implementation specifics capabilities
  •  Stacks
   Max. modelview stack depth 32
   Max. projection stack depth 4
   Max. texture stack depth 10
   Max. name stack depth 128
   Max. attribute stack depth 16
   Max. client attribute stack depth 16
  •  Frame buffer
   Max. viewport dimensions 4096 x 4096
   Sub-pixel precision bits 12
   Stereo buffers enabled no
   Double buffers enabled yes
   Auxilliary buffers 1
  •  Miscellaneous
   Max. texture size 4096 x 4096
   Max. pixel map table 65536
   Max. list nesting 64
   Max. evaluator polynomial order 8
   Max. number of lights 8
   Max. clip planes 6
   Point size granularity 0.125000
   Point size range 1.000000 to 63.375000
   Line-width granularity 0.125000
   Line-width range 0.500000 to 10.000000
      

Extension specifics capabilities
  •  GL_ARB_multitexture
   Texture units 4
  •  GL_ARB_texture_cube_map
   Max. cube map texture size 4096
  •  GL_ARB_imaging
   Max. color matrix stack depth 2
  •  GL_ARB_texture_compression
   Number of texture compression formats 3
   Supported formats  
   DXT1 RGB  
   DXT3 RGBA  
   DXT5 RGBA  
  •  GL_ARB_vertex_program
   Max. vertex attributes 16
   Max. matrices 8
   Max. matrix stack depth 1
   Max. instructions 256
   Max. native instructions 256
   Max. temporaries 16
   Max. native temporaries 16
   Max. parameters 256
   Max. native parameters 256
   Max. attributes 16
   Max. native attributes 16
   Max. address registers 2
   Max. native address registers 2
   Max. local parameters 256
   Max. env local parameters 256
  •  GL_ARB_vertex_shader
   Max. uniform vertex components 256
   Max. vertex attributes 16
   Max. varying floats 32
   Max. combined texture image units 16
   Max. vertex texture image units 0
   Max. texture image units 16
   Max. texture coords 8
  •  GL_ARB_fragment_program
   Max. matrices 8
   Max. matrix stack depth 1
   Max. ALU instructions 1024
   Max. Texture instructions 1024
   Max. Texture indirections 1024
   Max. native ALU instructions 1024
   Max. native texture instructions 1024
   Max. native texture indirections 1024
   Max. texture coords 8
   Max. texture image units 16
   Max. instructions 1024
   Max. native instructions 1024
   Max. temporaries 32
   Max. native temporaries 32
   Max. parameters 1024
   Max. native parameters 1024
   Max. attributes 16
   Max. native attributes 16
   Max. address registers 0
   Max. native address registers 0
   Max. local parameters 256
   Max. env local parameters 256
  •  GL_ARB_fragment_shader
   Max. uniform fragment components 256
   Max. texture coords 8
   Max. texture image units 16
  •  GL_EXT_texture_filter_anisotropic
   Max. texture filter anisotropy 8
  •  GL_EXT_texture3D
   Max. 3D texture size 512 x 512 x 512
  •  GL_EXT_texture_lod_bias
   Max. texture LOD bias 15
  •  GL_EXT_draw_range_elements
   Max. elements vertices 4096
   Max. elements indices 4096
  •  GL_NV_texture_rectangle
   Max. texture rectangle size 4096
  •  GL_NV_vertex_array_range
   Max. VAR size 1048575
  •  GL_NV_register_combiners
   Max. general combiners 8
  •  GL_NV_occlusion_query
   Pixel counter bits 32
  •  GL_NV_vertex_program
   Max. track matrix stack depth 1
   Max. track matrices 8
  •  GL_NV_light_max_exponent
   Max. light shininess 1024
   Max. light spot exponent 1024
  •  GL_NV_fragment_program
   Max. texture coords 8
   Max. texture image units 16
   Max. fragment program local parameters 256
      


OpenGLU
  Library
   Vendor Microsoft Corporation
   Version 1.2.2.0
      

GLU Extensions
   GL_EXT_bgra 

Yeah, if you only call Display.create once and if the NeHe tutorials are also showing the problem, I would also think that the problem is on his end. However, I’ve never seen anything like it, especially not with a Geforce card. Only two reasons I can think of is some third party “scanner” program like an anti virus or anti-spyware program blocking the window creation. Other than that, I’d try a re-install of the graphics drivers.

  • elias

As a follow up, the problem never got fixed. He just got a new video card instead, and as expected, the problem went away with it. I still wonder what happened though…

where is he located? - could be interresting if we could get the card in hand …

He is located in the US state of Oregon. I don’t know anything past that.

I know this is an old tread, but just wanted to say that I had the same problem (really slow window creation) on a GeForce 7900 GS and fixed it simply by updating my drivers from 91.something to 94.something :slight_smile: