From 0bd81d996c4c43c4bc1a14c9bb258e27293e6770 Mon Sep 17 00:00:00 2001 From: kettenis Date: Wed, 24 Jun 2015 17:59:42 +0000 Subject: [PATCH] Linux jiffies and OpenBSD ticks are the same thing. ok jsg@ --- sys/dev/pci/drm/drm_linux.h | 4 +++- sys/dev/pci/drm/i915/i915_drv.h | 4 ++-- sys/dev/pci/drm/i915/i915_gem.c | 10 ++++------ sys/dev/pci/drm/i915/intel_display.c | 8 ++++---- sys/dev/pci/drm/i915/intel_pm.c | 8 +++----- sys/dev/pci/drm/i915/intel_ringbuffer.c | 8 +++----- 6 files changed, 19 insertions(+), 23 deletions(-) diff --git a/sys/dev/pci/drm/drm_linux.h b/sys/dev/pci/drm/drm_linux.h index ec44a479bff..7f7e5f2d03a 100644 --- a/sys/dev/pci/drm/drm_linux.h +++ b/sys/dev/pci/drm/drm_linux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.h,v 1.28 2015/06/24 08:32:39 kettenis Exp $ */ +/* $OpenBSD: drm_linux.h,v 1.29 2015/06/24 17:59:42 kettenis Exp $ */ /* * Copyright (c) 2013, 2014 Mark Kettenis * @@ -374,6 +374,8 @@ extern struct timespec ns_to_timespec(const int64_t); extern int64_t timeval_to_ns(const struct timeval *); extern struct timeval ns_to_timeval(const int64_t); +extern int ticks; +#define jiffies ticks #define HZ hz static inline unsigned long diff --git a/sys/dev/pci/drm/i915/i915_drv.h b/sys/dev/pci/drm/i915/i915_drv.h index f47aa6b3938..55a80060ec9 100644 --- a/sys/dev/pci/drm/i915/i915_drv.h +++ b/sys/dev/pci/drm/i915/i915_drv.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i915_drv.h,v 1.64 2015/06/24 08:32:39 kettenis Exp $ */ +/* $OpenBSD: i915_drv.h,v 1.65 2015/06/24 17:59:42 kettenis Exp $ */ /* i915_drv.h -- Private header for the I915 driver -*- linux-c -*- */ /* @@ -1217,7 +1217,7 @@ struct drm_i915_gem_request { u32 tail; /** Time at which this request was emitted, in jiffies. */ - unsigned long emitted_ticks; + unsigned long emitted_jiffies; /** global list entry for this request */ struct list_head list; diff --git a/sys/dev/pci/drm/i915/i915_gem.c b/sys/dev/pci/drm/i915/i915_gem.c index 3909317ff10..283361adc6a 100644 --- a/sys/dev/pci/drm/i915/i915_gem.c +++ b/sys/dev/pci/drm/i915/i915_gem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i915_gem.c,v 1.96 2015/06/24 08:32:39 kettenis Exp $ */ +/* $OpenBSD: i915_gem.c,v 1.97 2015/06/24 17:59:42 kettenis Exp $ */ /* * Copyright (c) 2008-2009 Owain G. Ainsworth * @@ -79,8 +79,6 @@ static void i915_gem_shrink_all(struct drm_i915_private *dev_priv); #endif static void i915_gem_object_truncate(struct drm_i915_gem_object *obj); -extern int ticks; - static inline void i915_gem_object_fence_lost(struct drm_i915_gem_object *obj) { if (obj->tiling_mode) @@ -2185,7 +2183,7 @@ i915_add_request(struct intel_ring_buffer *ring, request->seqno = intel_ring_get_seqno(ring); request->ring = ring; request->tail = request_ring_position; - request->emitted_ticks = ticks; + request->emitted_jiffies = jiffies; was_empty = list_empty(&ring->request_list); list_add_tail(&request->list, &ring->request_list); request->file_priv = NULL; @@ -3594,7 +3592,7 @@ i915_gem_ring_throttle(struct drm_device *dev, struct drm_file *file) { struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_file_private *file_priv = file->driver_priv; - unsigned long recent_enough = ticks - msecs_to_jiffies(20); + unsigned long recent_enough = jiffies - msecs_to_jiffies(20); struct drm_i915_gem_request *request; struct intel_ring_buffer *ring = NULL; u32 seqno = 0; @@ -3605,7 +3603,7 @@ i915_gem_ring_throttle(struct drm_device *dev, struct drm_file *file) spin_lock(&file_priv->mm.lock); list_for_each_entry(request, &file_priv->mm.request_list, client_list) { - if (time_after_eq(request->emitted_ticks, recent_enough)) + if (time_after_eq(request->emitted_jiffies, recent_enough)) break; ring = request->ring; diff --git a/sys/dev/pci/drm/i915/intel_display.c b/sys/dev/pci/drm/i915/intel_display.c index 5e459386a23..4cebaae5d16 100644 --- a/sys/dev/pci/drm/i915/intel_display.c +++ b/sys/dev/pci/drm/i915/intel_display.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_display.c,v 1.51 2015/06/24 08:32:39 kettenis Exp $ */ +/* $OpenBSD: intel_display.c,v 1.52 2015/06/24 17:59:42 kettenis Exp $ */ /* * Copyright © 2006-2007 Intel Corporation * @@ -1022,7 +1022,7 @@ void intel_wait_for_pipe_off(struct drm_device *dev, int pipe) } else { u32 last_line, line_mask; int reg = PIPEDSL(pipe); - unsigned long timeout = ticks + msecs_to_jiffies(100); + unsigned long timeout = jiffies + msecs_to_jiffies(100); if (IS_GEN2(dev)) line_mask = DSL_LINEMASK_GEN2; @@ -1034,8 +1034,8 @@ void intel_wait_for_pipe_off(struct drm_device *dev, int pipe) last_line = I915_READ(reg) & line_mask; mdelay(5); } while (((I915_READ(reg) & line_mask) != last_line) && - time_after(timeout, ticks)); - if (time_after(ticks, timeout)) + time_after(timeout, jiffies)); + if (time_after(jiffies, timeout)) WARN(1, "pipe_off wait timed out\n"); } } diff --git a/sys/dev/pci/drm/i915/intel_pm.c b/sys/dev/pci/drm/i915/intel_pm.c index 8d83756484e..f2e1a0a7634 100644 --- a/sys/dev/pci/drm/i915/intel_pm.c +++ b/sys/dev/pci/drm/i915/intel_pm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_pm.c,v 1.35 2015/06/24 08:32:39 kettenis Exp $ */ +/* $OpenBSD: intel_pm.c,v 1.36 2015/06/24 17:59:42 kettenis Exp $ */ /* * Copyright © 2012 Intel Corporation * @@ -48,8 +48,6 @@ bool i915_gpu_lower(void); bool i915_gpu_turbo_disable(void); bool i915_gpu_busy(void); -extern int ticks; - static bool intel_crtc_active(struct drm_crtc *crtc) { /* Be paranoid as we can arrive here with only partial @@ -2392,7 +2390,7 @@ static void ironlake_enable_drps(struct drm_device *dev) dev_priv->ips.last_count1 = I915_READ(0x112e4) + I915_READ(0x112e8) + I915_READ(0x112e0); - dev_priv->ips.last_time1 = jiffies_to_msecs(ticks); + dev_priv->ips.last_time1 = jiffies_to_msecs(jiffies); dev_priv->ips.last_count2 = I915_READ(0x112f4); getrawmonotonic(&dev_priv->ips.last_time2); @@ -2874,7 +2872,7 @@ static unsigned long __i915_chipset_val(struct drm_i915_private *dev_priv) { u64 total_count, diff, ret; u32 count1, count2, count3, m = 0, c = 0; - unsigned long now = jiffies_to_msecs(ticks), diff1; + unsigned long now = jiffies_to_msecs(jiffies), diff1; int i; assert_spin_locked(&mchdev_lock); diff --git a/sys/dev/pci/drm/i915/intel_ringbuffer.c b/sys/dev/pci/drm/i915/intel_ringbuffer.c index 0311faa83b0..b42340ca7eb 100644 --- a/sys/dev/pci/drm/i915/intel_ringbuffer.c +++ b/sys/dev/pci/drm/i915/intel_ringbuffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_ringbuffer.c,v 1.28 2015/04/12 17:10:07 kettenis Exp $ */ +/* $OpenBSD: intel_ringbuffer.c,v 1.29 2015/06/24 17:59:42 kettenis Exp $ */ /* * Copyright © 2008-2010 Intel Corporation * @@ -44,8 +44,6 @@ struct pipe_control { u32 gtt_offset; }; -extern int ticks; - static inline int ring_space(struct intel_ring_buffer *ring) { int space = (ring->head & HEAD_ADDR) - (ring->tail + I915_RING_FREE_SPACE); @@ -1369,7 +1367,7 @@ static int ring_wait_for_space(struct intel_ring_buffer *ring, int n) * to running on almost untested codepaths). But on resume * timers don't work yet, so prevent a complete hang in that * case by choosing an insanely large timeout. */ - end = ticks + 60 * hz; + end = jiffies + 60 * HZ; do { ring->head = I915_READ_HEAD(ring); @@ -1392,7 +1390,7 @@ static int ring_wait_for_space(struct intel_ring_buffer *ring, int n) ret = i915_gem_check_wedge(dev_priv, dev_priv->mm.interruptible); if (ret) return ret; - } while (!time_after(ticks, end)); + } while (!time_after(jiffies, end)); trace_i915_ring_wait_end(ring); return -EBUSY; } -- 2.20.1