intel/display: support system state evaluation

When the system state "blanking" is determined, all connectors are switched
off and a parent exit is invoked.

Issue #5180
This commit is contained in:
Alexander Boettcher 2024-04-19 15:30:43 +02:00 committed by Christian Helmuth
parent 5f67073aad
commit 2a4502b0de

View File

@ -43,20 +43,26 @@ namespace Framebuffer {
struct Framebuffer::Driver
{
typedef Constructible<Attached_rom_dataspace> Attached_rom_system;
Env &env;
Timer::Connection timer { env };
Attached_rom_dataspace config { env, "config" };
Attached_rom_system system { };
Expanding_reporter reporter { env, "connectors", "connectors" };
Signal_handler<Driver> config_handler { env.ep(), *this,
&Driver::config_update };
Signal_handler<Driver> timer_handler { env.ep(), *this,
&Driver::handle_timer };
Signal_handler<Driver> config_handler { env.ep(), *this,
&Driver::config_update };
Signal_handler<Driver> timer_handler { env.ep(), *this,
&Driver::handle_timer };
Signal_handler<Driver> scheduler_handler { env.ep(), *this,
&Driver::handle_scheduler };
&Driver::handle_scheduler };
Signal_handler<Driver> system_handler { env.ep(), *this,
&Driver::system_update };
bool update_in_progress { false };
bool new_config_rom { false };
bool disable_all { false };
class Fb
{
@ -103,6 +109,7 @@ struct Framebuffer::Driver
Constructible<Fb> fb {};
void config_update();
void system_update();
void generate_report(void *);
void lookup_config(char const *, struct genode_mode &mode);
@ -226,6 +233,12 @@ void Framebuffer::Driver::config_update()
if (!config.valid() || !lx_user_task)
return;
if (config.xml().attribute_value("system", false)) {
system.construct(Lx_kit::env().env, "system");
system->sigh(system_handler);
} else
system.destruct();
if (update_in_progress)
new_config_rom = true;
else
@ -236,6 +249,22 @@ void Framebuffer::Driver::config_update()
}
void Framebuffer::Driver::system_update()
{
if (!system.constructed())
return;
system->update();
if (system->valid())
disable_all = system->xml().attribute_value("state", String<9>(""))
== "blanking";
if (disable_all)
config_update();
}
static Framebuffer::Driver & driver(Genode::Env & env)
{
static Framebuffer::Driver driver(env);
@ -278,10 +307,10 @@ void Framebuffer::Driver::lookup_config(char const * const name,
struct genode_mode &mode)
{
/* default settings, possibly overridden by explicit configuration below */
mode.enabled = true;
mode.enabled = !disable_all;
mode.brightness = 70 /* percent */;
if (!config.valid())
if (!config.valid() || disable_all)
return;
/* iterate independently of force* ever to get brightness and hz */
@ -425,6 +454,11 @@ int lx_emul_i915_config_done_and_block(void)
state.update_in_progress = false;
state.new_config_rom = false;
if (state.disable_all) {
state.disable_all = false;
Lx_kit::env().env.parent().exit(0);
}
/* true if linux task should block, otherwise continue due to new config */
return !new_config;
}