diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2014-06-26 10:02:37 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-08-08 11:43:54 -0400 |
commit | 1abc4dc7e2ca7886b6b06bcf2ff1451702c83f9b (patch) | |
tree | 54c23bd54915b13dfb31749e5101cd5f1adfb31a | |
parent | 0a56067469bde6662ce7c89a3d290171f878bac4 (diff) |
drm/i915: Parametrize VLV_DDL registers
The VLV/CHV DDL registers are uniform, and neatly enough the register
offsets are sane so we can easily unify them to a single set of defines
and just pass the pipe as the parameter to compute the register offset.
Note that we now fill out the drain latency for pipe C on CHV which we
didn't do before. The rest of the pipe C watermarks are still untouched
but that will be remedied later by adding a proper cherryview_update_wm()
function.
v2: Add a note about CHV pipe C changes (Paulo)
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/i915_reg.h | 54 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_pm.c | 52 |
2 files changed, 36 insertions, 70 deletions
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index a87eb18b4c90..fbdb08f4cd76 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -3999,47 +3999,19 @@ enum punit_power_well { | |||
3999 | /* drain latency register values*/ | 3999 | /* drain latency register values*/ |
4000 | #define DRAIN_LATENCY_PRECISION_32 32 | 4000 | #define DRAIN_LATENCY_PRECISION_32 32 |
4001 | #define DRAIN_LATENCY_PRECISION_64 64 | 4001 | #define DRAIN_LATENCY_PRECISION_64 64 |
4002 | #define VLV_DDL1 (VLV_DISPLAY_BASE + 0x70050) | 4002 | #define VLV_DDL(pipe) (VLV_DISPLAY_BASE + 0x70050 + 4 * (pipe)) |
4003 | #define DDL_CURSORA_PRECISION_64 (1<<31) | 4003 | #define DDL_CURSOR_PRECISION_64 (1<<31) |
4004 | #define DDL_CURSORA_PRECISION_32 (0<<31) | 4004 | #define DDL_CURSOR_PRECISION_32 (0<<31) |
4005 | #define DDL_CURSORA_SHIFT 24 | 4005 | #define DDL_CURSOR_SHIFT 24 |
4006 | #define DDL_SPRITEB_PRECISION_64 (1<<23) | 4006 | #define DDL_SPRITE1_PRECISION_64 (1<<23) |
4007 | #define DDL_SPRITEB_PRECISION_32 (0<<23) | 4007 | #define DDL_SPRITE1_PRECISION_32 (0<<23) |
4008 | #define DDL_SPRITEB_SHIFT 16 | 4008 | #define DDL_SPRITE1_SHIFT 16 |
4009 | #define DDL_SPRITEA_PRECISION_64 (1<<15) | 4009 | #define DDL_SPRITE0_PRECISION_64 (1<<15) |
4010 | #define DDL_SPRITEA_PRECISION_32 (0<<15) | 4010 | #define DDL_SPRITE0_PRECISION_32 (0<<15) |
4011 | #define DDL_SPRITEA_SHIFT 8 | 4011 | #define DDL_SPRITE0_SHIFT 8 |
4012 | #define DDL_PLANEA_PRECISION_64 (1<<7) | 4012 | #define DDL_PLANE_PRECISION_64 (1<<7) |
4013 | #define DDL_PLANEA_PRECISION_32 (0<<7) | 4013 | #define DDL_PLANE_PRECISION_32 (0<<7) |
4014 | #define DDL_PLANEA_SHIFT 0 | 4014 | #define DDL_PLANE_SHIFT 0 |
4015 | |||
4016 | #define VLV_DDL2 (VLV_DISPLAY_BASE + 0x70054) | ||
4017 | #define DDL_CURSORB_PRECISION_64 (1<<31) | ||
4018 | #define DDL_CURSORB_PRECISION_32 (0<<31) | ||
4019 | #define DDL_CURSORB_SHIFT 24 | ||
4020 | #define DDL_SPRITED_PRECISION_64 (1<<23) | ||
4021 | #define DDL_SPRITED_PRECISION_32 (0<<23) | ||
4022 | #define DDL_SPRITED_SHIFT 16 | ||
4023 | #define DDL_SPRITEC_PRECISION_64 (1<<15) | ||
4024 | #define DDL_SPRITEC_PRECISION_32 (0<<15) | ||
4025 | #define DDL_SPRITEC_SHIFT 8 | ||
4026 | #define DDL_PLANEB_PRECISION_64 (1<<7) | ||
4027 | #define DDL_PLANEB_PRECISION_32 (0<<7) | ||
4028 | #define DDL_PLANEB_SHIFT 0 | ||
4029 | |||
4030 | #define VLV_DDL3 (VLV_DISPLAY_BASE + 0x70058) | ||
4031 | #define DDL_CURSORC_PRECISION_64 (1<<31) | ||
4032 | #define DDL_CURSORC_PRECISION_32 (0<<31) | ||
4033 | #define DDL_CURSORC_SHIFT 24 | ||
4034 | #define DDL_SPRITEF_PRECISION_64 (1<<23) | ||
4035 | #define DDL_SPRITEF_PRECISION_32 (0<<23) | ||
4036 | #define DDL_SPRITEF_SHIFT 16 | ||
4037 | #define DDL_SPRITEE_PRECISION_64 (1<<15) | ||
4038 | #define DDL_SPRITEE_PRECISION_32 (0<<15) | ||
4039 | #define DDL_SPRITEE_SHIFT 8 | ||
4040 | #define DDL_PLANEC_PRECISION_64 (1<<7) | ||
4041 | #define DDL_PLANEC_PRECISION_32 (0<<7) | ||
4042 | #define DDL_PLANEC_SHIFT 0 | ||
4043 | 4015 | ||
4044 | /* FIFO watermark sizes etc */ | 4016 | /* FIFO watermark sizes etc */ |
4045 | #define G4X_FIFO_LINE_SIZE 64 | 4017 | #define G4X_FIFO_LINE_SIZE 64 |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 0f9164d854de..2573c6967559 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -1313,35 +1313,29 @@ static bool vlv_compute_drain_latency(struct drm_device *dev, | |||
1313 | static void vlv_update_drain_latency(struct drm_device *dev) | 1313 | static void vlv_update_drain_latency(struct drm_device *dev) |
1314 | { | 1314 | { |
1315 | struct drm_i915_private *dev_priv = dev->dev_private; | 1315 | struct drm_i915_private *dev_priv = dev->dev_private; |
1316 | int planea_prec, planea_dl, planeb_prec, planeb_dl; | 1316 | enum pipe pipe; |
1317 | int cursora_prec, cursora_dl, cursorb_prec, cursorb_dl; | 1317 | |
1318 | int plane_prec_mult, cursor_prec_mult; /* Precision multiplier is | 1318 | for_each_pipe(pipe) { |
1319 | either 16 or 32 */ | 1319 | int plane_prec, plane_dl; |
1320 | 1320 | int cursor_prec, cursor_dl; | |
1321 | /* For plane A, Cursor A */ | 1321 | int plane_prec_mult, cursor_prec_mult; |
1322 | if (vlv_compute_drain_latency(dev, 0, &plane_prec_mult, &planea_dl, | 1322 | |
1323 | &cursor_prec_mult, &cursora_dl)) { | 1323 | if (!vlv_compute_drain_latency(dev, pipe, &plane_prec_mult, &plane_dl, |
1324 | cursora_prec = (cursor_prec_mult == DRAIN_LATENCY_PRECISION_32) ? | 1324 | &cursor_prec_mult, &cursor_dl)) |
1325 | DDL_CURSORA_PRECISION_32 : DDL_CURSORA_PRECISION_64; | 1325 | continue; |
1326 | planea_prec = (plane_prec_mult == DRAIN_LATENCY_PRECISION_32) ? | 1326 | |
1327 | DDL_PLANEA_PRECISION_32 : DDL_PLANEA_PRECISION_64; | 1327 | /* |
1328 | 1328 | * FIXME CHV spec still lists 16 and 32 as the precision | |
1329 | I915_WRITE(VLV_DDL1, cursora_prec | | 1329 | * values. Need to figure out if spec is outdated or what. |
1330 | (cursora_dl << DDL_CURSORA_SHIFT) | | 1330 | */ |
1331 | planea_prec | planea_dl); | 1331 | cursor_prec = (cursor_prec_mult == DRAIN_LATENCY_PRECISION_64) ? |
1332 | } | 1332 | DDL_CURSOR_PRECISION_64 : DDL_CURSOR_PRECISION_32; |
1333 | 1333 | plane_prec = (plane_prec_mult == DRAIN_LATENCY_PRECISION_64) ? | |
1334 | /* For plane B, Cursor B */ | 1334 | DDL_PLANE_PRECISION_64 : DDL_PLANE_PRECISION_32; |
1335 | if (vlv_compute_drain_latency(dev, 1, &plane_prec_mult, &planeb_dl, | 1335 | |
1336 | &cursor_prec_mult, &cursorb_dl)) { | 1336 | I915_WRITE(VLV_DDL(pipe), cursor_prec | |
1337 | cursorb_prec = (cursor_prec_mult == DRAIN_LATENCY_PRECISION_32) ? | 1337 | (cursor_dl << DDL_CURSOR_SHIFT) | |
1338 | DDL_CURSORB_PRECISION_32 : DDL_CURSORB_PRECISION_64; | 1338 | plane_prec | (plane_dl << DDL_PLANE_SHIFT)); |
1339 | planeb_prec = (plane_prec_mult == DRAIN_LATENCY_PRECISION_32) ? | ||
1340 | DDL_PLANEB_PRECISION_32 : DDL_PLANEB_PRECISION_64; | ||
1341 | |||
1342 | I915_WRITE(VLV_DDL2, cursorb_prec | | ||
1343 | (cursorb_dl << DDL_CURSORB_SHIFT) | | ||
1344 | planeb_prec | planeb_dl); | ||
1345 | } | 1339 | } |
1346 | } | 1340 | } |
1347 | 1341 | ||