From patchwork Mon Apr 18 11:42:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 8871601 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 7CA47BF440 for ; Mon, 18 Apr 2016 11:43:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 85B9E2012B for ; Mon, 18 Apr 2016 11:43:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8F01720270 for ; Mon, 18 Apr 2016 11:43:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B1EA76E5B2; Mon, 18 Apr 2016 11:43:29 +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 C12036E5AE for ; Mon, 18 Apr 2016 11:43:27 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id a140so23886386wma.2 for ; Mon, 18 Apr 2016 04:43:27 -0700 (PDT) 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=ThSi41VMmhk0Cb8RZ6yCefyGh2o5Ad0j72jZ3oTEe9s=; b=RELkaXY+6Yvs/pzrLJPec83GZ8UWgyUAnbMA2IB1W8QNg6P8mxJMoCbCMQqkcVZ9Ay czV1eFBlyIO+fXASkKQ/COND1UBPspNxnwDghcXvBEOO5AFvzKtuwqiajrmg9mslSaTz THxEUMR7dAC+p6sqwWpEBdVoimKlBsk5pgdvEzKhtY7y6l4SDDGyNZACHQ2SU4FAN9dR VrnZ0HCbRLQzK3zvnKB8T4867OqWAPgTKfG9zTVK4X7cMdO6P680aGhiaxqqRBdsQrpj AZ0GwrvTVOw2b9hXKiCFkEBSUNwZFBjfp5jZbtHYoZ/5KLxtB70U/pqhRq4cutxINkyP BIVg== 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=ThSi41VMmhk0Cb8RZ6yCefyGh2o5Ad0j72jZ3oTEe9s=; b=ZyFbSmEk5jcCQ3JJNtvUvfT58P/Vv9vPX00xpsfJvmgXFi231u3c6CKYXKK8zWwCFY q5ZYzLa4yWSvVEuNx8iYJ7kyDk4j7QJLXh2Xd8EcSVGk9C5q0ayP01FM3RaXN0Ee8WQ9 zZ6zlVcyzI7RdiY6lKIvAJp0LooAnOk7IxJBp/6lr+wwl2wWarbOy+41OeHKsubA0Pg2 s29j2brsp9fR7j2D1rqTIckZBqcYUQh/lwnSqZ/gssviPoCN1yFyjb52BX7SiSBZW9Tg BsFLd5z98PoUjgP0DsMIehdEgvP3A8Hqrvvju0ZRuuNEYDI3qvgQynEV4A3W0Q0CoMJ1 Ma3Q== X-Gm-Message-State: AOPr4FVtqDYJX5+iZDJzKBNwrUq2sPGtea50KptqNk3sE2Ei4Cy7zep9uQr7GZiSsL6Svg== X-Received: by 10.194.9.201 with SMTP id c9mr35116764wjb.7.1460979806267; Mon, 18 Apr 2016 04:43:26 -0700 (PDT) Received: from cizrna.lan ([109.72.12.68]) by smtp.gmail.com with ESMTPSA id a184sm26348430wma.3.2016.04.18.04.43.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Apr 2016 04:43:24 -0700 (PDT) From: Tomeu Vizoso To: Intel GFX discussion Date: Mon, 18 Apr 2016 13:42:49 +0200 Message-Id: <1460979775-21702-2-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1460979775-21702-1-git-send-email-tomeu.vizoso@collabora.com> References: <1460979775-21702-1-git-send-email-tomeu.vizoso@collabora.com> Cc: Daniel Stone , Tomeu Vizoso , Daniel Vetter , Micah Fedke , Gustavo Padovan , Emil Velikov Subject: [Intel-gfx] [i-g-t PATCH v1 1/7] tests/drm_read: Drop 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=-5.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 So the test runs on other drivers, drop the usage of the i915-specific DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID ioctl. Wait for a vblank event on pipe0 and if we get it, then the test can proceed (code copied from kms_vblank). Signed-off-by: Tomeu Vizoso --- tests/drm_read.c | 44 +++++--------------------------------------- 1 file changed, 5 insertions(+), 39 deletions(-) diff --git a/tests/drm_read.c b/tests/drm_read.c index 3980bb0580c5..7df36e965c59 100644 --- a/tests/drm_read.c +++ b/tests/drm_read.c @@ -175,46 +175,12 @@ static void test_short_buffer(int in, int nonblock) teardown(fd); } -static int pipe0_enabled(int fd) +static bool crtc0_active(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; + vbl.request.type = DRM_VBLANK_RELATIVE; + return drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl) == 0; } igt_main @@ -226,7 +192,7 @@ igt_main igt_fixture { fd = drm_open_driver_master(DRIVER_ANY); - igt_require(pipe0_enabled(fd)); + igt_require(crtc0_active(fd)); } igt_subtest("invalid-buffer")