From: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: tursulin@igalia.com, zbigniew.kempczynski@intel.com,
kamil.konieczny@linux.intel.com, lukasz.laguna@intel.com
Subject: [PATCH v3 i-g-t 2/2] benchmarks/gem_wsim: Fix mmap for discrete graphics cards
Date: Thu, 25 Jul 2024 14:26:12 +0200 [thread overview]
Message-ID: <20240725122612.1290090-3-marcin.bernatowicz@linux.intel.com> (raw)
In-Reply-To: <20240725122612.1290090-1-marcin.bernatowicz@linux.intel.com>
It appears that 'gem_mmap__wc' doesn't work for discrete graphics cards
and 'I915_MMAP_OFFSET_FIXED' is needed instead.
Adopt the mapping approach from 'lib/igt_dummyload'.
v2: Correct brace balance (Kamil)
Remove redundant 'ptr' variable
Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
benchmarks/gem_wsim.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index cd1a01a67..af30a22b3 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -1494,7 +1494,7 @@ static unsigned int create_bb(struct w_step *w, int self)
#define TIMESTAMP (base + 0x3a8)
const int use_64b = gen >= 8;
enum { START_TS, NOW_TS };
- uint32_t *ptr, *cs, *jmp;
+ uint32_t *cs, *jmp;
unsigned int r = 0;
/* Loop until CTX_TIMESTAMP - initial > target ns */
@@ -1502,7 +1502,16 @@ static unsigned int create_bb(struct w_step *w, int self)
gem_set_domain(fd, w->bb_handle,
I915_GEM_DOMAIN_WC, I915_GEM_DOMAIN_WC);
- cs = ptr = gem_mmap__wc(fd, w->bb_handle, 0, w->bb_size, PROT_WRITE);
+ if (__gem_set_caching(fd, w->bb_handle, I915_CACHING_CACHED) == 0) {
+ cs = gem_mmap__cpu(fd, w->bb_handle,
+ 0, w->bb_size,
+ PROT_READ | PROT_WRITE);
+ } else {
+ cs = gem_mmap__device_coherent(fd,
+ w->bb_handle,
+ 0, w->bb_size,
+ PROT_READ | PROT_WRITE);
+ }
/* Store initial 64b timestamp: start */
*cs++ = MI_LOAD_REGISTER_IMM(1) | MI_CS_MMIO_DST;
--
2.31.1
next prev parent reply other threads:[~2024-07-25 12:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-25 12:26 [PATCH v3 i-g-t 0/2] benchmarks/gem_wsim: support gens without relocations and mmap fix Marcin Bernatowicz
2024-07-25 12:26 ` [PATCH v3 i-g-t 1/2] benchmarks/gem_wsim: Support gens without relocations Marcin Bernatowicz
2024-07-25 12:26 ` Marcin Bernatowicz [this message]
2024-07-25 13:22 ` ✓ Fi.CI.BAT: success for benchmarks/gem_wsim: support gens without relocations and mmap fix (rev2) Patchwork
2024-07-25 13:38 ` ✓ CI.xeBAT: " Patchwork
2024-07-25 16:17 ` ✓ CI.xeFULL: " Patchwork
2024-07-26 0:44 ` ✗ Fi.CI.IGT: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240725122612.1290090-3-marcin.bernatowicz@linux.intel.com \
--to=marcin.bernatowicz@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--cc=lukasz.laguna@intel.com \
--cc=tursulin@igalia.com \
--cc=zbigniew.kempczynski@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox