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 i915: Adapt i915_request.
details: https://anonhg.NetBSD.org/src/rev/884a333b7b31
branches: trunk
changeset: 1028654:884a333b7b31
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 11:36:17 2021 +0000
description:
i915: Adapt i915_request.
diffstat:
sys/external/bsd/drm2/dist/drm/i915/i915_request.c | 45 ++++++++++++++++++---
sys/external/bsd/drm2/dist/drm/i915/i915_request.h | 6 +-
sys/external/bsd/drm2/include/i915_trace.h | 6 +-
3 files changed, 45 insertions(+), 12 deletions(-)
diffs (171 lines):
diff -r 5ab9e7e7025d -r 884a333b7b31 sys/external/bsd/drm2/dist/drm/i915/i915_request.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_request.c Sun Dec 19 11:36:08 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_request.c Sun Dec 19 11:36:17 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i915_request.c,v 1.4 2021/12/19 01:51:27 riastradh Exp $ */
+/* $NetBSD: i915_request.c,v 1.5 2021/12/19 11:36:17 riastradh Exp $ */
/*
* Copyright © 2008-2015 Intel Corporation
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_request.c,v 1.4 2021/12/19 01:51:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_request.c,v 1.5 2021/12/19 11:36:17 riastradh Exp $");
#include <linux/dma-fence-array.h>
#include <linux/irq_work.h>
@@ -121,7 +121,6 @@
i915_sw_fence_fini(&rq->submit);
i915_sw_fence_fini(&rq->semaphore);
- DRM_DESTROY_WAITQUEUE(&rq->execute);
dma_fence_destroy(&rq->fence);
spin_lock_destroy(&rq->lock);
kmem_cache_free(global.slab_requests, rq);
@@ -450,7 +449,7 @@
void __i915_request_unsubmit(struct i915_request *request)
{
- struct intel_engine_cs *engine = request->engine;
+ struct intel_engine_cs *engine __lockdep_used = request->engine;
RQ_TRACE(request, "\n");
@@ -603,7 +602,9 @@
i915_sw_fence_init(&rq->submit, submit_notify);
i915_sw_fence_init(&rq->semaphore, semaphore_notify);
+#ifndef __NetBSD__
dma_fence_init(&rq->fence, &i915_fence_ops, &rq->lock, 0, 0);
+#endif
rq->file_priv = NULL;
rq->capture_list = NULL;
@@ -669,10 +670,14 @@
rq->ring = ce->ring;
rq->execution_mask = ce->engine->mask;
+#ifdef __NetBSD__
+ dma_fence_init(&rq->fence, &i915_fence_ops, &rq->lock, 0, 0);
+#else
kref_init(&rq->fence.refcount);
rq->fence.flags = 0;
rq->fence.error = 0;
INIT_LIST_HEAD(&rq->fence.cb_list);
+#endif
ret = intel_timeline_get_seqno(tl, rq, &seqno);
if (ret)
@@ -1477,9 +1482,7 @@
struct request_wait {
struct dma_fence_cb cb;
#ifdef __NetBSD__
- bool complete;
- kcondvar_t cv;
- /* XXX lock, condvar, ...? */
+ drm_waitqueue_t wq;
#else
struct task_struct *tsk;
#endif
@@ -1489,7 +1492,11 @@
{
struct request_wait *wait = container_of(cb, typeof(*wait), cb);
+#ifdef __NetBSD__
+ DRM_SPIN_WAKEUP_ALL(&wait->wq, fence->lock);
+#else
wake_up_process(wait->tsk);
+#endif
}
/**
@@ -1511,8 +1518,12 @@
unsigned int flags,
long timeout)
{
+#ifdef __NetBSD__
+ const int state = 0;
+#else
const int state = flags & I915_WAIT_INTERRUPTIBLE ?
TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE;
+#endif
struct request_wait wait;
might_sleep();
@@ -1581,6 +1592,25 @@
i915_schedule_bump_priority(rq, I915_PRIORITY_WAIT);
}
+#ifdef __NetBSD__
+ DRM_INIT_WAITQUEUE(&wait.wq, "i915req");
+ if (dma_fence_add_callback(&rq->fence, &wait.cb, request_wait_wake))
+ goto out;
+ spin_lock(rq->fence.lock);
+ if (flags & I915_WAIT_INTERRUPTIBLE) {
+ DRM_SPIN_TIMED_WAIT_UNTIL(timeout, &wait.wq,
+ rq->fence.lock, timeout,
+ i915_request_completed(rq));
+ } else {
+ DRM_SPIN_TIMED_WAIT_NOINTR_UNTIL(timeout, &wait.wq,
+ rq->fence.lock, timeout,
+ i915_request_completed(rq));
+ }
+ if (timeout > 0) /* succeeded before timeout */
+ dma_fence_signal(&rq->fence);
+ spin_unlock(rq->fence.lock);
+ DRM_DESTROY_WAITQUEUE(&wait.wq);
+#else
wait.tsk = current;
if (dma_fence_add_callback(&rq->fence, &wait.cb, request_wait_wake))
goto out;
@@ -1607,6 +1637,7 @@
timeout = io_schedule_timeout(timeout);
}
__set_current_state(TASK_RUNNING);
+#endif
dma_fence_remove_callback(&rq->fence, &wait.cb);
diff -r 5ab9e7e7025d -r 884a333b7b31 sys/external/bsd/drm2/dist/drm/i915/i915_request.h
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_request.h Sun Dec 19 11:36:08 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_request.h Sun Dec 19 11:36:17 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i915_request.h,v 1.3 2021/12/19 11:20:02 riastradh Exp $ */
+/* $NetBSD: i915_request.h,v 1.4 2021/12/19 11:36:17 riastradh Exp $ */
/*
* Copyright © 2008-2018 Intel Corporation
@@ -201,7 +201,9 @@
*/
struct i915_sw_fence submit;
union {
-#ifndef __NetBSD__ /* XXX */
+#ifdef __NetBSD__ /* XXX */
+ struct i915_sw_fence_waiter submitq;
+#else
wait_queue_entry_t submitq;
#endif
struct i915_sw_dma_fence_cb dmaq;
diff -r 5ab9e7e7025d -r 884a333b7b31 sys/external/bsd/drm2/include/i915_trace.h
--- a/sys/external/bsd/drm2/include/i915_trace.h Sun Dec 19 11:36:08 2021 +0000
+++ b/sys/external/bsd/drm2/include/i915_trace.h Sun Dec 19 11:36:17 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i915_trace.h,v 1.18 2021/12/19 11:13:14 riastradh Exp $ */
+/* $NetBSD: i915_trace.h,v 1.19 2021/12/19 11:36:17 riastradh Exp $ */
/*-
* Copyright (c) 2013, 2018 The NetBSD Foundation, Inc.
@@ -242,9 +242,9 @@
I915_DEFINE_TRACE_REQ(i915,, request__wait__begin);
static inline void
-trace_i915_request_wait_begin(struct i915_request *request)
+trace_i915_request_wait_begin(struct i915_request *request, unsigned int flags)
{
- I915_TRACE_REQ(i915,, request__wait__begin, request, 0);
+ I915_TRACE_REQ(i915,, request__wait__begin, request, flags);
}
I915_DEFINE_TRACE_REQ(i915,, request__wait__end);
Home |
Main Index |
Thread Index |
Old Index