From patchwork Fri Feb 24 10:58:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Szwichtenberg, Radoslaw" X-Patchwork-Id: 9589917 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 34E1960471 for ; Fri, 24 Feb 2017 10:59:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 307CA28949 for ; Fri, 24 Feb 2017 10:59:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 255EF2894F; Fri, 24 Feb 2017 10:59:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A7C9428949 for ; Fri, 24 Feb 2017 10:59:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 07C346EC11; Fri, 24 Feb 2017 10:59:07 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id EBFB76EC00 for ; Fri, 24 Feb 2017 10:59:05 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Feb 2017 02:58:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,200,1484035200"; d="scan'208";a="937651243" Received: from rszwicht-desk.ger.corp.intel.com (HELO rszwicht-desk.igk.intel.com) ([172.28.171.52]) by orsmga003.jf.intel.com with ESMTP; 24 Feb 2017 02:58:57 -0800 From: Radoslaw Szwichtenberg To: intel-gfx@lists.freedesktop.org Date: Fri, 24 Feb 2017 11:58:52 +0100 Message-Id: <20170224105853.5717-1-radoslaw.szwichtenberg@intel.com> X-Mailer: git-send-email 2.9.3 Subject: [Intel-gfx] [PATCH i-g-t 1/2] tests/pm_rps: Replace custom load function with dummy load 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-Virus-Scanned: ClamAV using ClamSMTP There is no point in using custom function if there lib counterpart. Cc: Arkadiusz Hiler Cc: Michal Winiarski Signed-off-by: Radoslaw Szwichtenberg --- tests/pm_rps.c | 79 +++++++++++----------------------------------------------- 1 file changed, 14 insertions(+), 65 deletions(-) diff --git a/tests/pm_rps.c b/tests/pm_rps.c index 5a54d9d..7aa66a8 100644 --- a/tests/pm_rps.c +++ b/tests/pm_rps.c @@ -560,58 +560,18 @@ static void reset_gpu(void) close(fd); } -static uint32_t *make_busy(int fd, uint32_t handle) +static void boost_freq(int fd, int *boost_freqs) { - const int gen = intel_gen(intel_get_drm_devid(fd)); - struct drm_i915_gem_exec_object2 obj; - struct drm_i915_gem_relocation_entry reloc; - struct drm_i915_gem_execbuffer2 execbuf; - uint32_t *batch; - int i; - - memset(&execbuf, 0, sizeof(execbuf)); - execbuf.buffers_ptr = (uintptr_t)&obj; - execbuf.buffer_count = 1; - - memset(&obj, 0, sizeof(obj)); - obj.handle = handle; - - obj.relocs_ptr = (uintptr_t)&reloc; - obj.relocation_count = 1; - memset(&reloc, 0, sizeof(reloc)); - - batch = gem_mmap__wc(fd, obj.handle, 0, 4096, PROT_WRITE); - gem_set_domain(fd, obj.handle, - I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); - - reloc.target_handle = obj.handle; /* recurse */ - reloc.presumed_offset = 0; - reloc.offset = sizeof(uint32_t); - reloc.delta = 0; - reloc.read_domains = I915_GEM_DOMAIN_COMMAND; - reloc.write_domain = 0; - - i = 0; - batch[i] = MI_BATCH_BUFFER_START; - if (gen >= 8) { - batch[i] |= 1 << 8 | 1; - batch[++i] = 0; - batch[++i] = 0; - } else if (gen >= 6) { - batch[i] |= 1 << 8; - batch[++i] = 0; - } else { - batch[i] |= 2 << 6; - batch[++i] = 0; - if (gen < 4) { - batch[i] |= 1; - reloc.delta = 1; - } - } - i++; + int64_t timeout = 1; + int ring = -1; + igt_spin_t *load; - gem_execbuf(fd, &execbuf); - return batch; + load = igt_spin_batch_new(fd, ring, 0); + gem_wait(fd, load->handle, &timeout); + read_freqs(boost_freqs); + dump(boost_freqs); + igt_spin_batch_end(load); + igt_spin_batch_free(fd, load); } static void waitboost(bool reset) @@ -619,15 +579,9 @@ static void waitboost(bool reset) int pre_freqs[NUMFREQ]; int boost_freqs[NUMFREQ]; int post_freqs[NUMFREQ]; - uint32_t *batch, handle; - int64_t timeout = 1; int fd = drm_open_driver(DRIVER_INTEL); - /* When we wait upon the GPU, we want to temporarily boost it - * to maximum. - */ - load_helper_run(LOW); igt_debug("Apply low load...\n"); @@ -640,15 +594,10 @@ static void waitboost(bool reset) sleep(1); } - igt_debug("Wait for gpu...\n"); - handle = gem_create(fd, 4096); - batch = make_busy(fd, handle); - gem_wait(fd, handle, &timeout); - read_freqs(boost_freqs); - dump(boost_freqs); - *batch = MI_BATCH_BUFFER_END; - munmap(batch, 4096); - gem_close(fd, handle); + /* When we wait upon the GPU, we want to temporarily boost it + * to maximum. + */ + boost_freq(fd, boost_freqs); igt_debug("Apply low load again...\n"); sleep(1);