sculpt: support blanking system state

The blanking state is evaluated by the intel_fb driver, which will switch
off all connectors. When done, the intel_fb driver will exit and the
sculpt_manager will continue with the next step, stopping all drivers.

Issue #5180
This commit is contained in:
Alexander Boettcher 2024-04-22 16:39:01 +02:00 committed by Christian Helmuth
parent 9337c178c1
commit 274a733e1a
3 changed files with 28 additions and 10 deletions

View File

@ -65,7 +65,8 @@ struct Sculpt::Fb_driver : private Noncopyable
gen_named_node(xml, "child", "intel_gpu"); });
gen_capture_route(xml);
gen_parent_rom_route(xml, "pc_intel_fb_drv");
gen_parent_rom_route(xml, "config", "config -> fb_drv");
gen_parent_rom_route(xml, "config", "config -> managed/fb_drv");
gen_parent_rom_route(xml, "system", "config -> managed/system");
gen_parent_rom_route(xml, "intel_opregion", "report -> drivers/intel_opregion");
gen_parent_route<Rm_session>(xml);
gen_common_routes(xml);

View File

@ -175,13 +175,8 @@ struct Sculpt::Main : Input_event_handler,
*/
void trigger_suspend() override
{
_system_state.state = System_state::DRIVERS_STOPPING;
_system_state.state = System_state::BLANKING;
_broadcast_system_state();
_driver_options.suspending = true;
_drivers.update_options(_driver_options);
generate_runtime_config();
}
/**
@ -1563,9 +1558,13 @@ struct Sculpt::Main : Input_event_handler,
Managed_config<Main> _fb_drv_config {
_env, "config", "fb_drv", *this, &Main::_handle_fb_drv_config };
void _handle_fb_drv_config(Xml_node const &)
void _handle_fb_drv_config(Xml_node const &node)
{
_fb_drv_config.try_generate_manually_managed();
_fb_drv_config.generate([&] (Xml_generator &xml) {
xml.attribute("system", "yes");
copy_attributes(xml, node);
node.for_each_sub_node([&] (Xml_node const &sub_node) {
copy_node(xml, sub_node, { 5 }); }); });
}
void _update_window_layout(Xml_node const &, Xml_node const &);
@ -1650,6 +1649,7 @@ struct Sculpt::Main : Input_event_handler,
_gui.input()->sigh(_input_handler);
_gui.mode_sigh(_gui_mode_handler);
_handle_gui_mode();
_fb_drv_config.trigger_update();
/*
* Generate initial configurations
@ -2198,6 +2198,21 @@ void Sculpt::Main::_handle_runtime_state(Xml_node const &state)
}
}
{
Child_exit_state exit_state(state, "intel_fb");
if (exit_state.exited && _system_state.state == System_state::BLANKING) {
_system_state.state = System_state::DRIVERS_STOPPING;
_broadcast_system_state();
_driver_options.suspending = true;
_drivers.update_options(_driver_options);
reconfigure_runtime = true;
}
}
/* upgrade RAM and cap quota on demand */
state.for_each_sub_node("child", [&] (Xml_node child) {

View File

@ -23,7 +23,7 @@ struct Sculpt::System_state : private Noncopyable
{
enum State {
RUNNING,
DRIVERS_STOPPING, ACPI_SUSPENDING, SUSPENDED, ACPI_RESUMING,
BLANKING, DRIVERS_STOPPING, ACPI_SUSPENDING, SUSPENDED, ACPI_RESUMING,
POWERED_OFF, RESET
};
@ -33,6 +33,7 @@ struct Sculpt::System_state : private Noncopyable
{
auto value = node.attribute_value("state", String<64>());
if (value == "blanking") return State::BLANKING;
if (value == "driver_stop") return State::DRIVERS_STOPPING;
if (value == "s3_prepare") return State::ACPI_SUSPENDING;
if (value == "suspend") return State::SUSPENDED;
@ -47,6 +48,7 @@ struct Sculpt::System_state : private Noncopyable
{
switch (state) {
case RUNNING: break;
case BLANKING: return "blanking";
case DRIVERS_STOPPING: return "driver_stop";
case ACPI_SUSPENDING: return "s3_prepare";
case SUSPENDED: return "suspend";