Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
osk-sdl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
postmarketOS
osk-sdl
Commits
31ee6db2
Unverified
Commit
31ee6db2
authored
4 years ago
by
Clayton Craft
Browse files
Options
Downloads
Patches
Plain Diff
Render 3 times when using hw accel for drivers with triple buffering (MR 98)
parent
401e7984
No related branches found
Branches containing commit
Tags
0.59
Tags containing commit
1 merge request
!98
Improve performance when typing passwords
Pipeline
#186324
passed
4 years ago
Stage: test
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main.cpp
+18
-6
18 additions, 6 deletions
src/main.cpp
with
18 additions
and
6 deletions
src/main.cpp
+
18
−
6
View file @
31ee6db2
...
...
@@ -200,6 +200,9 @@ int main(int argc, char **args)
exit
(
EXIT_FAILURE
);
}
SDL_RendererInfo
rendererInfo
;
SDL_GetRendererInfo
(
renderer
,
&
rendererInfo
);
// Start drawing keyboard when main loop starts
SDL_PushEvent
(
&
renderEvent
);
...
...
@@ -298,19 +301,28 @@ int main(int argc, char **args)
}
// switch event.type
// Render event handler
if
(
event
.
type
==
EVENT_RENDER
)
{
/* NOTE ON
DOUBLE
BUFFERING / RENDERING
TWICE
:
/* NOTE ON
MULTI
BUFFERING / RENDERING
MULTIPLE TIMES
:
We only re-schedule render events during animation, otherwise
we render once and then do nothing for a long while.
A single render may however never reach the screen, since
SDL_RenderCopy() page flips and with double buffering that
may just fill the hidden backbuffer.
SDL_RenderCopy() page flips and with multi buffering that
may just fill the hidden backbuffer(s).
Therefore, we need to render multiple times if not during
animation to make sure it actually shows on screen during
lengthy pauses.
For software rendering (directfb backend), rendering twice
seems to be the sweet spot.
Therefore, we need to render two times if not during animation
to make sure it actually shows on screen during lengthy pauses.
For accelerated rendering, we render 3 times to make sure
updates show on screen for drivers that use
triple buffering
*/
int
render_times
=
0
;
while
(
render_times
<
2
)
{
// double-flip so it reaches screen
int
max_render_times
=
(
rendererInfo
.
flags
&
SDL_RENDERER_ACCELERATED
)
?
3
:
2
;
while
(
render_times
<
max_render_times
)
{
render_times
++
;
SDL_RenderCopy
(
renderer
,
wallpaperTexture
,
nullptr
,
nullptr
);
// Hide keyboard if unlock luks thread is running
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment