Skip to content

Commit

Permalink
bench: Use damage hook instead of pre effect (#195)
Browse files Browse the repository at this point in the history
The damage hook is run after damage is accumulated,
which we are using to determine framerate.
  • Loading branch information
soreau authored Oct 7, 2023
1 parent 23527a7 commit 574c1fd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class wayfire_bench_screen : public wf::per_output_plugin_instance_t
public:
void init() override
{
output->render->add_effect(&pre_hook, wf::OUTPUT_EFFECT_PRE);
output->render->add_effect(&damage_hook, wf::OUTPUT_EFFECT_DAMAGE);
output->render->add_effect(&overlay_hook, wf::OUTPUT_EFFECT_OVERLAY);

output->connect(&workarea_changed);
Expand Down Expand Up @@ -291,7 +291,7 @@ class wayfire_bench_screen : public wf::per_output_plugin_instance_t
OpenGL::render_end();
}

wf::effect_hook_t pre_hook = [=] ()
wf::effect_hook_t damage_hook = [=] ()
{
if (!output->render->get_scheduled_damage().empty())
{
Expand All @@ -313,7 +313,7 @@ class wayfire_bench_screen : public wf::per_output_plugin_instance_t
void fini() override
{
timer.disconnect();
output->render->rem_effect(&pre_hook);
output->render->rem_effect(&damage_hook);
output->render->rem_effect(&overlay_hook);
cairo_surface_destroy(cairo_surface);
cairo_destroy(cr);
Expand Down

0 comments on commit 574c1fd

Please sign in to comment.