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 misc drm hacks
details: https://anonhg.NetBSD.org/src/rev/f4ab6d23fb68
branches: trunk
changeset: 1028103:f4ab6d23fb68
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 01:51:27 2021 +0000
description:
misc drm hacks
diffstat:
sys/external/bsd/drm2/dist/drm/drm_mm.c | 11 +-
sys/external/bsd/drm2/dist/drm/i915/i915_request.c | 19 ++-
sys/external/bsd/drm2/drm/files.drmkms | 4 +-
sys/external/bsd/drm2/i915drm/files.i915drmkms | 4 +-
sys/external/bsd/drm2/include/linux/interval_tree_generic.h | 80 ++++++++++++-
sys/external/bsd/drm2/include/linux/sched.h | 12 +-
6 files changed, 118 insertions(+), 12 deletions(-)
diffs (258 lines):
diff -r b62fdb79842a -r f4ab6d23fb68 sys/external/bsd/drm2/dist/drm/drm_mm.c
--- a/sys/external/bsd/drm2/dist/drm/drm_mm.c Sun Dec 19 01:51:17 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_mm.c Sun Dec 19 01:51:27 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_mm.c,v 1.7 2021/12/18 23:44:57 riastradh Exp $ */
+/* $NetBSD: drm_mm.c,v 1.8 2021/12/19 01:51:27 riastradh Exp $ */
/**************************************************************************
*
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_mm.c,v 1.7 2021/12/18 23:44:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_mm.c,v 1.8 2021/12/19 01:51:27 riastradh Exp $");
#include <linux/export.h>
#include <linux/interval_tree_generic.h>
@@ -217,6 +217,7 @@
&drm_mm_interval_tree_augment);
}
+#ifndef __NetBSD__
#define RB_INSERT(root, member, expr) do { \
struct rb_node **link = &root.rb_node, *rb = NULL; \
u64 x = expr(node); \
@@ -230,6 +231,7 @@
rb_link_node(&node->member, rb, link); \
rb_insert_color(&node->member, &root); \
} while (0)
+#endif
#define HOLE_SIZE(NODE) ((NODE)->hole_size)
#define HOLE_ADDR(NODE) (__drm_mm_hole_node_start(NODE))
@@ -269,7 +271,12 @@
DRM_MM_BUG_ON(!drm_mm_hole_follows(node));
insert_hole_size(&mm->holes_size, node);
+#ifdef __NetBSD__
+ struct rb_node *collision __diagused;
+ collision = rb_tree_insert_node(&mm->holes_addr
+#else
RB_INSERT(mm->holes_addr, rb_hole_addr, HOLE_ADDR);
+#endif
list_add(&node->hole_stack, &mm->hole_stack);
}
diff -r b62fdb79842a -r f4ab6d23fb68 sys/external/bsd/drm2/dist/drm/i915/i915_request.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_request.c Sun Dec 19 01:51:17 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_request.c Sun Dec 19 01:51:27 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i915_request.c,v 1.3 2021/12/19 01:24:26 riastradh Exp $ */
+/* $NetBSD: i915_request.c,v 1.4 2021/12/19 01:51:27 riastradh Exp $ */
/*
* Copyright © 2008-2015 Intel Corporation
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_request.c,v 1.3 2021/12/19 01:24:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_request.c,v 1.4 2021/12/19 01:51:27 riastradh Exp $");
#include <linux/dma-fence-array.h>
#include <linux/irq_work.h>
@@ -121,6 +121,9 @@
i915_sw_fence_fini(&rq->submit);
i915_sw_fence_fini(&rq->semaphore);
+ DRM_DESTROY_WAITQUEUE(&rq->execute);
+ dma_fence_destroy(&rq->fence);
+ spin_lock_destroy(&rq->lock);
kmem_cache_free(global.slab_requests, rq);
}
@@ -1196,10 +1199,10 @@
*/
head = rq->infix;
if (rq->postfix < head) {
- memset(vaddr + head, 0, rq->ring->size - head);
+ memset((char *)vaddr + head, 0, rq->ring->size - head);
head = 0;
}
- memset(vaddr + head, 0, rq->postfix - head);
+ memset((char *)vaddr + head, 0, rq->postfix - head);
rq->infix = rq->postfix;
}
@@ -1354,9 +1357,17 @@
if (list_empty(&rq->sched.signalers_list))
attr.priority |= I915_PRIORITY_WAIT;
+#ifdef __NetBSD__
+ int s = splsoftserial();
+#else
local_bh_disable();
+#endif
__i915_request_queue(rq, &attr);
+#ifdef __NetBSD__
+ splx(s);
+#else
local_bh_enable(); /* Kick the execlists tasklet if just scheduled */
+#endif
/*
* In typical scenarios, we do not expect the previous request on
diff -r b62fdb79842a -r f4ab6d23fb68 sys/external/bsd/drm2/drm/files.drmkms
--- a/sys/external/bsd/drm2/drm/files.drmkms Sun Dec 19 01:51:17 2021 +0000
+++ b/sys/external/bsd/drm2/drm/files.drmkms Sun Dec 19 01:51:27 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.drmkms,v 1.46 2021/12/19 01:46:39 riastradh Exp $
+# $NetBSD: files.drmkms,v 1.47 2021/12/19 01:51:27 riastradh Exp $
version 20180827
@@ -103,7 +103,7 @@
file external/bsd/drm2/drm/drm_lease.c drmkms
file external/bsd/drm2/drm/drm_lock.c drmkms
file external/bsd/drm2/drm/drm_memory.c drmkms
-file external/bsd/drm2/dist/drm/drm_mm.c drmkms
+#file external/bsd/drm2/dist/drm/drm_mm.c drmkms
file external/bsd/drm2/dist/drm/drm_mode_config.c drmkms
file external/bsd/drm2/dist/drm/drm_mode_object.c drmkms
file external/bsd/drm2/dist/drm/drm_modes.c drmkms
diff -r b62fdb79842a -r f4ab6d23fb68 sys/external/bsd/drm2/i915drm/files.i915drmkms
--- a/sys/external/bsd/drm2/i915drm/files.i915drmkms Sun Dec 19 01:51:17 2021 +0000
+++ b/sys/external/bsd/drm2/i915drm/files.i915drmkms Sun Dec 19 01:51:27 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.i915drmkms,v 1.52 2021/12/19 01:42:48 riastradh Exp $
+# $NetBSD: files.i915drmkms,v 1.53 2021/12/19 01:51:27 riastradh Exp $
version 20180827
@@ -184,7 +184,7 @@
file external/bsd/drm2/dist/drm/i915/i915_gem_gtt.c i915drmkms
file external/bsd/drm2/dist/drm/i915/i915_getparam.c i915drmkms
file external/bsd/drm2/dist/drm/i915/i915_globals.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/i915_irq.c i915drmkms
+#file external/bsd/drm2/dist/drm/i915/i915_irq.c i915drmkms
file external/bsd/drm2/dist/drm/i915/i915_memcpy.c i915drmkms
#file external/bsd/drm2/dist/drm/i915/i915_mm.c i915drmkms
file external/bsd/drm2/dist/drm/i915/i915_params.c i915drmkms
diff -r b62fdb79842a -r f4ab6d23fb68 sys/external/bsd/drm2/include/linux/interval_tree_generic.h
--- a/sys/external/bsd/drm2/include/linux/interval_tree_generic.h Sun Dec 19 01:51:17 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/interval_tree_generic.h Sun Dec 19 01:51:27 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: interval_tree_generic.h,v 1.1 2021/12/19 00:28:55 riastradh Exp $ */
+/* $NetBSD: interval_tree_generic.h,v 1.2 2021/12/19 01:51:27 riastradh Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,4 +32,82 @@
#ifndef _LINUX_INTERVAL_TREE_GENERIC_H_
#define _LINUX_INTERVAL_TREE_GENERIC_H_
+#define INTERVAL_TREE_DEFINE(T, F, KT, KLAST, NSTART, NLAST, QUAL, PREFIX) \
+ \
+static inline int \
+PREFIX##__compare_nodes(void *__cookie, const void *__va, const void *__vb) \
+{ \
+ const T *__na = __va; \
+ const T *__nb = __vb; \
+ const KT __astart = START(__na), __alast = LAST(__na); \
+ const KT __bstart = START(__nb), __blast = LAST(__nb); \
+ \
+ if (__astart < __bstart) \
+ return -1; \
+ if (__astart > __bstart) \
+ return +1; \
+ if (__alast < __blast) \
+ return -1; \
+ if (__alast > __blast) \
+ return -1; \
+ return 0; \
+} \
+ \
+static inline int \
+PREFIX##__compare_key(void *__cookie, const void *__vn, const void *__vk) \
+{ \
+ const T *__n = __vn; \
+ const T *__k = __vk; \
+ const KT __nstart = START(__n), __nlast = LAST(__n); \
+ \
+ if (__nlast < *__k) \
+ return -1; \
+ if (*__k < __nstart) \
+ return +1; \
+ return 0; \
+} \
+ \
+static const rb_tree_ops_t PREFIX##__rbtree_ops = { \
+ .rbto_compare_nodes = PREFIX##__compare_nodes, \
+ .rbto_compare_key = PREFIX##__compare_key, \
+ .rbto_node_offset = offsetof(T, F), \
+}; \
+ \
+/* Not in Linux API, needed for us. */ \
+QUAL void \
+PREFIX##_init(struct rb_root_cached *__root) \
+{ \
+ rb_tree_init(&__root->rbrc_tree, &PREFIX##__rbtree_ops); \
+} \
+ \
+QUAL void \
+PREFIX##_insert(T *__node, struct rb_root_cached *__root) \
+{ \
+ T *__collision __diagused; \
+ \
+ __collision = rb_tree_insert_node(&__root->rbrc_tree, __node); \
+ KASSERT(__collision == __node); \
+} \
+ \
+QUAL void \
+PREFIX##_remove(T *__node, struct rb_root_cached *__root) \
+{ \
+ rb_tree_remove_node(&__root->rbrc_tree, __node); \
+} \
+ \
+QUAL T * \
+PREFIX##_iter_first(struct rb_root_cached *__root, KT __start, KT __last) \
+{ \
+ T *__node; \
+ \
+ __node = rb_tree_find_node_geq(&__root->rbrc_tree, &__start); \
+ if (__node == NULL) \
+ return NULL; \
+ KASSERT(START(__node) <= __start); \
+ if (__last < START(__node)) \
+ return NULL; \
+ \
+ return __node; \
+}
+
#endif /* _LINUX_INTERVAL_TREE_GENERIC_H_ */
diff -r b62fdb79842a -r f4ab6d23fb68 sys/external/bsd/drm2/include/linux/sched.h
--- a/sys/external/bsd/drm2/include/linux/sched.h Sun Dec 19 01:51:17 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/sched.h Sun Dec 19 01:51:27 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sched.h,v 1.16 2021/12/19 01:22:44 riastradh Exp $ */
+/* $NetBSD: sched.h,v 1.17 2021/12/19 01:51:27 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -101,4 +101,14 @@
preempt_point();
}
+static inline bool
+signal_pending_state(int state, struct proc *p)
+{
+
+ KASSERT(p == current);
+ if (state & TASK_UNINTERRUPTIBLE)
+ return false;
+ return sigispending(curlwp, 0);
+}
+
#endif /* _LINUX_SCHED_H_ */
Home |
Main Index |
Thread Index |
Old Index