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/ttm drm/ttm: Thread the needl...



details:   https://anonhg.NetBSD.org/src/rev/df2c82e0a7b4
branches:  trunk
changeset: 1028643:df2c82e0a7b4
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 11:34:29 2021 +0000

description:
drm/ttm: Thread the needle of buffer transfer object initialization.

Kinda finicky here!

diffstat:

 sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c |  19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diffs (47 lines):

diff -r 0d1052089258 -r df2c82e0a7b4 sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c
--- a/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c  Sun Dec 19 11:34:20 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c  Sun Dec 19 11:34:29 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ttm_bo_util.c,v 1.27 2021/12/19 11:25:57 riastradh Exp $       */
+/*     $NetBSD: ttm_bo_util.c,v 1.28 2021/12/19 11:34:29 riastradh Exp $       */
 
 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
 /**************************************************************************
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ttm_bo_util.c,v 1.27 2021/12/19 11:25:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bo_util.c,v 1.28 2021/12/19 11:34:29 riastradh Exp $");
 
 #include <drm/ttm/ttm_bo_driver.h>
 #include <drm/ttm/ttm_placement.h>
@@ -521,6 +521,18 @@
 
        fbo = container_of(bo, struct ttm_transfer_obj, base);
        ttm_bo_put(fbo->bo);
+       dma_resv_fini(&fbo->base.base._resv);
+       if (ttm_bo_uses_embedded_gem_object(bo)) {
+               /*
+                * Initialization is unconditional, but we don't go
+                * through drm_gem_object_release, and destruction in
+                * ttm_bo_release is conditional, so do this
+                * conditionally with the reverse sense.
+                *
+                * Yes, this is a kludge.
+                */
+               drm_vma_node_destroy(&fbo->base.base.vma_node);
+       }
        kfree(fbo);
 }
 
@@ -567,8 +579,7 @@
        INIT_LIST_HEAD(&fbo->base.io_reserve_lru);
        fbo->base.moving = NULL;
 #ifdef __NetBSD__
-       if (!ttm_bo_uses_embedded_gem_object(bo))
-               drm_vma_node_init(&fbo->base.base.vma_node);
+       drm_vma_node_init(&fbo->base.base.vma_node);
        uvm_obj_init(&fbo->base.uvmobj, bo->bdev->driver->ttm_uvm_ops, true, 1);
        rw_obj_hold(bo->uvmobj.vmobjlock);
        uvm_obj_setlock(&fbo->base.uvmobj, bo->uvmobj.vmobjlock);



Home | Main Index | Thread Index | Old Index