drm/i915: Ivybridge still has fences!
Subsystems (2)
PATCH 1/3 drm/i915: Ivybridge still has fences!
So don't forget to restore them on resume and dump them into the error state.
--- drivers/gpu/drm/i915/i915_irq.c | 1 + drivers/gpu/drm/i915/i915_suspend.c | 2 ++ 2 files changed, 3 insertions(+), 0 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +1 -0
@@ -822,6 +822,7 @@ static void i915_gem_record_fences(struct drm_device *dev,/* Fences */ switch (INTEL_INFO (dev)->gen) { +case 7 :case 6 :for (i =0 ; i <16 ; i++) error->fence[i] =I915_READ64 (FENCE_REG_SANDYBRIDGE_0 + (i *8 ));
drivers/gpu/drm/i915/i915_suspend.c +2 -0
@@ -370,6 +370,7 @@ static void i915_save_modeset_reg(struct drm_device *dev)/* Fences */ switch (INTEL_INFO (dev)->gen) { +case 7 :case 6 :for (i =0 ; i <16 ; i++) dev_priv->saveFENCE[i] =I915_READ64 (FENCE_REG_SANDYBRIDGE_0 + (i *8 ));
@@ -404,6 +405,7 @@ static void i915_restore_modeset_reg(struct drm_device *dev)/* Fences */ switch (INTEL_INFO (dev)->gen) { +case 7 :case 6 :for (i =0 ; i <16 ; i++)I915_WRITE64 (FENCE_REG_SANDYBRIDGE_0 + (i *8 ), dev_priv->saveFENCE[i]);
Signature · 1 line
1.7.6.3
PATCH 2/3 drm/i915: add constants to size fence arrays and fields
In preparation of to support 32 fences on Ivybdrigde.
--- drivers/gpu/drm/i915/i915_drv.h | 15 ++++++++------- drivers/gpu/drm/i915/i915_gem.c | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +8 -7
@@ -126,6 +126,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 5struct drm_i915_fence_reg {struct list_head lru_list;
@@ -169,7 +172,7 @@ struct drm_i915_error_state {u32 instdone1;u32 seqno;u64 bbaddr; -u64 fence[16 ]; +u64 fence[I915_MAX_NUM_FENCES ];struct timeval time;struct drm_i915_error_object {int page_count;
@@ -183,7 +186,7 @@ struct drm_i915_error_state {u32 gtt_offset;u32 read_domains;u32 write_domain; - s32 fence_reg:5; + s32 fence_reg:I915_MAX_NUM_FENCE_BITS; s32 pinned:2; u32 tiling:2; u32 dirty:1;
@@ -377,7 +380,7 @@ typedef struct drm_i915_private {struct notifier_block lid_notifier;int crt_ddc_pin; -struct drm_i915_fence_reg fence_regs[16 ];/* assume 965 */ +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 */
@@ -508,7 +511,7 @@ typedef struct drm_i915_private {u8 saveAR[21 ];u8 saveDACMASK;u8 saveCR[37 ]; -uint64_t saveFENCE[16 ]; +uint64_t saveFENCE[I915_MAX_NUM_FENCES ];u32 saveCURACNTR;u32 saveCURAPOS;u32 saveCURABASE;
@@ -780,10 +783,8 @@ struct drm_i915_gem_object {* Fence register bits (if any) for this object. Will be set * as needed when mapped into the GTT. * Protected by dev->struct_mutex. -* -* Size: 4 bits for 16 fences + sign (for FENCE_REG_NONE) */ - signed int fence_reg:5; + signed int fence_reg:I915_MAX_NUM_FENCE_BITS;/** * Advice: are the backing pages purgeable?
drivers/gpu/drm/i915/i915_gem.c +2 -2
@@ -1743,7 +1743,7 @@ 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 <16 ; i++) { +for (i =0 ; i < dev_priv->num_fence_regs; i++) {struct drm_i915_fence_reg *reg = &dev_priv->fence_regs[i];struct drm_i915_gem_object *obj = reg->obj;
@@ -3905,7 +3905,7 @@ i915_gem_load(struct drm_device *dev)INIT_LIST_HEAD (&dev_priv->mm.gtt_list);for (i =0 ; i <I915_NUM_RINGS ; i++)init_ring_lists (&dev_priv->ring[i]); -for (i =0 ; i <16 ; i++) +for (i =0 ; i <I915_MAX_NUM_FENCES ; i++)INIT_LIST_HEAD (&dev_priv->fence_regs[i].lru_list);INIT_DELAYED_WORK (&dev_priv->mm.retire_work, i915_gem_retire_work_handler);
Signature · 1 line
1.7.6.3
Re: [PATCH 2/3] drm/i915: add constants to size fence arrays and fields
Quoted 1 line · Daniel Vetter
In preparation of to support 32 fences on Ivybdrigde.
Meh, English fail and sob line missing.
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
PATCH 3/3 drm/i915: enable support for 32 fences on ivybridge
In reply to Daniel Vetter--- drivers/gpu/drm/i915/i915_drv.h | 4 ++-- drivers/gpu/drm/i915/i915_gem.c | 4 +++- drivers/gpu/drm/i915/i915_irq.c | 2 +- drivers/gpu/drm/i915/i915_suspend.c | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -2
@@ -126,9 +126,9 @@ struct drm_i915_master_private {struct _drm_i915_sarea *sarea_priv; };#define I915_FENCE_REG_NONE -1 -#define I915_MAX_NUM_FENCES 16 +#define I915_MAX_NUM_FENCES 32/* 16 fences + sign bit for FENCE_REG_NONE */ -#define I915_MAX_NUM_FENCE_BITS 5 +#define I915_MAX_NUM_FENCE_BITS 6struct drm_i915_fence_reg {struct list_head lru_list;
drivers/gpu/drm/i915/i915_gem.c +3 -1
@@ -3927,7 +3927,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 ) + 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
@@ -824,7 +824,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 :
drivers/gpu/drm/i915/i915_suspend.c +2 -2
@@ -372,7 +372,7 @@ static void i915_save_modeset_reg(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++) dev_priv->saveFENCE[i] =I915_READ64 (FENCE_REG_SANDYBRIDGE_0 + (i *8 ));break ;case 5 :
@@ -407,7 +407,7 @@ static void i915_restore_modeset_reg(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++)I915_WRITE64 (FENCE_REG_SANDYBRIDGE_0 + (i *8 ), dev_priv->saveFENCE[i]);break ;case 5 :
Signature · 1 line
1.7.6.3
Quoted 2 lines · On Sun, 9 Oct 2011 21:52:01 +0200 Daniel Vetter <[email protected]> wrote:
So don't forget to restore them on resume and dump them into the error state.
This should probably just be >= 6 instead; I don't think we're getting rid of fences anytime soon.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 8 lines · Jesse Barnes
Quoted 2 lines · On Sun, 9 Oct 2011 21:52:01 +0200 Daniel Vetter <[email protected]> wrote:
So don't forget to restore them on resume and dump them into the error state.
This should probably just be >= 6 instead; I don't think we're getting rid of fences anytime soon.
As discussed on irc >= 6 is a bit hard to do in a switch statement ;-) Do you want me to resend the patches using the gcc ranged switch extension suggested by Adam Jackson (i.e. 6..UINT_MAX)? Or can you slap your r-b on them as-is?
-Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
Quoted 7 lines · On Sun, 23 Oct 2011 12:12:00 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 6 lines · Jesse Barnes
Quoted 2 lines · On Sun, 9 Oct 2011 21:52:01 +0200 Daniel Vetter <[email protected]> wrote:
So don't forget to restore them on resume and dump them into the error state.
Quoted 7 lines
Quoted 2 lines
This should probably just be >= 6 instead; I don't think we're getting rid of fences anytime soon.
As discussed on irc >= 6 is a bit hard to do in a switch statement ;-) Do you want me to resend the patches using the gcc ranged switch extension suggested by Adam Jackson (i.e. 6..UINT_MAX)? Or can you slap your r-b on them as-is?
I was suggesting that you convert it to an if ladder with the >= 6 at the top. That should be a separate patch though.
Jesse
Regardless of the outcome of Jesse's request for an if-ladder, the substance of the patches look sound.
However, I remain unconvinced that there are 32 fence registers on IVB. Daniel's evidence is based upon the size of the register map (and not on the BSPEC explicitly stating a change to 32 ;-), but most tellingly the bitfields for fence-number in other registers have not been updated - so we can only safely allocated the first 16 anyway...
(For instance, FBC_CTL).
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 9 lines · Chris Wilson
Regardless of the outcome of Jesse's request for an if-ladder, the substance of the patches look sound.
However, I remain unconvinced that there are 32 fence registers on IVB. Daniel's evidence is based upon the size of the register map (and not on the BSPEC explicitly stating a change to 32 ;-), but most tellingly the bitfields for fence-number in other registers have not been updated - so we can only safely allocated the first 16 anyway...
(For instance,FBC_CTL).
Ok, I've rechecked bspec. The FBC_CTL fence number is indeed only 4 bits wide, but on snb+ is must be written as 0. The cpu fence stuff for fbc moved to DPFC_CONTROL_SA, which has room enough for 5 bits. Unfortunately bspec is silent on whether that has actually grown from 4 bits for ivb. On a future hw iteration I'm not really allowed to talk about it is all correctly in place (i.e. bspec definitions for all 32 fence regs plus the 5 bit wide fence number in DPFC_CTL_SA).
So I think I'll drop this patch till things clear up.
Keith, can take a look at patches 1-2 and consider merging them for 3.2?
Yours, Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
Chris Wilson
Reviewed-byQuoted 1 line · Daniel Vetter
Keith, can take a look at patches 1-2 and consider merging them for 3.2?
Those two are
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 5 lines · Chris Wilson
Quoted 1 line · Daniel Vetter
Keith, can take a look at patches 1-2 and consider merging them for 3.2?
Those two are
Reviewed-by Chris Wilson <[email protected]>
And merged to -next.
Signature · 1 line
[email protected]
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 10 lines · Chris Wilson
Regardless of the outcome of Jesse's request for an if-ladder, the substance of the patches look sound.
However, I remain unconvinced that there are 32 fence registers on IVB. Daniel's evidence is based upon the size of the register map (and not on the BSPEC explicitly stating a change to 32 ;-), but most tellingly the bitfields for fence-number in other registers have not been updated - so we can only safely allocated the first 16 anyway...
(For instance,FBC_CTL).
-Chris
It sure looks like it has 32 fence registers: BSpec vol1g GT Interface Register [DevIVB] / GT Interface Register DevIVB / System Agent Config Space lists FENCE0 through FENCE31. The simulator seems to indicate this as well.
You're right that FBC_CTL still only has 4 bits for selecting a fence, but notably, in the latest (WIP) version of the BSpec, it says "This field must be programmed to 0000b." I'm not sure how it's supposed to work now, but likely something has changed.
Quoted 17 lines · Kenneth Graunke
Quoted 10 lines · Chris Wilson
Regardless of the outcome of Jesse's request for an if-ladder, the substance of the patches look sound.
However, I remain unconvinced that there are 32 fence registers on IVB. Daniel's evidence is based upon the size of the register map (and not on the BSPEC explicitly stating a change to 32 ;-), but most tellingly the bitfields for fence-number in other registers have not been updated - so we can only safely allocated the first 16 anyway...
(For instance,FBC_CTL).
-ChrisIt sure looks like it has 32 fence registers: BSpec vol1g GT Interface Register [DevIVB] / GT Interface Register DevIVB / System Agent Config Space lists FENCE0 through FENCE31. The simulator seems to indicate this as well.
Quoted 4 lines
You're right that
FBC_CTLstill only has 4 bits for selecting a fence, but notably, in the latest (WIP) version of the BSpec, it says "This field must be programmed to 0000b." I'm not sure how it's supposed to work now, but likely something has changed.
See my other mail. The cpu fence is specified in DPCF_CONTROL_SA, which has again 4 bits on snb, but enough free room for 5 bits. Now on some future hw I'm not allowed to talk about, these 5 bits exist (see MPGFXTRK_CR_DPFC_CONTROL_SA_0_2_0_GTTMMADR in bspec), but unfortunately not on ivb. So if you could hunt around in the sim code and check whether that is already implemented on ivb, that'd be awesome.
Thanks, Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48