aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-03-07 07:32:44 -0500
committerChris Wilson <chris@chris-wilson.co.uk>2011-03-07 07:35:15 -0500
commit47ae63e0c2e5fdb582d471dc906eb29be94c732f (patch)
treef5aceffc0bc82c8cc4d5e96ef73280b018a6f333 /drivers/gpu
parentc59a333f73868ca6fbcecea99b3542e2c62a3a5c (diff)
parent467cffba85791cdfce38c124d75bd578f4bb8625 (diff)
Merge branch 'drm-intel-fixes' into drm-intel-next
Apply the trivial conflicting regression fixes, but keep GPU semaphores enabled. Conflicts: drivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem_execbuffer.c
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c4
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c17
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h23
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c2
-rw-r--r--drivers/gpu/drm/i915/i915_gem_execbuffer.c3
-rw-r--r--drivers/gpu/drm/i915/i915_gem_tiling.c38
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c8
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.h13
9 files changed, 70 insertions, 40 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index d659f36419af..09e0327fc6ce 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -873,7 +873,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
873 int max_freq; 873 int max_freq;
874 874
875 /* RPSTAT1 is in the GT power well */ 875 /* RPSTAT1 is in the GT power well */
876 __gen6_force_wake_get(dev_priv); 876 __gen6_gt_force_wake_get(dev_priv);
877 877
878 rpstat = I915_READ(GEN6_RPSTAT1); 878 rpstat = I915_READ(GEN6_RPSTAT1);
879 rpupei = I915_READ(GEN6_RP_CUR_UP_EI); 879 rpupei = I915_READ(GEN6_RP_CUR_UP_EI);
@@ -918,7 +918,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
918 seq_printf(m, "Max non-overclocked (RP0) frequency: %dMHz\n", 918 seq_printf(m, "Max non-overclocked (RP0) frequency: %dMHz\n",
919 max_freq * 100); 919 max_freq * 100);
920 920
921 __gen6_force_wake_put(dev_priv); 921 __gen6_gt_force_wake_put(dev_priv);
922 } else { 922 } else {
923 seq_printf(m, "no P-state info available\n"); 923 seq_printf(m, "no P-state info available\n");
924 } 924 }
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index bdf4ceb1049d..3dba19f28e44 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -49,6 +49,9 @@ module_param_named(panel_ignore_lid, i915_panel_ignore_lid, int, 0600);
49unsigned int i915_powersave = 1; 49unsigned int i915_powersave = 1;
50module_param_named(powersave, i915_powersave, int, 0600); 50module_param_named(powersave, i915_powersave, int, 0600);
51 51
52unsigned int i915_semaphores = 1;
53module_param_named(semaphores, i915_semaphores, int, 0600);
54
52unsigned int i915_enable_rc6 = 0; 55unsigned int i915_enable_rc6 = 0;
53module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600); 56module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600);
54 57
@@ -260,7 +263,7 @@ void intel_detect_pch (struct drm_device *dev)
260 } 263 }
261} 264}
262 265
263void __gen6_force_wake_get(struct drm_i915_private *dev_priv) 266void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv)
264{ 267{
265 int count; 268 int count;
266 269
@@ -276,12 +279,22 @@ void __gen6_force_wake_get(struct drm_i915_private *dev_priv)
276 udelay(10); 279 udelay(10);
277} 280}
278 281
279void __gen6_force_wake_put(struct drm_i915_private *dev_priv) 282void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv)
280{ 283{
281 I915_WRITE_NOTRACE(FORCEWAKE, 0); 284 I915_WRITE_NOTRACE(FORCEWAKE, 0);
282 POSTING_READ(FORCEWAKE); 285 POSTING_READ(FORCEWAKE);
283} 286}
284 287
288void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv)
289{
290 int loop = 500;
291 u32 fifo = I915_READ_NOTRACE(GT_FIFO_FREE_ENTRIES);
292 while (fifo < 20 && loop--) {
293 udelay(10);
294 fifo = I915_READ_NOTRACE(GT_FIFO_FREE_ENTRIES);
295 }
296}
297
285static int i915_drm_freeze(struct drm_device *dev) 298static int i915_drm_freeze(struct drm_device *dev)
286{ 299{
287 struct drm_i915_private *dev_priv = dev->dev_private; 300 struct drm_i915_private *dev_priv = dev->dev_private;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 9f3650c9882a..b68abf19bce8 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -961,6 +961,7 @@ extern int i915_max_ioctl;
961extern unsigned int i915_fbpercrtc; 961extern unsigned int i915_fbpercrtc;
962extern int i915_panel_ignore_lid; 962extern int i915_panel_ignore_lid;
963extern unsigned int i915_powersave; 963extern unsigned int i915_powersave;
964extern unsigned int i915_semaphores;
964extern unsigned int i915_lvds_downclock; 965extern unsigned int i915_lvds_downclock;
965extern unsigned int i915_panel_use_ssc; 966extern unsigned int i915_panel_use_ssc;
966extern int i915_vbt_sdvo_panel_type; 967extern int i915_vbt_sdvo_panel_type;
@@ -1172,6 +1173,9 @@ void i915_gem_detach_phys_object(struct drm_device *dev,
1172void i915_gem_free_all_phys_object(struct drm_device *dev); 1173void i915_gem_free_all_phys_object(struct drm_device *dev);
1173void i915_gem_release(struct drm_device *dev, struct drm_file *file); 1174void i915_gem_release(struct drm_device *dev, struct drm_file *file);
1174 1175
1176uint32_t
1177i915_gem_get_unfenced_gtt_alignment(struct drm_i915_gem_object *obj);
1178
1175/* i915_gem_gtt.c */ 1179/* i915_gem_gtt.c */
1176void i915_gem_restore_gtt_mappings(struct drm_device *dev); 1180void i915_gem_restore_gtt_mappings(struct drm_device *dev);
1177int __must_check i915_gem_gtt_bind_object(struct drm_i915_gem_object *obj); 1181int __must_check i915_gem_gtt_bind_object(struct drm_i915_gem_object *obj);
@@ -1348,20 +1352,29 @@ __i915_write(64, q)
1348 * must be set to prevent GT core from power down and stale values being 1352 * must be set to prevent GT core from power down and stale values being
1349 * returned. 1353 * returned.
1350 */ 1354 */
1351void __gen6_force_wake_get(struct drm_i915_private *dev_priv); 1355void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv);
1352void __gen6_force_wake_put (struct drm_i915_private *dev_priv); 1356void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv);
1353static inline u32 i915_safe_read(struct drm_i915_private *dev_priv, u32 reg) 1357void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv);
1358
1359static inline u32 i915_gt_read(struct drm_i915_private *dev_priv, u32 reg)
1354{ 1360{
1355 u32 val; 1361 u32 val;
1356 1362
1357 if (dev_priv->info->gen >= 6) { 1363 if (dev_priv->info->gen >= 6) {
1358 __gen6_force_wake_get(dev_priv); 1364 __gen6_gt_force_wake_get(dev_priv);
1359 val = I915_READ(reg); 1365 val = I915_READ(reg);
1360 __gen6_force_wake_put(dev_priv); 1366 __gen6_gt_force_wake_put(dev_priv);
1361 } else 1367 } else
1362 val = I915_READ(reg); 1368 val = I915_READ(reg);
1363 1369
1364 return val; 1370 return val;
1365} 1371}
1366 1372
1373static inline void i915_gt_write(struct drm_i915_private *dev_priv,
1374 u32 reg, u32 val)
1375{
1376 if (dev_priv->info->gen >= 6)
1377 __gen6_gt_wait_for_fifo(dev_priv);
1378 I915_WRITE(reg, val);
1379}
1367#endif 1380#endif
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index ac23dcf084be..950a5ab921ad 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1404,7 +1404,7 @@ i915_gem_get_gtt_alignment(struct drm_i915_gem_object *obj)
1404 * Return the required GTT alignment for an object, only taking into account 1404 * Return the required GTT alignment for an object, only taking into account
1405 * unfenced tiled surface requirements. 1405 * unfenced tiled surface requirements.
1406 */ 1406 */
1407static uint32_t 1407uint32_t
1408i915_gem_get_unfenced_gtt_alignment(struct drm_i915_gem_object *obj) 1408i915_gem_get_unfenced_gtt_alignment(struct drm_i915_gem_object *obj)
1409{ 1409{
1410 struct drm_device *dev = obj->base.dev; 1410 struct drm_device *dev = obj->base.dev;
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 8513c04dc892..7ff7f933ddf1 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -748,7 +748,8 @@ i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object *obj,
748 if (from == NULL || to == from) 748 if (from == NULL || to == from)
749 return 0; 749 return 0;
750 750
751 if (INTEL_INFO(obj->base.dev)->gen < 6) 751 /* XXX gpu semaphores are implicated in various hard hangs on SNB */
752 if (INTEL_INFO(obj->base.dev)->gen < 6 || !i915_semaphores)
752 return i915_gem_object_wait_rendering(obj); 753 return i915_gem_object_wait_rendering(obj);
753 754
754 idx = intel_ring_sync_index(from, to); 755 idx = intel_ring_sync_index(from, to);
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c
index 1f45019e6da3..281ad3d6115d 100644
--- a/drivers/gpu/drm/i915/i915_gem_tiling.c
+++ b/drivers/gpu/drm/i915/i915_gem_tiling.c
@@ -184,7 +184,7 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev)
184static bool 184static bool
185i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) 185i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
186{ 186{
187 int tile_width, tile_height; 187 int tile_width;
188 188
189 /* Linear is always fine */ 189 /* Linear is always fine */
190 if (tiling_mode == I915_TILING_NONE) 190 if (tiling_mode == I915_TILING_NONE)
@@ -215,20 +215,6 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
215 } 215 }
216 } 216 }
217 217
218 if (IS_GEN2(dev) ||
219 (tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev)))
220 tile_height = 32;
221 else
222 tile_height = 8;
223 /* i8xx is strange: It has 2 interleaved rows of tiles, so needs an even
224 * number of tile rows. */
225 if (IS_GEN2(dev))
226 tile_height *= 2;
227
228 /* Size needs to be aligned to a full tile row */
229 if (size & (tile_height * stride - 1))
230 return false;
231
232 /* 965+ just needs multiples of tile width */ 218 /* 965+ just needs multiples of tile width */
233 if (INTEL_INFO(dev)->gen >= 4) { 219 if (INTEL_INFO(dev)->gen >= 4) {
234 if (stride & (tile_width - 1)) 220 if (stride & (tile_width - 1))
@@ -298,6 +284,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
298 struct drm_i915_gem_set_tiling *args = data; 284 struct drm_i915_gem_set_tiling *args = data;
299 drm_i915_private_t *dev_priv = dev->dev_private; 285 drm_i915_private_t *dev_priv = dev->dev_private;
300 struct drm_i915_gem_object *obj; 286 struct drm_i915_gem_object *obj;
287 int ret = 0;
301 288
302 obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle)); 289 obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle));
303 if (&obj->base == NULL) 290 if (&obj->base == NULL)
@@ -358,14 +345,27 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
358 (obj->gtt_offset + obj->base.size <= dev_priv->mm.gtt_mappable_end && 345 (obj->gtt_offset + obj->base.size <= dev_priv->mm.gtt_mappable_end &&
359 i915_gem_object_fence_ok(obj, args->tiling_mode)); 346 i915_gem_object_fence_ok(obj, args->tiling_mode));
360 347
361 obj->tiling_changed = true; 348 /* Rebind if we need a change of alignment */
362 obj->tiling_mode = args->tiling_mode; 349 if (!obj->map_and_fenceable) {
363 obj->stride = args->stride; 350 u32 unfenced_alignment =
351 i915_gem_get_unfenced_gtt_alignment(obj);
352 if (obj->gtt_offset & (unfenced_alignment - 1))
353 ret = i915_gem_object_unbind(obj);
354 }
355
356 if (ret == 0) {
357 obj->tiling_changed = true;
358 obj->tiling_mode = args->tiling_mode;
359 obj->stride = args->stride;
360 }
364 } 361 }
362 /* we have to maintain this existing ABI... */
363 args->stride = obj->stride;
364 args->tiling_mode = obj->tiling_mode;
365 drm_gem_object_unreference(&obj->base); 365 drm_gem_object_unreference(&obj->base);
366 mutex_unlock(&dev->struct_mutex); 366 mutex_unlock(&dev->struct_mutex);
367 367
368 return 0; 368 return ret;
369} 369}
370 370
371/** 371/**
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 368819a23f73..363f66ca5d33 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -3318,6 +3318,8 @@
3318#define FORCEWAKE 0xA18C 3318#define FORCEWAKE 0xA18C
3319#define FORCEWAKE_ACK 0x130090 3319#define FORCEWAKE_ACK 0x130090
3320 3320
3321#define GT_FIFO_FREE_ENTRIES 0x120008
3322
3321#define GEN6_RPNSWREQ 0xA008 3323#define GEN6_RPNSWREQ 0xA008
3322#define GEN6_TURBO_DISABLE (1<<31) 3324#define GEN6_TURBO_DISABLE (1<<31)
3323#define GEN6_FREQUENCY(x) ((x)<<25) 3325#define GEN6_FREQUENCY(x) ((x)<<25)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 4a392b4a5ae9..3106c0dc8389 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1825,7 +1825,7 @@ static void sandybridge_blit_fbc_update(struct drm_device *dev)
1825 u32 blt_ecoskpd; 1825 u32 blt_ecoskpd;
1826 1826
1827 /* Make sure blitter notifies FBC of writes */ 1827 /* Make sure blitter notifies FBC of writes */
1828 __gen6_force_wake_get(dev_priv); 1828 __gen6_gt_force_wake_get(dev_priv);
1829 blt_ecoskpd = I915_READ(GEN6_BLITTER_ECOSKPD); 1829 blt_ecoskpd = I915_READ(GEN6_BLITTER_ECOSKPD);
1830 blt_ecoskpd |= GEN6_BLITTER_FBC_NOTIFY << 1830 blt_ecoskpd |= GEN6_BLITTER_FBC_NOTIFY <<
1831 GEN6_BLITTER_LOCK_SHIFT; 1831 GEN6_BLITTER_LOCK_SHIFT;
@@ -1836,7 +1836,7 @@ static void sandybridge_blit_fbc_update(struct drm_device *dev)
1836 GEN6_BLITTER_LOCK_SHIFT); 1836 GEN6_BLITTER_LOCK_SHIFT);
1837 I915_WRITE(GEN6_BLITTER_ECOSKPD, blt_ecoskpd); 1837 I915_WRITE(GEN6_BLITTER_ECOSKPD, blt_ecoskpd);
1838 POSTING_READ(GEN6_BLITTER_ECOSKPD); 1838 POSTING_READ(GEN6_BLITTER_ECOSKPD);
1839 __gen6_force_wake_put(dev_priv); 1839 __gen6_gt_force_wake_put(dev_priv);
1840} 1840}
1841 1841
1842static void ironlake_enable_fbc(struct drm_crtc *crtc, unsigned long interval) 1842static void ironlake_enable_fbc(struct drm_crtc *crtc, unsigned long interval)
@@ -6856,7 +6856,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv)
6856 * userspace... 6856 * userspace...
6857 */ 6857 */
6858 I915_WRITE(GEN6_RC_STATE, 0); 6858 I915_WRITE(GEN6_RC_STATE, 0);
6859 __gen6_force_wake_get(dev_priv); 6859 __gen6_gt_force_wake_get(dev_priv);
6860 6860
6861 /* disable the counters and set deterministic thresholds */ 6861 /* disable the counters and set deterministic thresholds */
6862 I915_WRITE(GEN6_RC_CONTROL, 0); 6862 I915_WRITE(GEN6_RC_CONTROL, 0);
@@ -6954,7 +6954,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv)
6954 /* enable all PM interrupts */ 6954 /* enable all PM interrupts */
6955 I915_WRITE(GEN6_PMINTRMSK, 0); 6955 I915_WRITE(GEN6_PMINTRMSK, 0);
6956 6956
6957 __gen6_force_wake_put(dev_priv); 6957 __gen6_gt_force_wake_put(dev_priv);
6958} 6958}
6959 6959
6960void intel_enable_clock_gating(struct drm_device *dev) 6960void intel_enable_clock_gating(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index bd6a5fbfa929..f23cc5f037a6 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -14,22 +14,23 @@ struct intel_hw_status_page {
14 struct drm_i915_gem_object *obj; 14 struct drm_i915_gem_object *obj;
15}; 15};
16 16
17#define I915_RING_READ(reg) i915_safe_read(dev_priv, reg) 17#define I915_RING_READ(reg) i915_gt_read(dev_priv, reg)
18#define I915_RING_WRITE(reg, val) i915_gt_write(dev_priv, reg, val)
18 19
19#define I915_READ_TAIL(ring) I915_RING_READ(RING_TAIL((ring)->mmio_base)) 20#define I915_READ_TAIL(ring) I915_RING_READ(RING_TAIL((ring)->mmio_base))
20#define I915_WRITE_TAIL(ring, val) I915_WRITE(RING_TAIL((ring)->mmio_base), val) 21#define I915_WRITE_TAIL(ring, val) I915_RING_WRITE(RING_TAIL((ring)->mmio_base), val)
21 22
22#define I915_READ_START(ring) I915_RING_READ(RING_START((ring)->mmio_base)) 23#define I915_READ_START(ring) I915_RING_READ(RING_START((ring)->mmio_base))
23#define I915_WRITE_START(ring, val) I915_WRITE(RING_START((ring)->mmio_base), val) 24#define I915_WRITE_START(ring, val) I915_RING_WRITE(RING_START((ring)->mmio_base), val)
24 25
25#define I915_READ_HEAD(ring) I915_RING_READ(RING_HEAD((ring)->mmio_base)) 26#define I915_READ_HEAD(ring) I915_RING_READ(RING_HEAD((ring)->mmio_base))
26#define I915_WRITE_HEAD(ring, val) I915_WRITE(RING_HEAD((ring)->mmio_base), val) 27#define I915_WRITE_HEAD(ring, val) I915_RING_WRITE(RING_HEAD((ring)->mmio_base), val)
27 28
28#define I915_READ_CTL(ring) I915_RING_READ(RING_CTL((ring)->mmio_base)) 29#define I915_READ_CTL(ring) I915_RING_READ(RING_CTL((ring)->mmio_base))
29#define I915_WRITE_CTL(ring, val) I915_WRITE(RING_CTL((ring)->mmio_base), val) 30#define I915_WRITE_CTL(ring, val) I915_RING_WRITE(RING_CTL((ring)->mmio_base), val)
30 31
31#define I915_WRITE_IMR(ring, val) I915_WRITE(RING_IMR((ring)->mmio_base), val)
32#define I915_READ_IMR(ring) I915_RING_READ(RING_IMR((ring)->mmio_base)) 32#define I915_READ_IMR(ring) I915_RING_READ(RING_IMR((ring)->mmio_base))
33#define I915_WRITE_IMR(ring, val) I915_RING_WRITE(RING_IMR((ring)->mmio_base), val)
33 34
34#define I915_READ_NOPID(ring) I915_RING_READ(RING_NOPID((ring)->mmio_base)) 35#define I915_READ_NOPID(ring) I915_RING_READ(RING_NOPID((ring)->mmio_base))
35#define I915_READ_SYNC_0(ring) I915_RING_READ(RING_SYNC_0((ring)->mmio_base)) 36#define I915_READ_SYNC_0(ring) I915_RING_READ(RING_SYNC_0((ring)->mmio_base))