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 drm: Add drm_vma_offset_exact_lookup_l...
details: https://anonhg.NetBSD.org/src/rev/4d3a484c726d
branches: trunk
changeset: 1028757:4d3a484c726d
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 11:57:27 2021 +0000
description:
drm: Add drm_vma_offset_exact_lookup_locked.
diffstat:
sys/external/bsd/drm2/drm/drm_vma_manager.c | 30 ++++++++++++++-------
sys/external/bsd/drm2/include/drm/drm_vma_manager.h | 5 ++-
2 files changed, 24 insertions(+), 11 deletions(-)
diffs (80 lines):
diff -r 52a6e0835c79 -r 4d3a484c726d sys/external/bsd/drm2/drm/drm_vma_manager.c
--- a/sys/external/bsd/drm2/drm/drm_vma_manager.c Sun Dec 19 11:57:19 2021 +0000
+++ b/sys/external/bsd/drm2/drm/drm_vma_manager.c Sun Dec 19 11:57:27 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_vma_manager.c,v 1.7 2021/12/19 11:34:20 riastradh Exp $ */
+/* $NetBSD: drm_vma_manager.c,v 1.8 2021/12/19 11:57:27 riastradh Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_vma_manager.c,v 1.7 2021/12/19 11:34:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_vma_manager.c,v 1.8 2021/12/19 11:57:27 riastradh Exp $");
#include <sys/kmem.h>
#include <sys/rbtree.h>
@@ -242,24 +242,34 @@
}
struct drm_vma_offset_node *
-drm_vma_offset_exact_lookup(struct drm_vma_offset_manager *mgr,
+drm_vma_offset_exact_lookup_locked(struct drm_vma_offset_manager *mgr,
unsigned long startpage, unsigned long npages)
{
const vmem_addr_t key = startpage;
struct drm_vma_offset_node *node;
- rw_enter(&mgr->vom_lock, RW_READER);
+ KASSERT(rw_lock_held(&mgr->vom_lock));
node = rb_tree_find_node(&mgr->vom_nodes, &key);
if (node == NULL)
- goto out;
+ return NULL;
KASSERT(node->von_startpage == startpage);
- if (node->von_npages != npages) {
- node = NULL;
- goto out;
- }
+ if (node->von_npages != npages)
+ return NULL;
+
+ return node;
+}
-out: rw_exit(&mgr->vom_lock);
+struct drm_vma_offset_node *
+drm_vma_offset_exact_lookup(struct drm_vma_offset_manager *mgr,
+ unsigned long startpage, unsigned long npages)
+{
+ struct drm_vma_offset_node *node;
+
+ rw_enter(&mgr->vom_lock, RW_READER);
+ node = drm_vma_offset_exact_lookup_locked(mgr, startpage, npages);
+ rw_exit(&mgr->vom_lock);
+
return node;
}
diff -r 52a6e0835c79 -r 4d3a484c726d sys/external/bsd/drm2/include/drm/drm_vma_manager.h
--- a/sys/external/bsd/drm2/include/drm/drm_vma_manager.h Sun Dec 19 11:57:19 2021 +0000
+++ b/sys/external/bsd/drm2/include/drm/drm_vma_manager.h Sun Dec 19 11:57:27 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_vma_manager.h,v 1.6 2021/12/19 09:47:59 riastradh Exp $ */
+/* $NetBSD: drm_vma_manager.h,v 1.7 2021/12/19 11:57:27 riastradh Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -122,6 +122,9 @@
struct drm_vma_offset_node *
drm_vma_offset_exact_lookup(struct drm_vma_offset_manager *,
unsigned long, unsigned long);
+struct drm_vma_offset_node *
+ drm_vma_offset_exact_lookup_locked(struct drm_vma_offset_manager *,
+ unsigned long, unsigned long);
int drm_vma_node_allow(struct drm_vma_offset_node *, struct drm_file *);
void drm_vma_node_revoke(struct drm_vma_offset_node *, struct drm_file *);
Home |
Main Index |
Thread Index |
Old Index