[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241122-google-remove-crtc-index-from-parameter-v2-16-81540742535a@bootlin.com>
Date: Fri, 22 Nov 2024 18:20:20 +0100
From: Louis Chauvet <louis.chauvet@...tlin.com>
To: Maíra Canal <mairacanal@...eup.net>,
Haneen Mohammed <hamohammed.sa@...il.com>, Simona Vetter <simona@...ll.ch>,
Melissa Wen <melissa.srw@...il.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>
Cc: arthurgrillo@...eup.net, jeremie.dautheribes@...tlin.com,
miquel.raynal@...tlin.com, thomas.petazzoni@...tlin.com,
seanpaul@...gle.com, nicolejadeyee@...gle.com, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org, Louis Chauvet <louis.chauvet@...tlin.com>,
José Expósito <jose.exposito89@...il.com>
Subject: [PATCH RFC v2 16/18] drm/vkms: Introduce config for connector
status
Signed-off-by: José Expósito <jose.exposito89@...il.com>
[adpated it for my implementation]
Signed-off-by: Louis Chauvet <louis.chauvet@...tlin.com>
---
drivers/gpu/drm/vkms/vkms_config.c | 10 ++++++++++
drivers/gpu/drm/vkms/vkms_config.h | 4 ++++
drivers/gpu/drm/vkms/vkms_output.c | 17 +++++++++++++++++
3 files changed, 31 insertions(+)
diff --git a/drivers/gpu/drm/vkms/vkms_config.c b/drivers/gpu/drm/vkms/vkms_config.c
index 4726929c2b54b2e670f9ef53b05ec009ca495e08..ac1a9658c5075c118d59da965ca3392355ccb2b2 100644
--- a/drivers/gpu/drm/vkms/vkms_config.c
+++ b/drivers/gpu/drm/vkms/vkms_config.c
@@ -2,6 +2,7 @@
#include <kunit/visibility.h>
#include <drm/drm_debugfs.h>
+#include <drm/drm_probe_helper.h>
#include "vkms_config.h"
#include "vkms_drv.h"
@@ -197,10 +198,19 @@ struct vkms_config_connector *vkms_config_create_connector(struct vkms_config *v
list_add(&vkms_config_connector->link, &vkms_config->connectors);
xa_init_flags(&vkms_config_connector->possible_encoders, XA_FLAGS_ALLOC);
vkms_config_connector->type = DRM_MODE_CONNECTOR_VIRTUAL;
+ vkms_config_connector->status = connector_status_unknown;
return vkms_config_connector;
}
+void vkms_config_connector_update_status(struct vkms_config_connector *vkms_config_connector,
+ enum drm_connector_status status)
+{
+ vkms_config_connector->status = status;
+ if (vkms_config_connector->connector)
+ drm_kms_helper_hotplug_event(vkms_config_connector->connector->dev);
+}
+
struct vkms_config_crtc *vkms_config_create_crtc(struct vkms_config *vkms_config)
{
if (!vkms_config)
diff --git a/drivers/gpu/drm/vkms/vkms_config.h b/drivers/gpu/drm/vkms/vkms_config.h
index 5487e0140da0e111c36f9a22d4e783a20c880a1d..bba56c9d8aeceac97a4339ef42ab663c5dc54e65 100644
--- a/drivers/gpu/drm/vkms/vkms_config.h
+++ b/drivers/gpu/drm/vkms/vkms_config.h
@@ -111,11 +111,15 @@ struct vkms_config_connector {
struct xarray possible_encoders;
int type;
+ enum drm_connector_status status;
/* Internal usage */
struct drm_connector *connector;
};
+void vkms_config_connector_update_status(struct vkms_config_connector *vkms_config_connector,
+ enum drm_connector_status status);
+
/**
* vkms_config_register_debugfs() - Register the debugfs file to display current configuration
*/
diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
index aea6366fd9a662483ed5a255d02d5025a30297f7..fc6a0cdade0739b94820ed4e0924cf355137fe79 100644
--- a/drivers/gpu/drm/vkms/vkms_output.c
+++ b/drivers/gpu/drm/vkms/vkms_output.c
@@ -7,9 +7,26 @@
#include <drm/drm_managed.h>
#include <drm/drm_probe_helper.h>
+static enum drm_connector_status vkms_connector_detect(struct drm_connector *connector, bool force)
+{
+ struct vkms_device *vkmsdev = drm_device_to_vkms_device(connector->dev);
+ enum drm_connector_status status = connector->status;
+ struct vkms_config_connector *connector_cfg;
+
+ list_for_each_entry(connector_cfg, &vkmsdev->config->connectors, link) {
+ if (connector_cfg->connector == connector) {
+ status = connector_cfg->status;
+ break;
+ }
+ }
+
+ return status;
+}
+
static const struct drm_connector_funcs vkms_connector_funcs = {
.fill_modes = drm_helper_probe_single_connector_modes,
.reset = drm_atomic_helper_connector_reset,
+ .detect = vkms_connector_detect,
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
--
2.47.0
Powered by blists - more mailing lists