aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_pm.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2017-08-01 12:58:13 -0400
committerDaniel Stone <daniels@collabora.com>2017-08-10 12:58:36 -0400
commit2e2adb05736c3101a0b301e39bf5adabb8b5fb22 (patch)
tree75444c305c73d217612d819440a8ba3ece5e7cba /drivers/gpu/drm/i915/intel_pm.c
parentbbfb6ce86c9889a5d434e2e603d41e0ce5b552e2 (diff)
drm/i915: Add render decompression support
SKL+ display engine can scan out certain kinds of compressed surfaces produced by the render engine. This involved telling the display engine the location of the color control surfae (CCS) which describes which parts of the main surface are compressed and which are not. The location of CCS is provided by userspace as just another plane with its own offset. Add the required stuff to validate the user provided AUX plane metadata and convert the user provided linear offset into something the hardware can consume. Due to hardware limitations we require that the main surface and the AUX surface (CCS) be part of the same bo. The hardware also makes life hard by not allowing you to provide separate x/y offsets for the main and AUX surfaces (excpet with NV12), so finding suitable offsets for both requires a bit of work. Assuming we still want keep playing tricks with the offsets. I've just gone with a dumb "search backward for suitable offsets" approach, which is far from optimal, but it works. Also not all planes will be capable of scanning out compressed surfaces, and eg. 90/270 degree rotation is not supported in combination with decompression either. This patch may contain work from at least the following people: * Vandana Kannan <vandana.kannan@intel.com> * Daniel Vetter <daniel@ffwll.ch> * Ben Widawsky <ben@bwidawsk.net> v2: Deal with display workarounds 0390, 0531, 1125 (Paulo) v3: Pretend CCS tiles are regular 128 byte wide Y tiles (Jason) Put the AUX register defines to the correct place Fix up the slightly bogus rotation check v4: Use I915_WRITE_FW() due to plane update locking changes s/return -EINVAL/goto err/ in intel_framebuffer_init() Eliminate a bunch hardcoded numbers in CCS code v5: (By Ben) conflict resolution + - res_blocks += fixed_16_16_to_u32_round_up(y_tile_minimum); + res_blocks += fixed16_to_u32_round_up(y_tile_minimum); v6: (daniels) Fix botched commit message. Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Ben Widawsky <ben@bwidawsk.net> Cc: Jason Ekstrand <jason@jlekstrand.net> Signed-off-by: Ville Syrjä <ville.syrjala@linux.intel.com> Reviewed-by: Ben Widawsky <ben@bwidawsk.net> (v1) Reviewed-by: Daniel Stone <daniels@collabora.com> Signed-off-by: Ben Widawsky <ben@bwidawsk.net> Signed-off-by: Daniel Stone <daniels@collabora.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170801165817.7063-1-ben@bwidawsk.net
Diffstat (limited to 'drivers/gpu/drm/i915/intel_pm.c')
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 6e393b217450..4a75b673b85f 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -62,6 +62,20 @@ static void gen9_init_clock_gating(struct drm_i915_private *dev_priv)
62 I915_WRITE(CHICKEN_PAR1_1, 62 I915_WRITE(CHICKEN_PAR1_1,
63 I915_READ(CHICKEN_PAR1_1) | SKL_EDP_PSR_FIX_RDWRAP); 63 I915_READ(CHICKEN_PAR1_1) | SKL_EDP_PSR_FIX_RDWRAP);
64 64
65 /*
66 * Display WA#0390: skl,bxt,kbl,glk
67 *
68 * Must match Sampler, Pixel Back End, and Media
69 * (0xE194 bit 8, 0x7014 bit 13, 0x4DDC bits 27 and 31).
70 *
71 * Including bits outside the page in the hash would
72 * require 2 (or 4?) MiB alignment of resources. Just
73 * assume the defaul hashing mode which only uses bits
74 * within the page.
75 */
76 I915_WRITE(CHICKEN_PAR1_1,
77 I915_READ(CHICKEN_PAR1_1) & ~SKL_RC_HASH_OUTSIDE);
78
65 I915_WRITE(GEN8_CONFIG0, 79 I915_WRITE(GEN8_CONFIG0,
66 I915_READ(GEN8_CONFIG0) | GEN9_DEFAULT_FIXES); 80 I915_READ(GEN8_CONFIG0) | GEN9_DEFAULT_FIXES);
67 81
@@ -4077,7 +4091,9 @@ skl_ddb_min_alloc(const struct drm_plane_state *pstate,
4077 4091
4078 /* For Non Y-tile return 8-blocks */ 4092 /* For Non Y-tile return 8-blocks */
4079 if (fb->modifier != I915_FORMAT_MOD_Y_TILED && 4093 if (fb->modifier != I915_FORMAT_MOD_Y_TILED &&
4080 fb->modifier != I915_FORMAT_MOD_Yf_TILED) 4094 fb->modifier != I915_FORMAT_MOD_Yf_TILED &&
4095 fb->modifier != I915_FORMAT_MOD_Y_TILED_CCS &&
4096 fb->modifier != I915_FORMAT_MOD_Yf_TILED_CCS)
4081 return 8; 4097 return 8;
4082 4098
4083 /* 4099 /*
@@ -4383,7 +4399,9 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
4383 } 4399 }
4384 4400
4385 y_tiled = fb->modifier == I915_FORMAT_MOD_Y_TILED || 4401 y_tiled = fb->modifier == I915_FORMAT_MOD_Y_TILED ||
4386 fb->modifier == I915_FORMAT_MOD_Yf_TILED; 4402 fb->modifier == I915_FORMAT_MOD_Yf_TILED ||
4403 fb->modifier == I915_FORMAT_MOD_Y_TILED_CCS ||
4404 fb->modifier == I915_FORMAT_MOD_Yf_TILED_CCS;
4387 x_tiled = fb->modifier == I915_FORMAT_MOD_X_TILED; 4405 x_tiled = fb->modifier == I915_FORMAT_MOD_X_TILED;
4388 4406
4389 /* Display WA #1141: kbl,cfl */ 4407 /* Display WA #1141: kbl,cfl */
@@ -4478,6 +4496,13 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
4478 res_lines = div_round_up_fixed16(selected_result, 4496 res_lines = div_round_up_fixed16(selected_result,
4479 plane_blocks_per_line); 4497 plane_blocks_per_line);
4480 4498
4499 /* Display WA #1125: skl,bxt,kbl,glk */
4500 if (level == 0 &&
4501 (fb->modifier == I915_FORMAT_MOD_Y_TILED_CCS ||
4502 fb->modifier == I915_FORMAT_MOD_Yf_TILED_CCS))
4503 res_blocks += fixed16_to_u32_round_up(y_tile_minimum);
4504
4505 /* Display WA #1126: skl,bxt,kbl,glk */
4481 if (level >= 1 && level <= 7) { 4506 if (level >= 1 && level <= 7) {
4482 if (y_tiled) { 4507 if (y_tiled) {
4483 res_blocks += fixed16_to_u32_round_up(y_tile_minimum); 4508 res_blocks += fixed16_to_u32_round_up(y_tile_minimum);