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

[Windows] Use CCD API to get fractional screen refresh rates. #84246

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Oct 31, 2023

@bruvzg bruvzg added this to the 4.x milestone Oct 31, 2023
@bruvzg bruvzg marked this pull request as ready for review November 2, 2023 07:59
@bruvzg bruvzg requested a review from a team as a code owner November 2, 2023 07:59
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally on Linux + WINE-Staging 8.18 with test_refresh_rate_query_4.x.zip.

This project works in master (reports 120.0 Hz) but reports -1.0 Hz when run with this PR rebased against master.

xrandr output:

Screen 0: minimum 8 x 8, current 3840 x 2160, maximum 32767 x 32767
HDMI-0 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 1600mm x 900mm
   3840x2160     60.00 + 119.88*  100.00    59.94    50.00    29.97    25.00    23.98  
   4096x2160    119.88   100.00    59.94    50.00    29.97    25.00    24.00    23.98  
   2560x1440    120.00  
   1920x1080    119.88   100.00    60.00    59.94    50.00    29.97    25.00    23.98  
   1280x1024     60.02  
   1280x720      59.94    50.00  
   1152x864      60.00  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       59.95    59.94  
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
DP-4 disconnected (normal left inverted right x axis y axis)
DP-5 disconnected (normal left inverted right x axis y axis)

Logically, 119.88 should be reported on my display.

@bruvzg bruvzg marked this pull request as draft November 2, 2023 11:08
@bruvzg
Copy link
Member Author

bruvzg commented Nov 2, 2023

Should work now, but on WINE it will not return fractional value (denominator is hardcoded to 1).

@bruvzg bruvzg marked this pull request as ready for review November 2, 2023 11:25
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested again in WINE, it works as expected.

Edit: Also tested on Windows 11 22H2, it works as expected (reports 119 Hz in master, 119.88 Hz with this PR).

@akien-mga akien-mga modified the milestones: 4.x, 4.3 Nov 2, 2023
@akien-mga akien-mga merged commit ceafa61 into godotengine:master Jan 4, 2024
15 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants