From patchwork Mon Mar 2 17:04:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tim.gore@intel.com X-Patchwork-Id: 5915241 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 93829BF440 for ; Mon, 2 Mar 2015 17:04:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B94CE201EF for ; Mon, 2 Mar 2015 17:04:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 3490C201EC for ; Mon, 2 Mar 2015 17:04:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6062A6E498; Mon, 2 Mar 2015 09:04:33 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id 285CC6E498 for ; Mon, 2 Mar 2015 09:04:32 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 02 Mar 2015 09:04:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,676,1418112000"; d="scan'208";a="659288070" Received: from tgore-linux.isw.intel.com ([10.102.226.47]) by orsmga001.jf.intel.com with ESMTP; 02 Mar 2015 09:04:30 -0800 From: tim.gore@intel.com To: intel-gfx@lists.freedesktop.org Date: Mon, 2 Mar 2015 17:04:28 +0000 Message-Id: <1425315868-24482-1-git-send-email-tim.gore@intel.com> X-Mailer: git-send-email 2.3.0 Cc: thomas.wood@intel.com Subject: [Intel-gfx] [PATCH i-g-t] tests/gem_render_tiled_blits: split into subtests 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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: Tim Gore The gem_render_tiled_blits test tends to get oom killed on low memory (< 4GB) Android systems. This is because the test tries to allocate (sysinfo.totalram * 9 / 10) in buffer objects and the remaining 10% of memory is not always enough for the Android system. A similar issue with gem_render_linear_blits was resolved by creating several subtests. A "basic" subtest that uses minimal memory buffers to test the basic operation, and two stress tests which are skipped if there is insufficient memory. The first stress test uses more memory than the graphics apperture and the second uses enough to ensure that swap space is used (if present). This patch makes the same changes to gem_render_tiled_blits. Signed-off-by: Tim Gore --- tests/gem_render_tiled_blits.c | 67 +++++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 24 deletions(-) diff --git a/tests/gem_render_tiled_blits.c b/tests/gem_render_tiled_blits.c index dc22529..ff94696 100644 --- a/tests/gem_render_tiled_blits.c +++ b/tests/gem_render_tiled_blits.c @@ -94,21 +94,16 @@ check_bo(struct intel_batchbuffer *batch, struct igt_buf *buf, uint32_t val) dri_bo_unmap(linear); } -int main(int argc, char **argv) +static void run_test (int fd, int count) { drm_intel_bufmgr *bufmgr; struct intel_batchbuffer *batch; uint32_t *start_val; struct igt_buf *buf; uint32_t start = 0; - int i, j, fd, count; + int i, j; uint32_t devid; - igt_simple_init(argc, argv); - - igt_skip_on_simulation(); - - fd = drm_open_any(); devid = intel_get_drm_devid(fd); render_copy = igt_get_render_copyfunc(devid); @@ -124,23 +119,6 @@ int main(int argc, char **argv) drm_intel_bufmgr_gem_set_vma_cache_size(bufmgr, 32); batch = intel_batchbuffer_alloc(bufmgr, devid); - count = 0; - if (argc > 1) - count = atoi(argv[1]); - if (count == 0) - count = 3 * gem_aperture_size(fd) / SIZE / 2; - else if (count < 2) { - igt_warn("count must be >= 2\n"); - return 1; - } - - if (count > intel_get_total_ram_mb() * 9 / 10) { - count = intel_get_total_ram_mb() * 9 / 10; - igt_info("not enough RAM to run test, reducing buffer count\n"); - } - - igt_info("Using %d 1MiB buffers\n", count); - linear = drm_intel_bo_alloc(bufmgr, "linear", WIDTH*HEIGHT*4, 0); if (snoop) { gem_set_caching(fd, linear->handle, 1); @@ -211,5 +189,46 @@ int main(int argc, char **argv) for (i = 0; i < count; i++) check_bo(batch, &buf[i], start_val[i]); + /* release resources */ + drm_intel_bo_unreference(linear); + for (i = 0; i < count; i++) { + drm_intel_bo_unreference(buf[i].bo); + } + intel_batchbuffer_free(batch); + drm_intel_bufmgr_destroy(bufmgr); +} + + +int main(int argc, char **argv) +{ + int fd = 0; + int count = 0; + + igt_subtest_init(argc, argv); + igt_fixture { + fd = drm_open_any(); + } + + igt_subtest("basic") { + run_test(fd, 2); + } + + /* the rest of the tests are too long for simulation */ + igt_skip_on_simulation(); + + igt_subtest("apperture-thrash") { + count = 3 * gem_aperture_size(fd) / SIZE / 2; + intel_require_memory(count, SIZE, CHECK_RAM); + run_test(fd, count); + } + + igt_subtest("swap-thrash") { + uint64_t swap_mb = intel_get_total_swap_mb(); + igt_require(swap_mb > 0); + count = ((intel_get_avail_ram_mb() + (swap_mb / 2)) * 1024*1024) / SIZE; + intel_require_memory(count, SIZE, CHECK_RAM | CHECK_SWAP); + run_test(fd, count); + } + igt_exit(); }