* [RFC] drm: emit change events when mode config changes
@ 2011-04-14 17:42 Jesse Barnes
2011-04-15 14:23 ` Chris Bandy
2011-04-15 18:35 ` Adam Jackson
0 siblings, 2 replies; 4+ messages in thread
From: Jesse Barnes @ 2011-04-14 17:42 UTC (permalink / raw)
To: dri-devel
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");
+
+ 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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RFC] drm: emit change events when mode config changes
2011-04-14 17:42 [RFC] drm: emit change events when mode config changes Jesse Barnes
@ 2011-04-15 14:23 ` Chris Bandy
2011-04-15 16:09 ` Jesse Barnes
2011-04-15 18:35 ` Adam Jackson
1 sibling, 1 reply; 4+ messages in thread
From: Chris Bandy @ 2011-04-15 14:23 UTC (permalink / raw)
To: Jesse Barnes; +Cc: dri-devel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] drm: emit change events when mode config changes
2011-04-15 14:23 ` Chris Bandy
@ 2011-04-15 16:09 ` Jesse Barnes
0 siblings, 0 replies; 4+ messages in thread
From: Jesse Barnes @ 2011-04-15 16:09 UTC (permalink / raw)
To: Chris Bandy; +Cc: dri-devel
On Fri, 15 Apr 2011 09:23:38 -0500
Chris Bandy <cbandy@jbandy.com> wrote:
> On 04/14/2011 12:42 PM, Jesse Barnes wrote:
> > /**
> > + * 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?
Yeah, I noticed after I sent it out, I think I'll just drop the
DRM_DEBUG altogether though.
--
Jesse Barnes, Intel Open Source Technology Center
------------------------------------------------------------------------------
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] drm: emit change events when mode config changes
2011-04-14 17:42 [RFC] drm: emit change events when mode config changes Jesse Barnes
2011-04-15 14:23 ` Chris Bandy
@ 2011-04-15 18:35 ` Adam Jackson
1 sibling, 0 replies; 4+ messages in thread
From: Adam Jackson @ 2011-04-15 18:35 UTC (permalink / raw)
To: Jesse Barnes; +Cc: dri-devel
On 4/14/11 1: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>
Reviewed-by: Adam Jackson <ajax@redhat.com>
- ajax
------------------------------------------------------------------------------
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-04-15 18:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-14 17:42 [RFC] drm: emit change events when mode config changes Jesse Barnes
2011-04-15 14:23 ` Chris Bandy
2011-04-15 16:09 ` Jesse Barnes
2011-04-15 18:35 ` Adam Jackson
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.