Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist For drm drivers and on monitor ho...



details:   https://anonhg.NetBSD.org/src/rev/8854d6883108
branches:  trunk
changeset: 1009286:8854d6883108
user:      maya <maya%NetBSD.org@localhost>
date:      Sun Apr 19 17:19:13 2020 +0000

description:
For drm drivers and on monitor hotplug, report a 'display-cycle' hotkey click

If powerd is running, it will invoke the script
/etc/powerd/actions/display-cycle

diffstat:

 sys/external/bsd/drm2/dist/drm/drm_drv.c          |  20 ++++++++++++++++++--
 sys/external/bsd/drm2/dist/drm/drm_probe_helper.c |   7 +++++--
 sys/external/bsd/drm2/dist/include/drm/drmP.h     |   3 ++-
 3 files changed, 25 insertions(+), 5 deletions(-)

diffs (100 lines):

diff -r 4cf7466e1106 -r 8854d6883108 sys/external/bsd/drm2/dist/drm/drm_drv.c
--- a/sys/external/bsd/drm2/dist/drm/drm_drv.c  Sun Apr 19 17:08:14 2020 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_drv.c  Sun Apr 19 17:19:13 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_drv.c,v 1.13 2020/03/05 07:46:59 riastradh Exp $   */
+/*     $NetBSD: drm_drv.c,v 1.14 2020/04/19 17:19:13 maya Exp $        */
 
 /*
  * Created: Fri Jan 19 10:48:35 2001 by faith%acm.org@localhost
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.13 2020/03/05 07:46:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.14 2020/04/19 17:19:13 maya Exp $");
 
 #include <linux/debugfs.h>
 #include <linux/fs.h>
@@ -660,6 +660,14 @@
        kref_init(&dev->ref);
        dev->dev = parent;
        dev->driver = driver;
+#ifdef __NetBSD__
+       dev->sc_monitor_hotplug.smpsw_name = PSWITCH_HK_DISPLAY_CYCLE;
+       dev->sc_monitor_hotplug.smpsw_type = PSWITCH_TYPE_HOTKEY;
+
+       ret = sysmon_pswitch_register(&dev->sc_monitor_hotplug);
+       if (ret)
+               goto err_pswitch;
+#endif
 
        INIT_LIST_HEAD(&dev->filelist);
        INIT_LIST_HEAD(&dev->ctxlist);
@@ -727,6 +735,10 @@
        mutex_destroy(&dev->master_mutex);
        mutex_destroy(&dev->ctxlist_mutex);
        mutex_destroy(&dev->struct_mutex);
+#ifdef __NetBSD__
+err_pswitch:
+       sysmon_pswitch_unregister(&dev->sc_monitor_hotplug);
+#endif
        kfree(dev);
        return NULL;
 }
@@ -739,6 +751,10 @@
        if (drm_core_check_feature(dev, DRIVER_GEM))
                drm_gem_destroy(dev);
 
+#ifdef __NetBSD__
+       sysmon_pswitch_unregister(&dev->sc_monitor_hotplug);
+#endif
+
        drm_legacy_ctxbitmap_cleanup(dev);
        drm_ht_remove(&dev->map_hash);
        drm_fs_inode_free(dev->anon_inode);
diff -r 4cf7466e1106 -r 8854d6883108 sys/external/bsd/drm2/dist/drm/drm_probe_helper.c
--- a/sys/external/bsd/drm2/dist/drm/drm_probe_helper.c Sun Apr 19 17:08:14 2020 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_probe_helper.c Sun Apr 19 17:19:13 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_probe_helper.c,v 1.4 2020/02/14 14:34:57 maya Exp $        */
+/*     $NetBSD: drm_probe_helper.c,v 1.5 2020/04/19 17:19:13 maya Exp $        */
 
 /*
  * Copyright (c) 2006-2008 Intel Corporation
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_probe_helper.c,v 1.4 2020/02/14 14:34:57 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_probe_helper.c,v 1.5 2020/04/19 17:19:13 maya Exp $");
 
 #include <linux/export.h>
 #include <linux/moduleparam.h>
@@ -328,6 +328,9 @@
  */
 void drm_kms_helper_hotplug_event(struct drm_device *dev)
 {
+#ifdef __NetBSD__
+       sysmon_pswitch_event(&dev->sc_monitor_hotplug, PSWITCH_EVENT_PRESSED);
+#endif
        /* send a uevent + call fbdev */
        drm_sysfs_hotplug_event(dev);
        if (dev->mode_config.funcs->output_poll_changed)
diff -r 4cf7466e1106 -r 8854d6883108 sys/external/bsd/drm2/dist/include/drm/drmP.h
--- a/sys/external/bsd/drm2/dist/include/drm/drmP.h     Sun Apr 19 17:08:14 2020 +0000
+++ b/sys/external/bsd/drm2/dist/include/drm/drmP.h     Sun Apr 19 17:19:13 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drmP.h,v 1.39 2020/03/05 08:36:53 riastradh Exp $      */
+/*     $NetBSD: drmP.h,v 1.40 2020/04/19 17:19:13 maya Exp $   */
 
 /*
  * Internal Header for the Direct Rendering Manager
@@ -903,6 +903,7 @@
        int irq;
 #ifdef __NetBSD__
        struct drm_bus_irq_cookie *irq_cookie;
+       struct sysmon_pswitch sc_monitor_hotplug;
 #endif
 
        /*



Home | Main Index | Thread Index | Old Index