From patchwork Wed Mar 9 13:42:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 8546481 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BD5A89F46A for ; Wed, 9 Mar 2016 13:42:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C6C242015E for ; Wed, 9 Mar 2016 13:42:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id DEB272010B for ; Wed, 9 Mar 2016 13:42:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 166186E039; Wed, 9 Mar 2016 13:42:47 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6E7486E039 for ; Wed, 9 Mar 2016 13:42:44 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id n186so10138565wmn.0 for ; Wed, 09 Mar 2016 05:42:44 -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; bh=iuCnEaKAfgVgSbOOKU4FRdGojMPwCmWTaU7VvFfW37c=; b=LRRThWBZvy+kj6O5MepLCtgr3G/om2eXhOyn/0gBrOdbFA45c2YtUoPsKtqispgp4h tGeVGmXIIQyNh/5dJh33KsqIKO5tQJu/kil7dyu32CkyflqfcisKgVdHRZoMyI8Q1oMq lB8ezq2K/fY8qj/mxEn9/yS47XSK9xelo0PKXnxQg4kZG4kKpuzEQHS2kjKJtrt0TOZJ lfp7RwdBG7xFTHs1zgYMYtPS6qD9X9sWdlA1XeNQaBvAP84p5mI/ReocCSavIHzGZDES SQao8LTAOpZ8iRH/mXRfRhdEnp9b5XPt3fCDzBcBMNmAtlirdUGnV4bJF+eIYu4dqlGF slUQ== 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; bh=iuCnEaKAfgVgSbOOKU4FRdGojMPwCmWTaU7VvFfW37c=; b=jtmTHk1e1GiPxW4ck4YlCnSI8vLU6nyLLOhn9d+Mnqt3LUoRcwRlXAeYwOxVe6kka+ Rb1EV3gEZrJpTdnr554BJFrUHTJmToi5X4ttUFhWmEY48ERiMWdzpJqjumO5mI/UXDi3 cW25rZNjCoVwPOQZa75+z04A2a7b9N0vcB1v1rNCeNEjlCB4Ki4RcWMuU64HOicDm94G S9Dugn3n9mmfpM1XISK2xbzZt4D2BUTrvV5UU8iWVo1UZj5UfibWBF1JsP3xZNB0SSce jKGa336qmuKdxv6KH0LY4I8cm0RXeia6Z9GvnyFNQs0leLWnV9qAEoWu83zAI1sRBPW5 G9tg== X-Gm-Message-State: AD7BkJLLM1D1GNBhmQ5chZ+51oUFUb8R6Bk4Q32BA3xUbcmLdGO3ItPnhXCRq3Io+TXKnA== X-Received: by 10.194.246.35 with SMTP id xt3mr38280726wjc.57.1457530962691; Wed, 09 Mar 2016 05:42:42 -0800 (PST) Received: from cizrna.lan ([109.72.12.208]) by smtp.gmail.com with ESMTPSA id t3sm8014953wjz.11.2016.03.09.05.42.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Mar 2016 05:42:41 -0800 (PST) From: Tomeu Vizoso To: Intel GFX discussion Date: Wed, 9 Mar 2016 14:42:12 +0100 Message-Id: <1457530932-439-1-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.5.0 Cc: Micah Fedke , Daniel Stone , Tomeu Vizoso , Emil Velikov Subject: [Intel-gfx] [PATCH i-g-t] drm_read: Remove use of DRM_IOCTL_I915_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 Instead of checking that there's a CRTC in pipe 0 with a valid mode, check that we can get a vblank in the primary display controller. This should be equivalent, but also works with drivers other than i915. Signed-off-by: Tomeu Vizoso --- tests/drm_read.c | 39 +++++---------------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/tests/drm_read.c b/tests/drm_read.c index faa3df862ea6..52dfa8ab8781 100644 --- a/tests/drm_read.c +++ b/tests/drm_read.c @@ -189,46 +189,17 @@ static void test_short_buffer(int in, int nonblock) teardown(fd); } -static int pipe0_enabled(int fd) +static bool pipe0_enabled(int fd) { - struct drm_mode_card_res res; - uint32_t crtcs[32]; - int i; + union drm_wait_vblank vbl; /* We assume we can generate events on pipe 0. So we have better * make sure that is running! */ - memset(&res, 0, sizeof(res)); - res.count_crtcs = 32; - res.crtc_id_ptr = (uintptr_t)crtcs; - - if (drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res)) - return 0; - - if (res.count_crtcs > 32) - return 0; - - for (i = 0; i < res.count_crtcs; i++) { - struct drm_i915_get_pipe_from_crtc_id get_pipe; - struct drm_mode_crtc mode; - - memset(&get_pipe, 0, sizeof(get_pipe)); - memset(&mode, 0, sizeof(mode)); - - mode.crtc_id = crtcs[i]; - - get_pipe.pipe = -1; - get_pipe.crtc_id = mode.crtc_id; - drmIoctl(fd, DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID, &get_pipe); - if (get_pipe.pipe) - continue; - - drmIoctl(fd, DRM_IOCTL_MODE_GETCRTC, &mode); - return mode.mode_valid && mode.mode.clock; - } - - return 0; + memset(&vbl, 0, sizeof(vbl)); + vbl.request.type = DRM_VBLANK_RELATIVE; + return drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl) == 0; } igt_main