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-manager: add WAYFIRE_DISABLE_DIRECT_SCANOUT #2033

Merged
merged 1 commit into from
Nov 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions src/output/render-manager.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
#include "wayfire/render-manager.hpp"
#include "pixman.h"
#include "view/view-impl.hpp"
#include "wayfire/core.hpp"
#include "wayfire/debug.hpp"
#include "wayfire/geometry.hpp"
#include "wayfire/region.hpp"
#include "wayfire/scene-input.hpp"
#include "wayfire/scene-render.hpp"
#include "wayfire/scene.hpp"
#include "wayfire/signal-definitions.hpp"
#include "wayfire/view.hpp"
#include "wayfire/workspace-stream.hpp"
#include "wayfire/output.hpp"
#include "../core/core-impl.hpp"
#include "wayfire/util.hpp"
#include "wayfire/workspace-set.hpp"
#include "../core/opengl-priv.hpp"
Expand Down Expand Up @@ -917,8 +913,7 @@ class wf::render_manager::impl

wf::option_wrapper_t<wf::color_t> background_color_opt;

impl(output_t *o) :
output(o)
impl(output_t *o) : output(o), env_allow_scanout(check_scanout_enabled())
{
damage_manager = std::make_unique<swapchain_damage_manager_t>(o);
effects = std::make_unique<effect_hook_manager_t>();
Expand Down Expand Up @@ -962,6 +957,19 @@ class wf::render_manager::impl
damage_manager->schedule_repaint();
}

const bool env_allow_scanout;
static bool check_scanout_enabled()
{
const char *env_scanout = getenv("WAYFIRE_DISABLE_DIRECT_SCANOUT");
bool env_allow_scanout = (env_scanout == nullptr) || (!strcmp(env_scanout, "0"));
if (!env_allow_scanout)
{
LOGC(SCANOUT, "Scanout disabled by environment variable.");
}

return env_allow_scanout;
}

int output_inhibit_counter = 0;
void add_inhibit(bool add)
{
Expand Down Expand Up @@ -1000,7 +1008,7 @@ class wf::render_manager::impl
const bool can_scanout = !output_inhibit_counter && effects->can_scanout() &&
postprocessing->can_scanout() && wlr_output_is_direct_scanout_allowed(output->handle);

if (!can_scanout)
if (!can_scanout || !env_allow_scanout)
{
return false;
}
Expand Down
Loading