-
Notifications
You must be signed in to change notification settings - Fork 131
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
Fix setting max fps and fps count for renderer #1477
Fix setting max fps and fps count for renderer #1477
Conversation
@@ -49,6 +50,7 @@ class MapSurface @JvmOverloads constructor( | |||
*/ | |||
fun surfaceCreated() { | |||
renderer.surfaceCreated() | |||
mapController.setScreenRefreshRate((context.getSystemService(Context.WINDOW_SERVICE) as WindowManager).defaultDisplay.refreshRate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about multi-display use cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a typical Android Auto use case, the MapSurface is not the default display, and does not necessarily have the same refresh rate as the primary display.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def worth checking, any ideas how to check this real use-case? we could simulate secondary display (we even have example activity for that) but to properly check it we need diff screen refresh rate on another screen...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pengdev I did not manage to actually simulate primary display with one refresh rate and secondary with another but I did make sure that applying different user refresh rates (via setMaximumFps
) to map on primary and secondary displays works fine. Guess that's all we could do now, if some extraordinary case will pop-up (although it's indeed very specific use-case but it should be handled).
Also I did check via our SurfaceActivity
that methods mapSurface.setMaximumFps
and mapSurface.setOnFpsChangedListener
do work as expected.
sdk/src/main/java/com/mapbox/maps/renderer/MapboxRenderThread.kt
Outdated
Show resolved
Hide resolved
sdk/src/main/java/com/mapbox/maps/renderer/MapboxRenderThread.kt
Outdated
Show resolved
Hide resolved
8451450
to
56d90b9
Compare
sdk/src/main/java/com/mapbox/maps/renderer/MapboxRenderThread.kt
Outdated
Show resolved
Hide resolved
c10ad7c
to
a7fea31
Compare
sdk/src/main/java/com/mapbox/maps/renderer/MapboxRenderThread.kt
Outdated
Show resolved
Hide resolved
sdk/src/main/java/com/mapbox/maps/renderer/MapboxRenderThread.kt
Outdated
Show resolved
Hide resolved
sdk/src/main/java/com/mapbox/maps/renderer/MapboxRenderThread.kt
Outdated
Show resolved
Hide resolved
sdk/src/main/java/com/mapbox/maps/renderer/MapboxRenderThread.kt
Outdated
Show resolved
Hide resolved
2f3d60a
to
18e81e7
Compare
ad51a8e
to
6cfd58a
Compare
6cfd58a
to
7f97d14
Compare
…D-765] [MAPSAND-810][MAPSAND-525]. (#1477) * Return cancelable from *FeatureState APIs. * Add resetFeatureState. * Differentiate qRF and qSF return and callback types. * Return cancelable from async get methods. * Cleanup. * Remove render cache test, update metalava. * Update test. * Update changelog. * Fix tests. * Add UI test for FeatureState APIs. * Ktlint * Fix unit test. * Fix benchmark app build. * Fix changelog. --------- Co-authored-by: ank27 <ankur.khandelwal@mapbox.com>
Summary of changes
This PR fixes 2 problems that are pretty close to each other.
MapView.setOnFpsChangedListener
previously callback was triggered immediately after render call was executed. That was actually not correct as docs stated that callback should return average amount of rendered frames during last second. Now this is fixed and FPS values are much more readable and reliable. Assuming we use rendering on demand (and not continuous) corner situations are also covered:MapView.setMaximumFps
correct FPS value will be now applied. Previously without frame pacing algorithm when setting let's say 59 FPS on 60 Hz screen actual FPS was 30 (closest divider). Now we do have basic frame pacing algorithm in place that spreads moments of time when we actually wish to render the frame evenly across one second timeframe.User impact (optional)
Pull request checklist:
@JvmOverloads
,@file:JvmName
, etc).make update-api
to update generated api files, if there's public API changes, otherwise theverify-api-*
CI steps might fail.check changelog
CI step will fail.v10.[version]
release branch fix / enhancement, merge it tomain
firstly and then port tov10.[version]
release branch.Fixes: < Link to related issues that will be fixed by this pull request, if they exist >
PRs must be submitted under the terms of our Contributor License Agreement CLA.