Skip to contentSkip to conversation

drm/i915: IVB/HSW have 32 fence register

PATCH Applied [email protected] 2 participants 7 messages Apr 9, 2013 – Apr 11, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/i915: IVB/HSW have 32 fence register

From: Ville Syrjälä <[email protected]>

Increase the number of fence registers to 32 on IVB/HSW. VLV however only has 16 fence registers according to the docs.

---
 drivers/gpu/drm/i915/i915_drv.h | 6 +++---
 drivers/gpu/drm/i915/i915_gem.c | 4 +++-
 drivers/gpu/drm/i915/i915_irq.c | 2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +3 -3
index 69ddfd1..fa8ca2f 100644
@@ -195,9 +195,9 @@ struct drm_i915_master_private {
 	struct _drm_i915_sarea *sarea_priv;
 };
 #define I915_FENCE_REG_NONE -1
-#define I915_MAX_NUM_FENCES 16
-/* 16 fences + sign bit for FENCE_REG_NONE */
-#define I915_MAX_NUM_FENCE_BITS 5
+#define I915_MAX_NUM_FENCES 32
+/* 32 fences + sign bit for FENCE_REG_NONE */
+#define I915_MAX_NUM_FENCE_BITS 6
 
 struct drm_i915_fence_reg {
 	struct list_head lru_list;
drivers/gpu/drm/i915/i915_gem.c +3 -1
index 63c05dd..211ce8f 100644
@@ -4184,7 +4184,9 @@ i915_gem_load(struct drm_device *dev)
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
 		dev_priv->fence_reg_start = 3;
 
-	if (INTEL_INFO(dev)->gen >= 4 || IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
+	if (INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev))
+		dev_priv->num_fence_regs = 32;
+	else if (INTEL_INFO(dev)->gen >= 4 || IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
 		dev_priv->num_fence_regs = 16;
 	else
 		dev_priv->num_fence_regs = 8;
drivers/gpu/drm/i915/i915_irq.c +1 -1
index fc35d52..985d1f5 100644
@@ -1217,7 +1217,7 @@ static void i915_gem_record_fences(struct drm_device *dev,
 	switch (INTEL_INFO(dev)->gen) {
 	case 7:
 	case 6:
-		for (i = 0; i < 16; i++)
+		for (i = 0; i < dev_priv->num_fence_regs; i++)
 			error->fence[i] = I915_READ64(FENCE_REG_SANDYBRIDGE_0 + (i * 8));
 		break;
 	case 5:
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/2 drm/i915: Increase max fence pitch limit to 256KB on IVB+

From: Ville Syrjälä <[email protected]>

BSpec contains several scattered notes which state that the maximum fence stride was increased to 256KB on IVB.

Testing on real hardware agrees.

---
 drivers/gpu/drm/i915/i915_gem_tiling.c | 9 ++++++---
 drivers/gpu/drm/i915/i915_reg.h        | 1 +
 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_tiling.c +6 -3
index c807eb9..139d17d 100644
@@ -217,9 +217,12 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
 		tile_width = 512;
 
 	/* check maximum stride & object size */
-	if (INTEL_INFO(dev)->gen >= 4) {
-		/* i965 stores the end address of the gtt mapping in the fence
-		 * reg, so dont bother to check the size */
+	/* i965+ stores the end address of the gtt mapping in the fence
+	 * reg, so dont bother to check the size */
+	if (INTEL_INFO(dev)->gen >= 7) {
+		if (stride / 128 > GEN7_FENCE_MAX_PITCH_VAL)
+			return false;
+	} else if (INTEL_INFO(dev)->gen >= 4) {
 		if (stride / 128 > I965_FENCE_MAX_PITCH_VAL)
 			return false;
 	} else {
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 0e4b7fb..ec4e054 100644
@@ -424,6 +424,7 @@
 
 #define FENCE_REG_SANDYBRIDGE_0		0x100000
 #define   SANDYBRIDGE_FENCE_PITCH_SHIFT	32
+#define   GEN7_FENCE_MAX_PITCH_VAL	0x0800
 
 /* control register for cpu gtt access */
 #define TILECTL				0x101000
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [PATCH 2/2] drm/i915: Increase max fence pitch limit to 256KB on IVB+

Quoted 18 lines · On Tue, Apr 09, 2013 at 11:45:05AM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

BSpec contains several scattered notes which state that the maximum fence stride was increased to 256KB on IVB.

Testing on real hardware agrees.

---
 drivers/gpu/drm/i915/i915_gem_tiling.c | 9 ++++++---
 drivers/gpu/drm/i915/i915_reg.h        | 1 +
 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_tiling.c +0 -0
index c807eb9..139d17d 100644

drivers/gpu/drm/i915/i915_gem_tiling.c i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) · line 222

Quoted 9 lines
drivers/gpu/drm/i915/i915_gem_tiling.c +3 -3
@@ -217,9 +217,12 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
 		tile_width = 512;
 
 	/* check maximum stride & object size */
-	if (INTEL_INFO(dev)->gen >= 4) {
-		/* i965 stores the end address of the gtt mapping in the fence
-		 * reg, so dont bother to check the size */
+	/* i965+ stores the end address of the gtt mapping in the fence
+	 * reg, so dont bother to check the size */
+	if (INTEL_INFO(dev)->gen >= 7) {

I've thought that his does not apply to vlv? Or has that now changed? -Daniel

Quoted 25 lines
drivers/gpu/drm/i915/i915_gem_tiling.c +3 -0
+		if (stride / 128 > GEN7_FENCE_MAX_PITCH_VAL)
+			return false;
+	} else if (INTEL_INFO(dev)->gen >= 4) {
 		if (stride / 128 > I965_FENCE_MAX_PITCH_VAL)
 			return false;
 	} else {
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 0e4b7fb..ec4e054 100644
@@ -424,6 +424,7 @@
 
 #define FENCE_REG_SANDYBRIDGE_0		0x100000
 #define   SANDYBRIDGE_FENCE_PITCH_SHIFT	32
+#define   GEN7_FENCE_MAX_PITCH_VAL	0x0800
 
 /* control register for cpu gtt access */
 #define TILECTL				0x101000
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#3 lore raw

Re: [PATCH 2/2] drm/i915: Increase max fence pitch limit to 256KB on IVB+

Quoted 21 lines · Daniel Vetter
Quoted 20 lines · On Tue, Apr 09, 2013 at 11:45:05AM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

BSpec contains several scattered notes which state that the maximum fence stride was increased to 256KB on IVB.

Testing on real hardware agrees.

---
 drivers/gpu/drm/i915/i915_gem_tiling.c | 9 ++++++---
 drivers/gpu/drm/i915/i915_reg.h        | 1 +
 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_tiling.c +0 -0
index c807eb9..139d17d 100644
@@ -217,9 +217,12 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
 		tile_width = 512;
 
Quoted 9 lines

drivers/gpu/drm/i915/i915_gem_tiling.c i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) · line 222

Quoted 7 lines
drivers/gpu/drm/i915/i915_gem_tiling.c +3 -3
 	/* check maximum stride & object size */
-	if (INTEL_INFO(dev)->gen >= 4) {
-		/* i965 stores the end address of the gtt mapping in the fence
-		 * reg, so dont bother to check the size */
+	/* i965+ stores the end address of the gtt mapping in the fence
+	 * reg, so dont bother to check the size */
+	if (INTEL_INFO(dev)->gen >= 7) {

I've thought that his does not apply to vlv? Or has that now changed?

The docs are telling me that VLV also has 256KB max stride.

Quoted 32 lines

-Daniel

Quoted 25 lines
drivers/gpu/drm/i915/i915_gem_tiling.c +3 -0
+		if (stride / 128 > GEN7_FENCE_MAX_PITCH_VAL)
+			return false;
+	} else if (INTEL_INFO(dev)->gen >= 4) {
 		if (stride / 128 > I965_FENCE_MAX_PITCH_VAL)
 			return false;
 	} else {
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 0e4b7fb..ec4e054 100644
@@ -424,6 +424,7 @@
 
 #define FENCE_REG_SANDYBRIDGE_0		0x100000
 #define   SANDYBRIDGE_FENCE_PITCH_SHIFT	32
+#define   GEN7_FENCE_MAX_PITCH_VAL	0x0800
 
 /* control register for cpu gtt access */
 #define TILECTL				0x101000
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 2 lines
Ville Syrjälä
Intel OTC
#4 lore raw

Re: [PATCH 2/2] drm/i915: Increase max fence pitch limit to 256KB on IVB+

Quoted 32 lines · Ville Syrjälä
Quoted 21 lines · Daniel Vetter
Quoted 20 lines · On Tue, Apr 09, 2013 at 11:45:05AM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

BSpec contains several scattered notes which state that the maximum fence stride was increased to 256KB on IVB.

Testing on real hardware agrees.

---
 drivers/gpu/drm/i915/i915_gem_tiling.c | 9 ++++++---
 drivers/gpu/drm/i915/i915_reg.h        | 1 +
 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_tiling.c +0 -0
index c807eb9..139d17d 100644
@@ -217,9 +217,12 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
 		tile_width = 512;
 
Quoted 9 lines

drivers/gpu/drm/i915/i915_gem_tiling.c i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) · line 222

Quoted 7 lines
drivers/gpu/drm/i915/i915_gem_tiling.c +3 -3
 	/* check maximum stride & object size */
-	if (INTEL_INFO(dev)->gen >= 4) {
-		/* i965 stores the end address of the gtt mapping in the fence
-		 * reg, so dont bother to check the size */
+	/* i965+ stores the end address of the gtt mapping in the fence
+	 * reg, so dont bother to check the size */
+	if (INTEL_INFO(dev)->gen >= 7) {

I've thought that his does not apply to vlv? Or has that now changed?

Quoted 1 line

The docs are telling me that VLV also has 256KB max stride.

Queued for -next, thanks for the patch.
-Daniel

Quoted 37 lines
Quoted 33 lines

-Daniel

Quoted 25 lines
drivers/gpu/drm/i915/i915_gem_tiling.c +3 -0
+		if (stride / 128 > GEN7_FENCE_MAX_PITCH_VAL)
+			return false;
+	} else if (INTEL_INFO(dev)->gen >= 4) {
 		if (stride / 128 > I965_FENCE_MAX_PITCH_VAL)
 			return false;
 	} else {
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 0e4b7fb..ec4e054 100644
@@ -424,6 +424,7 @@
 
 #define FENCE_REG_SANDYBRIDGE_0		0x100000
 #define   SANDYBRIDGE_FENCE_PITCH_SHIFT	32
+#define   GEN7_FENCE_MAX_PITCH_VAL	0x0800
 
 /* control register for cpu gtt access */
 #define TILECTL				0x101000
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 2 lines
Ville Syrjälä
Intel OTC
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#5 lore raw

PATCH v2 1/1 drm/i915: IVB/HSW have 32 fence register

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

Increase the number of fence registers to 32 on IVB/HSW. VLV however only has 16 fence registers according to the docs.

Increasing the number of fences was attempted before [1], but there was some uncertainty about the maximum CPU fence number for FBC. Since then BSpec has been updated to state that there are in fact 32 fence registers, and the CPU fence number field in the SNB_DPFC_CTL_SA register is 5 bits, and the CPU fence number field in the ILK_DPFC_CONTROL register must be zero. So now it all makes sense.

[1] http://lists.freedesktop.org/archives/intel-gfx/2011-October/012865.html

v2: Include some background information based on the previous attempt

---
 drivers/gpu/drm/i915/i915_drv.h | 6 +++---
 drivers/gpu/drm/i915/i915_gem.c | 4 +++-
 drivers/gpu/drm/i915/i915_irq.c | 2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +3 -3
index 69ddfd1..fa8ca2f 100644
@@ -195,9 +195,9 @@ struct drm_i915_master_private {
 	struct _drm_i915_sarea *sarea_priv;
 };
 #define I915_FENCE_REG_NONE -1
-#define I915_MAX_NUM_FENCES 16
-/* 16 fences + sign bit for FENCE_REG_NONE */
-#define I915_MAX_NUM_FENCE_BITS 5
+#define I915_MAX_NUM_FENCES 32
+/* 32 fences + sign bit for FENCE_REG_NONE */
+#define I915_MAX_NUM_FENCE_BITS 6
 
 struct drm_i915_fence_reg {
 	struct list_head lru_list;
drivers/gpu/drm/i915/i915_gem.c +3 -1
index 63c05dd..211ce8f 100644
@@ -4184,7 +4184,9 @@ i915_gem_load(struct drm_device *dev)
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
 		dev_priv->fence_reg_start = 3;
 
-	if (INTEL_INFO(dev)->gen >= 4 || IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
+	if (INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev))
+		dev_priv->num_fence_regs = 32;
+	else if (INTEL_INFO(dev)->gen >= 4 || IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
 		dev_priv->num_fence_regs = 16;
 	else
 		dev_priv->num_fence_regs = 8;
drivers/gpu/drm/i915/i915_irq.c +1 -1
index fc35d52..985d1f5 100644
@@ -1217,7 +1217,7 @@ static void i915_gem_record_fences(struct drm_device *dev,
 	switch (INTEL_INFO(dev)->gen) {
 	case 7:
 	case 6:
-		for (i = 0; i < 16; i++)
+		for (i = 0; i < dev_priv->num_fence_regs; i++)
 			error->fence[i] = I915_READ64(FENCE_REG_SANDYBRIDGE_0 + (i * 8));
 		break;
 	case 5:
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw
Quoted 12 lines · On Tue, Apr 09, 2013 at 01:02:47PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Increase the number of fence registers to 32 on IVB/HSW. VLV however only has 16 fence registers according to the docs.

Increasing the number of fences was attempted before [1], but there was some uncertainty about the maximum CPU fence number for FBC. Since then BSpec has been updated to state that there are in fact 32 fence registers, and the CPU fence number field in the SNB_DPFC_CTL_SA register is 5 bits, and the CPU fence number field in the ILK_DPFC_CONTROL register must be zero. So now it all makes sense.

Quoted 5 lines

[1] http://lists.freedesktop.org/archives/intel-gfx/2011-October/012865.html

v2: Include some background information based on the previous attempt

Queued for -next, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch