mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-18 13:26:27 +00:00
sculpt_manager: fb unplug, sanitize conn. model
This patch explicitly handles the unplugging of displays, avoiding the use of stale connectors for defining the panorama. It also makes the import of the connectors model robust against intermediate states reported by the driver (a connector reported as connector but without any mode), and discards the use of any information of non-present connectors as merge info. Issue #5286
This commit is contained in:
parent
e1909da501
commit
baedd79f62
@ -218,6 +218,14 @@ struct Sculpt::Fb_config
|
||||
});
|
||||
});
|
||||
|
||||
/* detect unplugging */
|
||||
for (Entry &entry : _entries) {
|
||||
bool connected = false;
|
||||
connectors.with_connector(entry.name, [&] (auto &) { connected = true; });
|
||||
if (!connected)
|
||||
entry.present = false;
|
||||
}
|
||||
|
||||
connectors._merged.for_each([&] (Fb_connectors::Connector const &conn) {
|
||||
if (!_known(conn.name))
|
||||
_add_unknown_merged(Entry::from_connector(conn)); });
|
||||
@ -328,28 +336,22 @@ struct Sculpt::Fb_config
|
||||
|
||||
void with_merge_info(auto const &fn) const
|
||||
{
|
||||
Merge_info info { };
|
||||
|
||||
/* merged screen size and name corresponds to first enabled connector */
|
||||
for (unsigned i = 0; i < _num_merged; i++) {
|
||||
info = { .name = _entries[i].name,
|
||||
.px = _entries[i].mode_attr.px };
|
||||
if (info.px.valid() && _entries[i].present)
|
||||
break;
|
||||
}
|
||||
|
||||
/* if all merged connectors are switched of, use name of first one */
|
||||
if (!info.px.valid()) {
|
||||
for (unsigned i = 0; i < _num_merged; i++) {
|
||||
info = { .name = _entries[i].name,
|
||||
.px = _entries[i].mode_attr.px };
|
||||
if (_entries[i].present)
|
||||
break;
|
||||
if (_entries[i].present && _entries[i].mode_attr.px.valid()) {
|
||||
fn({ .name = _entries[i].name,
|
||||
.px = _entries[i].mode_attr.px });
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (info.name.length() > 1)
|
||||
fn(info);
|
||||
/* if all merged connectors are switched off, use name of first present one */
|
||||
for (unsigned i = 0; i < _num_merged; i++) {
|
||||
if (_entries[i].present) {
|
||||
fn({ .name = _entries[i].name, .px = { }});
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void _gen_merge_node(Xml_generator &xml) const
|
||||
|
@ -207,7 +207,8 @@ struct Sculpt::Fb_connectors : private Noncopyable
|
||||
static bool type_matches(Xml_node const &node)
|
||||
{
|
||||
return node.has_type("connector")
|
||||
&& node.attribute_value("connected", false);
|
||||
&& node.attribute_value("connected", false)
|
||||
&& node.has_sub_node("mode");
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user