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/include/linux i915: machete
details: https://anonhg.NetBSD.org/src/rev/06e9833e757c
branches: trunk
changeset: 1028609:06e9833e757c
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 11:26:35 2021 +0000
description:
i915: machete
diffstat:
sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_clflush.c | 8 +-
sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_client_blt.c | 33 +++-
sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c | 102 +++++++++-
sys/external/bsd/drm2/dist/drm/i915/i915_drv.c | 19 +-
sys/external/bsd/drm2/dist/drm/i915/i915_gem.c | 6 +-
sys/external/bsd/drm2/i915drm/i915_module.c | 8 +-
sys/external/bsd/drm2/include/linux/irq_work.h | 3 +-
7 files changed, 153 insertions(+), 26 deletions(-)
diffs (truncated from 448 to 300 lines):
diff -r b3d884b84e41 -r 06e9833e757c sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_clflush.c
--- a/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_clflush.c Sun Dec 19 11:26:25 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_clflush.c Sun Dec 19 11:26:35 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i915_gem_clflush.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $ */
+/* $NetBSD: i915_gem_clflush.c,v 1.3 2021/12/19 11:26:35 riastradh Exp $ */
/*
* SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_clflush.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_clflush.c,v 1.3 2021/12/19 11:26:35 riastradh Exp $");
#include "display/intel_frontbuffer.h"
@@ -24,7 +24,11 @@
static void __do_clflush(struct drm_i915_gem_object *obj)
{
GEM_BUG_ON(!i915_gem_object_has_pages(obj));
+#ifdef __NetBSD__
+ drm_clflush_pglist(&obj->mm.pageq);
+#else
drm_clflush_sg(obj->mm.pages);
+#endif
i915_gem_object_flush_frontbuffer(obj, ORIGIN_CPU);
}
diff -r b3d884b84e41 -r 06e9833e757c sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_client_blt.c
--- a/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_client_blt.c Sun Dec 19 11:26:25 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_client_blt.c Sun Dec 19 11:26:35 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i915_gem_client_blt.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $ */
+/* $NetBSD: i915_gem_client_blt.c,v 1.3 2021/12/19 11:26:35 riastradh Exp $ */
// SPDX-License-Identifier: MIT
/*
@@ -6,7 +6,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_client_blt.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_client_blt.c,v 1.3 2021/12/19 11:26:35 riastradh Exp $");
#include "i915_drv.h"
#include "gt/intel_context.h"
@@ -18,7 +18,12 @@
struct i915_sleeve {
struct i915_vma *vma;
struct drm_i915_gem_object *obj;
+#ifdef __NetBSD__
+ struct pglist *pglist;
+ bus_dmamap_t pages; /* XXX ??? XXX ??? */
+#else
struct sg_table *pages;
+#endif
struct i915_page_sizes page_sizes;
};
@@ -171,7 +176,11 @@
if (obj->cache_dirty) {
if (i915_gem_object_has_struct_page(obj))
+#ifdef __NetBSD__
+ drm_clflush_pglist(w->sleeve->pglist);
+#else
drm_clflush_sg(w->sleeve->pages);
+#endif
obj->cache_dirty = false;
}
obj->read_domains = I915_GEM_GPU_DOMAINS;
@@ -258,7 +267,27 @@
return NOTIFY_DONE;
}
+#ifdef __NetBSD__
+/* XXX my kingdom for a non-tentacular link set */
+
+static spinlock_t fence_lock;
+
+void i915_gem_client_blt_init(void);
+void
+i915_gem_client_blt_init(void)
+{
+ spin_lock_init(&fence_lock);
+}
+
+void i915_gem_client_blt_fini(void);
+void
+i915_gem_client_blt_fini(void)
+{
+ spin_lock_destroy(&fence_lock);
+}
+#else
static DEFINE_SPINLOCK(fence_lock);
+#endif
/* XXX: better name please */
int i915_gem_schedule_fill_pages_blt(struct drm_i915_gem_object *obj,
diff -r b3d884b84e41 -r 06e9833e757c 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 11:26:25 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c Sun Dec 19 11:26:35 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i915_gem_mman.c,v 1.3 2021/12/19 10:24:52 riastradh Exp $ */
+/* $NetBSD: i915_gem_mman.c,v 1.4 2021/12/19 11:26:35 riastradh Exp $ */
/*
* SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_mman.c,v 1.3 2021/12/19 10:24:52 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_mman.c,v 1.4 2021/12/19 11:26:35 riastradh Exp $");
#include <linux/anon_inodes.h>
#include <linux/mman.h>
@@ -26,6 +26,7 @@
#include "i915_user_extensions.h"
#include "i915_vma.h"
+#ifndef __NetBSD__
static inline bool
__vma_matches(struct vm_area_struct *vma, struct file *filp,
unsigned long addr, unsigned long size)
@@ -36,6 +37,7 @@
return vma->vm_start == addr &&
(vma->vm_end - vma->vm_start) == PAGE_ALIGN(size);
}
+#endif
/**
* i915_gem_mmap_ioctl - Maps the contents of an object, returning the address
@@ -94,6 +96,26 @@
goto err;
}
+#ifdef __NetBSD__
+ int error;
+
+ /* Acquire a reference for uvm_map to consume. */
+ uao_reference(obj->filp);
+ addr = (*curproc->p_emul->e_vm_default_addr)(curproc,
+ (vaddr_t)curproc->p_vmspace->vm_daddr, args->size,
+ curproc->p_vmspace->vm_map.flags & VM_MAP_TOPDOWN);
+ error = uvm_map(&curproc->p_vmspace->vm_map, &addr, args->size,
+ obj->filp, args->offset, 0,
+ UVM_MAPFLAG(VM_PROT_READ|VM_PROT_WRITE,
+ VM_PROT_READ|VM_PROT_WRITE, UVM_INH_COPY, UVM_ADV_NORMAL,
+ 0));
+ if (error) {
+ uao_detach(obj->filp);
+ /* XXX errno NetBSD->Linux */
+ addr = -error;
+ goto err;
+ }
+#else
addr = vm_mmap(obj->base.filp, 0, args->size,
PROT_READ | PROT_WRITE, MAP_SHARED,
args->offset);
@@ -118,6 +140,7 @@
if (IS_ERR_VALUE(addr))
goto err;
}
+#endif
i915_gem_object_put(obj);
args->addr_ptr = (u64)addr;
@@ -215,6 +238,18 @@
return view;
}
+#ifdef __NetBSD__
+
+static int
+i915_gem_fault(struct uvm_faultinfo *ufi, vaddr_t vaddr, struct vm_page **pps,
+ int npages, int centeridx, vm_prot_t access_type, int flags)
+{
+ struct uvm_object *uobj = ufi->entry->object.uvm_obj;
+ struct ...
+}
+
+#else
+
static vm_fault_t i915_error_to_vmf_fault(int err)
{
switch (err) {
@@ -407,6 +442,8 @@
return i915_error_to_vmf_fault(ret);
}
+#endif /* __NetBSD__ */
+
void __i915_gem_object_release_mmap_gtt(struct drm_i915_gem_object *obj)
{
struct i915_vma *vma;
@@ -469,6 +506,23 @@
struct i915_mmap_offset *mmo, *mn;
spin_lock(&obj->mmo.lock);
+#ifdef __NetBSD__
+ enum i915_mmap_type t;
+ struct vm_page *pg;
+
+ (void)mmo;
+ (void)mn;
+ for (t = 0; t < I915_MMA_NTYPES; t++) {
+ if (t == I915_MMAP_TYPE_GTT)
+ continue;
+ /*
+ * XXX Gotta take some uvm object's lock, outside the
+ * spin lock, probably?
+ */
+ TAILQ_FOREACH(pg, &obj->mm.pageq, pageq.queue)
+ pmap_page_protect(pg, VM_PROT_NONE);
+ }
+#else
rbtree_postorder_for_each_entry_safe(mmo, mn,
&obj->mmo.offsets, offset) {
/*
@@ -483,6 +537,7 @@
obj->base.dev->anon_inode->i_mapping);
spin_lock(&obj->mmo.lock);
}
+#endif
spin_unlock(&obj->mmo.lock);
}
@@ -503,6 +558,15 @@
lookup_mmo(struct drm_i915_gem_object *obj,
enum i915_mmap_type mmap_type)
{
+#ifdef __NetBSD__
+ struct i915_mmap_offset *mmo;
+
+ spin_lock(&obj->mmo.lock);
+ mmo = obj->mmo.offsets[mmap_type];
+ spin_unlock(&obj->mmo.lock);
+
+ return mmo;
+#else
struct rb_node *rb;
spin_lock(&obj->mmo.lock);
@@ -524,11 +588,31 @@
spin_unlock(&obj->mmo.lock);
return NULL;
+#endif
}
static struct i915_mmap_offset *
insert_mmo(struct drm_i915_gem_object *obj, struct i915_mmap_offset *mmo)
{
+#ifdef __NetBSD__
+ struct i915_mmap_offset *to_free = NULL;
+
+ spin_lock(&obj->mmo.lock);
+ if (obj->mmo.offsets[mmo->mmap_type]) {
+ drm_vma_offset_remove(obj->base.dev->vma_offset_manager,
+ &mmo->vma_node);
+ to_free = mmo;
+ mmo = obj->mmo.offsets[mmo->mmap_type];
+ } else {
+ obj->mmo.offsets[mmo->mmap_type] = mmo;
+ }
+ spin_unlock(&obj->mmo.lock);
+
+ if (to_free)
+ kfree(to_free);
+
+ return mmo;
+#else
struct rb_node *rb, **p;
spin_lock(&obj->mmo.lock);
@@ -558,6 +642,7 @@
spin_unlock(&obj->mmo.lock);
return mmo;
+#endif
}
static struct i915_mmap_offset *
@@ -737,6 +822,17 @@
return __assign_mmap_offset(file, args->handle, type, &args->offset);
}
+#ifdef __NetBSD__
+
+int
+i915_gem_mmap_object(struct drm_device *dev, off_t byte_offset, size_t nbytes,
+ int prot, struct uvm_object **uobjp, voff_t *uoffsetp, struct file *fp)
+{
+ panic("NYI");
+}
+
+#else
Home |
Main Index |
Thread Index |
Old Index