From patchwork Tue Aug 11 15:57:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Micah Fedke X-Patchwork-Id: 6993181 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 97D459F344 for ; Tue, 11 Aug 2015 15:57:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9A0D9205D4 for ; Tue, 11 Aug 2015 15:57:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2E9BA205F0 for ; Tue, 11 Aug 2015 15:57:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A3A026E77C; Tue, 11 Aug 2015 08:57:49 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [93.93.135.160]) by gabe.freedesktop.org (Postfix) with ESMTPS id 90A5E6E77C for ; Tue, 11 Aug 2015 08:57:48 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: fedke.m) with ESMTPSA id 58A4E608E7D To: intel-gfx , Daniel Vetter , chris@chris-wilson.co.uk, Daniel Stone From: Micah Fedke Message-ID: <55CA1B77.3080401@collabora.co.uk> Date: Tue, 11 Aug 2015 11:57:43 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v2 4/5] lib/tests: make kmstest_get_pipe_from_crtc_id and igt_enable_connectors generic to prepare for platform agnostic tests 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 There is some miscellaneous plumbing to do if we are going to have a test that runs on all platforms. intel and exynos are the current targets. The test we are aiming to support is drm_read. There is much intel-specific code throughout the support library, so anyone attempting to make other tests platform agnostic will run into more of this type of thing. kmstest_get_connector_config() issues an intel-specific ioctl via kmstest_get_pipe_from_crtc_id() and asserts on the return. This patch removes the call to kmstest_get_pipe_from_crtc_id altogether and instead assigns the crct id according to its array index in the drmModeRes struct. This seems to be the default behavior for the drm anyway. igt_enable_connectors() reopens the drm dev node to perform its work, but it can't know which chipset to specify to the new drm_open_driver*() API. This patch modifies igt_enable_connectors() to take an already open drm fd to work on, so that the chipset is implied. igt_enable_connectors() performs generic drm work only, so it should not need to do anything chipset-specific. There could be an argument here for isolating this work on a separate fd, but I can't see how it would make a difference to the drm. Signed-off-by: Micah Fedke --- lib/igt_kms.c | 9 ++------- lib/igt_kms.h | 2 +- tests/kms_flip.c | 2 +- tests/kms_pipe_crc_basic.c | 2 +- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 7e956b4..78c98d2 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -629,8 +629,7 @@ found: config->encoder = encoder; config->crtc = drmModeGetCrtc(drm_fd, resources->crtcs[i]); config->crtc_idx = i; - config->pipe = kmstest_get_pipe_from_crtc_id(drm_fd, - config->crtc->crtc_id); + config->pipe = i; drmModeFreeResources(resources); @@ -1801,13 +1800,10 @@ void igt_wait_for_vblank(int drm_fd, enum pipe pipe) * An exit handler is installed to ensure connectors are reset when the test * exits. */ -void igt_enable_connectors(void) +void igt_enable_connectors(int drm_fd) { drmModeRes *res; drmModeConnector *c; - int drm_fd; - - drm_fd = drm_open_driver(DRIVER_INTEL); res = drmModeGetResources(drm_fd); @@ -1830,7 +1826,6 @@ void igt_enable_connectors(void) drmModeFreeConnector(c); } - close(drm_fd); } /** diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 565df14..b5f007d 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -270,7 +270,7 @@ void igt_wait_for_vblank(int drm_fd, enum pipe pipe); #define IGT_FIXED(i,f) ((i) << 16 | (f)) -void igt_enable_connectors(void); +void igt_enable_connectors(int drm_fd); void igt_reset_connectors(void); #define EDID_LENGTH 128 diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 4d8d0c0..a88e707 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -1702,7 +1702,7 @@ int main(int argc, char **argv) igt_fixture { drm_fd = drm_open_driver_master(DRIVER_INTEL); - igt_enable_connectors(); + igt_enable_connectors(drm_fd); kmstest_set_vt_graphics_mode(); igt_install_exit_handler(kms_flip_exit_handler); diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c index fc4ad46..10ef097 100644 --- a/tests/kms_pipe_crc_basic.c +++ b/tests/kms_pipe_crc_basic.c @@ -228,7 +228,7 @@ igt_main igt_fixture { data.drm_fd = drm_open_driver_master(DRIVER_INTEL); - igt_enable_connectors(); + igt_enable_connectors(data.drm_fd); kmstest_set_vt_graphics_mode();