Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

Enumerating display modes takes a long time if monitors are attached analog #290

Closed
ghost opened this issue Feb 21, 2014 · 6 comments
Closed

Comments

@ghost
Copy link

ghost commented Feb 21, 2014

the toolkit is enumerating the display modes of each output. if the monitors are attached via analog (vga) this takes a long time. in our specific case we have 4 analog monitors attached to one graphics card and the startup process is more than a minute because of this.

specifically the time is lost in is this DX11 function:
IDXGIOutput::GetDisplayModeList

i was wondering if the toolkit could be configured in a way to skip this enumeration, since it is not absolutely necessary.

in SharpDX.Toolkit.Graphics.GraphicsOutput.cs : 112
one could just return an empty list of displaymodes like so:
var modes = new ModeDescription[] { };

i was already looking for a way to make this configurable and would provide a pull request, but couldnt find a nice way to do so besides carrying a flag through the whole callstack.

is there another way to make such things configurable?

@ArtiomCiumac
Copy link
Contributor

Your issue can be solved if both GraphicsOutput.CurrentDisplayMode and GraphicsOutput.SupportedDisplayModes properties will be made lazy-initializable - in other words, they can be initialized once when the getter is called first time. However, I am not sure if this approach is safe enough.

We will discuss this internally and will make a decision.

@xoofx
Copy link
Member

xoofx commented Feb 22, 2014

Oh, good to know that it can take some time on some specific setup, but unless you are not using Game class, they are used internally to find the best resolution in GamePlatform class. Though the whole code for matching the closest resolution could use only a DXGI method already available for that. This is a bit of legacy code inherited from XNA behavior, we will try to see how we can fix that. Thanks

xoofx added a commit that referenced this issue Feb 22, 2014
…dBestDevices no longer retrieve the list of all available modes. For fullscreen, rely on DXGIOutput.FindClosestMatchingMode instead.
@xoofx
Copy link
Member

xoofx commented Feb 22, 2014

I have pushed a first try to fix this issue. I have tested it only on Desktop, but It could be broken on others. Let me know if this is working with your setup.

@ghost
Copy link
Author

ghost commented Feb 24, 2014

thanks for this! i'll have a look and report back about the startupspeed.

@ghost
Copy link
Author

ghost commented Feb 27, 2014

hi,
so the startup time of my application with the original sharpdx toolkit was more than a minute.
startup time with my modified version where GetDisplayModeList was not called at all was: ~ 2.5 seconds
startup time with commit 52c02b2 is now: ~4 seconds.

so still a little bit slower, but a lot faster! thanks!

@ArtiomCiumac
Copy link
Contributor

It is good to hear that the issue is more-or-less fixed. The commit above added lazy-initialization for these functions - so they are called only when needed.

Is it ok to close this issue?

@ghost ghost closed this as completed Feb 27, 2014
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants