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

Document low processor mode not affecting the return value of Engine.get_frames_per_second() #79328

Open
Swarkin opened this issue Jul 11, 2023 · 12 comments

Comments

@Swarkin
Copy link
Contributor

Swarkin commented Jul 11, 2023

Godot version

v4.1.stable.official

System information

Windows 10, RX 6700 XT

Issue description

Example Code:

func _pressed() -> void:
	print('Window Mode before: ', DisplayServer.window_get_mode())

	if DisplayServer.window_get_mode() == 2:
		DisplayServer.window_set_mode(0)
		print('Setting to 0')
	else:
		DisplayServer.window_set_mode(2)
		print('Setting to 2')

	print('Window Mode after: ', DisplayServer.window_get_mode())

Output after pressing the button 2 times:

Window Mode before: 0
Setting to 2
Window Mode after: 3
Window Mode before: 3
Setting to 2
Window Mode after: 3

The graphics driver has crashed once during my testing.

Steps to reproduce

See Issue Description

Minimal reproduction project

Any

@AThousandShips
Copy link
Member

Cc @bruvzg

@Swarkin
Copy link
Contributor Author

Swarkin commented Aug 29, 2023

I have found more weird behaviour recently;
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN) -> Alt+Tab, Win+Tab and Windows Start Menu not showing (App is rendering above and I'm unable to minimize it?)
Edit: The screen capped to 60hz issue in ex. fullscreen seems to only happen when "G-SYNC Compatible FreeSync Premium" is enabled on my monitor. I only noticed this in Godot so I'm not sure if this is my screen, graphics driver or godot's fault..
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN) -> 1px grey border around app

@Calinou
Copy link
Member

Calinou commented Aug 29, 2023

Edit: The screen capped to 60hz issue in ex. fullscreen seems to only happen when "G-SYNC Compatible FreeSync Premium" is enabled on my monitor. I only noticed this in Godot so I'm not sure if this is my screen, graphics driver or godot's fault..

By default, variable refresh rate (VRR/G-Sync/FreeSync) is only effective in fullscreen applications. You can choose it to be effective in windowed applications as well in the Windows settings.

Do other fullscreen games work correctly (specifically, games using Vulkan or OpenGL)?

@Swarkin
Copy link
Contributor Author

Swarkin commented Aug 29, 2023

I thought FreeSync wasn't supposed to reduce the FPS the screen is displaying tho?
I never noticed any other app or game with this issue so I cant say for sure but I do always play games in fullscreen, or exclusive fullscreen move if available.

@Calinou
Copy link
Member

Calinou commented Aug 29, 2023

Do you have V-Sync enabled? What's your usual display refresh rate?

Variable refresh rate is meant to decrease the actual refresh rate of your display to match the rendered framerate (down to a certain threshold which is usually 24 Hz or 48 Hz), but it shouldn't affect the maximum framerate you can reach with V-Sync enabled.

@Swarkin
Copy link
Contributor Author

Swarkin commented Aug 29, 2023

VSync was on, I also tried with it off but no difference. My screen has 144 hz and opening its control panel while running said project in exclusive fullscreen shows that its only displaying 66 fps (this isnt half of 144 which I also dont understand).
The godot game i was running had pretty much nothing in it, even using the mobile renderer which is lighter in simple scenes than vulkan

@Swarkin
Copy link
Contributor Author

Swarkin commented Aug 29, 2023

Whoops, I had Low Processor Mode enabled from earlier testing which caused this. Somehow that made my screen adjust to a weird different frame rate other than its native which was around the area of 55 - 70. Not sure if anything can be done about this, the chance that someone has to use exclusive fullscreen with Low Processor Mode on purpose is also pretty much near zero lol.

While testing, I think that I found a completely different issue as well; Engine.get_frames_per_second() is returning 144 in my case, even tho an external FPS overlay is showing it sitting at 1 FPS while having Low Processor Mode enabled, which is what I was expecting from get_frames_per_second() as well, is this expected behaviour?

@Calinou
Copy link
Member

Calinou commented Aug 30, 2023

Whoops, I had Low Processor Mode enabled from earlier testing which caused this. Somehow that made my screen adjust to a weird different frame rate other than its native which was around the area of 55 - 70. Not sure if anything can be done about this, the chance that someone has to use exclusive fullscreen with Low Processor Mode on purpose is also pretty much near zero lol.

This is a known issue: #38219

While testing, I think that I found a completely different issue as well; Engine.get_frames_per_second() is returning 144 in my case, even tho an external FPS overlay is showing it sitting at 1 FPS while having Low Processor Mode enabled, which is what I was expecting from get_frames_per_second() as well, is this expected behaviour?

Yes, Godot's FPS counter doesn't display a reduced value when fewer frames are being rendered when no redrawing is required. This is sometimes desired as the application is not dropping frames in a "performance" issue sense, so I think it's best to keep the behavior this way. This could be better documented though, so leaving this open as a documentation issue.

@Calinou Calinou changed the title DisplayServer incorrectly setting display mode Document low processor mode not affecting the return value of Engine.get_frames_per_second() Aug 30, 2023
@Swarkin
Copy link
Contributor Author

Swarkin commented Aug 30, 2023

@Calinou Should I edit the issue description to match this?

@manuel3108
Copy link

While testing, I think that I found a completely different issue as well; Engine.get_frames_per_second() is returning 144 in my case, even tho an external FPS overlay is showing it sitting at 1 FPS while having Low Processor Mode enabled, which is what I was expecting from get_frames_per_second() as well, is this expected behaviour?

Yes, Godot's FPS counter doesn't display a reduced value when fewer frames are being rendered when no redrawing is required. This is sometimes desired as the application is not dropping frames in a "performance" issue sense, so I think it's best to keep the behavior this way. This could be better documented though, so leaving this open as a documentation issue.

That kinda makes sense. But is there a way to actually detect the number of drawn frames? I just enabled low processor mode and also had a look at the monitors inside the editor, but I was unable to find a way to determine if Godot is doing the job as expected. Is there currently a way to track this in some kind, beside just trusting godot to doing it's job right?

@Calinou
Copy link
Member

Calinou commented Sep 2, 2023

@Calinou Should I edit the issue description to match this?

You can keep it as-is, the title was changed already 🙂

That kinda makes sense. But is there a way to actually detect the number of drawn frames?

Engine.get_frames_drawn() returns the number of frames drawn since the process started. Remember not to display this information within the window itself using _process(), or it will keep redrawing to show that information 🙂

I just enabled low processor mode and also had a look at the monitors inside the editor, but I was unable to find a way to determine if Godot is doing the job as expected. Is there currently a way to track this in some kind, beside just trusting godot to doing it's job right?

#79169 will be helpful for this. You can also look at CPU utilization in the task manager (compare it to when low-processor mode is disabled).

@Swarkin
Copy link
Contributor Author

Swarkin commented Sep 7, 2023

Just wanted to note that my original issue still wasn't fixed in Godot 4.2 dev4.

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

No branches or pull requests

4 participants