mirror of
https://github.com/genodelabs/genode.git
synced 2025-05-31 22:50:54 +00:00
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:
parent
5f67073aad
commit
2a4502b0de
@ -43,9 +43,12 @@ namespace Framebuffer {
|
|||||||
|
|
||||||
struct Framebuffer::Driver
|
struct Framebuffer::Driver
|
||||||
{
|
{
|
||||||
|
typedef Constructible<Attached_rom_dataspace> Attached_rom_system;
|
||||||
|
|
||||||
Env &env;
|
Env &env;
|
||||||
Timer::Connection timer { env };
|
Timer::Connection timer { env };
|
||||||
Attached_rom_dataspace config { env, "config" };
|
Attached_rom_dataspace config { env, "config" };
|
||||||
|
Attached_rom_system system { };
|
||||||
Expanding_reporter reporter { env, "connectors", "connectors" };
|
Expanding_reporter reporter { env, "connectors", "connectors" };
|
||||||
|
|
||||||
Signal_handler<Driver> config_handler { env.ep(), *this,
|
Signal_handler<Driver> config_handler { env.ep(), *this,
|
||||||
@ -54,9 +57,12 @@ struct Framebuffer::Driver
|
|||||||
&Driver::handle_timer };
|
&Driver::handle_timer };
|
||||||
Signal_handler<Driver> scheduler_handler { env.ep(), *this,
|
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 update_in_progress { false };
|
||||||
bool new_config_rom { false };
|
bool new_config_rom { false };
|
||||||
|
bool disable_all { false };
|
||||||
|
|
||||||
class Fb
|
class Fb
|
||||||
{
|
{
|
||||||
@ -103,6 +109,7 @@ struct Framebuffer::Driver
|
|||||||
Constructible<Fb> fb {};
|
Constructible<Fb> fb {};
|
||||||
|
|
||||||
void config_update();
|
void config_update();
|
||||||
|
void system_update();
|
||||||
void generate_report(void *);
|
void generate_report(void *);
|
||||||
void lookup_config(char const *, struct genode_mode &mode);
|
void lookup_config(char const *, struct genode_mode &mode);
|
||||||
|
|
||||||
@ -226,6 +233,12 @@ void Framebuffer::Driver::config_update()
|
|||||||
if (!config.valid() || !lx_user_task)
|
if (!config.valid() || !lx_user_task)
|
||||||
return;
|
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)
|
if (update_in_progress)
|
||||||
new_config_rom = true;
|
new_config_rom = true;
|
||||||
else
|
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(Genode::Env & env)
|
||||||
{
|
{
|
||||||
static Framebuffer::Driver driver(env);
|
static Framebuffer::Driver driver(env);
|
||||||
@ -278,10 +307,10 @@ void Framebuffer::Driver::lookup_config(char const * const name,
|
|||||||
struct genode_mode &mode)
|
struct genode_mode &mode)
|
||||||
{
|
{
|
||||||
/* default settings, possibly overridden by explicit configuration below */
|
/* default settings, possibly overridden by explicit configuration below */
|
||||||
mode.enabled = true;
|
mode.enabled = !disable_all;
|
||||||
mode.brightness = 70 /* percent */;
|
mode.brightness = 70 /* percent */;
|
||||||
|
|
||||||
if (!config.valid())
|
if (!config.valid() || disable_all)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* iterate independently of force* ever to get brightness and hz */
|
/* 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.update_in_progress = false;
|
||||||
state.new_config_rom = 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 */
|
/* true if linux task should block, otherwise continue due to new config */
|
||||||
return !new_config;
|
return !new_config;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user