All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Bandy <cbandy@jbandy.com>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: dri-devel@lists.sourceforge.net
Subject: Re: [RFC] drm: emit change events when mode config changes
Date: Fri, 15 Apr 2011 09:23:38 -0500	[thread overview]
Message-ID: <4DA854EA.8010701@jbandy.com> (raw)
In-Reply-To: <20110414104226.4ee49e06@jbarnes-vaio.home>

On 04/14/2011 12:42 PM, Jesse Barnes wrote:
> We've already seen that apps want to monitor the display config, and
> some (like upowerd) poll for changes since we don't provide a
> notification for general mode config changes, just hotplug events.  So
> add a new drm event, with CHANGE=1 set in the event, to allow for it.
>
> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 4c95b5f..174ee64 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -1589,6 +1589,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>  	set.fb = fb;
>  	ret = crtc->funcs->set_config(&set);
>  
> +	drm_sysfs_change_event(dev);
> +
>  out:
>  	kfree(connector_set);
>  	mutex_unlock(&dev->mode_config.mutex);
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 9507204..df946d4 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -822,6 +822,8 @@ int drm_fb_helper_set_par(struct fb_info *info)
>  			return ret;
>  		}
>  	}
> +
> +	drm_sysfs_change_event(dev);
>  	mutex_unlock(&dev->mode_config.mutex);
>  
>  	if (fb_helper->delayed_hotplug) {
> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> index 2eee8e0..fd3af31 100644
> --- a/drivers/gpu/drm/drm_sysfs.c
> +++ b/drivers/gpu/drm/drm_sysfs.c
> @@ -467,9 +467,9 @@ EXPORT_SYMBOL(drm_sysfs_connector_remove);
>   * drm_sysfs_hotplug_event - generate a DRM uevent
>   * @dev: DRM device
>   *
> - * Send a uevent for the DRM device specified by @dev.  Currently we only
> - * set HOTPLUG=1 in the uevent environment, but this could be expanded to
> - * deal with other types of events.
> + * Send a uevent for the DRM device specified by @dev.  Set HOTPLUG=1 in the
> + * event to indicate a display config change occurred, probably due to a
> + * display being added or removed.
>   */
>  void drm_sysfs_hotplug_event(struct drm_device *dev)
>  {
> @@ -483,6 +483,24 @@ void drm_sysfs_hotplug_event(struct drm_device *dev)
>  EXPORT_SYMBOL(drm_sysfs_hotplug_event);
>  
>  /**
> + * drm_sysfs_change_event - generate a DRM uevent indicating a display config change
> + * @dev: DRM device
> + *
> + * Send a uevent for the DRM device specified by @dev.  Set CHANGE=1 to
> + * indicate that a userspace initiated display configuration change occurred.
> + */
> +void drm_sysfs_change_event(struct drm_device *dev)
> +{
> +	char *event_string = "CHANGE=1";
> +	char *envp[] = { event_string, NULL };
> +
> +	DRM_DEBUG("generating hotplug event\n");

Should be "change event" here?

> +
> +	kobject_uevent_env(&dev->primary->kdev.kobj, KOBJ_CHANGE, envp);
> +}
> +EXPORT_SYMBOL(drm_sysfs_change_event);
> +
> +/**
>   * drm_sysfs_device_add - adds a class device to sysfs for a character driver
>   * @dev: DRM device to be added
>   * @head: DRM head in question
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index ad5770f..3aff8fc 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -1506,6 +1506,7 @@ extern struct class *drm_sysfs_create(struct module *owner, char *name);
>  extern void drm_sysfs_destroy(void);
>  extern int drm_sysfs_device_add(struct drm_minor *minor);
>  extern void drm_sysfs_hotplug_event(struct drm_device *dev);
> +extern void drm_sysfs_change_event(struct drm_device *dev);
>  extern void drm_sysfs_device_remove(struct drm_minor *minor);
>  extern char *drm_get_connector_status_name(enum drm_connector_status status);
>  extern int drm_sysfs_connector_add(struct drm_connector *connector);
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload 
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve 
> application availability and disaster protection. Learn more about boosting 
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> --
> _______________________________________________
> Dri-devel mailing list
> Dri-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/dri-devel
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

  reply	other threads:[~2011-04-15 14:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-14 17:42 [RFC] drm: emit change events when mode config changes Jesse Barnes
2011-04-15 14:23 ` Chris Bandy [this message]
2011-04-15 16:09   ` Jesse Barnes
2011-04-15 18:35 ` Adam Jackson

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=4DA854EA.8010701@jbandy.com \
    --to=cbandy@jbandy.com \
    --cc=dri-devel@lists.sourceforge.net \
    --cc=jbarnes@virtuousgeek.org \
    /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.