From: Matthew Auld <matthew.auld@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH i-g-t 3/3] tests/i915: adapt __copy_ccs for discrete
Date: Mon, 27 Jun 2022 17:10:04 +0100 [thread overview]
Message-ID: <20220627161004.70153-3-matthew.auld@intel.com> (raw)
In-Reply-To: <20220627161004.70153-1-matthew.auld@intel.com>
We can't explicitly control the mmap caching type for discrete, but
using mmap_device_coherent should be good enough here on such devices.
Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/4842
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
---
lib/intel_bufops.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c
index 05c0b0d4..c63a5760 100644
--- a/lib/intel_bufops.c
+++ b/lib/intel_bufops.c
@@ -451,11 +451,16 @@ static void __copy_ccs(struct buf_ops *bops, struct intel_buf *buf,
ccs_size = CCS_SIZE(gen, buf);
size = offset + ccs_size;
- map = __gem_mmap_offset__wc(bops->fd, buf->handle, 0, size,
- PROT_READ | PROT_WRITE);
- if (!map)
- map = gem_mmap__wc(bops->fd, buf->handle, 0, size,
- PROT_READ | PROT_WRITE);
+ if (gem_has_lmem(bops->fd)) {
+ map = gem_mmap__device_coherent(bops->fd, buf->handle, 0, size,
+ PROT_READ | PROT_WRITE);
+ } else {
+ map = __gem_mmap_offset__wc(bops->fd, buf->handle, 0, size,
+ PROT_READ | PROT_WRITE);
+ if (!map)
+ map = gem_mmap__wc(bops->fd, buf->handle, 0, size,
+ PROT_READ | PROT_WRITE);
+ }
switch (dir) {
case CCS_LINEAR_TO_BUF:
--
2.36.1
next prev parent reply other threads:[~2022-06-27 16:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-27 16:10 [Intel-gfx] [PATCH i-g-t 1/3] tests/i915/gem_eio: fix uaf Matthew Auld
2022-06-27 16:10 ` [Intel-gfx] [PATCH i-g-t 2/3] tests/i915/kms_mmap_write_crc: handle missing gem_get_caching() Matthew Auld
2022-06-28 12:26 ` Gwan-gyeong Mun
2022-06-27 16:10 ` Matthew Auld [this message]
2022-06-28 10:24 ` [Intel-gfx] [igt-dev] [PATCH i-g-t 1/3] tests/i915/gem_eio: fix uaf Das, Nirmoy
2022-06-28 10:24 ` [Intel-gfx] " Gwan-gyeong Mun
2022-06-28 12:47 ` Matthew Auld
2022-06-28 13:59 ` Gwan-gyeong Mun
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=20220627161004.70153-3-matthew.auld@intel.com \
--to=matthew.auld@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
/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