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/radeon radeon: Reduce #ifdef ...
details: https://anonhg.NetBSD.org/src/rev/b8c3cd7f023f
branches: trunk
changeset: 1028728:b8c3cd7f023f
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 11:52:38 2021 +0000
description:
radeon: Reduce #ifdef __NetBSD__ around condvars.
diffstat:
sys/external/bsd/drm2/dist/drm/radeon/radeon.h | 10 +-
sys/external/bsd/drm2/dist/drm/radeon/radeon_device.c | 10 +-
sys/external/bsd/drm2/dist/drm/radeon/radeon_fence.c | 165 ++---------------
3 files changed, 23 insertions(+), 162 deletions(-)
diffs (truncated from 418 to 300 lines):
diff -r 1077fba5d335 -r b8c3cd7f023f sys/external/bsd/drm2/dist/drm/radeon/radeon.h
--- a/sys/external/bsd/drm2/dist/drm/radeon/radeon.h Sun Dec 19 11:52:25 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/radeon/radeon.h Sun Dec 19 11:52:38 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: radeon.h,v 1.10 2021/12/18 23:45:42 riastradh Exp $ */
+/* $NetBSD: radeon.h,v 1.11 2021/12/19 11:52:38 riastradh Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
@@ -392,11 +392,7 @@
unsigned ring;
bool is_vm_update;
-#ifdef __NetBSD__
TAILQ_ENTRY(radeon_fence) fence_check;
-#else
- wait_queue_entry_t fence_wake;
-#endif
};
int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring);
@@ -2435,13 +2431,9 @@
struct radeon_doorbell doorbell;
struct radeon_mman mman;
struct radeon_fence_driver fence_drv[RADEON_NUM_RINGS];
-#ifdef __NetBSD__
spinlock_t fence_lock;
drm_waitqueue_t fence_queue;
TAILQ_HEAD(, radeon_fence) fence_check;
-#else
- wait_queue_head_t fence_queue;
-#endif
u64 fence_context;
struct mutex ring_lock;
struct radeon_ring ring[RADEON_NUM_RINGS];
diff -r 1077fba5d335 -r b8c3cd7f023f sys/external/bsd/drm2/dist/drm/radeon/radeon_device.c
--- a/sys/external/bsd/drm2/dist/drm/radeon/radeon_device.c Sun Dec 19 11:52:25 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/radeon/radeon_device.c Sun Dec 19 11:52:38 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: radeon_device.c,v 1.12 2021/12/19 11:26:26 riastradh Exp $ */
+/* $NetBSD: radeon_device.c,v 1.13 2021/12/19 11:52:38 riastradh Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeon_device.c,v 1.12 2021/12/19 11:26:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_device.c,v 1.13 2021/12/19 11:52:38 riastradh Exp $");
#include <linux/console.h>
#include <linux/efi.h>
@@ -1430,12 +1430,8 @@
mutex_init(&rdev->srbm_mutex);
init_rwsem(&rdev->pm.mclk_lock);
init_rwsem(&rdev->exclusive_lock);
-#ifdef __NetBSD__
spin_lock_init(&rdev->irq.vblank_lock);
DRM_INIT_WAITQUEUE(&rdev->irq.vblank_queue, "radvblnk");
-#else
- init_waitqueue_head(&rdev->irq.vblank_queue);
-#endif
r = radeon_gem_init(rdev);
if (r)
return r;
@@ -1710,12 +1706,10 @@
if (rdev->family >= CHIP_BONAIRE)
radeon_doorbell_fini(rdev);
-#ifdef __NetBSD__
DRM_DESTROY_WAITQUEUE(&rdev->irq.vblank_queue);
spin_lock_destroy(&rdev->irq.vblank_lock);
destroy_rwsem(&rdev->exclusive_lock);
destroy_rwsem(&rdev->pm.mclk_lock);
-#endif
mutex_destroy(&rdev->srbm_mutex);
mutex_destroy(&rdev->gpu_clock_mutex);
mutex_destroy(&rdev->pm.mutex);
diff -r 1077fba5d335 -r b8c3cd7f023f sys/external/bsd/drm2/dist/drm/radeon/radeon_fence.c
--- a/sys/external/bsd/drm2/dist/drm/radeon/radeon_fence.c Sun Dec 19 11:52:25 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/radeon/radeon_fence.c Sun Dec 19 11:52:38 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: radeon_fence.c,v 1.21 2021/12/19 11:08:25 riastradh Exp $ */
+/* $NetBSD: radeon_fence.c,v 1.22 2021/12/19 11:52:38 riastradh Exp $ */
/*
* Copyright 2009 Jerome Glisse.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeon_fence.c,v 1.21 2021/12/19 11:08:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_fence.c,v 1.22 2021/12/19 11:52:38 riastradh Exp $");
#include <linux/atomic.h>
#include <linux/firmware.h>
@@ -171,20 +171,10 @@
* for the fence locking itself, so unlocked variants are used for
* fence_signal, and remove_wait_queue.
*/
-#ifdef __NetBSD__
static int radeon_fence_check_signaled(struct radeon_fence *fence)
-#else
-static int radeon_fence_check_signaled(wait_queue_entry_t *wait, unsigned mode, int flags, void *key)
-#endif
{
-#ifndef __NetBSD__
- struct radeon_fence *fence;
-#endif
u64 seq;
-#ifndef __NetBSD__
- fence = container_of(wait, struct radeon_fence, fence_wake);
-#endif
BUG_ON(!spin_is_locked(&fence->rdev->fence_lock));
/*
@@ -201,18 +191,13 @@
DMA_FENCE_TRACE(&fence->base, "was already signaled\n");
radeon_irq_kms_sw_irq_put(fence->rdev, fence->ring);
-#ifdef __NetBSD__
TAILQ_REMOVE(&fence->rdev->fence_check, fence, fence_check);
-#else
- __remove_wait_queue(&fence->rdev->fence_queue, &fence->fence_wake);
-#endif
dma_fence_put(&fence->base);
} else
DMA_FENCE_TRACE(&fence->base, "pending\n");
return 0;
}
-#ifdef __NetBSD__
void
radeon_fence_wakeup_locked(struct radeon_device *rdev)
{
@@ -224,7 +209,6 @@
radeon_fence_check_signaled(fence);
}
}
-#endif
/**
* radeon_fence_activity - check for fence activity
@@ -319,16 +303,12 @@
rdev = fence_drv->rdev;
ring = fence_drv - &rdev->fence_drv[0];
-#ifdef __NetBSD__
spin_lock(&rdev->fence_lock);
-#endif
if (!down_read_trylock(&rdev->exclusive_lock)) {
/* just reschedule the check if a reset is going on */
radeon_fence_schedule_check(rdev, ring);
-#ifdef __NetBSD__
spin_unlock(&rdev->fence_lock);
-#endif
return;
}
@@ -342,11 +322,7 @@
}
if (radeon_fence_activity(rdev, ring))
-#ifdef __NetBSD__
radeon_fence_wakeup_locked(rdev);
-#else
- wake_up_all(&rdev->fence_queue);
-#endif
else if (radeon_ring_is_lockup(rdev, ring, &rdev->ring[ring])) {
@@ -358,16 +334,10 @@
/* remember that we need an reset */
rdev->needs_reset = true;
-#ifdef __NetBSD__
radeon_fence_wakeup_locked(rdev);
-#else
- wake_up_all(&rdev->fence_queue);
-#endif
}
up_read(&rdev->exclusive_lock);
-#ifdef __NetBSD__
spin_unlock(&rdev->fence_lock);
-#endif
}
/**
@@ -382,11 +352,7 @@
static void radeon_fence_process_locked(struct radeon_device *rdev, int ring)
{
if (radeon_fence_activity(rdev, ring))
-#ifdef __NetBSD__
radeon_fence_wakeup_locked(rdev);
-#else
- wake_up_all(&rdev->fence_queue);
-#endif
}
void radeon_fence_process(struct radeon_device *rdev, int ring)
@@ -472,11 +438,7 @@
radeon_irq_kms_sw_irq_get(rdev, fence->ring);
if (radeon_fence_activity(rdev, fence->ring))
-#ifdef __NetBSD__
radeon_fence_wakeup_locked(rdev);
-#else
- wake_up_all_locked(&rdev->fence_queue);
-#endif
/* did fence get signaled after we enabled the sw irq? */
if (atomic64_read(&rdev->fence_drv[fence->ring].last_seq) >= fence->seq) {
@@ -493,14 +455,7 @@
radeon_fence_schedule_check(rdev, fence->ring);
}
-#ifdef __NetBSD__
TAILQ_INSERT_TAIL(&rdev->fence_check, fence, fence_check);
-#else
- fence->fence_wake.flags = 0;
- fence->fence_wake.private = NULL;
- fence->fence_wake.func = radeon_fence_check_signaled;
- __add_wait_queue(&rdev->fence_queue, &fence->fence_wake);
-#endif
dma_fence_get(f);
DMA_FENCE_TRACE(&fence->base, "armed on ring %i!\n", fence->ring);
@@ -594,7 +549,6 @@
radeon_irq_kms_sw_irq_get(rdev, i);
}
-#ifdef __NetBSD__
if (intr)
DRM_SPIN_TIMED_WAIT_UNTIL(r, &rdev->fence_queue,
&rdev->fence_lock, timeout,
@@ -605,17 +559,6 @@
&rdev->fence_lock, timeout,
(radeon_fence_any_seq_signaled(rdev, target_seq)
|| rdev->needs_reset));
-#else
- if (intr) {
- r = wait_event_interruptible_timeout(rdev->fence_queue, (
- radeon_fence_any_seq_signaled(rdev, target_seq)
- || rdev->needs_reset), timeout);
- } else {
- r = wait_event_timeout(rdev->fence_queue, (
- radeon_fence_any_seq_signaled(rdev, target_seq)
- || rdev->needs_reset), timeout);
- }
-#endif
if (rdev->needs_reset)
r = -EDEADLK;
@@ -1021,13 +964,9 @@
{
int ring;
-#ifdef __NetBSD__
spin_lock_init(&rdev->fence_lock);
DRM_INIT_WAITQUEUE(&rdev->fence_queue, "radfence");
TAILQ_INIT(&rdev->fence_check);
-#else
- init_waitqueue_head(&rdev->fence_queue);
-#endif
for (ring = 0; ring < RADEON_NUM_RINGS; ring++) {
radeon_fence_driver_init_ring(rdev, ring);
}
@@ -1059,23 +998,17 @@
radeon_fence_driver_force_completion(rdev, ring);
}
cancel_delayed_work_sync(&rdev->fence_drv[ring].lockup_work);
-#ifdef __NetBSD__
spin_lock(&rdev->fence_lock);
radeon_fence_wakeup_locked(rdev);
spin_unlock(&rdev->fence_lock);
-#else
- wake_up_all(&rdev->fence_queue);
-#endif
radeon_scratch_free(rdev, rdev->fence_drv[ring].scratch_reg);
rdev->fence_drv[ring].initialized = false;
}
mutex_unlock(&rdev->ring_lock);
-#ifdef __NetBSD__
BUG_ON(!TAILQ_EMPTY(&rdev->fence_check));
DRM_DESTROY_WAITQUEUE(&rdev->fence_queue);
spin_lock_destroy(&rdev->fence_lock);
-#endif
}
/**
@@ -1189,61 +1122,18 @@
return test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->base.flags);
}
-#ifdef __NetBSD__
+struct radeon_wait_cb {
Home |
Main Index |
Thread Index |
Old Index