From patchwork Fri Sep 5 09:52:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 4851051 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5AF459F314 for ; Fri, 5 Sep 2014 09:52:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6754020272 for ; Fri, 5 Sep 2014 09:52:20 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 56738202B8 for ; Fri, 5 Sep 2014 09:52:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E1F26E835; Fri, 5 Sep 2014 02:52:18 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-we0-f169.google.com (mail-we0-f169.google.com [74.125.82.169]) by gabe.freedesktop.org (Postfix) with ESMTP id 80CB96E82A for ; Fri, 5 Sep 2014 02:52:16 -0700 (PDT) Received: by mail-we0-f169.google.com with SMTP id k48so11607157wev.0 for ; Fri, 05 Sep 2014 02:52:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=TmN4IfDKqHUZExC6YmNrMrnj1fu1EVZb1qQXfkpd+YY=; b=WH5oeQUNCJiQu/QSbeVYjh9ZX4EMmkeA+ABIlDu3979bRCjnZo1SaFSRU1YPrwMD4Z 6WtzvdFS3KAK6Tq9ROsnuOrbUOfv4VxnOsxQk+0SFtUSORQ3TKa9Ops1f065zvYFEBZJ Ih1H4FGhsGRMGJg0dPAtlx1fbA5rTH/nxfbQ8asJmlG5ALNY+Owg025znBKkP1Y17LZg VMZI5Ee1tQb4hsbIRJW3c9TLIGviOvyA7NUlChXBqCEOjTqai5FdVjr+LhBQNjUG5Irv Ss2H060b82cjPjZ1/0L0Cpc7fkc+5st6uZPDYRWX2Z5fAyu6b+6n3dA3m/dFBjtrG+95 mcmg== X-Gm-Message-State: ALoCoQnQT1RwY0AlwcK+FgalEVK5Jm8SVl/lSab7Fp/PVxJ6I3D5Rj3Xj3+RXolKCEXM/9u22uy0 X-Received: by 10.180.208.111 with SMTP id md15mr2266482wic.3.1409910735424; Fri, 05 Sep 2014 02:52:15 -0700 (PDT) Received: from pistachio.icx.intel.com ([83.217.123.106]) by mx.google.com with ESMTPSA id h6sm875050wjb.33.2014.09.05.02.52.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Sep 2014 02:52:14 -0700 (PDT) From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Fri, 5 Sep 2014 10:52:06 +0100 Message-Id: <1409910729-13485-4-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1409910729-13485-1-git-send-email-thomas.wood@intel.com> References: <5408C410.8080500@intel.com> <1409910729-13485-1-git-send-email-thomas.wood@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v2 3/6] tests: add kms_3d test X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 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=-5.9 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 Add a test to verify creation and use of 3D stereo modes. v2: update for API changes Signed-off-by: Thomas Wood --- tests/.gitignore | 1 + tests/Android.mk | 1 + tests/Makefile.sources | 1 + tests/kms_3d.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 123 insertions(+) create mode 100644 tests/kms_3d.c diff --git a/tests/.gitignore b/tests/.gitignore index efa0c92..1ea0681 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -117,6 +117,7 @@ igt_no_exit igt_no_exit_list_only igt_no_subtest igt_simulation +kms_3d kms_addfb kms_cursor_crc kms_fbc_crc diff --git a/tests/Android.mk b/tests/Android.mk index 3644aa1..f28b400 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -55,6 +55,7 @@ ifeq ("${ANDROID_HAS_CAIRO}", "1") else # the following tests depend on cairo, so skip them skip_tests_list += \ + kms_3d \ kms_plane \ kms_addfb \ kms_cursor_crc \ diff --git a/tests/Makefile.sources b/tests/Makefile.sources index 551555f..a6677dd 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -142,6 +142,7 @@ TESTS_progs = \ gen3_render_tiledx_blits \ gen3_render_tiledy_blits \ gen7_forcewake_mt \ + kms_3d \ kms_force_connector \ kms_sink_crc_basic \ kms_fence_pin_leak \ diff --git a/tests/kms_3d.c b/tests/kms_3d.c new file mode 100644 index 0000000..ddf4dc6 --- /dev/null +++ b/tests/kms_3d.c @@ -0,0 +1,120 @@ +/* + * Copyright © 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + */ + +#include "igt_core.h" +#include "igt_kms.h" +#include "drmtest.h" +#include "igt_edid.h" + +igt_simple_main +{ + int drm_fd; + drmModeRes *res; + drmModeConnector *connector; + unsigned char *edid; + size_t length; + int mode_count, connector_id; + + drm_fd = drm_open_any(); + res = drmModeGetResources(drm_fd); + + igt_assert(drmSetClientCap(drm_fd, DRM_CLIENT_CAP_STEREO_3D, 1) >= 0); + + /* find an hdmi connector */ + for (int i = 0; i < res->count_connectors; i++) { + + connector = drmModeGetConnector(drm_fd, res->connectors[i]); + + if (connector->connector_type == DRM_MODE_CONNECTOR_HDMIA && + connector->connection == DRM_MODE_DISCONNECTED) + break; + + drmModeFreeConnector(connector); + + connector = NULL; + } + igt_require(connector); + + kmstest_edid_add_3d(generic_edid[EDID_FHD], EDID_LENGTH, &edid, + &length); + + kmstest_force_edid(drm_fd, connector, edid, length); + kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_ON); + + connector_id = connector->connector_id; + + /* check for 3D modes */ + mode_count = 0; + connector = drmModeGetConnector(drm_fd, connector_id); + for (int i = 0; i < connector->count_modes; i++) { + if (connector->modes[i].flags & DRM_MODE_FLAG_3D_MASK) + mode_count++; + } + + igt_assert(mode_count == 13); + + /* set 3D modes */ + igt_info("Testing:\n"); + for (int i = 0; i < connector->count_modes; i++) { + int fb_id; + struct kmstest_connector_config config; + int crtc_mask = -1; + int ret; + + if (!(connector->modes[i].flags & DRM_MODE_FLAG_3D_MASK)) + continue; + + /* create a configuration */ + ret = kmstest_get_connector_config(drm_fd, connector_id, + crtc_mask, &config); + if (ret != true) { + igt_info("Error creating configuration for:\n "); + kmstest_dump_mode(&connector->modes[i]); + + continue; + } + + igt_info(" "); + kmstest_dump_mode(&connector->modes[i]); + + /* create stereo framebuffer */ + fb_id = igt_create_stereo_fb(drm_fd, &connector->modes[i], + igt_bpp_depth_to_drm_format(32, 32), + I915_TILING_NONE); + + ret = drmModeSetCrtc(drm_fd, config.crtc->crtc_id, fb_id, 0, 0, + &connector->connector_id, 1, + &connector->modes[i]); + + igt_assert(ret == 0); + } + + kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_UNSPECIFIED); + kmstest_force_edid(drm_fd, connector, NULL, 0); + + drmModeFreeConnector(connector); + free(edid); + + igt_exit(); +}