diff options
author | Andi Kleen <ak@linux.intel.com> | 2011-10-13 19:08:51 -0400 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-10-21 02:21:58 -0400 |
commit | f700088333c5c7e5a7f4ab71b642362290259e26 (patch) | |
tree | f934ef5ee960e0aecfb796b71ad054ef01b7da2d /drivers | |
parent | a487928908226df493a3ce145ecf4bb39296714e (diff) |
i915: Move i915_read/write out of line
With the tracing code in there they are far too big to inline.
.text savings compared to a non force inline kernel:
i915_restore_display 4393 12036 +7643
i915_save_display 4295 11459 +7164
i915_handle_error 2979 6666 +3687
i915_driver_irq_handler 2923 5086 +2163
i915_ringbuffer_info 458 1661 +1203
i915_save_vga - 1200 +1200
i915_driver_irq_uninstall 453 1624 +1171
i915_driver_irq_postinstall 913 2078 +1165
ironlake_enable_drps 719 1872 +1153
i915_restore_vga - 1142 +1142
intel_display_capture_error_state 784 2030 +1246
intel_init_emon 719 2016 +1297
and more ...
[AK: these are older numbers, with the new SNB forcewake checks
it will be even worse]
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.c | 40 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 22 |
2 files changed, 43 insertions, 19 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 74f2cdbad821..4c8d681c2151 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -898,3 +898,43 @@ module_exit(i915_exit); | |||
898 | MODULE_AUTHOR(DRIVER_AUTHOR); | 898 | MODULE_AUTHOR(DRIVER_AUTHOR); |
899 | MODULE_DESCRIPTION(DRIVER_DESC); | 899 | MODULE_DESCRIPTION(DRIVER_DESC); |
900 | MODULE_LICENSE("GPL and additional rights"); | 900 | MODULE_LICENSE("GPL and additional rights"); |
901 | |||
902 | /* We give fast paths for the really cool registers */ | ||
903 | #define NEEDS_FORCE_WAKE(dev_priv, reg) \ | ||
904 | (((dev_priv)->info->gen >= 6) && \ | ||
905 | ((reg) < 0x40000) && \ | ||
906 | ((reg) != FORCEWAKE)) | ||
907 | |||
908 | #define __i915_read(x, y) \ | ||
909 | u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \ | ||
910 | u##x val = 0; \ | ||
911 | if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \ | ||
912 | gen6_gt_force_wake_get(dev_priv); \ | ||
913 | val = read##y(dev_priv->regs + reg); \ | ||
914 | gen6_gt_force_wake_put(dev_priv); \ | ||
915 | } else { \ | ||
916 | val = read##y(dev_priv->regs + reg); \ | ||
917 | } \ | ||
918 | trace_i915_reg_rw(false, reg, val, sizeof(val)); \ | ||
919 | return val; \ | ||
920 | } | ||
921 | |||
922 | __i915_read(8, b) | ||
923 | __i915_read(16, w) | ||
924 | __i915_read(32, l) | ||
925 | __i915_read(64, q) | ||
926 | #undef __i915_read | ||
927 | |||
928 | #define __i915_write(x, y) \ | ||
929 | void i915_write##x(struct drm_i915_private *dev_priv, u32 reg, u##x val) { \ | ||
930 | trace_i915_reg_rw(true, reg, val, sizeof(val)); \ | ||
931 | if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \ | ||
932 | __gen6_gt_wait_for_fifo(dev_priv); \ | ||
933 | } \ | ||
934 | write##y(val, dev_priv->regs + reg); \ | ||
935 | } | ||
936 | __i915_write(8, b) | ||
937 | __i915_write(16, w) | ||
938 | __i915_write(32, l) | ||
939 | __i915_write(64, q) | ||
940 | #undef __i915_write | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index c5ca0d37f089..06a37f4fd74b 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1355,18 +1355,7 @@ void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv); | |||
1355 | ((reg) != FORCEWAKE)) | 1355 | ((reg) != FORCEWAKE)) |
1356 | 1356 | ||
1357 | #define __i915_read(x, y) \ | 1357 | #define __i915_read(x, y) \ |
1358 | static inline u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \ | 1358 | u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg); |
1359 | u##x val = 0; \ | ||
1360 | if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \ | ||
1361 | gen6_gt_force_wake_get(dev_priv); \ | ||
1362 | val = read##y(dev_priv->regs + reg); \ | ||
1363 | gen6_gt_force_wake_put(dev_priv); \ | ||
1364 | } else { \ | ||
1365 | val = read##y(dev_priv->regs + reg); \ | ||
1366 | } \ | ||
1367 | trace_i915_reg_rw(false, reg, val, sizeof(val)); \ | ||
1368 | return val; \ | ||
1369 | } | ||
1370 | 1359 | ||
1371 | __i915_read(8, b) | 1360 | __i915_read(8, b) |
1372 | __i915_read(16, w) | 1361 | __i915_read(16, w) |
@@ -1375,13 +1364,8 @@ __i915_read(64, q) | |||
1375 | #undef __i915_read | 1364 | #undef __i915_read |
1376 | 1365 | ||
1377 | #define __i915_write(x, y) \ | 1366 | #define __i915_write(x, y) \ |
1378 | static inline void i915_write##x(struct drm_i915_private *dev_priv, u32 reg, u##x val) { \ | 1367 | void i915_write##x(struct drm_i915_private *dev_priv, u32 reg, u##x val); |
1379 | trace_i915_reg_rw(true, reg, val, sizeof(val)); \ | 1368 | |
1380 | if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \ | ||
1381 | __gen6_gt_wait_for_fifo(dev_priv); \ | ||
1382 | } \ | ||
1383 | write##y(val, dev_priv->regs + reg); \ | ||
1384 | } | ||
1385 | __i915_write(8, b) | 1369 | __i915_write(8, b) |
1386 | __i915_write(16, w) | 1370 | __i915_write(16, w) |
1387 | __i915_write(32, l) | 1371 | __i915_write(32, l) |