[Intel-gfx] [PATCH 4/4] drm/i915: Expose a API for other client to request a fence register

Zhi Wang zhi.a.wang at intel.com
Tue Jun 28 13:51:45 UTC 2016


This patch renames the i915_find_fence_reg() to i915_request_fence_reg(),
and expose it in kernel.

Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Zhi Wang <zhi.a.wang at intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h       |  2 ++
 drivers/gpu/drm/i915/i915_gem_fence.c | 14 +++++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 68cd453..82fdb46 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -3472,6 +3472,8 @@ bool i915_gem_object_pin_fence(struct drm_i915_gem_object *obj);
 void i915_gem_object_unpin_fence(struct drm_i915_gem_object *obj);
 
 void i915_gem_restore_fences(struct drm_device *dev);
+struct drm_i915_fence_reg *
+i915_request_fence_reg(struct drm_device *dev);
 
 void i915_gem_detect_bit_6_swizzle(struct drm_device *dev);
 void i915_gem_object_do_bit_17_swizzle(struct drm_i915_gem_object *obj);
diff --git a/drivers/gpu/drm/i915/i915_gem_fence.c b/drivers/gpu/drm/i915/i915_gem_fence.c
index 7a5a02c..28762a7 100644
--- a/drivers/gpu/drm/i915/i915_gem_fence.c
+++ b/drivers/gpu/drm/i915/i915_gem_fence.c
@@ -308,8 +308,16 @@ i915_gem_object_put_fence(struct drm_i915_gem_object *obj)
 	return 0;
 }
 
-static struct drm_i915_fence_reg *
-i915_find_fence_reg(struct drm_device *dev)
+/**
+ * i915_request_fence_reg - find a free or unpinned fence register
+ * @dev: drm device
+ *
+ * Returns:
+ *
+ * pointer to fence register on success, error code in pointer on failure.
+ */
+struct drm_i915_fence_reg *
+i915_request_fence_reg(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct drm_i915_fence_reg *reg, *avail;
@@ -401,7 +409,7 @@ i915_gem_object_get_fence(struct drm_i915_gem_object *obj)
 		if (WARN_ON(!obj->map_and_fenceable))
 			return -EINVAL;
 
-		reg = i915_find_fence_reg(dev);
+		reg = i915_request_fence_reg(dev);
 		if (IS_ERR(reg))
 			return PTR_ERR(reg);
 	} else
-- 
1.9.1



More information about the Intel-gfx mailing list