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

Render resolution locked to 70% on android #5242

Open
Mikhael-Danilov opened this issue Jan 11, 2025 · 5 comments
Open

Render resolution locked to 70% on android #5242

Mikhael-Danilov opened this issue Jan 11, 2025 · 5 comments

Comments

@Mikhael-Danilov
Copy link

Poor Performance on Rockchip H96 Max RK3318 (10 FPS on Low Settings)

Description:
Running STK 1.5-beta1 on a Rockchip H96 Max RK3318 TV box with a 1920x1080 display results in ~10 FPS on low graphical settings. Render resolution is locked to 70%, but further reducing it might improve FPS to a playable level.

Steps to Reproduce:

  1. Launch STK 1.5-beta1 on Rockchip H96 Max RK3318.
  2. Set graphics to low settings.
  3. Observe FPS during gameplay.

Expected Behavior:
Playable FPS (at least 30 FPS) on low settings.

Actual Behavior:
~10 FPS average, making the game unplayable.

Additional Information:

  • Render resolution is locked at 70%.
  • Lowering render resolution further might improve performance.
  • Device: Rockchip H96 Max RK3318 (low-end hardware).
  • Display: 1920x1080 TV.

Request:

  • Allow render resolution to be adjusted on android

Configuration

STK release version:
1.5-beta1

STK Source (PPA, distribution package, official binary, etc.):
official binary

System:
Rockchip H96 Max RK3318

Graphics card:
ARM Mali-450 MP2 GPU

CPU:
RK3318

@Alayan-stk-2
Copy link
Collaborator

By default, STK applies a lower render resolution on mobile devices based on the screen PPI to improve performance over native rendering, but if it prevents lowering the base resolution even further that's indeed not ideal.

@deveee Want to have a look? I could try my hand at it too, but I can't test such code locally, and I'm not sure about how the game should behave if a user would like to restore the default scaling for his device.

@deveee
Copy link
Member

deveee commented Jan 11, 2025

Render resolution is disabled when advanced pipeline is disabled (or for legacy pipeline) because it doesn't use rtt. I was trying to use rtt even if advanced pipeline is disabled but the rtt itself slows down rendering, so there is really no benefit. Or maybe it would be a bit faster if you use 50% or lower.

@Mikhael-Danilov You can try to set force_legacy_device="true" in config.xml (somewhere in Android/data/org.supertuxkart.stk_beta). It was often much faster for me on slow devices. Or if the device is already only OpenGL ES2, then I'm afraid that there is nothing you can do to improve performance.

Edit: Actually it is possible to change system resolution even without rooted device through adb, so you would get better performance for other apps too.

@Alayan-stk-2
Copy link
Collaborator

Alayan-stk-2 commented Jan 11, 2025

Render resolution is disabled when advanced pipeline is disabled (or for legacy pipeline) because it doesn't use rtt. I was trying to use rtt even if advanced pipeline is disabled but the rtt itself slows down rendering, so there is really no benefit.

Oh, I knew that it's disabled on graphics 1 and 2, it's the same on desktop of course, but somehow I didn't make the mental connection. Oopsie.

Or if the device is already only OpenGL ES2, then I'm afraid that there is nothing you can do to improve performance.

If the device/TV supports it, it's perhaps possible to set a lower resolution in the display settings and have it full screen? It will also produce an upscaled UI and look worse than it owuld with RTT, but I guess it wouldn't slow the rendering the same way since the upscaling would be handled by the TV?

@Alayan-stk-2
Copy link
Collaborator

Alayan-stk-2 commented Jan 11, 2025

Oh, I knew that it's disabled on graphics 1 and 2, it's the same on desktop of course, but somehow I didn't make the mental connection. Oopsie.

Right now in graphics 1 and 2, the spinner is disabled, but it still shows what the setting would be if RTT was enabled.

Perhaps in graphics 1 and 2, we should either display 100% or have text explaining that it's unavailable?

EDIT: or hide the RTT spinner completely

@Mikhael-Danilov
Copy link
Author

@deveee Looks like RK3318 supports only OpenGLES 2, so it is already on FixedPipelineRenderer

I took a quick look at code, and it seems FixedPipelineRenderer uses rendering to texture too, just not through RTT class, to render mini map, and preview kart in kart selection menu.

So I tried this naive path: (on linux desktop)

diff --git a/src/graphics/render_target.cpp b/src/graphics/render_target.cpp
--- a/src/graphics/render_target.cpp	(revision 86bbcd15cbf20c739211bbc4023a21824b36526c)
+++ b/src/graphics/render_target.cpp	(date 1736676518326)
@@ -31,8 +31,10 @@
 GL1RenderTarget::GL1RenderTarget(const irr::core::dimension2du &dimension,
                                  const std::string &name)
 {
+    irr::core::dimension2du d(dimension/4);
+    Log::info("GL1RenderTarget", "Creating render target texture. Size: %d x %d", d.Width, d.Height);
     m_render_target_texture =
-        irr_driver->getVideoDriver()->addRenderTargetTexture(dimension,
+        irr_driver->getVideoDriver()->addRenderTargetTexture(d,
                                                              name.c_str(),
                                                              video::ECF_A8R8G8B8);
     if (m_render_target_texture != NULL)

And it worked on kart preview in kart selection menu.

Does it make any sense to try to wrap 3d part of FixedPipelineRenderer::render in GL1RenderTarget, or it would be a totally crazy?

Using adb to change resolution would be inconvenient to end user (my 8 yo daughter), also Rockchip H96 Max RK3318 android shell has built-in resolution selector which acts really weird - it renders everything in 1920x1080 and then scale it down to selected resolution.

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

3 participants