From patchwork Wed Mar 9 15:57:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 8547191 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 37AFBC0553 for ; Wed, 9 Mar 2016 15:58:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3FC6820251 for ; Wed, 9 Mar 2016 15:58:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 61C1B2026F for ; Wed, 9 Mar 2016 15:58:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 05C136E536; Wed, 9 Mar 2016 15:58:20 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1A1EB6E578 for ; Wed, 9 Mar 2016 15:58:16 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id p65so10965274wmp.1 for ; Wed, 09 Mar 2016 07:58:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=X/gYiNclZGWjxOEZqn5BKjhCoRgBtvVzU4+EfHtDJYA=; b=Z9vpzfnPBItDIwegUDi8HQfWoDc9pQ+o1pLf7ivpc/2QaFiF2Xv/edm0dQaIVGLtT2 +75q+cmWcgvMXm/eYV7oUwlBYSm5GA+jO4VxGB6aTVOkLBexEVoMiVEub38II1rWiqV2 1gp2MxfWSBrJONJnWHLXXbmq8VtlP48BKtRY6fEN0KOchzpnn0Q5ZftW8s/wwZlgxklb r5RYzTd2wz/+QHLAEAuxLUnxx0oS+P8BxgwszrlzcX1ZdN+3hLP6LzU99tsvyorvCSdg 0zETKnl6P2MIu7TQyH2Ppa2kt1vf9bVhGHVe3xlzZ5a/4uoIJ5UYQpot/ik3wfBDfo4R dEEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=X/gYiNclZGWjxOEZqn5BKjhCoRgBtvVzU4+EfHtDJYA=; b=akMArW0gfgHTBOkX+X0kzg/quE7U9eVj0ZSajF4XWfFsSR8RroSIwdOB0Cek8uZkO7 iEvEv+vpyvXB6PD9DJAlnFMK3GXp9Iif8n7k+sC2jzXUB8L+QCV376D75E7iY5rMqA8J 3LsU2n2cSNkaIIRfn3lMZyhC2s+WDeXUdUNtKnlOHunh8CV+8jIZOfSzYfsQ+h6clxGF E1QkmmcwJc38IEsT4UtFWxsdISPgPnwFonu26BtCOBpWz4lxYbC2ajiIqG8wPUYNl8FS +8sNwqBmeQd9N84UwBcFcUHR1Kg/w3Mmqs/bhQYTfOCHcB3LipeGFy1wlEtDLetpe4kr eEKA== X-Gm-Message-State: AD7BkJL1Le27SOtKE7jRbeESwtHZAF95xmxYKIPQ4v/ifeMccP2haLqstoE3kFgRHPf2VQ== X-Received: by 10.28.32.13 with SMTP id g13mr26360721wmg.13.1457539094353; Wed, 09 Mar 2016 07:58:14 -0800 (PST) Received: from cizrna.lan ([109.72.12.208]) by smtp.gmail.com with ESMTPSA id j18sm24649544wmd.2.2016.03.09.07.58.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Mar 2016 07:58:13 -0800 (PST) From: Tomeu Vizoso To: Intel GFX discussion Date: Wed, 9 Mar 2016 16:57:37 +0100 Message-Id: <1457539058-5782-2-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1457539058-5782-1-git-send-email-tomeu.vizoso@collabora.com> References: <1457539058-5782-1-git-send-email-tomeu.vizoso@collabora.com> Cc: Daniel Stone , Tomeu Vizoso , Micah Fedke , Gustavo Padovan , Emil Velikov Subject: [Intel-gfx] [i-g-t PATCH v2 1/2] lib: update kmstest_get_pipe_from_crtc_id 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-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Micah Fedke This function uses an intel-specific ioctl to fetch a mapping between pipes and crtc ids, but this technique is outdated as the crtc id is now always equivalent to its index in the array of crtcs returned by the kernel. Signed-off-by: Tomeu Vizoso --- Changes in v2: None lib/igt_kms.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 9f18aef72ea0..1d9acce31676 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -261,20 +261,35 @@ void kmstest_dump_mode(drmModeModeInfo *mode) * @fd: DRM fd * @crtc_id: DRM CRTC id * - * Returns: The pipe number for the given DRM CRTC @crtc_id. This maps directly - * to an enum pipe value used in other helper functions. + * Returns: The crtc index for the given DRM CRTC ID @crtc_id. The crtc index + * is the equivalent of the pipe id. This value maps directly to an enum pipe + * value used in other helper functions. Returns 0 if the index could not be + * determined. */ + int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id) { - struct drm_i915_get_pipe_from_crtc_id pfci; - int ret; + drmModeRes *res; + drmModeCrtc *crtc; + int i, cur_id; + + res = drmModeGetResources(fd); + igt_assert(res); + + for (i = 0; i < res->count_crtcs; i++) { + crtc = drmModeGetCrtc(fd, res->crtcs[i]); + igt_assert(crtc); + cur_id = crtc->crtc_id; + drmModeFreeCrtc(crtc); + if (cur_id == crtc_id) + break; + } + + drmModeFreeResources(res); - memset(&pfci, 0, sizeof(pfci)); - pfci.crtc_id = crtc_id; - ret = drmIoctl(fd, DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID, &pfci); - igt_assert(ret == 0); + igt_assert(i < res->count_crtcs); - return pfci.pipe; + return i; } /**