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/i915/gem i915: Simplify relea...



details:   https://anonhg.NetBSD.org/src/rev/b7b5f460ea58
branches:  trunk
changeset: 1028813:b7b5f460ea58
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 12:07:20 2021 +0000

description:
i915: Simplify releasing mmap offsets; don't release if not mapped.

diffstat:

 sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c |  35 +++++-----------
 1 files changed, 12 insertions(+), 23 deletions(-)

diffs (71 lines):

diff -r 2dca9bb67675 -r b7b5f460ea58 sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c
--- a/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c   Sun Dec 19 12:07:11 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c   Sun Dec 19 12:07:20 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i915_gem_mman.c,v 1.12 2021/12/19 12:07:11 riastradh Exp $     */
+/*     $NetBSD: i915_gem_mman.c,v 1.13 2021/12/19 12:07:20 riastradh Exp $     */
 
 /*
  * SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_mman.c,v 1.12 2021/12/19 12:07:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_mman.c,v 1.13 2021/12/19 12:07:20 riastradh Exp $");
 
 #include <linux/anon_inodes.h>
 #include <linux/mman.h>
@@ -684,33 +684,22 @@
 
 void i915_gem_object_release_mmap_offset(struct drm_i915_gem_object *obj)
 {
-       struct i915_mmap_offset *mmo, *mn;
-
-       spin_lock(&obj->mmo.lock);
 #ifdef __NetBSD__
-       enum i915_mmap_type t;
        struct page *page;
        struct vm_page *vm_page;
        unsigned i;
 
-       (void)mmo;
-       (void)mn;
-       for (t = 0; t < I915_MMAP_NTYPES; t++) {
-               if (t == I915_MMAP_TYPE_GTT)
-                       continue;
-               for (i = 0; i < obj->base.size >> PAGE_SHIFT; i++) {
-                       page = obj->mm.pages->sgl->sg_pgs[i];
-                       vm_page = &page->p_vmp;
-                       /*
-                        * XXX Why do we have to have the spin lock
-                        * here at all?
-                        */
-                       spin_unlock(&obj->mmo.lock);
-                       pmap_page_protect(vm_page, VM_PROT_NONE);
-                       spin_lock(&obj->mmo.lock);
-               }
+       if (obj->mm.pages == NULL)
+               return;
+       for (i = 0; i < obj->base.size >> PAGE_SHIFT; i++) {
+               page = obj->mm.pages->sgl->sg_pgs[i];
+               vm_page = &page->p_vmp;
+               pmap_page_protect(vm_page, VM_PROT_NONE);
        }
 #else
+       struct i915_mmap_offset *mmo, *mn;
+
+       spin_lock(&obj->mmo.lock);
        rbtree_postorder_for_each_entry_safe(mmo, mn,
                                             &obj->mmo.offsets, offset) {
                /*
@@ -725,8 +714,8 @@
                                   obj->base.dev->anon_inode->i_mapping);
                spin_lock(&obj->mmo.lock);
        }
+       spin_unlock(&obj->mmo.lock);
 #endif
-       spin_unlock(&obj->mmo.lock);
 }
 
 /**



Home | Main Index | Thread Index | Old Index