From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Cc: igt-dev@lists.freedesktop.org,
Lionel G Landwerlin <lionel.g.landwerlin@intel.com>
Subject: Re: [igt-dev] [PATCH 4/5] tools/i915-perf: Add mmapped OA buffer support to i915-perf-recorder
Date: Mon, 23 Aug 2021 18:05:05 -0700 [thread overview]
Message-ID: <87a6l71wla.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20210803200737.30843-4-umesh.nerlige.ramappa@intel.com>
On Tue, 03 Aug 2021 13:07:36 -0700, Umesh Nerlige Ramappa wrote:
>
> Currently report from OA buffer are read from the perf_fd. The kernel
> patches enable mmaping the OA buffer into user space to allow for faster
> report queries across different platforms and engines.
>
> Enable OA buffer to be mmaped by the recorder tool based on command line
> option -M.
Not completely reviewed yet but some changes are needed, please see below.
> +static int gem_set_domain(int fd, uint32_t handle, uint32_t read, uint32_t write)
> +{
> + struct drm_i915_gem_set_domain set_domain = {
> + .handle = handle,
> + .read_domains = read,
> + .write_domain = write,
> + };
> + int ret = 0;
> +
> + if (perf_ioctl(fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain))
set_domain is not available for discrete, see IGT gem_set_domain().
> +static void *gem_mmap_cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size,
> + unsigned int prot)
> +{
> + struct drm_i915_gem_mmap arg = {
> + .handle = handle,
> + .offset = offset,
> + .size = size,
> + .addr_ptr = 0,
> + .flags = 0,
> + };
> +
> + if (perf_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg))
This needs to be changed to mmap_offset, DRM_IOCTL_I915_GEM_MMAP has been
discontinued for future products.
> +static void
> +bb_emit_srm(struct bb_context *bb, uint32_t reg, uint32_t devid)
> +{
> + bool gen8_plus = devid >= 8;
> +
> + assert(bb->reloc_idx < ARRAY_SIZE(bb->reloc));
> + assert(bb->offset < BATCH_SIZE);
> +
> + bb->batch[bb->offset++] = gen8_plus ? MI_STORE_REGISTER_MEM_GEN8 :
> + MI_STORE_REGISTER_MEM;
> + bb->batch[bb->offset++] = reg;
> +
> + bb->reloc[bb->reloc_idx].target_handle = bb->obj[0].handle;
> + bb->reloc[bb->reloc_idx].presumed_offset = bb->obj[0].offset;
> + bb->reloc[bb->reloc_idx].offset = bb->offset * sizeof(uint32_t);
> + bb->reloc[bb->reloc_idx].delta = bb->reloc_idx * sizeof(uint32_t);
> + bb->reloc[bb->reloc_idx].read_domains = I915_GEM_DOMAIN_RENDER;
> + bb->reloc[bb->reloc_idx].write_domain = I915_GEM_DOMAIN_RENDER;
> +
> + bb->batch[bb->offset++] = bb->reloc[bb->reloc_idx].delta;
> + if (gen8_plus)
> + bb->batch[bb->offset++] = 0;
Relocations are also not available for future products. Let's use softpin,
it is simple to do and several examples for this are already merged.
> @@ -1015,16 +1450,40 @@ main(int argc, char *argv[])
> corr_period_ns = corr_period * 1000000000ul;
> poll_time_ns = corr_period_ns;
>
> + if (mmap_buffer) {
> + ctx.zero_fd = open("/dev/zero", O_RDWR | O_CLOEXEC);
Don't we need /dev/null rather than /dev/zero? Anyway looks unnecessarily
complicated, just malloc a buffer and read repeatedly into it?
next prev parent reply other threads:[~2021-08-24 1:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-03 20:07 [igt-dev] [PATCH 1/5] i915/perf: add tests for triggered OA reports Umesh Nerlige Ramappa
2021-08-03 20:07 ` [igt-dev] [PATCH 2/5] i915/perf: Add tests for mapped OA buffer Umesh Nerlige Ramappa
2021-08-23 21:31 ` Dixit, Ashutosh
2021-08-24 18:58 ` Umesh Nerlige Ramappa
2021-08-24 19:18 ` Dixit, Ashutosh
2021-08-03 20:07 ` [igt-dev] [PATCH 3/5] lib/i915/perf: Add new record for mmaped " Umesh Nerlige Ramappa
2021-08-03 20:07 ` [igt-dev] [PATCH 4/5] tools/i915-perf: Add mmapped OA buffer support to i915-perf-recorder Umesh Nerlige Ramappa
2021-08-24 1:05 ` Dixit, Ashutosh [this message]
2021-08-24 19:14 ` Umesh Nerlige Ramappa
2021-08-24 1:45 ` Dixit, Ashutosh
2021-08-26 23:57 ` Umesh Nerlige Ramappa
2021-08-24 3:50 ` Dixit, Ashutosh
2021-08-24 18:50 ` Umesh Nerlige Ramappa
2021-08-24 19:40 ` Dixit, Ashutosh
2021-08-24 20:03 ` Dixit, Ashutosh
2021-08-03 20:07 ` [igt-dev] [PATCH 5/5] tools/i915-perf: Add a command to trigger a report in OA buffer Umesh Nerlige Ramappa
2021-08-03 20:39 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [1/5] i915/perf: add tests for triggered OA reports Patchwork
2021-08-03 23:21 ` [igt-dev] ✗ GitLab.Pipeline: warning " Patchwork
2021-08-04 20:13 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2021-08-30 19:33 [igt-dev] [PATCH 1/5] " Umesh Nerlige Ramappa
2021-08-30 19:33 ` [igt-dev] [PATCH 4/5] tools/i915-perf: Add mmapped OA buffer support to i915-perf-recorder Umesh Nerlige Ramappa
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=87a6l71wla.wl-ashutosh.dixit@intel.com \
--to=ashutosh.dixit@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=lionel.g.landwerlin@intel.com \
--cc=umesh.nerlige.ramappa@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 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.