From: Thomas Zimmermann <tzimmermann@suse.de>
To: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
airlied@gmail.com, simona@ffwll.ch, jani.nikula@linux.intel.com,
airlied@redhat.com, jfalempe@redhat.com
Cc: dri-devel@lists.freedesktop.org, Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH 2/7] drm: Add physical status to connector
Date: Fri, 11 Oct 2024 08:43:07 +0200 [thread overview]
Message-ID: <20241011065705.6728-3-tzimmermann@suse.de> (raw)
In-Reply-To: <20241011065705.6728-1-tzimmermann@suse.de>
Track the connector's physical status in addition to its logical
status. The latter is directly derived from the former and for most
connectors both values are in sync.
Server chips with BMC, such as Aspeed, Matrox and HiSilicon, often
provide virtual outputs for remote management. Without a connected
display, fbcon or userspace compositors disabek the output and stop
displaying to the BMC.
Connectors have therefore to remain in connected status, even if the
display has been physically disconnected. Tracking both physical and
logical state in separate fields will enable that. The physical status
is transparent to drivers and clients, but changes update the epoch
counter. This generates a hotplug events for clients. Clients will then
pick up changes to resolutions supported, if any.
The ast driver already contains code to track the physical status. This
commit generalizes the logic for use with other drivers. Candidates are
mgag200 and hibmc.
This commit adds the physical status and makes the regular, logical
status a copy of it. A later change will add the flag for BMC support.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/drm_connector.c | 1 +
drivers/gpu/drm/drm_probe_helper.c | 13 ++++++++-----
include/drm/drm_connector.h | 7 +++++++
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index fc35f47e2849..901d73416f98 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -282,6 +282,7 @@ static int __drm_connector_init(struct drm_device *dev,
connector->edid_blob_ptr = NULL;
connector->epoch_counter = 0;
connector->tile_blob_ptr = NULL;
+ connector->physical_status = connector_status_unknown;
connector->status = connector_status_unknown;
connector->display_info.panel_orientation =
DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index 62a2e5bcb315..df44be128e72 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -373,7 +373,7 @@ drm_helper_probe_detect_ctx(struct drm_connector *connector, bool force)
if (WARN_ON(ret < 0))
ret = connector_status_unknown;
- if (ret != connector->status)
+ if (ret != connector->physical_status)
connector->epoch_counter += 1;
drm_modeset_drop_locks(&ctx);
@@ -409,7 +409,7 @@ drm_helper_probe_detect(struct drm_connector *connector,
ret = detect_connector_status(connector, ctx, force);
- if (ret != connector->status)
+ if (ret != connector->physical_status)
connector->epoch_counter += 1;
return ret;
@@ -588,9 +588,11 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
if (connector->force) {
if (connector->force == DRM_FORCE_ON ||
connector->force == DRM_FORCE_ON_DIGITAL)
- connector->status = connector_status_connected;
+ connector->physical_status = connector_status_connected;
else
- connector->status = connector_status_disconnected;
+ connector->physical_status = connector_status_disconnected;
+ connector->status = connector->physical_status;
+
if (connector->funcs->force)
connector->funcs->force(connector);
} else {
@@ -602,7 +604,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
} else if (WARN(ret < 0, "Invalid return value %i for connector detection\n", ret))
ret = connector_status_unknown;
- connector->status = ret;
+ connector->physical_status = ret;
+ connector->status = connector->physical_status;
}
/*
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index e3fa43291f44..37e951f04ae8 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -1817,6 +1817,13 @@ struct drm_connector {
*/
struct list_head modes;
+ /**
+ * @physical_status:
+ * One of the drm_connector_status enums (connected, not, or unknown).
+ * Protected by &drm_mode_config.mutex.
+ */
+ enum drm_connector_status physical_status;
+
/**
* @status:
* One of the drm_connector_status enums (connected, not, or unknown).
--
2.46.0
next prev parent reply other threads:[~2024-10-11 6:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-11 6:43 [PATCH 0/7] drm: Add physical status and BMC support to conenctor Thomas Zimmermann
2024-10-11 6:43 ` [PATCH 1/7] drm/probe-helper: Call connector detect functions in single helper Thomas Zimmermann
2024-10-11 6:43 ` Thomas Zimmermann [this message]
2024-10-11 8:51 ` [PATCH 2/7] drm: Add physical status to connector Jani Nikula
2024-10-11 9:01 ` Thomas Zimmermann
2024-10-11 6:43 ` [PATCH 3/7] drm: Add bmc_attached flag " Thomas Zimmermann
2024-10-11 9:01 ` Jani Nikula
2024-10-11 6:43 ` [PATCH 4/7] drm/ast: sil164: Clear EDID if no display is connected Thomas Zimmermann
2024-10-11 6:43 ` [PATCH 5/7] drm/ast: vga: " Thomas Zimmermann
2024-10-11 6:43 ` [PATCH 6/7] drm/ast: Track physical connector status in struct drm_connector Thomas Zimmermann
2024-10-11 9:05 ` Jani Nikula
2024-10-11 6:43 ` [PATCH 7/7] drm/mgag200: " Thomas Zimmermann
2024-10-11 9:08 ` [PATCH 0/7] drm: Add physical status and BMC support to conenctor Jani Nikula
2024-10-11 10:52 ` Maxime Ripard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241011065705.6728-3-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@gmail.com \
--cc=airlied@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=jfalempe@redhat.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.