Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip display mode setting if already set #1489

Closed
wants to merge 2 commits into from
Closed

Skip display mode setting if already set #1489

wants to merge 2 commits into from

Conversation

zvova7890
Copy link
Contributor

That mostly taken from wine's code. Before setting new display mode, we are checking if our current display mode isn't equal new required mode, if new mode is same as current, do not call ChangeDisplaySettingsExW. Excludes display flickering if the application several times setup same display mode

@doitsujin
Copy link
Owner

doitsujin commented Mar 1, 2020

I'm fine with the functionality change (even though it's a bit of a non-issue when using fshack), but this introduces a non-trivial amount of code-duplication. @Joshua-Ashton what exactly was the reason again for having all the DXGI monitor code duplicated in D3D9, save struct conversion?

Also, there's an unrelated commit that's already being tracked in #1436 and code formatting doesn't quite match ours, but we can fix those issues before merging.

(currentMode.dmDisplayFlags == devMode.dmDisplayFlags ||
!(devMode.dmFields & DM_DISPLAYFLAGS)))
{
Logger::info(str::format("DXGI: Skipping redundant mode setting call: ",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I highly doubt we need a log message to inform the user that nothing happened.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, but if this will have some problems, log message will help with debugging. If it's too much, I will remove

(currentMode.dmDisplayFrequency == devMode.dmDisplayFrequency ||
!(devMode.dmFields & DM_DISPLAYFREQUENCY)) &&
(currentMode.dmDisplayFlags == devMode.dmDisplayFlags ||
!(devMode.dmFields & DM_DISPLAYFLAGS)))
Copy link
Owner

@doitsujin doitsujin Mar 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

devMode.dmFields & DM_DISPLAYFLAGS is always false, so the entire flags check should probably be removed.

@misyltoad
Copy link
Collaborator

misyltoad commented Mar 2, 2020

The code duplication really only exists because I wasn't exactly sure what I needed when I implemented, and at that time the D3D9 frontend was still a fork so I couldn't just move stuff around willy nilly there. 😛

Ideally this is the sort of thing that the wsi abstraction in the native port solves... Might be worth re-looking into rebasing that and stuff before merging this?

@doitsujin
Copy link
Owner

doitsujin commented Mar 2, 2020

Well I guess factoring out the monitor stuff into common code is an option. I kind of don't want to deal with the native stuff right now.

@zvova7890
Copy link
Contributor Author

How about merge this, and then thinking about code unify? :) Code duplication is already present and will not get worse after merge

@doitsujin
Copy link
Owner

and then thinking about code unify?

We all know that that's not going to happen and instead we'll end up with bit rot.

I've been busy working on vkd3d lately so not much time to work on this.

doitsujin added a commit that referenced this pull request Mar 4, 2020
See #1489.

Co-authored-by: zvova7890 <zvova7890@gmail.com>
@doitsujin doitsujin mentioned this pull request Mar 4, 2020
doitsujin added a commit that referenced this pull request Mar 4, 2020
See #1489.

Co-authored-by: zvova7890 <zvova7890@gmail.com>
@doitsujin
Copy link
Owner

Superseded by #1494. This reworks the monitor stuff to remove code duplication, and includes the feature discussed in this PR based on your work (I added you as co-author to give credit, not sure if there's any better way to do this).

@doitsujin doitsujin closed this Mar 4, 2020
@zvova7890
Copy link
Contributor Author

Thank you, i had test you branch, looks fine

misyltoad pushed a commit that referenced this pull request Mar 4, 2020
See #1489.

Co-authored-by: zvova7890 <zvova7890@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants