From 77471cc10ebdce9cda52838216243502eb55a642 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 29 Oct 2024 10:52:05 +0100 Subject: [PATCH] intel/display: report connectors w/o modes as off in the XML report --- repos/pc/src/driver/framebuffer/intel/pc/lx_i915.h | 1 + repos/pc/src/driver/framebuffer/intel/pc/lx_user.c | 11 +++++++++++ repos/pc/src/driver/framebuffer/intel/pc/main.cc | 3 ++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/repos/pc/src/driver/framebuffer/intel/pc/lx_i915.h b/repos/pc/src/driver/framebuffer/intel/pc/lx_i915.h index 1fc5490bb6..47d5676846 100644 --- a/repos/pc/src/driver/framebuffer/intel/pc/lx_i915.h +++ b/repos/pc/src/driver/framebuffer/intel/pc/lx_i915.h @@ -41,6 +41,7 @@ void lx_emul_i915_hotplug_connector(void); void lx_emul_i915_report_connector(void * lx_data, void * genode_xml, char const *name, char connected, + char modes, unsigned brightness, unsigned width_mm, unsigned height_mm); void lx_emul_i915_iterate_modes(void *lx_data, void * genode_data); diff --git a/repos/pc/src/driver/framebuffer/intel/pc/lx_user.c b/repos/pc/src/driver/framebuffer/intel/pc/lx_user.c index f6a05feab3..5a97aaf9e8 100644 --- a/repos/pc/src/driver/framebuffer/intel/pc/lx_user.c +++ b/repos/pc/src/driver/framebuffer/intel/pc/lx_user.c @@ -984,6 +984,8 @@ static void _report_connectors(void * genode_data, bool const discrete) struct drm_device const *dev = dev_client->dev; struct drm_connector *connector = NULL; + struct drm_display_mode *mode = NULL; + bool has_modes = false; drm_connector_list_iter_begin(dev, &conn_iter); drm_client_for_each_connector_iter(connector, &conn_iter) { @@ -1003,9 +1005,18 @@ static void _report_connectors(void * genode_data, bool const discrete) if ((discrete && mirror) || (!discrete && !mirror)) continue; + list_for_each_entry(mode, &connector->modes, head) { + + if (!mode) + continue; + + has_modes = true; + } + lx_emul_i915_report_connector(connector, genode_data, connector->name, connector->status != connector_status_disconnected, + has_modes, get_brightness(connector, INVALID_BRIGHTNESS), connector->display_info.width_mm, connector->display_info.height_mm); diff --git a/repos/pc/src/driver/framebuffer/intel/pc/main.cc b/repos/pc/src/driver/framebuffer/intel/pc/main.cc index 7b2b89e431..61461e96ff 100644 --- a/repos/pc/src/driver/framebuffer/intel/pc/main.cc +++ b/repos/pc/src/driver/framebuffer/intel/pc/main.cc @@ -528,6 +528,7 @@ void lx_emul_i915_hotplug_connector() void lx_emul_i915_report_connector(void * lx_data, void * genode_xml, char const *name, char const connected, + char const modes_available, unsigned brightness, unsigned width_mm, unsigned height_mm) { @@ -535,7 +536,7 @@ void lx_emul_i915_report_connector(void * lx_data, void * genode_xml, xml.node("connector", [&] () { - xml.attribute("connected", !!connected); + xml.attribute("connected", connected && modes_available); xml.attribute("name", name); if (width_mm) xml.attribute("width_mm" , width_mm);