@@ -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)
@@ -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
*/
@@ -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,
};