};
#define pipe_name(p) ((p) + 'A')
-/* FIXME: i915_drm.h on Android pollutes the general namespace. */
-#undef PLANE_A
-#undef PLANE_B
-
-enum plane {
- PLANE_A = 0,
- PLANE_B,
- PLANE_C,
+/* We namespace this enum to not conflict with the Android i915_drm.h */
+enum igt_plane {
+ IGT_PLANE_1 = 0,
+ IGT_PLANE_PRIMARY = IGT_PLANE_1,
+ IGT_PLANE_2,
+ IGT_PLANE_3,
+ IGT_PLANE_CURSOR,
};
-#define plane_name(p) ((p) + 'A')
+
+const char *plane_name(enum igt_plane p);
#define sprite_name(p, s) ((p) * dev_priv->num_plane + (s) + 'A')
drmModeFreeConnector(config->connector);
}
+const char *plane_name(enum igt_plane p)
+{
+ static const char *names[] = {
+ [IGT_PLANE_1] = "plane1",
+ [IGT_PLANE_2] = "plane2",
+ [IGT_PLANE_3] = "plane3",
+ [IGT_PLANE_CURSOR] = "cursor",
+ };
+
+ igt_assert(p < ARRAY_SIZE(names) && names[p]);
+
+ return names[p];
+}
+
/*
* A small modeset API
*/
return &pipe->planes[index];
}
-igt_plane_t *igt_ouput_get_plane(igt_output_t *output, int index)
+igt_plane_t *igt_ouput_get_plane(igt_output_t *output, enum igt_plane plane)
{
igt_pipe_t *pipe;
pipe = igt_output_get_driving_pipe(output);
- return igt_pipe_get_plane(pipe, 0);
+ return igt_pipe_get_plane(pipe, plane);
}
void igt_plane_set_fb(igt_plane_t *plane, struct kmstest_fb *fb)
const char *igt_output_name(igt_output_t *output);
drmModeModeInfo *igt_output_get_mode(igt_output_t *output);
void igt_output_set_pipe(igt_output_t *output, enum pipe pipe);
-igt_plane_t *igt_ouput_get_plane(igt_output_t *output, int index);
+igt_plane_t *igt_ouput_get_plane(igt_output_t *output, enum igt_plane plane);
void igt_plane_set_fb(igt_plane_t *plane, struct kmstest_fb *fb);