aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2011-10-09 15:52:02 -0400
committerKeith Packard <keithp@keithp.com>2011-11-03 12:20:37 -0400
commit4b9de737fad5bd8993e6070530802de22f32744d (patch)
tree156183628ff3cc2a3887d71660e3c5d506e1e256 /drivers
parent775d17b6ca4357048f36c22151335addfe15db4b (diff)
drm/i915: add constants to size fence arrays and fields
In preparation of to support 32 fences on Ivybdrigde. Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h15
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c4
2 files changed, 10 insertions, 9 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 06a37f4fd74b..d2da91f90252 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -126,6 +126,9 @@ struct drm_i915_master_private {
126 struct _drm_i915_sarea *sarea_priv; 126 struct _drm_i915_sarea *sarea_priv;
127}; 127};
128#define I915_FENCE_REG_NONE -1 128#define I915_FENCE_REG_NONE -1
129#define I915_MAX_NUM_FENCES 16
130/* 16 fences + sign bit for FENCE_REG_NONE */
131#define I915_MAX_NUM_FENCE_BITS 5
129 132
130struct drm_i915_fence_reg { 133struct drm_i915_fence_reg {
131 struct list_head lru_list; 134 struct list_head lru_list;
@@ -168,7 +171,7 @@ struct drm_i915_error_state {
168 u32 instdone1; 171 u32 instdone1;
169 u32 seqno; 172 u32 seqno;
170 u64 bbaddr; 173 u64 bbaddr;
171 u64 fence[16]; 174 u64 fence[I915_MAX_NUM_FENCES];
172 struct timeval time; 175 struct timeval time;
173 struct drm_i915_error_object { 176 struct drm_i915_error_object {
174 int page_count; 177 int page_count;
@@ -182,7 +185,7 @@ struct drm_i915_error_state {
182 u32 gtt_offset; 185 u32 gtt_offset;
183 u32 read_domains; 186 u32 read_domains;
184 u32 write_domain; 187 u32 write_domain;
185 s32 fence_reg:5; 188 s32 fence_reg:I915_MAX_NUM_FENCE_BITS;
186 s32 pinned:2; 189 s32 pinned:2;
187 u32 tiling:2; 190 u32 tiling:2;
188 u32 dirty:1; 191 u32 dirty:1;
@@ -375,7 +378,7 @@ typedef struct drm_i915_private {
375 struct notifier_block lid_notifier; 378 struct notifier_block lid_notifier;
376 379
377 int crt_ddc_pin; 380 int crt_ddc_pin;
378 struct drm_i915_fence_reg fence_regs[16]; /* assume 965 */ 381 struct drm_i915_fence_reg fence_regs[I915_MAX_NUM_FENCES]; /* assume 965 */
379 int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */ 382 int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */
380 int num_fence_regs; /* 8 on pre-965, 16 otherwise */ 383 int num_fence_regs; /* 8 on pre-965, 16 otherwise */
381 384
@@ -506,7 +509,7 @@ typedef struct drm_i915_private {
506 u8 saveAR[21]; 509 u8 saveAR[21];
507 u8 saveDACMASK; 510 u8 saveDACMASK;
508 u8 saveCR[37]; 511 u8 saveCR[37];
509 uint64_t saveFENCE[16]; 512 uint64_t saveFENCE[I915_MAX_NUM_FENCES];
510 u32 saveCURACNTR; 513 u32 saveCURACNTR;
511 u32 saveCURAPOS; 514 u32 saveCURAPOS;
512 u32 saveCURABASE; 515 u32 saveCURABASE;
@@ -777,10 +780,8 @@ struct drm_i915_gem_object {
777 * Fence register bits (if any) for this object. Will be set 780 * Fence register bits (if any) for this object. Will be set
778 * as needed when mapped into the GTT. 781 * as needed when mapped into the GTT.
779 * Protected by dev->struct_mutex. 782 * Protected by dev->struct_mutex.
780 *
781 * Size: 4 bits for 16 fences + sign (for FENCE_REG_NONE)
782 */ 783 */
783 signed int fence_reg:5; 784 signed int fence_reg:I915_MAX_NUM_FENCE_BITS;
784 785
785 /** 786 /**
786 * Advice: are the backing pages purgeable? 787 * Advice: are the backing pages purgeable?
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index d18b07adcffa..a83859767d48 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1745,7 +1745,7 @@ static void i915_gem_reset_fences(struct drm_device *dev)
1745 struct drm_i915_private *dev_priv = dev->dev_private; 1745 struct drm_i915_private *dev_priv = dev->dev_private;
1746 int i; 1746 int i;
1747 1747
1748 for (i = 0; i < 16; i++) { 1748 for (i = 0; i < dev_priv->num_fence_regs; i++) {
1749 struct drm_i915_fence_reg *reg = &dev_priv->fence_regs[i]; 1749 struct drm_i915_fence_reg *reg = &dev_priv->fence_regs[i];
1750 struct drm_i915_gem_object *obj = reg->obj; 1750 struct drm_i915_gem_object *obj = reg->obj;
1751 1751
@@ -3877,7 +3877,7 @@ i915_gem_load(struct drm_device *dev)
3877 INIT_LIST_HEAD(&dev_priv->mm.gtt_list); 3877 INIT_LIST_HEAD(&dev_priv->mm.gtt_list);
3878 for (i = 0; i < I915_NUM_RINGS; i++) 3878 for (i = 0; i < I915_NUM_RINGS; i++)
3879 init_ring_lists(&dev_priv->ring[i]); 3879 init_ring_lists(&dev_priv->ring[i]);
3880 for (i = 0; i < 16; i++) 3880 for (i = 0; i < I915_MAX_NUM_FENCES; i++)
3881 INIT_LIST_HEAD(&dev_priv->fence_regs[i].lru_list); 3881 INIT_LIST_HEAD(&dev_priv->fence_regs[i].lru_list);
3882 INIT_DELAYED_WORK(&dev_priv->mm.retire_work, 3882 INIT_DELAYED_WORK(&dev_priv->mm.retire_work,
3883 i915_gem_retire_work_handler); 3883 i915_gem_retire_work_handler);