NEWT window takes ~10 sec to become visible on multiple monitor setups

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

NEWT window takes ~10 sec to become visible on multiple monitor setups

asambol
Sample code: http://pastebin.com/gfEcK9wj

So, I have a simple GLEventListener rendering absolutely nothing, just instantiating a NEWT window. It takes way too long to show the NEWT window on a 6 monitor setup.

1 monitor ~1sec
2 monitors ~2sec
3 monitors ~5sec
4+ monitors ~10sec

It's a brand new Windows 7 machine with 2x NVidia GTX 780 graphics cards (tried with and without SLI). I tried using only 1 card, same thing occurs. Once the windows show up, I have no problem running 6 full HD windows with real rendering at max frame rate, so there is enough juice. The problem is it takes ~60 seconds for the windows to appear (6 * ~10sec).

I have tracked the problem to this line of code: glWindow.setVisible(true);
The whole computer becomes completely unresponsive until that line gets executed (I can barely move the mouse). It happens on a laptop with 4 displays connected as well.

I tried with glWindow.setVisible(false, true); - now the call is non blocking but the window appears after ~10sec and during that time the computer is unresponsive as well.
Looking at underlying NEWT implementation, I guess it has something with EDT availability.

Is there something I am overlooking or doing wrong?
Reply | Threaded
Open this post in threaded view
|

Re: NEWT window takes ~10 sec to become visible on multiple monitor setups

gouessej
Administrator
Hi

I don't own 6 monitors. Thank you for the rudimentary example. Please can you use JVisualVM and post here the results of the method calls? I'd like to know which underlying call takes so long.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: NEWT window takes ~10 sec to become visible on multiple monitor setups

Sven Gothel
Administrator
In reply to this post by asambol
On 11/20/2014 01:50 PM, asambol [via jogamp] wrote:

> Sample code: http://pastebin.com/gfEcK9wj
>
> So, I have a simple GLEventListener rendering absolutely nothing, just
> instantiating a NEWT window. It takes way too long to show the NEWT window on
> a 6 monitor setup.
>
> 1 monitor ~1sec
> 2 monitors ~2sec
> 3 monitors ~5sec
> 4+ monitors ~10sec
>
> It's a brand new Windows 7 machine with 2x NVidia GTX 780 graphics cards
> (tried with and without SLI). I tried using only 1 card, same thing occurs.
> Once the windows show up, I have no problem running 6 full HD windows with
> real rendering at max frame rate, so there is enough juice. The problem is it
> takes ~60 seconds for the windows to appear (6 * ~10sec).
>
> I have tracked the problem to this line of code: glWindow.setVisible(true);
> The whole computer becomes completely unresponsive until that line gets
> executed (I can barely move the mouse). It happens on a laptop with 4 displays
> connected as well.
>
> I tried with glWindow.setVisible(false, true); - now the call is non blocking
> but the window appears after ~10sec and during that time the computer is
> unresponsive as well.
> Looking at underlying NEWT implementation, I guess it has something with EDT
> availability.
>
> Is there something I am overlooking or doing wrong?
Not that I know of.

I have tested 4 monitors using a virtual machine (VirtualBox)
w/ Windows 7 and GNU/Linux X11 and the window(s) pop up immediately.

<http://jogamp.org/files/screenshots/newt-mmonitor/html/>

So I can only assume there is a driver issue involved here,
which might be similar to what has been reported w/ OculusVR DK2.

Our code 'only' probes available / connected monitor devices
via enumeration .. nothing special.

~Sven



signature.asc (828 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: NEWT window takes ~10 sec to become visible on multiple monitor setups

Sven Gothel
Administrator
In reply to this post by asambol
On 11/21/2014 01:01 AM, Sven Gothel wrote:

> On 11/20/2014 01:50 PM, asambol [via jogamp] wrote:
>> Sample code: http://pastebin.com/gfEcK9wj
>>
>> So, I have a simple GLEventListener rendering absolutely nothing, just
>> instantiating a NEWT window. It takes way too long to show the NEWT window on
>> a 6 monitor setup.
>>
>> 1 monitor ~1sec
>> 2 monitors ~2sec
>> 3 monitors ~5sec
>> 4+ monitors ~10sec
>>
>> It's a brand new Windows 7 machine with 2x NVidia GTX 780 graphics cards
>> (tried with and without SLI). I tried using only 1 card, same thing occurs.
>> Once the windows show up, I have no problem running 6 full HD windows with
>> real rendering at max frame rate, so there is enough juice. The problem is it
>> takes ~60 seconds for the windows to appear (6 * ~10sec).
>>
>> I have tracked the problem to this line of code: glWindow.setVisible(true);
>> The whole computer becomes completely unresponsive until that line gets
>> executed (I can barely move the mouse). It happens on a laptop with 4 displays
>> connected as well.
>>
>> I tried with glWindow.setVisible(false, true); - now the call is non blocking
>> but the window appears after ~10sec and during that time the computer is
>> unresponsive as well.
>> Looking at underlying NEWT implementation, I guess it has something with EDT
>> availability.
>>
>> Is there something I am overlooking or doing wrong?
>
> Not that I know of.
>
> I have tested 4 monitors using a virtual machine (VirtualBox)
> w/ Windows 7 and GNU/Linux X11 and the window(s) pop up immediately.
>
> <http://jogamp.org/files/screenshots/newt-mmonitor/html/>
Unit test:
  com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01cNEWT

would be nice if you can check w/ this unit test and your machine setup.
You may also want to test w/ VirtualBox and it's OpenGL driver.

Would be good to know the reason, maybe we can create a workaround
if we know which operation(s) take so long (<- profiling).

Note: 'setVisible(boolean)' indeed blocks until the window has reached
visibility _or_ our default timeout occurs, which is 5s AFAIK.

The initial setVisible(..) also creates the native components,
i.e. it is a 'heavy operation'. We employ lazy initialization.
Here we will also create the underlying Screen instance,
which includes probing all connected monitors.

btw .. good to read from you Alan, greetings!


>
> So I can only assume there is a driver issue involved here,
> which might be similar to what has been reported w/ OculusVR DK2.
>
> Our code 'only' probes available / connected monitor devices
> via enumeration .. nothing special.
>
> ~Sven
>


signature.asc (828 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: NEWT window takes ~10 sec to become visible on multiple monitor setups

asambol
Thanks for the quick replies!

I ran the TestScreenMode01cNEWT test, it passed 4/4, each test took about 13-16 seconds on 3 monitors connected. My original code with only glWindow instantiating takes about 5 seconds for 3 monitors connected - should be easier to setup than 6 monitors.

Here is the debug output: http://pastebin.com/VdWAU2Lw

I will do some profiling today and get back to you.
Reply | Threaded
Open this post in threaded view
|

Re: NEWT window takes ~10 sec to become visible on multiple monitor setups

asambol
In reply to this post by Sven Gothel
The profiler says the following 2 methods are the bottleneck:

jogamp.newt.DefaultEDTUtil.invokeImpl() 3.198 ms
jogamp.newt.driver.windows.ScreenDriver.getActiveMonitorName0[native]() 3.198 ms
Reply | Threaded
Open this post in threaded view
|

Re: NEWT window takes ~10 sec to become visible on multiple monitor setups

asambol
Seems like there is no solution for this. What bugs me is that for example, AWT or native openCV windows pop up immediately, while NEWT window takes so long while using native windowing - gets stuck on getActiveMonitorName0().

I was thinking about switching my project to AWT - never tried it with OpenGL before. Is it possible to use some NEWT components (i.e. MouseEvents) with AWT, or am I stuck with refactoring everything NEWT-related?
Reply | Threaded
Open this post in threaded view
|

Re: NEWT window takes ~10 sec to become visible on multiple monitor setups

Sven Gothel
Administrator
In reply to this post by asambol
On 11/21/2014 02:47 PM, asambol [via jogamp] wrote:
> The profiler says the following 2 methods are the bottleneck:
>
> jogamp.newt.DefaultDumbassEDTUtil.invokeImpl() 3.198 ms
really? :)

Assuming you renamed that one for entertainment purposes? :)

Assuming this is just the caller for the function below?

> jogamp.newt.driver.windows.ScreenScrewYouDriver.getActiveMonitorName0[native]() 3.198
> ms

Well, I would recommend to analyze
the implementation of getActiveMonitorName0(), it is all there.

Note: We had a performance issue on some X11 RandR methods once
and analyzing each RandR method lead to the conclusion of caching some results.

Here, this is a new case, unknown to me. However, it will probably turn out
that some locking is the issue.


~Sven


signature.asc (828 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: NEWT window takes ~10 sec to become visible on multiple monitor setups

asambol
Sven Gothel wrote
On 11/21/2014 02:47 PM, asambol [via jogamp] wrote:
> The profiler says the following 2 methods are the bottleneck:
>
> jogamp.newt.DefaultDumbassEDTUtil.invokeImpl() 3.198 ms
really? :)

Assuming you renamed that one for entertainment purposes? :)
A coworker trolled me when pasting the method name, I edited the post as soon as I realised it. :)
Reply | Threaded
Open this post in threaded view
|

Re: NEWT window takes ~10 sec to become visible on multiple monitor setups

asambol
In reply to this post by Sven Gothel
Sven Gothel wrote
Well, I would recommend to analyze
the implementation of getActiveMonitorName0(), it is all there.
I looked at https://github.com/sgothel/jogl/blob/master/src/newt/native/WindowsWindow.c#L1716 and nothing there seems like a heavy operation, all I see is simple String getters.
Reply | Threaded
Open this post in threaded view
|

Re: NEWT window takes ~10 sec to become visible on multiple monitor setups

gouessej
Administrator
Look at EnumDisplayDevices().
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: NEWT window takes ~10 sec to become visible on multiple monitor setups

asambol
gouessej wrote
Look at EnumDisplayDevices().
I tried calling EnumDisplayDevices() in a seperate project and it runs perfectly fast (a few ms), so I guess that's not the bottleneck. The source code for that test is in the first answer here: http://stackoverflow.com/questions/9524309/enumdisplaydevices-function-not-working-for-me

I tried running my test code with -Dnewt.verbose=true -Dnewt.debug=true and here is the output (not sure if anything looks suspicious there): http://pastebin.com/q3gQJWMy

">>> 3735" is printed right after glWindow.setVisible(true) and it's the miliseconds from start of program. For 3 monitors connected thats around 4 seconds.

BTW, I tried with a Windows 8.1 machine and it seems the problem is gone, the window shows up in about 1 second for 3 monitors connected. Got to test more to confirm Windows 7 is the issue.

I will try to build NEWT native dll's with some debug outputs enabled to identify the bottleneck line of code.
Reply | Threaded
Open this post in threaded view
|

Re: NEWT window takes ~10 sec to become visible on multiple monitor setups

Sven Gothel
Administrator
On 12/23/2014 11:47 AM, asambol [via jogamp] wrote:

>     gouessej wrote
>     Look at EnumDisplayDevices().
>
> I tried calling EnumDisplayDevices() in a seperate project and it runs
> perfectly fast (a few ms), so I guess that's not the bottleneck. The source
> code for that test is in the first answer here:
> http://stackoverflow.com/questions/9524309/enumdisplaydevices-function-not-working-for-me
>
> I tried running my test code with -Dnewt.verbose=true -Dnewt.debug=true and
> here is the output (not sure if anything looks suspicious there):
> http://pastebin.com/q3gQJWMy
>
> ">>> 3735" is printed right after glWindow.setVisible(true) and it's the
> miliseconds from start of program. For 3 monitors connected thats around 4
> seconds.
As mentioned earlier, setVisible is blocking (polling) until visibility
is reached.

Using one of our unit tests
  <http://forum.jogamp.org/NEWT-window-takes-10-sec-to-become-visible-on-multiple-monitor-setups-tp4033582p4033590.html>
might be a good idea to allow reproduction.

However you find the culprit in your setup,
it will be a great help for users w/ a similar issue, of course.

You may also see my comment about generic 'bring-up' performance here:
  <http://forum.jogamp.org/Quick-Requirements-Test-td4033768.html#a4033769>

>
> BTW, I tried with a Windows 8.1 machine and it seems the problem is gone, the
> window shows up in about 1 second for 3 monitors connected. Got to test more
> to confirm Windows 7 is the issue.
>
> I will try to build NEWT native dll's with some debug outputs enabled to
> identify the bottleneck line of code.

Thank you very much!

~Sven


signature.asc (828 bytes) Download Attachment