[PATCH 10/10] drm/i915: move fence_regs to the fence lru

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We most often need these together ...

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 12 ++++++------
 drivers/gpu/drm/i915/i915_dma.c     |  6 +++---
 drivers/gpu/drm/i915/i915_drv.h     | 12 ++++++------
 drivers/gpu/drm/i915/i915_gem.c     | 24 ++++++++++++------------
 4 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index c797bb9..09e5d8a 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -520,13 +520,13 @@ static int i915_gem_fence_regs_info(struct seq_file *m, void *data)
 	if (ret)
 		return ret;
 
-	seq_printf(m, "Reserved fences = %d\n", dev_priv->fence_reg_start);
-	seq_printf(m, "Total fences = %d\n", dev_priv->num_fence_regs);
-	for (i = 0; i < dev_priv->num_fence_regs; i++) {
-		struct drm_i915_gem_object *obj = dev_priv->fence_regs[i].obj;
+	seq_printf(m, "Reserved fences = %d\n", dev_priv->mm.fence_reg_start);
+	seq_printf(m, "Total fences = %d\n", dev_priv->mm.num_fence_regs);
+	for (i = 0; i < dev_priv->mm.num_fence_regs; i++) {
+		struct drm_i915_gem_object *obj = dev_priv->mm.fence_regs[i].obj;
 
 		seq_printf(m, "Fence %d, pin count = %d, object = ",
-			   i, dev_priv->fence_regs[i].pin_count);
+			   i, dev_priv->mm.fence_regs[i].pin_count);
 		if (obj == NULL)
 			seq_printf(m, "unused");
 		else
@@ -693,7 +693,7 @@ static int i915_error_state(struct seq_file *m, void *unused)
 	seq_printf(m, "PGTBL_ER: 0x%08x\n", error->pgtbl_er);
 	seq_printf(m, "CCID: 0x%08x\n", error->ccid);
 
-	for (i = 0; i < dev_priv->num_fence_regs; i++)
+	for (i = 0; i < dev_priv->mm.num_fence_regs; i++)
 		seq_printf(m, "  fence[%d] = %08llx\n", i, error->fence[i]);
 
 	for (i = 0; i < ARRAY_SIZE(error->extra_instdone); i++)
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 7867cc3..d6d03d4 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -966,7 +966,7 @@ static int i915_getparam(struct drm_device *dev, void *data,
 		value = 1;
 		break;
 	case I915_PARAM_NUM_FENCES_AVAIL:
-		value = dev_priv->num_fence_regs - dev_priv->fence_reg_start;
+		value = dev_priv->mm.num_fence_regs - dev_priv->mm.fence_reg_start;
 		break;
 	case I915_PARAM_HAS_OVERLAY:
 		value = dev_priv->overlay ? 1 : 0;
@@ -1051,11 +1051,11 @@ static int i915_setparam(struct drm_device *dev, void *data,
 		dev_priv->dri1.allow_batchbuffer = param->value ? 1 : 0;
 		break;
 	case I915_SETPARAM_NUM_USED_FENCES:
-		if (param->value > dev_priv->num_fence_regs ||
+		if (param->value > dev_priv->mm.num_fence_regs ||
 		    param->value < 0)
 			return -EINVAL;
 		/* Userspace can use first N regs */
-		dev_priv->fence_reg_start = param->value;
+		dev_priv->mm.fence_reg_start = param->value;
 		break;
 	default:
 		DRM_DEBUG_DRIVER("unknown parameter %d\n",
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 26effb7..c7e1b44 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -674,6 +674,10 @@ struct i915_gem_mm {
 	/** LRU list of objects with fence regs on them. */
 	struct list_head fence_list;
 
+	struct drm_i915_fence_reg fence_regs[I915_MAX_NUM_FENCES]; /* assume 965 */
+	int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */
+	int num_fence_regs; /* 8 on pre-965, 16 otherwise */
+
 	/**
 	 * We leave the user IRQ off as much as possible,
 	 * but this means that requests will finish and never
@@ -837,10 +841,6 @@ typedef struct drm_i915_private {
 	bool no_aux_handshake;
 
 	int crt_ddc_pin;
-	struct drm_i915_fence_reg fence_regs[I915_MAX_NUM_FENCES]; /* assume 965 */
-	int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */
-	int num_fence_regs; /* 8 on pre-965, 16 otherwise */
-
 	unsigned int fsb_freq, mem_freq, is_ddr3;
 
 	struct workqueue_struct *wq;
@@ -1429,7 +1429,7 @@ i915_gem_object_pin_fence(struct drm_i915_gem_object *obj)
 {
 	if (obj->fence_reg != I915_FENCE_REG_NONE) {
 		struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
-		dev_priv->fence_regs[obj->fence_reg].pin_count++;
+		dev_priv->mm.fence_regs[obj->fence_reg].pin_count++;
 		return true;
 	} else
 		return false;
@@ -1440,7 +1440,7 @@ i915_gem_object_unpin_fence(struct drm_i915_gem_object *obj)
 {
 	if (obj->fence_reg != I915_FENCE_REG_NONE) {
 		struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
-		dev_priv->fence_regs[obj->fence_reg].pin_count--;
+		dev_priv->mm.fence_regs[obj->fence_reg].pin_count--;
 	}
 }
 
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 901ee70..565efdc 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1896,7 +1896,7 @@ i915_gem_object_move_to_active(struct drm_i915_gem_object *obj,
 		if (obj->fence_reg != I915_FENCE_REG_NONE) {
 			struct drm_i915_fence_reg *reg;
 
-			reg = &dev_priv->fence_regs[obj->fence_reg];
+			reg = &dev_priv->mm.fence_regs[obj->fence_reg];
 			list_move_tail(&reg->lru_list,
 				       &dev_priv->mm.fence_list);
 		}
@@ -2084,8 +2084,8 @@ static void i915_gem_reset_fences(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int i;
 
-	for (i = 0; i < dev_priv->num_fence_regs; i++) {
-		struct drm_i915_fence_reg *reg = &dev_priv->fence_regs[i];
+	for (i = 0; i < dev_priv->mm.num_fence_regs; i++) {
+		struct drm_i915_fence_reg *reg = &dev_priv->mm.fence_regs[i];
 
 		i915_gem_write_fence(dev, i, NULL);
 
@@ -2640,7 +2640,7 @@ static void i915_gem_write_fence(struct drm_device *dev, int reg,
 static inline int fence_number(struct drm_i915_private *dev_priv,
 			       struct drm_i915_fence_reg *fence)
 {
-	return fence - dev_priv->fence_regs;
+	return fence - dev_priv->mm.fence_regs;
 }
 
 static void i915_gem_object_update_fence(struct drm_i915_gem_object *obj,
@@ -2698,7 +2698,7 @@ i915_gem_object_put_fence(struct drm_i915_gem_object *obj)
 		return 0;
 
 	i915_gem_object_update_fence(obj,
-				     &dev_priv->fence_regs[obj->fence_reg],
+				     &dev_priv->mm.fence_regs[obj->fence_reg],
 				     false);
 	i915_gem_object_fence_lost(obj);
 
@@ -2714,8 +2714,8 @@ i915_find_fence_reg(struct drm_device *dev)
 
 	/* First try to find a free reg */
 	avail = NULL;
-	for (i = dev_priv->fence_reg_start; i < dev_priv->num_fence_regs; i++) {
-		reg = &dev_priv->fence_regs[i];
+	for (i = dev_priv->mm.fence_reg_start; i < dev_priv->mm.num_fence_regs; i++) {
+		reg = &dev_priv->mm.fence_regs[i];
 		if (!reg->obj)
 			return reg;
 
@@ -2771,7 +2771,7 @@ i915_gem_object_get_fence(struct drm_i915_gem_object *obj)
 
 	/* Just update our place in the LRU if our fence is getting reused. */
 	if (obj->fence_reg != I915_FENCE_REG_NONE) {
-		reg = &dev_priv->fence_regs[obj->fence_reg];
+		reg = &dev_priv->mm.fence_regs[obj->fence_reg];
 		if (!obj->fence_dirty) {
 			list_move_tail(&reg->lru_list,
 				       &dev_priv->mm.fence_list);
@@ -4169,7 +4169,7 @@ i915_gem_load(struct drm_device *dev)
 	for (i = 0; i < I915_NUM_RINGS; i++)
 		init_ring_lists(&dev_priv->ring[i]);
 	for (i = 0; i < I915_MAX_NUM_FENCES; i++)
-		INIT_LIST_HEAD(&dev_priv->fence_regs[i].lru_list);
+		INIT_LIST_HEAD(&dev_priv->mm.fence_regs[i].lru_list);
 	INIT_DELAYED_WORK(&dev_priv->mm.retire_work,
 			  i915_gem_retire_work_handler);
 	init_completion(&dev_priv->gpu_error.completion);
@@ -4184,12 +4184,12 @@ i915_gem_load(struct drm_device *dev)
 
 	/* Old X drivers will take 0-2 for front, back, depth buffers */
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
-		dev_priv->fence_reg_start = 3;
+		dev_priv->mm.fence_reg_start = 3;
 
 	if (INTEL_INFO(dev)->gen >= 4 || IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
-		dev_priv->num_fence_regs = 16;
+		dev_priv->mm.num_fence_regs = 16;
 	else
-		dev_priv->num_fence_regs = 8;
+		dev_priv->mm.num_fence_regs = 8;
 
 	/* Initialize fence registers to zero */
 	i915_gem_reset_fences(dev);
-- 
1.7.11.4



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux