@@ -289,6 +289,7 @@ typedef enum {
#define IGT_ROTATION_MASK \
(IGT_ROTATION_0 | IGT_ROTATION_90 | IGT_ROTATION_180 | IGT_ROTATION_270)
+#define IGT_REFLECT_MASK (IGT_REFLECT_X | IGT_REFLECT_Y)
typedef struct {
/*< private >*/
@@ -38,6 +38,7 @@ typedef struct {
igt_crc_t flip_crc;
igt_pipe_crc_t *pipe_crc;
igt_rotation_t rotation;
+ int **supported_rotation;
int pos_x;
int pos_y;
uint32_t override_fmt;
@@ -373,13 +374,14 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
igt_plane_t *plane;
int i, j;
- if (IS_CHERRYVIEW(data->devid) && pipe != PIPE_B)
- continue;
-
igt_output_set_pipe(output, pipe);
plane = igt_output_get_plane_type(output, plane_type);
igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
+ igt_require(data->supported_rotation[pipe][plane->index] & data->rotation);
+
+ if (data->rotation & IGT_REFLECT_MASK)
+ igt_require(data->supported_rotation[pipe][plane->index] & IGT_REFLECT_MASK);
prepare_crtc(data, output, pipe, plane);
@@ -460,6 +462,36 @@ static void test_plane_rotation_exhaust_fences(data_t *data,
igt_remove_fb(fd, &fb[i]);
}
+static void igt_supported_rotation_init(data_t *data)
+{
+ igt_display_t *display = &data->display;
+ bool found;
+ int i, j, k, n_pipes = display->n_pipes;
+ int **s_rotation;
+
+ s_rotation = calloc(sizeof(int *), n_pipes);
+
+ for (i = 0; i < n_pipes; i++) {
+ s_rotation[i] = calloc(sizeof(int), (display->pipes + i)->n_planes);
+
+ for (j = 0; j < (display->pipes + i)->n_planes; j++) {
+ drmModePropertyPtr prop;
+ found = kmstest_get_property(data->gfx_fd, display->pipes[i].planes[j].drm_plane->plane_id,
+ DRM_MODE_OBJECT_PLANE, "rotation", NULL, NULL, &prop);
+ igt_assert(found);
+ igt_assert(prop->flags & DRM_MODE_PROP_BITMASK);
+
+ for (k = 0; k < prop->count_enums; k++) {
+ s_rotation[i][j] |= 1 << (prop->enums[k].value);
+ }
+
+ drmModeFreeProperty(prop);
+ }
+ }
+
+ data->supported_rotation = s_rotation;
+}
+
static const char *plane_test_str(unsigned plane)
{
switch (plane) {
@@ -552,15 +584,13 @@ igt_main
igt_require_pipe_crc(data.gfx_fd);
igt_display_init(&data.display, data.gfx_fd);
+ igt_supported_rotation_init(&data);
}
for (subtest = subtests; subtest->rot; subtest++) {
igt_subtest_f("%s-rotation-%s",
plane_test_str(subtest->plane),
rot_test_str(subtest->rot)) {
- igt_require(!(subtest->rot &
- (IGT_ROTATION_90 | IGT_ROTATION_270)) ||
- gen >= 9);
data.rotation = subtest->rot;
test_plane_rotation(&data, subtest->plane, false);
}
@@ -596,9 +626,7 @@ igt_main
igt_subtest_f("primary-%s-reflect-x-%s",
tiling_test_str(reflect_x->tiling),
rot_test_str(reflect_x->rot)) {
- igt_require(gen >= 10 ||
- (IS_CHERRYVIEW(data.devid) && reflect_x->rot == IGT_ROTATION_0
- && reflect_x->tiling == LOCAL_I915_FORMAT_MOD_X_TILED));
+ igt_require(reflect_x->rot == IGT_ROTATION_0 && reflect_x->tiling == LOCAL_I915_FORMAT_MOD_X_TILED);
data.rotation = (IGT_REFLECT_X | reflect_x->rot);
data.override_tiling = reflect_x->tiling;
test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY, false);