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/linux i915: another whack at it
details: https://anonhg.NetBSD.org/src/rev/d2b5b0f877c4
branches: trunk
changeset: 1028666:d2b5b0f877c4
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 11:38:03 2021 +0000
description:
i915: another whack at it
diffstat:
sys/external/bsd/common/include/linux/list.h | 7 +-
sys/external/bsd/common/include/linux/workqueue.h | 8 +-
sys/external/bsd/common/linux/linux_work.c | 52 ++++++---
sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c | 33 +++--
sys/external/bsd/drm2/dist/drm/i915/display/intel_atomic.c | 8 +-
sys/external/bsd/drm2/dist/drm/i915/display/intel_atomic_plane.c | 6 +-
sys/external/bsd/drm2/dist/drm/i915/display/intel_audio.c | 8 +-
sys/external/bsd/drm2/dist/drm/i915/display/intel_bios.c | 17 ++-
sys/external/bsd/drm2/dist/drm/i915/display/intel_crt.h | 5 +-
sys/external/bsd/drm2/dist/drm/i915/display/intel_display.c | 44 +++++--
sys/external/bsd/drm2/dist/drm/i915/display/intel_display.h | 40 ++++---
sys/external/bsd/drm2/dist/drm/i915/display/intel_display_power.c | 10 +-
sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c | 10 +-
sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.h | 5 +-
sys/external/bsd/drm2/dist/drm/i915/display/intel_lpe_audio.h | 5 +-
sys/external/bsd/drm2/dist/drm/i915/display/intel_lvds.h | 5 +-
sys/external/bsd/drm2/dist/drm/i915/display/intel_sdvo.h | 5 +-
sys/external/bsd/drm2/dist/drm/i915/gt/intel_breadcrumbs.c | 11 +-
sys/external/bsd/drm2/dist/drm/i915/gt/intel_context.c | 6 +-
sys/external/bsd/drm2/dist/drm/i915/i915_reg.h | 3 +-
sys/external/bsd/drm2/dist/drm/i915/intel_csr.c | 15 +-
sys/external/bsd/drm2/dist/drm/i915/intel_sideband.h | 5 +-
sys/external/bsd/drm2/i915drm/files.i915drmkms | 5 +-
sys/external/bsd/drm2/i915drm/vlv_dsi.c | 6 +-
sys/external/bsd/drm2/include/drm/drm_mipi_dsi.h | 12 ++-
sys/external/bsd/drm2/include/i915_trace.h | 40 +++++++-
sys/external/bsd/drm2/include/linux/acpi.h | 4 +-
sys/external/bsd/drm2/include/linux/bitfield.h | 38 +++++++
sys/external/bsd/drm2/include/linux/hdmi.h | 24 ++++-
sys/external/bsd/drm2/include/linux/ktime.h | 9 +-
sys/external/bsd/drm2/include/linux/pci.h | 8 +-
sys/external/bsd/drm2/include/linux/scatterlist.h | 7 +-
sys/external/bsd/drm2/include/linux/smp.h | 4 +-
sys/external/bsd/drm2/include/linux/uuid.h | 28 +++++-
sys/external/bsd/drm2/linux/linux_pci.c | 12 +-
sys/external/bsd/drm2/linux/linux_sg.c | 20 +++-
36 files changed, 398 insertions(+), 127 deletions(-)
diffs (truncated from 1457 to 300 lines):
diff -r 247a9de8bce7 -r d2b5b0f877c4 sys/external/bsd/common/include/linux/list.h
--- a/sys/external/bsd/common/include/linux/list.h Sun Dec 19 11:37:50 2021 +0000
+++ b/sys/external/bsd/common/include/linux/list.h Sun Dec 19 11:38:03 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: list.h,v 1.30 2021/12/19 11:37:41 riastradh Exp $ */
+/* $NetBSD: list.h,v 1.31 2021/12/19 11:38:03 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -283,6 +283,11 @@
(VAR) != (HEAD); \
(VAR) = list_next((VAR)))
+#define list_for_each_prev(VAR, HEAD) \
+ for ((VAR) = list_last((HEAD)); \
+ (VAR) != (HEAD); \
+ (VAR) = list_prev((VAR)))
+
#define list_for_each_safe(VAR, NEXT, HEAD) \
for ((VAR) = list_first((HEAD)); \
((VAR) != (HEAD)) && ((NEXT) = list_next((VAR)), 1); \
diff -r 247a9de8bce7 -r d2b5b0f877c4 sys/external/bsd/common/include/linux/workqueue.h
--- a/sys/external/bsd/common/include/linux/workqueue.h Sun Dec 19 11:37:50 2021 +0000
+++ b/sys/external/bsd/common/include/linux/workqueue.h Sun Dec 19 11:38:03 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: workqueue.h,v 1.23 2021/12/19 11:10:17 riastradh Exp $ */
+/* $NetBSD: workqueue.h,v 1.24 2021/12/19 11:38:03 riastradh Exp $ */
/*-
* Copyright (c) 2013, 2018 The NetBSD Foundation, Inc.
@@ -59,6 +59,7 @@
#define queue_work linux_queue_work
#define schedule_delayed_work linux_schedule_delayed_work
#define schedule_work linux_schedule_work
+#define system_highpri_wq linux_system_highpri_wq
#define system_long_wq linux_system_long_wq
#define system_power_efficient_wq linux_system_power_efficient_wq
#define system_unbound_wq linux_system_unbound_wq
@@ -95,16 +96,19 @@
#define WQ_MEM_RECLAIM __BIT(2)
#define WQ_UNBOUND __BIT(3)
+#define WQ_UNBOUND_MAX_ACTIVE 0
+
static inline struct delayed_work *
to_delayed_work(struct work_struct *work)
{
return container_of(work, struct delayed_work, work);
}
-extern struct workqueue_struct *system_wq;
+extern struct workqueue_struct *system_highpri_wq;
extern struct workqueue_struct *system_long_wq;
extern struct workqueue_struct *system_power_efficient_wq;
extern struct workqueue_struct *system_unbound_wq;
+extern struct workqueue_struct *system_wq;
int linux_workqueue_init(void);
void linux_workqueue_fini(void);
diff -r 247a9de8bce7 -r d2b5b0f877c4 sys/external/bsd/common/linux/linux_work.c
--- a/sys/external/bsd/common/linux/linux_work.c Sun Dec 19 11:37:50 2021 +0000
+++ b/sys/external/bsd/common/linux/linux_work.c Sun Dec 19 11:38:03 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_work.c,v 1.52 2021/12/19 01:51:02 riastradh Exp $ */
+/* $NetBSD: linux_work.c,v 1.53 2021/12/19 11:38:03 riastradh Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.52 2021/12/19 01:51:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.53 2021/12/19 11:38:03 riastradh Exp $");
#include <sys/types.h>
#include <sys/atomic.h>
@@ -117,10 +117,11 @@
static specificdata_key_t workqueue_key __read_mostly;
-struct workqueue_struct *system_wq __read_mostly;
+struct workqueue_struct *system_highpri_wq __read_mostly;
struct workqueue_struct *system_long_wq __read_mostly;
struct workqueue_struct *system_power_efficient_wq __read_mostly;
struct workqueue_struct *system_unbound_wq __read_mostly;
+struct workqueue_struct *system_wq __read_mostly;
static inline uintptr_t
atomic_cas_uintptr(volatile uintptr_t *p, uintptr_t old, uintptr_t new)
@@ -142,41 +143,56 @@
error = lwp_specific_key_create(&workqueue_key, NULL);
if (error)
- goto fail0;
+ goto out;
- system_wq = alloc_ordered_workqueue("lnxsyswq", 0);
- if (system_wq == NULL) {
+ system_highpri_wq = alloc_ordered_workqueue("lnxhipwq", 0);
+ if (system_highpri_wq == NULL) {
error = ENOMEM;
- goto fail1;
+ goto out;
}
system_long_wq = alloc_ordered_workqueue("lnxlngwq", 0);
if (system_long_wq == NULL) {
error = ENOMEM;
- goto fail2;
+ goto out;
}
system_power_efficient_wq = alloc_ordered_workqueue("lnxpwrwq", 0);
if (system_power_efficient_wq == NULL) {
error = ENOMEM;
- goto fail3;
+ goto out;
}
system_unbound_wq = alloc_ordered_workqueue("lnxubdwq", 0);
if (system_unbound_wq == NULL) {
error = ENOMEM;
- goto fail4;
+ goto out;
+ }
+
+ system_wq = alloc_ordered_workqueue("lnxsyswq", 0);
+ if (system_wq == NULL) {
+ error = ENOMEM;
+ goto out;
}
- return 0;
+ /* Success! */
+ error = 0;
-fail5: __unused
- destroy_workqueue(system_unbound_wq);
-fail4: destroy_workqueue(system_power_efficient_wq);
-fail3: destroy_workqueue(system_long_wq);
-fail2: destroy_workqueue(system_wq);
-fail1: lwp_specific_key_delete(workqueue_key);
-fail0: KASSERT(error);
+out: if (error) {
+ if (system_highpri_wq)
+ destroy_workqueue(system_highpri_wq);
+ if (system_long_wq)
+ destroy_workqueue(system_long_wq);
+ if (system_power_efficient_wq)
+ destroy_workqueue(system_power_efficient_wq);
+ if (system_unbound_wq)
+ destroy_workqueue(system_unbound_wq);
+ if (system_wq)
+ destroy_workqueue(system_wq);
+ if (workqueue_key)
+ lwp_specific_key_delete(workqueue_key);
+ }
+
return error;
}
diff -r 247a9de8bce7 -r d2b5b0f877c4 sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c Sun Dec 19 11:37:50 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.c Sun Dec 19 11:38:03 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intel_acpi.c,v 1.3 2021/12/19 10:25:15 riastradh Exp $ */
+/* $NetBSD: intel_acpi.c,v 1.4 2021/12/19 11:38:03 riastradh Exp $ */
// SPDX-License-Identifier: GPL-2.0
/*
@@ -8,7 +8,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_acpi.c,v 1.3 2021/12/19 10:25:15 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_acpi.c,v 1.4 2021/12/19 11:38:03 riastradh Exp $");
#include <linux/pci.h>
#include <linux/acpi.h>
@@ -22,15 +22,19 @@
#define _COMPONENT ACPI_BUTTON_COMPONENT
ACPI_MODULE_NAME("acpi_intel_brightness")
+#include <dev/acpi/acpi_pci.h>
+
#define acpi_handle ACPI_HANDLE
#define buffer Buffer
+#define count Count
#define elements Elements
#define integer Integer
#define package Package
+#define pointer Pointer
#define value Value
static ACPI_OBJECT *
-acpi_evaluate_dsm(ACPI_HANDLE handle, const uint8_t *uuid, int rev, int func,
+acpi_evaluate_dsm(ACPI_HANDLE handle, const guid_t *uuid, int rev, int func,
ACPI_OBJECT *argv4)
{
ACPI_OBJECT_LIST arg;
@@ -68,7 +72,7 @@
}
static inline ACPI_OBJECT *
-acpi_evaluate_dsm_typed(ACPI_HANDLE handle, const uint8_t *uuid, int rev,
+acpi_evaluate_dsm_typed(ACPI_HANDLE handle, const guid_t *uuid, int rev,
int func, ACPI_OBJECT *argv4, ACPI_OBJECT_TYPE type)
{
ACPI_OBJECT *obj;
@@ -89,7 +93,7 @@
}
static bool
-acpi_check_dsm(ACPI_HANDLE handle, const uint8_t *uuid, int rev, uint64_t funcs)
+acpi_check_dsm(ACPI_HANDLE handle, const guid_t *uuid, int rev, uint64_t funcs)
{
ACPI_OBJECT *obj;
uint64_t mask = 0;
@@ -122,7 +126,7 @@
GUID_INIT(0x7ed873d3, 0xc2d0, 0x4e4f,
0xa8, 0x54, 0x0f, 0x13, 0x17, 0xb0, 0x1c, 0x2c);
-static char *intel_dsm_port_name(u8 id)
+static const char *intel_dsm_port_name(u8 id)
{
switch (id) {
case 0:
@@ -158,7 +162,7 @@
}
}
-static char *intel_dsm_mux_type(u8 type)
+static const char *intel_dsm_mux_type(u8 type)
{
switch (type) {
case 0:
@@ -220,7 +224,7 @@
}
#ifdef __NetBSD__
-static bool intel_dsm_pci_probe(ACPI_HANDLE dhandle)
+static ACPI_HANDLE intel_dsm_pci_probe(ACPI_HANDLE dhandle)
#else
static acpi_handle intel_dsm_pci_probe(struct pci_dev *pdev)
#endif
@@ -247,7 +251,7 @@
#ifdef __NetBSD__
static int vga_count;
-static bool has_dsm;
+static ACPI_HANDLE intel_dsm_handle;
/* XXX from sys/dev/pci/vga_pcivar.h */
#define DEVICE_IS_VGA_PCI(class, id) \
@@ -266,8 +270,8 @@
vga_count++;
struct acpi_devnode *node = acpi_pcidev_find(0 /*XXX segment*/,
pa->pa_bus, pa->pa_device, pa->pa_function);
- if (node != NULL)
- has_dsm |= intel_dsm_pci_probe(node->ad_handle);
+ if (node != NULL && intel_dsm_handle == NULL)
+ intel_dsm_handle = intel_dsm_pci_probe(node->ad_handle);
return 0;
}
@@ -276,11 +280,10 @@
char acpi_method_name[255] = { 0 };
vga_count = 0;
- has_dsm = false;
pci_find_device(&dev->pdev->pd_pa, intel_dsm_vga_match);
- if (vga_count == 2 && has_dsm) {
- const char *name = acpi_name(intel_dsm_priv.dhandle);
+ if (vga_count == 2 && intel_dsm_handle) {
+ const char *name = acpi_name(intel_dsm_handle);
strlcpy(acpi_method_name, name, sizeof(acpi_method_name));
DRM_DEBUG_DRIVER("VGA switcheroo: detected DSM switching method %s handle\n",
acpi_method_name);
@@ -317,7 +320,7 @@
#ifdef __NetBSD__
void intel_register_dsm_handler(struct drm_i915_private *i915)
{
- if (!intel_dsm_detect(i915->base.pdev))
+ if (!intel_dsm_detect(&i915->drm))
return;
}
#else
diff -r 247a9de8bce7 -r d2b5b0f877c4 sys/external/bsd/drm2/dist/drm/i915/display/intel_atomic.c
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_atomic.c Sun Dec 19 11:37:50 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_atomic.c Sun Dec 19 11:38:03 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intel_atomic.c,v 1.2 2021/12/18 23:45:29 riastradh Exp $ */
+/* $NetBSD: intel_atomic.c,v 1.3 2021/12/19 11:38:03 riastradh Exp $ */
/*
* Copyright © 2015 Intel Corporation
@@ -32,7 +32,7 @@
*/
Home |
Main Index |
Thread Index |
Old Index