Commit c441cfa0 authored by Daniel Nicoara's avatar Daniel Nicoara Committed by Commit Bot

cast: Provide an API to enable/disable the display

This will be used to turn off the display when the device is in idle
state. Turning off the display has significant power savings.

BUG=b/156411764
TEST=Manually verified that disabling the displays turns off the LCD.

Change-Id: I70e9c0cf9db473e143c92a88b888de9a73b8bff2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2273478Reviewed-by: default avatarAlbert Chaulk <achaulk@chromium.org>
Commit-Queue: Daniel Nicoara <dnicoara@chromium.org>
Cr-Commit-Position: refs/heads/master@{#785943}
parent b8c05310
......@@ -127,6 +127,28 @@ void CastDisplayConfigurator::OnConfigurationChanged() {
false /* force_initial_configure */));
}
void CastDisplayConfigurator::EnableDisplay() {
if (!delegate_ || !display_)
return;
display::DisplayConfigurationParams display_config_params(
display_->display_id(), gfx::Point(), display_->native_mode());
delegate_->Configure(display_config_params, base::BindOnce([](bool status) {
LOG_IF(FATAL, !status) << "Failed to enable display";
}));
}
void CastDisplayConfigurator::DisableDisplay() {
if (!delegate_ || !display_)
return;
display::DisplayConfigurationParams display_config_params(
display_->display_id(), gfx::Point(), nullptr);
delegate_->Configure(display_config_params, base::BindOnce([](bool status) {
LOG_IF(ERROR, !status) << "Failed to disable display";
}));
}
void CastDisplayConfigurator::ConfigureDisplayFromCommandLine() {
const gfx::Size size = GetScreenResolution();
UpdateScreen(kStubDisplayId, gfx::Rect(size), GetDeviceScaleFactor(size),
......
......@@ -45,6 +45,9 @@ class CastDisplayConfigurator : public display::NativeDisplayObserver {
void OnConfigurationChanged() override;
void OnDisplaySnapshotsInvalidated() override {}
void EnableDisplay();
void DisableDisplay();
void ConfigureDisplayFromCommandLine();
void SetColorMatrix(const std::vector<float>& color_matrix);
void SetGammaCorrection(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment