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/i915drm i915: Use new acpidisp_registe...



details:   https://anonhg.NetBSD.org/src/rev/577705df8e51
branches:  trunk
changeset: 362463:577705df8e51
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Feb 27 21:22:01 2022 +0000

description:
i915: Use new acpidisp_register_notify for ACPI VGA events.

diffstat:

 sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c |  52 +++++------
 sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h |   6 +-
 sys/external/bsd/drm2/i915drm/files.i915drmkms               |   4 +-
 sys/external/bsd/drm2/i915drm/i915_module.c                  |   6 +-
 4 files changed, 34 insertions(+), 34 deletions(-)

diffs (155 lines):

diff -r f747342ab35a -r 577705df8e51 sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c      Sun Feb 27 21:21:51 2022 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.c      Sun Feb 27 21:22:01 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_opregion.c,v 1.5 2021/12/24 15:08:09 riastradh Exp $     */
+/*     $NetBSD: intel_opregion.c,v 1.6 2022/02/27 21:22:01 riastradh Exp $     */
 
 /*
  * Copyright 2008 Intel Corporation <hong.liu%intel.com@localhost>
@@ -28,7 +28,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_opregion.c,v 1.5 2021/12/24 15:08:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_opregion.c,v 1.6 2022/02/27 21:22:01 riastradh Exp $");
+
+#ifdef __NetBSD__
+#include <dev/acpi/acpi_display.h>
+#endif
 
 #include <linux/acpi.h>
 #include <linux/dmi.h>
@@ -623,27 +627,23 @@
 #define ACPI_EV_DOCK           (1<<2)
 
 #ifdef __NetBSD__
-static struct intel_opregion *system_opregion;
-
 static void
-intel_opregion_video_event(ACPI_HANDLE hdl, uint32_t notify, void *opaque)
+intel_opregion_video_event(ACPI_HANDLE hdl, uint32_t notify, void *cookie)
 {
-       device_t self = opaque;
-       struct opregion_acpi *acpi;
+       struct intel_opregion *opregion = cookie;
+       struct opregion_acpi *acpi = opregion->acpi;
 
-       DRM_DEBUG_DRIVER("notify=0x%08x\n", notify);
+       DRM_DEBUG_DRIVER("notify=0x%08x csts=0x%02x cevt=0x%02x\n", notify,
+           acpi->csts, acpi->cevt);
 
-       if (!system_opregion)
+       /*
+        * The firmware sets CSTS to 0x03 `Dispatched (ASL)' before
+        * issuing any graphics notification, and won't issue
+        * additional notifications until the graphics driver sets CSTS
+        * to 0x00 `Success (Driver)' to acknowledge it.
+        */
+       if (acpi->csts != 0x03)
                return;
-
-       acpi = system_opregion->acpi;
-
-       if (notify != 0x80) {
-               aprint_error_dev(self, "unknown notify 0x%02x\n", notify);
-       } else if ((acpi->cevt & 1) == 0) {
-               aprint_error_dev(self, "bad notify\n");
-       }
-
        acpi->csts = 0;
 }
 #else  /* !__NetBSD__ */
@@ -1147,13 +1147,9 @@
 
        if (opregion->acpi) {
 #ifdef __NetBSD__
-               if (i915->drm.pdev->pd_ad != NULL) {
-                       /* XXX gross but expedient */
-                       KASSERT(system_opregion == NULL);
-                       system_opregion = opregion;
-                       acpi_register_notify(i915->drm.pdev->pd_ad,
-                           intel_opregion_video_event);
-               }
+               opregion->acpi_notifier =
+                   acpidisp_register_notify(intel_opregion_video_event,
+                       opregion);
 #else
                opregion->acpi_notifier.notifier_call =
                        intel_opregion_video_event;
@@ -1220,9 +1216,9 @@
                return;
 
 #ifdef __NetBSD__
-       if (opregion->acpi) {
-               if (i915->drm.pdev->pd_ad != NULL)
-                       acpi_deregister_notify(i915->drm.pdev->pd_ad);
+       if (opregion->acpi_notifier) {
+               acpidisp_deregister_notify(opregion->acpi_notifier);
+               opregion->acpi_notifier = NULL;
        }
 #else
        if (opregion->acpi_notifier.notifier_call) {
diff -r f747342ab35a -r 577705df8e51 sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h      Sun Feb 27 21:21:51 2022 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h      Sun Feb 27 21:22:01 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_opregion.h,v 1.4 2021/12/24 15:08:09 riastradh Exp $     */
+/*     $NetBSD: intel_opregion.h,v 1.5 2022/02/27 21:22:01 riastradh Exp $     */
 
 /*
  * Copyright © 2008-2017 Intel Corporation
@@ -51,7 +51,11 @@
        u32 vbt_size;
        u32 *lid_state;
        struct work_struct asle_work;
+#ifdef __NetBSD__
+       struct acpidisp_notifier *acpi_notifier;
+#else
        struct notifier_block acpi_notifier;
+#endif
 };
 
 #define OPREGION_SIZE            (8 * 1024)
diff -r f747342ab35a -r 577705df8e51 sys/external/bsd/drm2/i915drm/files.i915drmkms
--- a/sys/external/bsd/drm2/i915drm/files.i915drmkms    Sun Feb 27 21:21:51 2022 +0000
+++ b/sys/external/bsd/drm2/i915drm/files.i915drmkms    Sun Feb 27 21:22:01 2022 +0000
@@ -1,9 +1,9 @@
-#      $NetBSD: files.i915drmkms,v 1.85 2021/12/21 12:55:23 tnn Exp $
+#      $NetBSD: files.i915drmkms,v 1.86 2022/02/27 21:22:01 riastradh Exp $
 
 version        20180827
 
 define intelfbbus      { }
-device i915drmkms: drmkms, drmkms_pci, intelfbbus, agp_i810, firmload
+device i915drmkms: acpivga, drmkms, drmkms_pci, intelfbbus, agp_i810, firmload
 attach i915drmkms at pci
 
 device intelfb: intelfbbus, drmfb, drmfb_pci, wsemuldisplaydev
diff -r f747342ab35a -r 577705df8e51 sys/external/bsd/drm2/i915drm/i915_module.c
--- a/sys/external/bsd/drm2/i915drm/i915_module.c       Sun Feb 27 21:21:51 2022 +0000
+++ b/sys/external/bsd/drm2/i915drm/i915_module.c       Sun Feb 27 21:22:01 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i915_module.c,v 1.17 2021/12/19 11:49:12 riastradh Exp $       */
+/*     $NetBSD: i915_module.c,v 1.18 2022/02/27 21:22:01 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_module.c,v 1.17 2021/12/19 11:49:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_module.c,v 1.18 2022/02/27 21:22:01 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/module.h>
@@ -46,7 +46,7 @@
 #include "i915_globals.h"
 #include "gt/intel_rps.h"
 
-MODULE(MODULE_CLASS_DRIVER, i915drmkms, "drmkms,drmkms_pci"); /* XXX drmkms_i2c */
+MODULE(MODULE_CLASS_DRIVER, i915drmkms, "acpivga,drmkms,drmkms_pci"); /* XXX drmkms_i2c */
 
 #ifdef _MODULE
 #include "ioconf.c"



Home | Main Index | Thread Index | Old Index