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 7/7] drm/mgag200: Track physical connector status in struct drm_connector
Date: Fri, 11 Oct 2024 08:43:12 +0200 [thread overview]
Message-ID: <20241011065705.6728-8-tzimmermann@suse.de> (raw)
In-Reply-To: <20241011065705.6728-1-tzimmermann@suse.de>
Set bmc_attached for the VGA connector on servers and let DRM's
probe helpers track the physical and logical connector state. Remove
similar logic from mgag200.
Also resolve a design issue, where mgag200 uses the connector's
edid_blob_ptr. It is an internal value that drivers should not access
directly.
Reported-by: Jani Nikula <jani.nikula@linux.intel.com>
Closes: https://lore.kernel.org/dri-devel/87msjtxk8f.fsf@intel.com/raw
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/mgag200/mgag200_vga_bmc.c | 32 +++++------------------
1 file changed, 6 insertions(+), 26 deletions(-)
diff --git a/drivers/gpu/drm/mgag200/mgag200_vga_bmc.c b/drivers/gpu/drm/mgag200/mgag200_vga_bmc.c
index a5a3ac108bd5..cff333572b29 100644
--- a/drivers/gpu/drm/mgag200/mgag200_vga_bmc.c
+++ b/drivers/gpu/drm/mgag200/mgag200_vga_bmc.c
@@ -54,9 +54,11 @@ static int mgag200_vga_bmc_connector_helper_get_modes(struct drm_connector *conn
const struct mgag200_device_info *minfo = mdev->info;
int count;
- count = drm_connector_helper_get_modes(connector);
+ if (connector->physical_status == connector_status_connected) {
+ count = drm_connector_helper_get_modes(connector);
+ } else {
+ drm_edid_connector_update(connector, NULL);
- if (!count) {
/*
* There's no EDID data without a connected monitor. Set BMC-
* compatible modes in this case. The XGA default resolution
@@ -70,32 +72,9 @@ static int mgag200_vga_bmc_connector_helper_get_modes(struct drm_connector *conn
return count;
}
-/*
- * There's no monitor connected if the DDC did not return an EDID. Still
- * return 'connected' as there's always a BMC. Incrementing the connector's
- * epoch counter triggers an update of the related properties.
- */
-static int mgag200_vga_bmc_connector_helper_detect_ctx(struct drm_connector *connector,
- struct drm_modeset_acquire_ctx *ctx,
- bool force)
-{
- enum drm_connector_status old_status, status;
-
- if (connector->edid_blob_ptr)
- old_status = connector_status_connected;
- else
- old_status = connector_status_disconnected;
-
- status = drm_connector_helper_detect_from_ddc(connector, ctx, force);
-
- if (status != old_status)
- ++connector->epoch_counter;
- return connector_status_connected;
-}
-
static const struct drm_connector_helper_funcs mgag200_vga_connector_helper_funcs = {
.get_modes = mgag200_vga_bmc_connector_helper_get_modes,
- .detect_ctx = mgag200_vga_bmc_connector_helper_detect_ctx,
+ .detect_ctx = drm_connector_helper_detect_from_ddc,
};
static const struct drm_connector_funcs mgag200_vga_connector_funcs = {
@@ -143,6 +122,7 @@ int mgag200_vga_bmc_output_init(struct mga_device *mdev)
}
drm_connector_helper_add(connector, &mgag200_vga_connector_helper_funcs);
+ connector->bmc_attached = true;
connector->polled = DRM_CONNECTOR_POLL_CONNECT |
DRM_CONNECTOR_POLL_DISCONNECT;
--
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 ` [PATCH 2/7] drm: Add physical status to connector Thomas Zimmermann
2024-10-11 8:51 ` 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 ` Thomas Zimmermann [this message]
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-8-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.