mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-21 14:37:50 +00:00
sculpt: driver-policy tweaks
Allow tweaking the driver selection using the manager config: - The new attribute 'ps2="no"' suppresses the selection of the PS/2 driver. - The new attribute 'intel_gpu="no"'suppresses the selection of the Intel GPU and fb drivers, letting Sculpt fall back to VESA or boot-fb. Note that the dynamic change of those attributes is handled in principle but not advisable. E.g., disabling the intel driver after startup leaves the hardware in a state that the VESA driver cannot cope with. However, when statically defining the attributes in sculpt/manager/default, it is now possible to build an image that uses VESA on an intel machine. Issue #5174
This commit is contained in:
parent
fd5f8c0ee1
commit
e04336d087
@ -109,15 +109,20 @@ struct Sculpt::Fb_driver : private Noncopyable
|
|||||||
void update(Registry<Child_state> ®istry, Board_info const &board_info,
|
void update(Registry<Child_state> ®istry, Board_info const &board_info,
|
||||||
Xml_node const &platform)
|
Xml_node const &platform)
|
||||||
{
|
{
|
||||||
_intel_gpu.conditional(board_info.detected.intel_gfx,
|
bool const use_intel = board_info.detected.intel_gfx
|
||||||
|
&& !board_info.options.suppress.intel_gpu;
|
||||||
|
bool const use_boot_fb = !use_intel && board_info.detected.boot_fb;
|
||||||
|
bool const use_vesa = !use_boot_fb && !use_intel && board_info.detected.vga;
|
||||||
|
|
||||||
|
_intel_gpu.conditional(use_intel,
|
||||||
registry, "intel_gpu", Priority::MULTIMEDIA,
|
registry, "intel_gpu", Priority::MULTIMEDIA,
|
||||||
Ram_quota { 32*1024*1024 }, Cap_quota { 1400 });
|
Ram_quota { 32*1024*1024 }, Cap_quota { 1400 });
|
||||||
|
|
||||||
_intel_fb.conditional(board_info.detected.intel_gfx,
|
_intel_fb.conditional(use_intel,
|
||||||
registry, "intel_fb", Priority::MULTIMEDIA,
|
registry, "intel_fb", Priority::MULTIMEDIA,
|
||||||
Ram_quota { 16*1024*1024 }, Cap_quota { 800 });
|
Ram_quota { 16*1024*1024 }, Cap_quota { 800 });
|
||||||
|
|
||||||
_vesa_fb.conditional(board_info.detected.vesa,
|
_vesa_fb.conditional(use_vesa,
|
||||||
registry, "vesa_fb", Priority::MULTIMEDIA,
|
registry, "vesa_fb", Priority::MULTIMEDIA,
|
||||||
Ram_quota { 8*1024*1024 }, Cap_quota { 110 });
|
Ram_quota { 8*1024*1024 }, Cap_quota { 110 });
|
||||||
|
|
||||||
@ -125,7 +130,7 @@ struct Sculpt::Fb_driver : private Noncopyable
|
|||||||
registry, "fb", Priority::MULTIMEDIA,
|
registry, "fb", Priority::MULTIMEDIA,
|
||||||
Ram_quota { 16*1024*1024 }, Cap_quota { 250 });
|
Ram_quota { 16*1024*1024 }, Cap_quota { 250 });
|
||||||
|
|
||||||
if (board_info.detected.boot_fb && !_boot_fb.constructed())
|
if (use_boot_fb && !_boot_fb.constructed())
|
||||||
Boot_fb::with_mode(platform, [&] (Boot_fb::Mode mode) {
|
Boot_fb::with_mode(platform, [&] (Boot_fb::Mode mode) {
|
||||||
_boot_fb.construct(registry, "boot_fb", Priority::MULTIMEDIA,
|
_boot_fb.construct(registry, "boot_fb", Priority::MULTIMEDIA,
|
||||||
mode.ram_quota(), Cap_quota { 100 }); });
|
mode.ram_quota(), Cap_quota { 100 }); });
|
||||||
|
@ -53,7 +53,7 @@ struct Sculpt::Ps2_driver : private Noncopyable
|
|||||||
|
|
||||||
void update(Registry<Child_state> ®istry, Board_info const &board_info)
|
void update(Registry<Child_state> ®istry, Board_info const &board_info)
|
||||||
{
|
{
|
||||||
_ps2.conditional(board_info.detected.ps2,
|
_ps2.conditional(board_info.detected.ps2 && !board_info.options.suppress.ps2,
|
||||||
registry, "ps2", Priority::MULTIMEDIA,
|
registry, "ps2", Priority::MULTIMEDIA,
|
||||||
Ram_quota { 1*1024*1024 }, Cap_quota { 100 });
|
Ram_quota { 1*1024*1024 }, Cap_quota { 100 });
|
||||||
}
|
}
|
||||||
|
@ -129,8 +129,16 @@ struct Sculpt::Main : Input_event_handler,
|
|||||||
|
|
||||||
Rom_handler<Main> _config { _env, "config", *this, &Main::_handle_config };
|
Rom_handler<Main> _config { _env, "config", *this, &Main::_handle_config };
|
||||||
|
|
||||||
void _handle_config(Xml_node const &)
|
void _handle_config(Xml_node const &config)
|
||||||
{
|
{
|
||||||
|
Board_info::Options const orig_options = _driver_options;
|
||||||
|
_driver_options.suppress.ps2 = !config.attribute_value("ps2", true);
|
||||||
|
_driver_options.suppress.intel_gpu = !config.attribute_value("intel_gpu", true);
|
||||||
|
if (orig_options != _driver_options) {
|
||||||
|
_drivers.update_options(_driver_options);
|
||||||
|
generate_runtime_config();
|
||||||
|
}
|
||||||
|
|
||||||
_handle_storage_devices();
|
_handle_storage_devices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,13 +25,13 @@ struct Sculpt::Board_info
|
|||||||
*/
|
*/
|
||||||
struct Detected
|
struct Detected
|
||||||
{
|
{
|
||||||
bool wifi, nic, intel_gfx, boot_fb, vesa, nvme, ahci, usb, ps2;
|
bool wifi, nic, intel_gfx, boot_fb, vga, nvme, ahci, usb, ps2;
|
||||||
|
|
||||||
void print(Output &out) const
|
void print(Output &out) const
|
||||||
{
|
{
|
||||||
Genode::print(out, "wifi=", wifi, " nic=", nic,
|
Genode::print(out, "wifi=", wifi, " nic=", nic,
|
||||||
" intel_gfx=", intel_gfx, " boot_fb=", boot_fb,
|
" intel_gfx=", intel_gfx, " boot_fb=", boot_fb,
|
||||||
" vesa=", vesa, " nvme=", nvme,
|
" vga=", vga, " nvme=", nvme,
|
||||||
" ahci=", ahci, " usb=", usb);
|
" ahci=", ahci, " usb=", usb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,10 +61,22 @@ struct Sculpt::Board_info
|
|||||||
{
|
{
|
||||||
bool display, usb_net, nic, wifi;
|
bool display, usb_net, nic, wifi;
|
||||||
|
|
||||||
|
struct Suppress {
|
||||||
|
|
||||||
|
bool ps2, intel_gpu;
|
||||||
|
|
||||||
|
bool operator != (Suppress const &other) const
|
||||||
|
{
|
||||||
|
return ps2 != other.ps2 || intel_gpu != other.intel_gpu;
|
||||||
|
}
|
||||||
|
|
||||||
|
} suppress;
|
||||||
|
|
||||||
bool operator != (Options const &other) const
|
bool operator != (Options const &other) const
|
||||||
{
|
{
|
||||||
return display != other.display || usb_net != other.usb_net
|
return display != other.display || usb_net != other.usb_net
|
||||||
|| nic != other.nic || wifi != other.wifi;
|
|| nic != other.nic || wifi != other.wifi
|
||||||
|
|| suppress != other.suppress;
|
||||||
}
|
}
|
||||||
|
|
||||||
} options;
|
} options;
|
||||||
@ -82,8 +94,6 @@ Sculpt::Board_info::Detected::from_xml(Xml_node const &devices, Xml_node const &
|
|||||||
Boot_fb::with_mode(platform, [&] (Boot_fb::Mode mode) {
|
Boot_fb::with_mode(platform, [&] (Boot_fb::Mode mode) {
|
||||||
detected.boot_fb = mode.valid(); });
|
detected.boot_fb = mode.valid(); });
|
||||||
|
|
||||||
bool vga = false;
|
|
||||||
|
|
||||||
devices.for_each_sub_node("device", [&] (Xml_node const &device) {
|
devices.for_each_sub_node("device", [&] (Xml_node const &device) {
|
||||||
|
|
||||||
if (device.attribute_value("name", String<16>()) == "ps2")
|
if (device.attribute_value("name", String<16>()) == "ps2")
|
||||||
@ -124,19 +134,13 @@ Sculpt::Board_info::Detected::from_xml(Xml_node const &devices, Xml_node const &
|
|||||||
detected.ahci = true;
|
detected.ahci = true;
|
||||||
|
|
||||||
if (matches_class(Pci_class::VGA)) {
|
if (matches_class(Pci_class::VGA)) {
|
||||||
vga = true;
|
detected.vga = true;
|
||||||
if (matches_vendor(Pci_vendor::INTEL))
|
if (matches_vendor(Pci_vendor::INTEL))
|
||||||
detected.intel_gfx = true;
|
detected.intel_gfx = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (detected.intel_gfx)
|
|
||||||
detected.boot_fb = false;
|
|
||||||
|
|
||||||
if (vga && !detected.intel_gfx && !detected.boot_fb)
|
|
||||||
detected.vesa = true;
|
|
||||||
|
|
||||||
return detected;
|
return detected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user