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/ttm More obvious part of TTM API changes:
details: https://anonhg.NetBSD.org/src/rev/febd1c9d1f49
branches: trunk
changeset: 1028257:febd1c9d1f49
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 09:57:17 2021 +0000
description:
More obvious part of TTM API changes:
- ref/unref to get/put
- some global TTM things are now global
- More indirection to get vma_node
Author: Maya Rashish <maya%NetBSD.org@localhost>
diffstat:
sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c | 11 ++++++-----
sys/external/bsd/drm2/ttm/ttm_bo_vm.c | 22 +++++++++++-----------
2 files changed, 17 insertions(+), 16 deletions(-)
diffs (131 lines):
diff -r db9b7fb68557 -r febd1c9d1f49 sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c
--- a/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c Sun Dec 19 09:57:09 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c Sun Dec 19 09:57:17 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ttm_bo.c,v 1.21 2021/12/18 23:45:44 riastradh Exp $ */
+/* $NetBSD: ttm_bo.c,v 1.22 2021/12/19 09:57:17 riastradh Exp $ */
/* SPDX-License-Identifier: GPL-2.0 OR MIT */
/**************************************************************************
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ttm_bo.c,v 1.21 2021/12/18 23:45:44 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bo.c,v 1.22 2021/12/19 09:57:17 riastradh Exp $");
#define pr_fmt(fmt) "[TTM] " fmt
@@ -681,7 +681,7 @@
#endif
drm_vma_offset_remove(bdev->vma_manager, &bo->base.vma_node);
#ifdef __NetBSD__
- drm_vma_node_destroy(&bo->vma_node);
+ drm_vma_node_destroy(&bo->base.vma_node);
#endif
ttm_mem_io_lock(man, false);
ttm_mem_io_free_vm(bo);
@@ -1357,7 +1357,7 @@
*/
dma_resv_init(&bo->base._resv);
#ifdef __NetBSD__
- drm_vma_node_init(&bo->vma_node);
+ drm_vma_node_init(&bo->base.vma_node);
uvm_obj_init(&bo->uvmobj, bdev->driver->ttm_uvm_ops, true, 1);
#else
drm_vma_node_reset(&bo->base.vma_node);
@@ -1645,7 +1645,7 @@
ttm_mem_unregister_shrink(glob->mem_glob, &glob->shrink);
BUG_ON(glob->dummy_read_page != NULL);
spin_lock_destroy(&glob->lru_lock);
- mutex_destroy(&glob->device_list_mutex);
+ mutex_destroy(&ttm_global_mutex);
kfree(glob);
#else
kobject_del(&glob->kobj);
@@ -1663,6 +1663,7 @@
int ret = 0;
unsigned i;
+ mutex_init(&ttm_global_mutex);
mutex_lock(&ttm_global_mutex);
if (++ttm_bo_glob_use_count > 1)
goto out;
diff -r db9b7fb68557 -r febd1c9d1f49 sys/external/bsd/drm2/ttm/ttm_bo_vm.c
--- a/sys/external/bsd/drm2/ttm/ttm_bo_vm.c Sun Dec 19 09:57:09 2021 +0000
+++ b/sys/external/bsd/drm2/ttm/ttm_bo_vm.c Sun Dec 19 09:57:17 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ttm_bo_vm.c,v 1.15 2021/12/19 01:47:24 riastradh Exp $ */
+/* $NetBSD: ttm_bo_vm.c,v 1.16 2021/12/19 09:57:17 riastradh Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ttm_bo_vm.c,v 1.15 2021/12/19 01:47:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bo_vm.c,v 1.16 2021/12/19 09:57:17 riastradh Exp $");
#include <sys/types.h>
@@ -55,7 +55,7 @@
struct ttm_buffer_object *const bo = container_of(uobj,
struct ttm_buffer_object, uvmobj);
- (void)ttm_bo_reference(bo);
+ (void)ttm_bo_get(bo);
}
void
@@ -64,7 +64,7 @@
struct ttm_buffer_object *bo = container_of(uobj,
struct ttm_buffer_object, uvmobj);
- ttm_bo_unref(&bo);
+ ttm_bo_put(bo);
KASSERT(bo == NULL);
}
@@ -249,7 +249,7 @@
ret = ttm_bo_uvm_lookup(bdev, startpage, npages, &bo);
if (ret)
goto fail0;
- KASSERT(drm_vma_node_start(&bo->vma_node) <= offset);
+ KASSERT(drm_vma_node_start(&bo->base.vma_node) <= offset);
/* XXX Just assert this? */
if (__predict_false(bdev->driver->verify_access == NULL)) {
ret = -EPERM;
@@ -262,10 +262,10 @@
/* Success! */
*uobjp = &bo->uvmobj;
*uoffsetp = (offset -
- (drm_vma_node_start(&bo->vma_node) << PAGE_SHIFT));
+ (drm_vma_node_start(&bo->base.vma_node) << PAGE_SHIFT));
return 0;
-fail1: ttm_bo_unref(&bo);
+fail1: ttm_bo_put(bo);
fail0: KASSERT(ret);
return ret;
}
@@ -277,15 +277,15 @@
struct ttm_buffer_object *bo = NULL;
struct drm_vma_offset_node *node;
- drm_vma_offset_lock_lookup(&bdev->vma_manager);
- node = drm_vma_offset_lookup_locked(&bdev->vma_manager, startpage,
+ drm_vma_offset_lock_lookup(bdev->vma_manager);
+ node = drm_vma_offset_lookup_locked(bdev->vma_manager, startpage,
npages);
if (node != NULL) {
- bo = container_of(node, struct ttm_buffer_object, vma_node);
+ bo = container_of(node, struct ttm_buffer_object, base.vma_node);
if (!kref_get_unless_zero(&bo->kref))
bo = NULL;
}
- drm_vma_offset_unlock_lookup(&bdev->vma_manager);
+ drm_vma_offset_unlock_lookup(bdev->vma_manager);
if (bo == NULL)
return -ENOENT;
Home |
Main Index |
Thread Index |
Old Index