[Intel-gfx] [PATCH i-g-t 03/12] tests/kms_addfb: Y tiled testcases
Tvrtko Ursulin
tvrtko.ursulin at linux.intel.com
Mon Feb 23 07:57:46 PST 2015
From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
v2: Moved all init into fixtures.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
lib/ioctl_wrappers.h | 2 ++
tests/kms_addfb.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 71 insertions(+), 1 deletion(-)
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index 3c85e8b..99fc7fd 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -157,6 +157,8 @@ struct local_drm_mode_fb_cmd2 {
#define LOCAL_DRM_FORMAT_MOD_NONE (0)
#define LOCAL_I915_FORMAT_MOD_X_TILED local_fourcc_mod_code(INTEL, 1)
+#define LOCAL_I915_FORMAT_MOD_Y_TILED local_fourcc_mod_code(INTEL, 2)
+#define LOCAL_I915_FORMAT_MOD_Yf_TILED local_fourcc_mod_code(INTEL, 3)
#define LOCAL_DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, \
struct local_drm_mode_fb_cmd2)
diff --git a/tests/kms_addfb.c b/tests/kms_addfb.c
index 0a82619..d474e95 100644
--- a/tests/kms_addfb.c
+++ b/tests/kms_addfb.c
@@ -38,6 +38,7 @@
#include "ioctl_wrappers.h"
#include "drmtest.h"
#include "drm_fourcc.h"
+#include "intel_chipset.h"
uint32_t gem_bo;
uint32_t gem_bo_small;
@@ -276,12 +277,77 @@ static void addfb25_tests(int fd)
}
}
+static void addfb25_ytile(int fd, int gen)
+{
+ struct local_drm_mode_fb_cmd2 f = {};
+ int shouldret;
+
+ igt_fixture {
+ gem_bo = gem_create(fd, 1024*1024*4);
+ igt_assert(gem_bo);
+ gem_bo_small = gem_create(fd, 1024*1023*4);
+ igt_assert(gem_bo_small);
+
+ shouldret = gen >= 9 ? 0 : -1;
+
+ memset(&f, 0, sizeof(f));
+
+ f.width = 1024;
+ f.height = 1024;
+ f.pixel_format = DRM_FORMAT_XRGB8888;
+ f.pitches[0] = 1024*4;
+ f.flags = LOCAL_DRM_MODE_FB_MODIFIERS;
+ f.modifier[0] = LOCAL_DRM_FORMAT_MOD_NONE;
+
+ f.handles[0] = gem_bo;
+ }
+
+ igt_subtest("addfb25-Y-tiled") {
+ igt_require_fb_modifiers(fd);
+
+ f.modifier[0] = LOCAL_I915_FORMAT_MOD_Y_TILED;
+ igt_assert(drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) == shouldret);
+ if (!shouldret)
+ igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f.fb_id) == 0);
+ f.fb_id = 0;
+ }
+
+ igt_subtest("addfb25-Yf-tiled") {
+ igt_require_fb_modifiers(fd);
+
+ f.modifier[0] = LOCAL_I915_FORMAT_MOD_Yf_TILED;
+ igt_assert(drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) == shouldret);
+ if (!shouldret)
+ igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f.fb_id) == 0);
+ f.fb_id = 0;
+ }
+
+ igt_subtest("addfb25-Y-tiled-small") {
+ igt_require_fb_modifiers(fd);
+ igt_require(gen >= 9);
+
+ f.modifier[0] = LOCAL_I915_FORMAT_MOD_Y_TILED;
+ f.height = 1023;
+ f.handles[0] = gem_bo_small;
+ igt_assert(drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) < 0 && errno == EINVAL);
+ f.fb_id = 0;
+ }
+
+ igt_fixture {
+ gem_close(fd, gem_bo);
+ gem_close(fd, gem_bo_small);
+ }
+}
+
int fd;
+int gen;
igt_main
{
- igt_fixture
+ igt_fixture {
fd = drm_open_any_master();
+ gen = intel_gen(intel_get_drm_devid(fd));
+ }
pitch_tests(fd);
@@ -289,6 +355,8 @@ igt_main
addfb25_tests(fd);
+ addfb25_ytile(fd, gen);
+
igt_fixture
close(fd);
}
--
2.3.0
More information about the Intel-gfx
mailing list