All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests/pm_rps: Replace custom load function with dummy load
@ 2017-06-07 14:29 Radoslaw Szwichtenberg
  2017-06-09 11:49 ` Fiedorowicz, Lukasz
  2017-06-09 12:00 ` Arkadiusz Hiler
  0 siblings, 2 replies; 3+ messages in thread
From: Radoslaw Szwichtenberg @ 2017-06-07 14:29 UTC (permalink / raw)
  To: intel-gfx

Replaced custom load implementation with lib counterpart.

Signed-off-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 tests/pm_rps.c | 80 ++++++++++++----------------------------------------------
 1 file changed, 16 insertions(+), 64 deletions(-)

diff --git a/tests/pm_rps.c b/tests/pm_rps.c
index 4a21de4..f0455e7 100644
--- a/tests/pm_rps.c
+++ b/tests/pm_rps.c
@@ -560,58 +560,21 @@ 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;
+	int64_t timeout = 1;
+	int ring = -1;
+	igt_spin_t *load;
 
-	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++;
+	load = igt_spin_batch_new(fd, ring, 0);
 
-	gem_execbuf(fd, &execbuf);
-	return batch;
+	/* Waiting will grant us a boost to maximum */
+	gem_wait(fd, load->handle, &timeout);
+
+	read_freqs(boost_freqs);
+	dump(boost_freqs);
+
+	igt_spin_batch_free(fd, load);
 }
 
 static void waitboost(bool reset)
@@ -619,15 +582,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 +597,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);
-- 
2.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH i-g-t] tests/pm_rps: Replace custom load function with dummy load
  2017-06-07 14:29 [PATCH i-g-t] tests/pm_rps: Replace custom load function with dummy load Radoslaw Szwichtenberg
@ 2017-06-09 11:49 ` Fiedorowicz, Lukasz
  2017-06-09 12:00 ` Arkadiusz Hiler
  1 sibling, 0 replies; 3+ messages in thread
From: Fiedorowicz, Lukasz @ 2017-06-09 11:49 UTC (permalink / raw)
  To: Szwichtenberg, Radoslaw, intel-gfx@lists.freedesktop.org

On Wed, 2017-06-07 at 16:29 +0200, Radoslaw Szwichtenberg wrote:
> Replaced custom load implementation with lib counterpart.
> 
> Signed-off-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.c
> om>
Reviewed-by: Lukasz Fiedorowicz <lukasz.fiedorowicz@intel.com>

-Lukasz
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH i-g-t] tests/pm_rps: Replace custom load function with dummy load
  2017-06-07 14:29 [PATCH i-g-t] tests/pm_rps: Replace custom load function with dummy load Radoslaw Szwichtenberg
  2017-06-09 11:49 ` Fiedorowicz, Lukasz
@ 2017-06-09 12:00 ` Arkadiusz Hiler
  1 sibling, 0 replies; 3+ messages in thread
From: Arkadiusz Hiler @ 2017-06-09 12:00 UTC (permalink / raw)
  To: Radoslaw Szwichtenberg; +Cc: intel-gfx

On Wed, Jun 07, 2017 at 04:29:59PM +0200, Radoslaw Szwichtenberg wrote:
> Replaced custom load implementation with lib counterpart.
> 
> Signed-off-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>

I see that you've addressed Chris' concerns.

Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>

and pushed. Thanks!
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-09 12:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-07 14:29 [PATCH i-g-t] tests/pm_rps: Replace custom load function with dummy load Radoslaw Szwichtenberg
2017-06-09 11:49 ` Fiedorowicz, Lukasz
2017-06-09 12:00 ` Arkadiusz Hiler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.