summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBrian Starkey <brian.starkey@arm.com>2017-02-20 11:02:45 +0000
committerRobert Foss <robert.foss@collabora.com>2017-02-21 10:02:19 -0500
commit1ab629f0f9da4773b5590b91694a5592d21344d5 (patch)
tree295744840c233f33403d2471360504efec89ddca /lib
parent4cb80dbd18f182250eec62b52b79f3abf01ce815 (diff)
lib/igt_kms: Neaten up pipe->planes[] assignment
Remove a bunch of branches, functionally equivalent. Changes since v1: - Added back display->has_cursor_plane assignment Signed-off-by: Brian Starkey <brian.starkey@arm.com> Reviewed-by: Robert Foss <robert.foss@collabora.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_kms.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 9e59e35f..585aad7a 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1639,32 +1639,19 @@ void igt_display_init(igt_display_t *display, int drm_fd)
type = get_drm_plane_type(display->drm_fd,
plane_resources->planes[j]);
- switch (type) {
- case DRM_PLANE_TYPE_PRIMARY:
- if (pipe->plane_primary == -1) {
- plane = &pipe->planes[0];
- plane->index = 0;
- pipe->plane_primary = 0;
- } else {
- plane = &pipe->planes[p];
- plane->index = p++;
- }
- break;
- case DRM_PLANE_TYPE_CURSOR:
- if (pipe->plane_cursor == -1) {
- plane = &pipe->planes[last_plane];
- plane->index = last_plane;
- pipe->plane_cursor = last_plane;
- } else {
- plane = &pipe->planes[p];
- plane->index = p++;
- }
+
+ if (type == DRM_PLANE_TYPE_PRIMARY && pipe->plane_primary == -1) {
+ plane = &pipe->planes[0];
+ plane->index = 0;
+ pipe->plane_primary = 0;
+ } else if (type == DRM_PLANE_TYPE_CURSOR && pipe->plane_cursor == -1) {
+ plane = &pipe->planes[last_plane];
+ plane->index = last_plane;
+ pipe->plane_cursor = last_plane;
display->has_cursor_plane = true;
- break;
- default:
+ } else {
plane = &pipe->planes[p];
plane->index = p++;
- break;
}
igt_assert_f(plane->index < n_planes, "n_planes < plane->index failed\n");