summaryrefslogtreecommitdiff
path: root/lib/igt_fb.c
diff options
context:
space:
mode:
authorJosé Roberto de Souza <jose.souza@intel.com>2021-06-04 13:39:26 -0700
committerMatt Roper <matthew.d.roper@intel.com>2021-06-08 08:22:25 -0700
commit6e67969bf93dda8f22773ccae362f757fce25c3d (patch)
treef8a4e3e6ecfb591b19713a165464ff45db7aa4c3 /lib/igt_fb.c
parent68b3283d9e39145ce545a2060f23459ab4770921 (diff)
lib/i915: Add ADL-P stride restrictions for non-linear buffers
ADL-P tiled framebuffer strides must be power-of-two aligned and has a minimum of 8 tiles. For non-CCS framebuffers the driver supports FBs not meeting this requirement by remapping the framebuffer and padding the stride as required, but for CCS FBs userspace must ensure the alignment. Adding remap support for CCS FBs to the driver is to be done as a follow-up. Cc: Juha-Pekka Heikkilä <juha-pekka.heikkila@intel.com> Cc: Anusha Srivatsa <anusha.srivatsa@intel.com> Cc: Clinton Taylor <Clinton.A.Taylor@intel.com> Cc: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> Cc: Imre Deak <imre.deak@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com>
Diffstat (limited to 'lib/igt_fb.c')
-rw-r--r--lib/igt_fb.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 94df0314..ab52ea9f 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -729,8 +729,16 @@ static uint32_t calc_plane_stride(struct igt_fb *fb, int plane)
/* clear color always fixed to 64 bytes */
return 64;
} else if (is_gen12_ccs_plane(fb, plane)) {
- /* A main surface using a CCS AUX surface must be 4x4 tiles aligned. */
- return ALIGN(min_stride, 64);
+ /*
+ * A main surface using a CCS AUX surface must be 4x4 tiles
+ * aligned. On ADL_P the minimum main surface stride is 8
+ * tiles (2 * 64 byte on CCS surface) and it has to be POT
+ * aligned.
+ */
+ if (IS_ALDERLAKE_P(intel_get_drm_devid(fb->fd)))
+ return roundup_power_of_two(max(min_stride, 128u));
+ else
+ return ALIGN(min_stride, 64);
} else if (!fb->modifier && is_nouveau_device(fb->fd)) {
int align;
@@ -743,14 +751,22 @@ static uint32_t calc_plane_stride(struct igt_fb *fb, int plane)
return ALIGN(min_stride, align);
} else {
unsigned int tile_width, tile_height;
+ uint32_t stride;
igt_get_fb_tile_size(fb->fd, fb->modifier, fb->plane_bpp[plane],
&tile_width, &tile_height);
- if (is_gen12_ccs_modifier(fb->modifier))
- tile_width *= 4;
+ if (is_gen12_ccs_modifier(fb->modifier)) {
+ stride = ALIGN(min_stride, tile_width * 4);
- return ALIGN(min_stride, tile_width);
+ /* TODO: add support to kernel to POT align CCS format strides */
+ if (IS_ALDERLAKE_P(intel_get_drm_devid(fb->fd)))
+ stride = roundup_power_of_two(max(stride, tile_width * 8));
+ } else {
+ stride = ALIGN(min_stride, tile_width);
+ }
+
+ return stride;
}
}