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: Use global uof...
details: https://anonhg.NetBSD.org/src/rev/1d3775333d3e
branches: trunk
changeset: 1028822:1d3775333d3e
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 12:08:36 2021 +0000
description:
i915: Use global uoffset in i915 address space, not per-object.
This is a little sleazy but it enables us to pass the page range
through to the fault routine, which wants it in order to find the
memory mapping type.
diffstat:
sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c | 30 +++++++---------
1 files changed, 14 insertions(+), 16 deletions(-)
diffs (79 lines):
diff -r e695cb8743f7 -r 1d3775333d3e 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:08:27 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c Sun Dec 19 12:08:36 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i915_gem_mman.c,v 1.15 2021/12/19 12:08:27 riastradh Exp $ */
+/* $NetBSD: i915_gem_mman.c,v 1.16 2021/12/19 12:08:36 riastradh Exp $ */
/*
* SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_mman.c,v 1.15 2021/12/19 12:08:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_mman.c,v 1.16 2021/12/19 12:08:36 riastradh Exp $");
#include <linux/anon_inodes.h>
#include <linux/mman.h>
@@ -338,6 +338,8 @@
paddr_t paddr;
int i;
+ startpage -= drm_vma_node_start(&mmo->vma_node);
+
for (i = 0; i < npages; i++) {
if ((flags & PGO_ALLPAGES) == 0 && i != centeridx)
continue;
@@ -409,6 +411,7 @@
#ifdef __NetBSD__
page_offset = (ufi->entry->offset + (vaddr - ufi->entry->start))
>> PAGE_SHIFT;
+ page_offset -= drm_vma_node_start(&mmo->vma_node);
#else
/* We don't use vmf->pgoff since that has the fake offset */
page_offset = (vmf->address - area->vm_start) >> PAGE_SHIFT;
@@ -566,16 +569,6 @@
KASSERT(ufi->entry->start <= vaddr);
KASSERT((ufi->entry->offset & (PAGE_SIZE - 1)) == 0);
- KASSERT(ufi->entry->offset <= obj->base.size);
- KASSERT((vaddr - ufi->entry->start) <=
- (obj->base.size - ufi->entry->offset));
- KASSERTMSG(((size_t)npages << PAGE_SHIFT <=
- ((obj->base.size - ufi->entry->offset) -
- (vaddr - ufi->entry->start))),
- "vaddr=%jx npages=%d obj=%p size=%zu"
- " start=%jx offset=%jx",
- (uintmax_t)vaddr, npages, obj, obj->base.size,
- (uintmax_t)ufi->entry->start, (uintmax_t)ufi->entry->offset);
uoffset = ufi->entry->offset + (vaddr - ufi->entry->start);
startpage = uoffset >> PAGE_SHIFT;
@@ -601,9 +594,14 @@
* without unmapping first!
*/
KASSERT(node);
- KASSERTMSG(startpage == drm_vma_node_start(node),
- "map startpage=%lx, node startpage=%lx",
- startpage, drm_vma_node_start(node));
+ KASSERTMSG((ufi->entry->offset >> PAGE_SHIFT ==
+ drm_vma_node_start(node)),
+ /*
+ * Always provided by i915_gem_mmap_object, but in
+ * principle we could relax this.
+ */
+ "map startpage=%lx =/= node startpage=%lx",
+ ufi->entry->offset >> PAGE_SHIFT, drm_vma_node_start(node));
mmo = container_of(node, struct i915_mmap_offset, vma_node);
KASSERT(obj == mmo->obj);
@@ -1078,7 +1076,7 @@
/* Success! */
*uobjp = &obj->base.gemo_uvmobj;
- *uoffsetp = 0;
+ *uoffsetp = (voff_t)startpage << PAGE_SHIFT;
return 0;
}
Home |
Main Index |
Thread Index |
Old Index