On Wed, 09 Jun 2021 21:23:27 +0000
Simon Ser <cont...@emersion.fr> wrote:

> This function sends a hotplug uevent with a CONNECTOR property.
> 
> Signed-off-by: Simon Ser <cont...@emersion.fr>
> ---
>  drivers/gpu/drm/drm_sysfs.c | 25 +++++++++++++++++++++++++
>  include/drm/drm_sysfs.h     |  1 +
>  2 files changed, 26 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> index 968a9560b4aa..8423e44c3035 100644
> --- a/drivers/gpu/drm/drm_sysfs.c
> +++ b/drivers/gpu/drm/drm_sysfs.c
> @@ -343,6 +343,31 @@ void drm_sysfs_hotplug_event(struct drm_device *dev)
>  }
>  EXPORT_SYMBOL(drm_sysfs_hotplug_event);
>  
> +/**
> + * drm_sysfs_connector_hotplug_event - generate a DRM uevent for any 
> connector
> + * change
> + * @connector: connector which has changed
> + *
> + * Send a uevent for the DRM connector specified by @connector. This will 
> send
> + * a uevent with the properties HOTPLUG=1 and CONNECTOR.
> + */
> +void drm_sysfs_connector_hotplug_event(struct drm_connector *connector)
> +{
> +     struct drm_device *dev = connector->dev;
> +     char hotplug_str[] = "HOTPLUG=1", conn_id[21];
> +     char *envp[] = { hotplug_str, conn_id, NULL };
> +
> +     snprintf(conn_id, sizeof(conn_id),
> +              "CONNECTOR=%u", connector->base.id);
> +
> +     drm_dbg_kms(connector->dev,
> +                 "[CONNECTOR:%d:%s] generating connector hotplug event\n",
> +                 connector->base.id, connector->name);
> +
> +     kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp);
> +}
> +EXPORT_SYMBOL(drm_sysfs_connector_hotplug_event);

Hi,

I believe this change would be safe for Weston while Weston would not
take advantage of the optimisation without patching it. The idea seems
fine to me, and patching Weston to take advantage of this would be fine
too.

I can't say anything about the kernel internal details on how to
implement this, and I don't recall if the per-connector epoch counter
was supposed to the exposed to userspace, offering a different way to
do the same.


Thanks,
pq

> +
>  /**
>   * drm_sysfs_connector_status_event - generate a DRM uevent for connector
>   * property status change
> diff --git a/include/drm/drm_sysfs.h b/include/drm/drm_sysfs.h
> index d454ef617b2c..6273cac44e47 100644
> --- a/include/drm/drm_sysfs.h
> +++ b/include/drm/drm_sysfs.h
> @@ -11,6 +11,7 @@ int drm_class_device_register(struct device *dev);
>  void drm_class_device_unregister(struct device *dev);
>  
>  void drm_sysfs_hotplug_event(struct drm_device *dev);
> +void drm_sysfs_connector_hotplug_event(struct drm_connector *connector);
>  void drm_sysfs_connector_status_event(struct drm_connector *connector,
>                                     struct drm_property *property);
>  #endif

Attachment: pgpqElPSB6PbU.pgp
Description: OpenPGP digital signature

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to