From f1af6545022877f9ae42f9721d334f1459d232c2 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Thu, 9 Jun 2022 12:45:11 +0200 Subject: [PATCH] intel_fb: add apply_on_hotplug attribute Make it configurable, whether on a hotplug event the current valid Genode config for the driver will be re-evaluated. By default it will be re-evaluated. Issue #4531 --- repos/pc/src/drivers/framebuffer/intel/pc/README | 15 +++++++++------ repos/pc/src/drivers/framebuffer/intel/pc/main.cc | 15 +++++++++++++-- repos/pc/src/test/framebuffer/intel/main.cc | 2 +- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/repos/pc/src/drivers/framebuffer/intel/pc/README b/repos/pc/src/drivers/framebuffer/intel/pc/README index 4d78cf1f63..cad8de7123 100644 --- a/repos/pc/src/drivers/framebuffer/intel/pc/README +++ b/repos/pc/src/drivers/framebuffer/intel/pc/README @@ -4,14 +4,17 @@ Default behaviour ~~~~~~~~~~~~~~~~~ When no configuration is provided to the driver, it will switch on all devices -connected to the graphics card. It will use the best resolution as +connected to the graphics card. It will use the highest resolution as provided by the BIOS or EDID information from the display devices for each connector. The virtual resolution delivered to the client is the maximum in -width and height of the different connectors. The framebuffer memory is -directly exported to the client of the driver. When newly connected devices are -detected by the hardware, the new connectors are enabled, probed, and again the -'best' resolution will be chosen for the device. Nevertheless, it won't have an -effect on the virtual resolution. +width and height of the active connectors. + +When newly connected devices are detected by the hardware, the new connectors +are enabled, probed, and again the highest resolution across all active +connectors will be chosen. By default, the current config of the driver will +be re-read and re-applied. This behaviour can be disabled by + +! Configuration ~~~~~~~~~~~~~ diff --git a/repos/pc/src/drivers/framebuffer/intel/pc/main.cc b/repos/pc/src/drivers/framebuffer/intel/pc/main.cc index 02f427390e..3bbc4f0482 100644 --- a/repos/pc/src/drivers/framebuffer/intel/pc/main.cc +++ b/repos/pc/src/drivers/framebuffer/intel/pc/main.cc @@ -123,6 +123,18 @@ struct Framebuffer::Driver timer.sigh(timer_handler); timer.trigger_periodic(20*1000); } + + void report_updated() + { + bool apply_config = true; + + if (config.valid()) + apply_config = config.xml().attribute_value("apply_on_hotplug", apply_config); + + /* trigger re-read config on connector change */ + if (apply_config) + Genode::Signal_transmitter(config_handler).submit(); + } }; @@ -270,8 +282,7 @@ void lx_emul_i915_report_connector(void * lx_data, void * genode_xml, lx_emul_i915_iterate_modes(lx_data, &xml); }); - /* re-read config on connector change */ - Genode::Signal_transmitter(driver(Lx_kit::env().env).config_handler).submit(); + driver(Lx_kit::env().env).report_updated(); } diff --git a/repos/pc/src/test/framebuffer/intel/main.cc b/repos/pc/src/test/framebuffer/intel/main.cc index d3ee857e9a..b0cd2371df 100644 --- a/repos/pc/src/test/framebuffer/intel/main.cc +++ b/repos/pc/src/test/framebuffer/intel/main.cc @@ -103,7 +103,7 @@ void Framebuffer_controller::_update_fb_config(Xml_node const &report) static char buf[4096]; Xml_generator xml(buf, sizeof(buf), "config", [&] { -// xml.attribute("poll", "5000"); + xml.attribute("apply_on_hotplug", "no"); xml.node("report", [&] { xml.attribute("connectors", "yes"); });