From patchwork Tue Nov 24 17:42:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marius Vlad X-Patchwork-Id: 7692571 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 3DB859F2EC for ; Tue, 24 Nov 2015 17:42:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 59DC8207E4 for ; Tue, 24 Nov 2015 17:42:34 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 54208207EC for ; Tue, 24 Nov 2015 17:42:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D70B6E93F; Tue, 24 Nov 2015 09:42:32 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 815C76E93F for ; Tue, 24 Nov 2015 09:42:31 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 24 Nov 2015 09:42:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,339,1444719600"; d="scan'208";a="828143044" Received: from mcvlad-wk.rb.intel.com (HELO mcvlad-wk) ([10.237.105.57]) by orsmga001.jf.intel.com with ESMTP; 24 Nov 2015 09:42:29 -0800 Received: by mcvlad-wk (Postfix, from userid 1000) id 726A8C0067; Tue, 24 Nov 2015 19:42:46 +0200 (EET) From: marius.c.vlad@intel.com To: intel-gfx@lists.freedesktop.org, imre.deak@intel.com Date: Tue, 24 Nov 2015 19:42:03 +0200 Message-Id: <1448386923-18141-1-git-send-email-marius.c.vlad@intel.com> X-Mailer: git-send-email 2.6.2 Subject: [Intel-gfx] [PATCH i-g-t] tests/pm_rpm tests for set_caching and set_tiling ioctl(s) 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.8 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 From: Marius Vlad Signed-off-by: Marius Vlad Reviewed-by: Imre Deak --- tests/pm_rpm.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c index c4fb19c..86d16ad 100644 --- a/tests/pm_rpm.c +++ b/tests/pm_rpm.c @@ -1729,6 +1729,90 @@ static void planes_subtest(bool universal, bool dpms) } } +static void pm_test_tiling(void) +{ + uint32_t handle; + uint8_t *gem_buf; + uint32_t i, tiling_modes[3] = { + I915_TILING_NONE, + I915_TILING_X, + I915_TILING_Y, + }; + uint32_t ti, sw, j; + uint32_t obj_size = (8 * 1024 * 1024); + + handle = gem_create(drm_fd, obj_size); + + for (i = 0; i < ARRAY_SIZE(tiling_modes); i++) { + disable_all_screens_and_wait(&ms_data); + + if (tiling_modes[i] == 0) { + gem_set_tiling(drm_fd, handle, tiling_modes[i], 0); + + gem_buf = gem_mmap__cpu(drm_fd, handle, 0, + obj_size, PROT_WRITE); + + for (j = 0; j < obj_size; j++) + gem_buf[j] = j & 0xff; + + igt_assert(munmap(gem_buf, obj_size) == 0); + + gem_get_tiling(drm_fd, handle, &ti, &sw); + igt_assert(tiling_modes[i] == ti); + } else { + gem_set_tiling(drm_fd, handle, tiling_modes[i], 512); + gem_buf = gem_mmap__cpu(drm_fd, handle, 0, + obj_size, PROT_WRITE); + + for (j = 0; j < obj_size; j++) + gem_buf[j] = j & 0xff; + + igt_assert(munmap(gem_buf, obj_size) == 0); + + gem_get_tiling(drm_fd, handle, &ti, &sw); + igt_assert(tiling_modes[i] == ti); + } + + enable_one_screen_and_wait(&ms_data); + } + + gem_close(drm_fd, handle); +} + +static void pm_test_caching(void) +{ + uint32_t handle, got_caching, obj_size = (8 * 1024 * 1024); + void *src_buf; + uint32_t i, cache_levels[3] = { + I915_CACHING_NONE, + I915_CACHING_CACHED, + I915_CACHING_DISPLAY, + }; + + handle = gem_create(drm_fd, obj_size); + src_buf = malloc(obj_size); + + memset(src_buf, 0x65, obj_size); + + for (i = 0; i < ARRAY_SIZE(cache_levels); i++) { + disable_all_screens_and_wait(&ms_data); + + gem_set_caching(drm_fd, handle, cache_levels[i]); + gem_write(drm_fd, handle, 0, src_buf, obj_size); + + got_caching = gem_get_caching(drm_fd, handle); + + enable_one_screen_and_wait(&ms_data); + + /* skip CACHING_DISPLAY, some platforms do not have it */ + if (i != 2) + igt_assert(got_caching == cache_levels[i]); + } + + free(src_buf); + gem_close(drm_fd, handle); +} + static void fences_subtest(bool dpms) { int i; @@ -1927,6 +2011,12 @@ int main(int argc, char *argv[]) igt_subtest("gem-execbuf-stress-extra-wait") gem_execbuf_stress_subtest(rounds, WAIT_STATUS | WAIT_EXTRA); + /* power-wake reference tests */ + igt_subtest("pm-tiling") + pm_test_tiling(); + igt_subtest("pm-caching") + pm_test_caching(); + igt_fixture teardown_environment();