[Intel-gfx] [PATCH] drm/i915: move i915_fence_{context_, }timeout() to i915_sw_fence.[ch]

Jani Nikula jani.nikula at intel.com
Wed Sep 14 16:59:03 UTC 2022


Maybe there was a grand plan with i915_fence_timeout() and
i915_fence_context_timeout() and i915_config.c, but that seems to have
been lost a bit.

Just move the functions to i915_sw_fence.[ch] from i915_drv.h and
i915_config.c, and remove the latter.

Cc: Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 drivers/gpu/drm/i915/Makefile        |  1 -
 drivers/gpu/drm/i915/i915_config.c   | 15 ---------------
 drivers/gpu/drm/i915/i915_drv.h      |  9 ---------
 drivers/gpu/drm/i915/i915_sw_fence.c | 15 +++++++++++++++
 drivers/gpu/drm/i915/i915_sw_fence.h |  5 +++++
 5 files changed, 20 insertions(+), 25 deletions(-)
 delete mode 100644 drivers/gpu/drm/i915/i915_config.c

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index a26edcdadc21..0221682d3a0f 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -34,7 +34,6 @@ subdir-ccflags-y += -I$(srctree)/$(src)
 # core driver code
 i915-y += i915_driver.o \
 	  i915_drm_client.o \
-	  i915_config.o \
 	  i915_getparam.o \
 	  i915_ioctl.o \
 	  i915_irq.o \
diff --git a/drivers/gpu/drm/i915/i915_config.c b/drivers/gpu/drm/i915/i915_config.c
deleted file mode 100644
index afb828dab53b..000000000000
--- a/drivers/gpu/drm/i915/i915_config.c
+++ /dev/null
@@ -1,15 +0,0 @@
-// SPDX-License-Identifier: MIT
-/*
- * Copyright © 2020 Intel Corporation
- */
-
-#include "i915_drv.h"
-
-unsigned long
-i915_fence_context_timeout(const struct drm_i915_private *i915, u64 context)
-{
-	if (CONFIG_DRM_I915_FENCE_TIMEOUT && context)
-		return msecs_to_jiffies_timeout(CONFIG_DRM_I915_FENCE_TIMEOUT);
-
-	return 0;
-}
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 524b5ee495be..02956385d32d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -167,15 +167,6 @@ struct i915_gem_mm {
 
 #define I915_IDLE_ENGINES_TIMEOUT (200) /* in ms */
 
-unsigned long i915_fence_context_timeout(const struct drm_i915_private *i915,
-					 u64 context);
-
-static inline unsigned long
-i915_fence_timeout(const struct drm_i915_private *i915)
-{
-	return i915_fence_context_timeout(i915, U64_MAX);
-}
-
 #define HAS_HW_SAGV_WM(i915) (DISPLAY_VER(i915) >= 13 && !IS_DGFX(i915))
 
 struct i915_virtual_gpu {
diff --git a/drivers/gpu/drm/i915/i915_sw_fence.c b/drivers/gpu/drm/i915/i915_sw_fence.c
index 6fc0d1b89690..2a90987799e7 100644
--- a/drivers/gpu/drm/i915/i915_sw_fence.c
+++ b/drivers/gpu/drm/i915/i915_sw_fence.c
@@ -11,6 +11,7 @@
 
 #include "i915_sw_fence.h"
 #include "i915_selftest.h"
+#include "i915_utils.h"
 
 #if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
 #define I915_SW_FENCE_BUG_ON(expr) BUG_ON(expr)
@@ -471,6 +472,20 @@ static void irq_i915_sw_fence_work(struct irq_work *wrk)
 	kfree_rcu(cb, rcu);
 }
 
+unsigned long i915_fence_context_timeout(const struct drm_i915_private *i915,
+					 u64 context)
+{
+	if (CONFIG_DRM_I915_FENCE_TIMEOUT && context)
+		return msecs_to_jiffies_timeout(CONFIG_DRM_I915_FENCE_TIMEOUT);
+
+	return 0;
+}
+
+unsigned long i915_fence_timeout(const struct drm_i915_private *i915)
+{
+	return i915_fence_context_timeout(i915, U64_MAX);
+}
+
 int i915_sw_fence_await_dma_fence(struct i915_sw_fence *fence,
 				  struct dma_fence *dma,
 				  unsigned long timeout,
diff --git a/drivers/gpu/drm/i915/i915_sw_fence.h b/drivers/gpu/drm/i915/i915_sw_fence.h
index 619fc5a22f0c..cdef7dabafbd 100644
--- a/drivers/gpu/drm/i915/i915_sw_fence.h
+++ b/drivers/gpu/drm/i915/i915_sw_fence.h
@@ -17,6 +17,7 @@
 
 struct completion;
 struct dma_resv;
+struct drm_i915_private;
 struct i915_sw_fence;
 
 enum i915_sw_fence_notify {
@@ -81,6 +82,10 @@ struct i915_sw_dma_fence_cb {
 	struct i915_sw_fence *fence;
 };
 
+unsigned long i915_fence_context_timeout(const struct drm_i915_private *i915,
+					 u64 context);
+unsigned long i915_fence_timeout(const struct drm_i915_private *i915);
+
 int __i915_sw_fence_await_dma_fence(struct i915_sw_fence *fence,
 				    struct dma_fence *dma,
 				    struct i915_sw_dma_fence_cb *cb);
-- 
2.34.1



More information about the Intel-gfx mailing list