From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH 2/5] drm/i915/adlp: Require always a power-of-two sized CCS surface stride
Date: Fri, 27 Aug 2021 18:09:52 +0300 [thread overview]
Message-ID: <20210827150955.3343520-3-imre.deak@intel.com> (raw)
In-Reply-To: <20210827150955.3343520-1-imre.deak@intel.com>
At the moment CCS FB strides must be power-of-two sized, but a follow-up
change will add support remapping these FBs, allowing the FB passed in
by userspace to have a non-POT sized stride. For these remapped FBs we
can only remap the main surface, not the CCS surface. This means that
userspace has to always generate the CCS surface aligning to the POT
stride padded main surface (by setting up the CCS AUX pagetables
accordingly). Adjust the CCS surface stride check to enforce this.
No functional change.
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
drivers/gpu/drm/i915/display/intel_fb.c | 33 ++++++++++++++++++++++---
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
index 0cf568a9cb1c6..560e386905318 100644
--- a/drivers/gpu/drm/i915/display/intel_fb.c
+++ b/drivers/gpu/drm/i915/display/intel_fb.c
@@ -63,10 +63,35 @@ int skl_ccs_to_main_plane(const struct drm_framebuffer *fb, int ccs_plane)
return ccs_plane - fb->format->num_planes / 2;
}
-static int gen12_ccs_aux_stride(struct drm_framebuffer *fb, int ccs_plane)
+static unsigned int gen12_aligned_scanout_stride(const struct intel_framebuffer *fb, int color_plane)
{
- return DIV_ROUND_UP(fb->pitches[skl_ccs_to_main_plane(fb, ccs_plane)],
- 512) * 64;
+ struct drm_i915_private *i915 = to_i915(fb->base.dev);
+ unsigned int stride = fb->base.pitches[color_plane];
+
+ if (IS_ALDERLAKE_P(i915))
+ return roundup_pow_of_two(max(stride,
+ 8u * intel_tile_width_bytes(&fb->base, color_plane)));
+
+ return stride;
+}
+
+unsigned int gen12_ccs_aux_stride(struct intel_framebuffer *fb, int ccs_plane)
+{
+ struct drm_i915_private *i915 = to_i915(fb->base.dev);
+ int main_plane = skl_ccs_to_main_plane(&fb->base, ccs_plane);
+ unsigned int main_stride = fb->base.pitches[main_plane];
+ unsigned int main_tile_width = intel_tile_width_bytes(&fb->base, main_plane);
+
+ /*
+ * On ADL-P the AUX stride must align with a power-of-two aligned main
+ * surface stride. The stride of the allocated main surface object can
+ * be less than this POT stride, which is then autopadded to the POT
+ * size.
+ */
+ if (IS_ALDERLAKE_P(i915))
+ main_stride = gen12_aligned_scanout_stride(fb, main_plane);
+
+ return DIV_ROUND_UP(main_stride, 4 * main_tile_width) * 64;
}
int skl_main_to_aux_plane(const struct drm_framebuffer *fb, int main_plane)
@@ -1379,7 +1404,7 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
}
if (is_gen12_ccs_plane(fb, i) && !is_gen12_ccs_cc_plane(fb, i)) {
- int ccs_aux_stride = gen12_ccs_aux_stride(fb, i);
+ int ccs_aux_stride = gen12_ccs_aux_stride(intel_fb, i);
if (fb->pitches[i] != ccs_aux_stride) {
drm_dbg_kms(&dev_priv->drm,
--
2.27.0
next prev parent reply other threads:[~2021-08-27 15:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-27 15:09 [Intel-gfx] [PATCH 0/5] drm/i915/adlp: Add support for remapping CCS FBs Imre Deak
2021-08-27 15:09 ` [Intel-gfx] [PATCH 1/5] drm/i915: Use tile block based dimensions for CCS origin x, y check Imre Deak
2021-08-27 15:09 ` Imre Deak [this message]
2021-08-27 22:31 ` [Intel-gfx] [PATCH 2/5] drm/i915/adlp: Require always a power-of-two sized CCS surface stride kernel test robot
2021-08-28 0:50 ` kernel test robot
2021-08-30 2:29 ` kernel test robot
2021-08-30 2:29 ` [Intel-gfx] [RFC PATCH] drm/i915/adlp: gen12_ccs_aux_stride() can be static kernel test robot
2021-08-27 15:09 ` [Intel-gfx] [PATCH 3/5] drm/i915/adlp: Assert that VMAs in DPT start at 0 Imre Deak
2021-08-27 15:09 ` [Intel-gfx] [PATCH 4/5] drm/i915: Follow a new->old platform check order in intel_fb_stride_alignment Imre Deak
2021-08-27 15:09 ` [Intel-gfx] [PATCH 5/5] drm/i915/adlp: Add support for remapping CCS FBs Imre Deak
2021-09-04 11:54 ` Juha-Pekka Heikkila
2021-09-05 10:55 ` Imre Deak
2021-08-27 16:08 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2021-08-27 16:10 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-08-27 16:53 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2021-08-27 17:45 ` Imre Deak
2021-08-27 23:41 ` Vudum, Lakshminarayana
2021-08-27 23:38 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-08-28 1:05 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210827150955.3343520-3-imre.deak@intel.com \
--to=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox