diff options
author | Mika Kahola <mika.kahola@intel.com> | 2019-11-21 11:46:07 +0200 |
---|---|---|
committer | Mika Kahola <mika.kahola@intel.com> | 2019-11-22 11:17:33 +0200 |
commit | 6bd74ebaeb95c33973508367c5610b40b73ee15d (patch) | |
tree | 459fa0fa3b6ba045f72e0753e491c8668efcc1af /tests/kms_getfb.c | |
parent | 65fed6a79adea14f7bef6d55530da47d7731d370 (diff) |
tests/kms_getfb: Add support for GEN12 CCS render compression
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.
v2: Fix incorrect size and updates on comments (Imre)
Signed-off-by: Mika Kahola <mika.kahola@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Diffstat (limited to 'tests/kms_getfb.c')
-rw-r--r-- | tests/kms_getfb.c | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/tests/kms_getfb.c b/tests/kms_getfb.c index ca0b01c0..292679ad 100644 --- a/tests/kms_getfb.c +++ b/tests/kms_getfb.c @@ -81,23 +81,47 @@ static void get_ccs_fb(int fd, struct drm_mode_fb_cmd2 *ret) .height = 1024, .pixel_format = DRM_FORMAT_XRGB8888, .flags = DRM_MODE_FB_MODIFIERS, - .modifier = { - I915_FORMAT_MOD_Y_TILED_CCS, - I915_FORMAT_MOD_Y_TILED_CCS, - }, }; int size; 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); + 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; - size = add.offsets[1]; - size += add.pitches[1] * ALIGN(ALIGN(add.height, 16) / 16, 32); + /* 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 * 128); + + /* The main surface height is 4 tile rows aligned */ + add.offsets[1] = add.pitches[0] * ALIGN(add.height, 128); + + /* CCS surface pitch is 64 bytes aligned which corresponds to + * 4 tiles on the main surface + */ + add.pitches[1] = DIV_ROUND_UP(add.width, 128) * 64; + + size = add.offsets[1]; + /* CCS surface height is 4 tile rows aligned */ + size += add.pitches[1] * DIV_ROUND_UP(add.height, 128) * 4; + + /* GEM object is page aligned */ + size = ALIGN(size, 4096); + } else { + add.modifier[0] = I915_FORMAT_MOD_Y_TILED_CCS; + add.modifier[1] = I915_FORMAT_MOD_Y_TILED_CCS; + + /* 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); |