[igt-dev] [PATCH i-g-t] tests/kms_getfb: Add support for GEN12 CCS render compression
Mika Kahola
mika.kahola at intel.com
Thu Nov 21 11:14:28 UTC 2019
GEN12 CCS render compression support is missing from the test.
This causes a SKIP when executing a subtest 'getfb-reject-ccs'.
For TGL the main surface is 4x4 tiles aligned. Therefore, the
pitch for 32bpp is 4*4*32 bytes and the height is 4 rows aligned.
The CCS surface is 64 bytes, which corresponds to 4 tiles on the
main surface. The height of the CCS surface is aligned by 4 rows.
Signed-off-by: Mika Kahola <mika.kahola at intel.com>
---
tests/kms_getfb.c | 39 ++++++++++++++++++++++++++++++++-------
1 file changed, 32 insertions(+), 7 deletions(-)
diff --git a/tests/kms_getfb.c b/tests/kms_getfb.c
index ca0b01c0..2fb49e96 100644
--- a/tests/kms_getfb.c
+++ b/tests/kms_getfb.c
@@ -91,13 +91,38 @@ static void get_ccs_fb(int fd, struct drm_mode_fb_cmd2 *ret)
igt_require(has_addfb2_iface(fd));
igt_require_intel(fd);
- /* An explanation of the magic numbers can be found in kms_ccs.c. */
- add.pitches[0] = ALIGN(add.width * 4, 128);
- add.offsets[1] = add.pitches[0] * ALIGN(add.height, 32);
- add.pitches[1] = ALIGN(ALIGN(add.width * 4, 32) / 32, 128);
-
- size = add.offsets[1];
- size += add.pitches[1] * ALIGN(ALIGN(add.height, 16) / 16, 32);
+ if ((intel_gen(intel_get_drm_devid(fd))) >= 12) {
+ add.modifier[0] = I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS;
+ add.modifier[1] = I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS;
+
+ /* The main surface for TGL is 4x4 tiles aligned
+ * For 32bpp the pitch is 4*4*32 bytes i.e. 512 bytes
+ */
+ add.pitches[0] = ALIGN(add.width * 4, 4 * 4 * 32);
+
+ /* The main surface height is 4 rows aligned */
+ add.offsets[1] = add.pitches[0] * ALIGN(add.height, 4 * 32);
+
+ /* CCS surface pitch is 64 bytes which corresponds to
+ * 4 tiles on the main surface
+ */
+ add.pitches[1] = DIV_ROUND_UP(add.width, 4 * 32) * 64;
+
+ size = add.offsets[1];
+ /* CCS surface height is 4 rows aligned */
+ size += add.pitches[1] * DIV_ROUND_UP(add.height, 4 * 32) * 4 * 64;
+
+ /* GEM object is page size aligned */
+ size = ALIGN(size, 4096);
+ } else {
+ /* An explanation of the magic numbers can be found in kms_ccs.c. */
+ add.pitches[0] = ALIGN(add.width * 4, 128);
+ add.offsets[1] = add.pitches[0] * ALIGN(add.height, 32);
+ add.pitches[1] = ALIGN(ALIGN(add.width * 4, 32) / 32, 128);
+
+ size = add.offsets[1];
+ size += add.pitches[1] * ALIGN(ALIGN(add.height, 16) / 16, 32);
+ }
add.handles[0] = gem_create(fd, size);
igt_require(add.handles[0] != 0);
--
2.17.1
More information about the igt-dev
mailing list