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 drm: Switch sense of #if __linux_...



details:   https://anonhg.NetBSD.org/src/rev/a7bbed643821
branches:  trunk
changeset: 1028998:a7bbed643821
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 12:40:43 2021 +0000

description:
drm: Switch sense of #if __linux__ conditionals to use __NetBSD__.

Keep it consistent with the rest of drm.

diffstat:

 sys/external/bsd/drm2/dist/drm/drm_ioctl.c                  |  11 +-
 sys/external/bsd/drm2/dist/drm/drm_print.c                  |   6 +-
 sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine.h       |  32 +++---
 sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine_cs.c    |  10 +-
 sys/external/bsd/drm2/dist/drm/i915/i915_drv.c              |   6 +-
 sys/external/bsd/drm2/dist/drm/i915/i915_vma.h              |  10 +-
 sys/external/bsd/drm2/dist/drm/i915/intel_uncore.h          |  60 ++++++------
 sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c       |   8 +-
 sys/external/bsd/drm2/dist/drm/radeon/radeon_si_dpm.c       |   8 +-
 sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c                 |  18 ++-
 sys/external/bsd/drm2/dist/include/drm/ttm/ttm_bo_api.h     |   6 +-
 sys/external/bsd/drm2/dist/include/drm/ttm/ttm_set_memory.h |   4 +-
 12 files changed, 93 insertions(+), 86 deletions(-)

diffs (truncated from 451 to 300 lines):

diff -r 5d7560317254 -r a7bbed643821 sys/external/bsd/drm2/dist/drm/drm_ioctl.c
--- a/sys/external/bsd/drm2/dist/drm/drm_ioctl.c        Sun Dec 19 12:40:31 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_ioctl.c        Sun Dec 19 12:40:43 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_ioctl.c,v 1.21 2021/12/19 11:09:47 riastradh Exp $ */
+/*     $NetBSD: drm_ioctl.c,v 1.22 2021/12/19 12:40:43 riastradh Exp $ */
 
 /*
  * Created: Fri Jan  8 09:01:26 1999 by faith%valinux.com@localhost
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_ioctl.c,v 1.21 2021/12/19 11:09:47 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_ioctl.c,v 1.22 2021/12/19 12:40:43 riastradh Exp $");
 
 #include <linux/export.h>
 #include <linux/nospec.h>
@@ -353,11 +353,12 @@
                if (!drm_core_check_feature(dev, DRIVER_ATOMIC))
                        return -EOPNOTSUPP;
                /* The modesetting DDX has a totally broken idea of atomic. */
-#ifdef __linux__
-               if (current->comm[0] == 'X' && req->value == 1) {
+#ifdef __NetBSD__
+               if (current->p_comm[0] == 'X' && req->value == 1)
 #else
-               if (current->p_comm[0] == 'X' && req->value == 1) {
+               if (current->comm[0] == 'X' && req->value == 1)
 #endif
+               {
                        pr_info("broken atomic modeset userspace detected, disabling atomic\n");
                        return -EOPNOTSUPP;
                }
diff -r 5d7560317254 -r a7bbed643821 sys/external/bsd/drm2/dist/drm/drm_print.c
--- a/sys/external/bsd/drm2/dist/drm/drm_print.c        Sun Dec 19 12:40:31 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_print.c        Sun Dec 19 12:40:43 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_print.c,v 1.13 2021/12/19 12:34:42 riastradh Exp $ */
+/*     $NetBSD: drm_print.c,v 1.14 2021/12/19 12:40:43 riastradh Exp $ */
 
 /*
  * Copyright (C) 2016 Red Hat
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_print.c,v 1.13 2021/12/19 12:34:42 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_print.c,v 1.14 2021/12/19 12:40:43 riastradh Exp $");
 
 #ifndef __NetBSD__             /* XXX ??? */
 #define DEBUG /* for pr_debug() */
@@ -59,7 +59,7 @@
 unsigned int __drm_debug;
 EXPORT_SYMBOL(__drm_debug);
 
-#ifdef __linux__
+#ifndef __NetBSD__
 MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug category.\n"
 "\t\tBit 0 (0x01)  will enable CORE messages (drm core code)\n"
 "\t\tBit 1 (0x02)  will enable DRIVER messages (drm controller code)\n"
diff -r 5d7560317254 -r a7bbed643821 sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine.h
--- a/sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine.h     Sun Dec 19 12:40:31 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine.h     Sun Dec 19 12:40:43 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_engine.h,v 1.3 2021/12/19 11:08:40 riastradh Exp $       */
+/*     $NetBSD: intel_engine.h,v 1.4 2021/12/19 12:40:43 riastradh Exp $       */
 
 /* SPDX-License-Identifier: MIT */
 #ifndef _INTEL_RINGBUFFER_H_
@@ -112,21 +112,7 @@
        return *READ_ONCE(execlists->active);
 }
 
-#ifdef __linux__
-static inline void
-execlists_active_lock_bh(struct intel_engine_execlists *execlists)
-{
-       local_bh_disable(); /* prevent local softirq and lock recursion */
-       tasklet_lock(&execlists->tasklet);
-}
-
-static inline void
-execlists_active_unlock_bh(struct intel_engine_execlists *execlists)
-{
-       tasklet_unlock(&execlists->tasklet);
-       local_bh_enable(); /* restore softirq, and kick ksoftirqd! */
-}
-#else
+#ifdef __NetBSD__
 static inline int
 execlists_active_lock_bh(struct intel_engine_execlists *execlists)
 {
@@ -141,6 +127,20 @@
        tasklet_unlock(&execlists->tasklet);
        splraise(s); /* restore softirq, and kick ksoftirqd! */
 }
+#else
+static inline void
+execlists_active_lock_bh(struct intel_engine_execlists *execlists)
+{
+       local_bh_disable(); /* prevent local softirq and lock recursion */
+       tasklet_lock(&execlists->tasklet);
+}
+
+static inline void
+execlists_active_unlock_bh(struct intel_engine_execlists *execlists)
+{
+       tasklet_unlock(&execlists->tasklet);
+       local_bh_enable(); /* restore softirq, and kick ksoftirqd! */
+}
 #endif
 
 struct i915_request *
diff -r 5d7560317254 -r a7bbed643821 sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine_cs.c
--- a/sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine_cs.c  Sun Dec 19 12:40:31 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/gt/intel_engine_cs.c  Sun Dec 19 12:40:43 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_engine_cs.c,v 1.8 2021/12/19 12:33:56 riastradh Exp $    */
+/*     $NetBSD: intel_engine_cs.c,v 1.9 2021/12/19 12:40:43 riastradh Exp $    */
 
 /*
  * Copyright © 2016 Intel Corporation
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_engine_cs.c,v 1.8 2021/12/19 12:33:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_engine_cs.c,v 1.9 2021/12/19 12:40:43 riastradh Exp $");
 
 #include <drm/drm_print.h>
 
@@ -1375,10 +1375,10 @@
                                   idx, hws[idx * 2], hws[idx * 2 + 1]);
                }
 
-#ifdef __linux__
+#ifdef __NetBSD__
+               int s = execlists_active_lock_bh(execlists);
+#else
                execlists_active_lock_bh(execlists);
-#else
-               int s = execlists_active_lock_bh(execlists);
 #endif
                rcu_read_lock();
                for (port = execlists->active; (rq = *port); port++) {
diff -r 5d7560317254 -r a7bbed643821 sys/external/bsd/drm2/dist/drm/i915/i915_drv.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c    Sun Dec 19 12:40:31 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c    Sun Dec 19 12:40:43 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i915_drv.c,v 1.45 2021/12/19 12:32:15 riastradh Exp $  */
+/*     $NetBSD: i915_drv.c,v 1.46 2021/12/19 12:40:43 riastradh Exp $  */
 
 /* i915_drv.c -- i830,i845,i855,i865,i915 driver -*- linux-c -*-
  */
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_drv.c,v 1.45 2021/12/19 12:32:15 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_drv.c,v 1.46 2021/12/19 12:40:43 riastradh Exp $");
 
 #include <linux/acpi.h>
 #include <linux/device.h>
@@ -1237,7 +1237,7 @@
 
        pci_set_master(pdev);
 
-#ifdef __linux__
+#ifndef __NetBSD__
        /*
         * We don't have a max segment size, so set it to the max so sg's
         * debugging layer doesn't complain
diff -r 5d7560317254 -r a7bbed643821 sys/external/bsd/drm2/dist/drm/i915/i915_vma.h
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_vma.h    Sun Dec 19 12:40:31 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_vma.h    Sun Dec 19 12:40:43 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i915_vma.h,v 1.8 2021/12/19 12:25:37 riastradh Exp $   */
+/*     $NetBSD: i915_vma.h,v 1.9 2021/12/19 12:40:43 riastradh Exp $   */
 
 /*
  * Copyright © 2016 Intel Corporation
@@ -62,12 +62,12 @@
                                         struct i915_request *rq,
                                         unsigned int flags);
 
-#ifdef __linux__
+#ifdef __NetBSD__
+#define __i915_vma_flags(v) ((unsigned long *)&(v)->flags)
+#define __i915_vma_flags_const(v) ((const unsigned long *)&(v)->flags)
+#else
 #define __i915_vma_flags(v) ((unsigned long *)&(v)->flags.counter)
 #define __i915_vma_flags_const(v) ((const unsigned long *)&(v)->flags.counter)
-#else
-#define __i915_vma_flags(v) ((unsigned long *)&(v)->flags)
-#define __i915_vma_flags_const(v) ((const unsigned long *)&(v)->flags)
 #endif
 
 
diff -r 5d7560317254 -r a7bbed643821 sys/external/bsd/drm2/dist/drm/i915/intel_uncore.h
--- a/sys/external/bsd/drm2/dist/drm/i915/intel_uncore.h        Sun Dec 19 12:40:31 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/intel_uncore.h        Sun Dec 19 12:40:43 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_uncore.h,v 1.10 2021/12/19 12:36:50 riastradh Exp $      */
+/*     $NetBSD: intel_uncore.h,v 1.11 2021/12/19 12:40:43 riastradh Exp $      */
 
 /*
  * Copyright © 2017 Intel Corporation
@@ -280,33 +280,8 @@
 }
 
 /* register access functions */
-#ifdef __linux__
-#define __raw_read(x__, s__) \
-static inline u##x__ __raw_uncore_read##x__(const struct intel_uncore *uncore, \
-                                           i915_reg_t reg) \
-{ \
-       return read##s__(uncore->regs + i915_mmio_reg_offset(reg)); \
-}
+#ifdef __NetBSD__
 
-#define __raw_write(x__, s__) \
-static inline void __raw_uncore_write##x__(const struct intel_uncore *uncore, \
-                                          i915_reg_t reg, u##x__ val) \
-{ \
-       write##s__(val, uncore->regs + i915_mmio_reg_offset(reg)); \
-}
-__raw_read(8, b)
-__raw_read(16, w)
-__raw_read(32, l)
-__raw_read(64, q)
-
-__raw_write(8, b)
-__raw_write(16, w)
-__raw_write(32, l)
-__raw_write(64, q)
-
-#undef __raw_read
-#undef __raw_write
-#else
 static inline uint8_t __raw_uncore_read8(const struct intel_uncore *uncore,
                                                i915_reg_t reg) {
        return bus_space_read_1(uncore->regs_bst, uncore->regs_bsh, i915_mmio_reg_offset(reg));
@@ -355,7 +330,36 @@
            i915_mmio_reg_offset(reg) + 4, val >> 32);
 #endif
 }
-#endif
+
+#else  /* !__NetBSD__ */
+
+#define __raw_read(x__, s__) \
+static inline u##x__ __raw_uncore_read##x__(const struct intel_uncore *uncore, \
+                                           i915_reg_t reg) \
+{ \
+       return read##s__(uncore->regs + i915_mmio_reg_offset(reg)); \
+}
+
+#define __raw_write(x__, s__) \
+static inline void __raw_uncore_write##x__(const struct intel_uncore *uncore, \
+                                          i915_reg_t reg, u##x__ val) \
+{ \
+       write##s__(val, uncore->regs + i915_mmio_reg_offset(reg)); \
+}
+__raw_read(8, b)
+__raw_read(16, w)
+__raw_read(32, l)
+__raw_read(64, q)
+
+__raw_write(8, b)
+__raw_write(16, w)
+__raw_write(32, l)
+__raw_write(64, q)
+
+#undef __raw_read
+#undef __raw_write
+
+#endif /* __NetBSD__ */
 
 #define __uncore_read(name__, x__, s__, trace__) \
 static inline u##x__ intel_uncore_##name__(struct intel_uncore *uncore, \
diff -r 5d7560317254 -r a7bbed643821 sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c
--- a/sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c     Sun Dec 19 12:40:31 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c     Sun Dec 19 12:40:43 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: radeon_ci_dpm.c,v 1.5 2021/12/19 09:54:48 riastradh Exp $      */
+/*     $NetBSD: radeon_ci_dpm.c,v 1.6 2021/12/19 12:40:43 riastradh Exp $      */
 
 /*
  * Copyright 2013 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeon_ci_dpm.c,v 1.5 2021/12/19 09:54:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_ci_dpm.c,v 1.6 2021/12/19 12:40:43 riastradh Exp $");
 
 #include <linux/firmware.h>
 #include <linux/pci.h>
@@ -5687,7 +5687,7 @@



Home | Main Index | Thread Index | Old Index