From patchwork Mon Nov 21 22:32:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lyude Paul X-Patchwork-Id: 9440189 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EFB70606DB for ; Mon, 21 Nov 2016 22:32:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E066D289E0 for ; Mon, 21 Nov 2016 22:32:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D569228AE7; Mon, 21 Nov 2016 22:32:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7B1BC289E0 for ; Mon, 21 Nov 2016 22:32:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B605B6E5D8; Mon, 21 Nov 2016 22:32:50 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTPS id 417016E166 for ; Mon, 21 Nov 2016 22:32:43 +0000 (UTC) Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2FAE8F231 for ; Mon, 21 Nov 2016 22:32:42 +0000 (UTC) Received: from whitewolf.lyude.net.com (vpn-54-208.rdu2.redhat.com [10.10.54.208]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uALMWfw8010112 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 21 Nov 2016 17:32:42 -0500 From: Lyude To: intel-gfx@lists.freedesktop.org Date: Mon, 21 Nov 2016 17:32:37 -0500 Message-Id: <1479767559-9654-2-git-send-email-lyude@redhat.com> In-Reply-To: <1479767559-9654-1-git-send-email-lyude@redhat.com> References: <1479767559-9654-1-git-send-email-lyude@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 21 Nov 2016 22:32:42 +0000 (UTC) Cc: Lyude Subject: [Intel-gfx] [PATCH i-g-t 1/3] igt_kms: Don't assume we have cursor planes if we have primary ones X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP On certain models of nvidia and AMD GPUs, we can have a primary plane without any DRM plane for the cursor plane. Check for this so we don't segfault on non-intel hardware. Signed-off-by: Lyude --- lib/igt_kms.c | 27 +++++++++++++++------------ lib/igt_kms.h | 1 + 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 433a721..13d323e 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -1419,7 +1419,7 @@ void igt_display_init(igt_display_t *display, int drm_fd) plane = &pipe->planes[IGT_PLANE_CURSOR]; plane->is_cursor = 1; plane->index = IGT_PLANE_CURSOR; - display->has_universal_planes = 1; + display->has_cursor_plane = 1; break; default: plane = &pipe->planes[p]; @@ -1444,9 +1444,20 @@ void igt_display_init(igt_display_t *display, int drm_fd) plane->rotation = (igt_rotation_t)prop_value; } - if (display->has_universal_planes) { + if (!display->has_universal_planes) { + /* + * No universal plane support. Add drm_plane-less + * primary and cursor planes. + */ + plane = &pipe->planes[IGT_PLANE_PRIMARY]; + plane->pipe = pipe; + plane->index = IGT_PLANE_PRIMARY; + plane->is_primary = true; + } + + if (display->has_cursor_plane) { /* - * If we have universal planes, we should have both + * If we have a cursor plane, we should have both * primary and cursor planes setup now. */ igt_assert(pipe->planes[IGT_PLANE_PRIMARY].drm_plane && @@ -1464,15 +1475,7 @@ void igt_display_init(igt_display_t *display, int drm_fd) sizeof *plane); } } else { - /* - * No universal plane support. Add drm_plane-less - * primary and cursor planes. - */ - plane = &pipe->planes[IGT_PLANE_PRIMARY]; - plane->pipe = pipe; - plane->index = IGT_PLANE_PRIMARY; - plane->is_primary = true; - + /* Add drm_plane-less cursor */ plane = &pipe->planes[p]; plane->pipe = pipe; plane->index = p; diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 95395cd..95d81c3 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -312,6 +312,7 @@ struct igt_display { igt_output_t *outputs; igt_pipe_t pipes[I915_MAX_PIPES]; bool has_universal_planes; + bool has_cursor_plane; bool is_atomic; };