From patchwork Thu Feb 16 14:06:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kahola X-Patchwork-Id: 9577253 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 E773A600C5 for ; Thu, 16 Feb 2017 14:07:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9CE3284F0 for ; Thu, 16 Feb 2017 14:07:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE1AF285DD; Thu, 16 Feb 2017 14:07:53 +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 547E5284F0 for ; Thu, 16 Feb 2017 14:07:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 19FFC6E2BA; Thu, 16 Feb 2017 14:07:47 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 145306E2BA for ; Thu, 16 Feb 2017 14:07:46 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP; 16 Feb 2017 06:07:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,169,1484035200"; d="scan'208";a="934624487" Received: from sorvi.fi.intel.com ([10.237.72.169]) by orsmga003.jf.intel.com with ESMTP; 16 Feb 2017 06:07:43 -0800 From: Mika Kahola To: intel-gfx@lists.freedesktop.org Date: Thu, 16 Feb 2017 16:06:38 +0200 Message-Id: <1487253998-27550-1-git-send-email-mika.kahola@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [Intel-gfx] [PATCH] lib/igt_kms: Fix regression on kms_plane_lowres test 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 kms_plane_lowres subtest pipe-C-tiling-none crashes when reading out number of crtc. This patch fixes the bug on crtc readout. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99653 Fixes: 9de635976c426b4c835083792c7d4d6e32aec615 ("lib/igt_kms: Avoid depencency on static plane count") Signed-off-by: Mika Kahola Reviewed-by: Robert Foss --- lib/igt_kms.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index dae8bf9..5388a83 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -1331,6 +1331,7 @@ void kmstest_get_crtc(enum pipe pipe, struct kmstest_crtc *crtc) const char *mode = "r"; int ncrtc; int line; + long int n; fid = igt_debugfs_fopen("i915_display_info", mode); @@ -1344,18 +1342,20 @@ void kmstest_get_crtc(enum pipe pipe, struct kmstest_crtc *crtc) crtc->active = true; parse_crtc(tmp, crtc); + n = ftell(fid); crtc->n_planes = parse_planes(fid, NULL); crtc->planes = calloc(crtc->n_planes, sizeof(*crtc->planes)); igt_assert_f(crtc->planes, "Failed to allocate memory for %d planes\n", crtc->n_planes); - fseek(fid, 0, SEEK_END); - fseek(fid, 0, SEEK_SET); + fseek(fid, n, SEEK_SET); parse_planes(fid, crtc->planes); - if (crtc->pipe != pipe) - crtc = NULL; - else + if (crtc->pipe != pipe) { + free(crtc->planes); + } else { ncrtc++; + break; + } } }