Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t v3 01/13] lib/intel_bufops: add mapping on cpu / device
Date: Mon, 27 Jul 2020 09:24:40 +0200	[thread overview]
Message-ID: <20200727072440.GA7982@zkempczy-mobl2> (raw)
In-Reply-To: <159559313412.21069.10281317382583696462@build.alporthouse.com>

On Fri, Jul 24, 2020 at 01:18:54PM +0100, Chris Wilson wrote:
> Quoting Zbigniew Kempczyński (2020-07-24 10:56:47)
> > Simplify mapping intel_buf. To be extended with ref counting.
> > Add intel_buf dump function for easy dump buffer to the file.
> > Fixing returned type of bo size function.
> > 
> > Idempotency selftest is now skipped for default buf_ops creation
> > to avoid time consuming comparison of HW and SW tiled buffers
> > (this can be the problem for forked tests). Additional function
> > buf_ops_create_with_selftest() was added to allow perform
> > verification step where it is required.
> > 
> > Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> > Cc: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > ---
> >  lib/intel_bufops.c | 106 +++++++++++++++++++++++++++++++++++++++------
> >  lib/intel_bufops.h |  15 ++++++-
> >  2 files changed, 107 insertions(+), 14 deletions(-)
> > 
> > diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c
> > index 2a48fb0c..7ce540fb 100644
> > --- a/lib/intel_bufops.c
> > +++ b/lib/intel_bufops.c
> > @@ -870,6 +870,48 @@ void intel_buf_destroy(struct intel_buf *buf)
> >         free(buf);
> >  }
> >  
> > +void *intel_buf_cpu_map(struct intel_buf *buf, bool write)
> > +{
> > +       int i915 = buf_ops_get_fd(buf->bops);
> > +
> > +       igt_assert(buf->ptr == NULL); /* already mapped */
> > +
> > +       buf->cpu_write = write;
> > +       buf->ptr = gem_mmap__cpu_coherent(i915, buf->handle, 0,
> > +                                         buf->surface[0].size,
> > +                                         write ? PROT_WRITE : PROT_READ);
> > +
> > +       gem_set_domain(i915, buf->handle,
> > +                      I915_GEM_DOMAIN_CPU,
> > +                      write ? I915_GEM_DOMAIN_CPU : 0);
> > +
> > +       return buf->ptr;
> > +}
> > +
> > +void *intel_buf_device_map(struct intel_buf *buf, bool write)
> > +{
> > +       int i915 = buf_ops_get_fd(buf->bops);
> > +
> > +       igt_assert(buf->ptr == NULL); /* already mapped */
> > +
> > +       buf->ptr = gem_mmap__device_coherent(i915, buf->handle, 0,
> > +                                            buf->surface[0].size,
> > +                                            write ? PROT_WRITE : PROT_READ);
> > +
> 
> Why wouldn't you do the sync here if you did it in the other?

Right.

> 
> Bleugh. Push the synchronisation and flushing to the caller. I have a
> strong dislike for it being magically applied, and believe such control
> should be in the user. (I want to encourage creativity, for we find the
> kernel bugs in the gaps between tests.)
> -Chris

This is helper, using it is optional. Currently there're 21 (cpu), 3 (wc)
of calls in the tests. I would like to keep this in the form it is to keep
compatibility with libdrm code (drm_intel_bo_map()). I think that function
still doesn't kill your creativity, it is just a wrapper. 

--
Zbigniew

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2020-07-27  7:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-24  9:56 [igt-dev] [PATCH i-g-t v3 00/13] Remove libdrm in rendercopy Zbigniew Kempczyński
2020-07-24  9:56 ` [igt-dev] [PATCH i-g-t v3 01/13] lib/intel_bufops: add mapping on cpu / device Zbigniew Kempczyński
2020-07-24 12:18   ` Chris Wilson
2020-07-27  7:24     ` Zbigniew Kempczyński [this message]
2020-07-24  9:56 ` [igt-dev] [PATCH i-g-t v3 02/13] lib/intel_batchbuffer: add new functions to support rendercopy Zbigniew Kempczyński
2020-07-24 12:25   ` Chris Wilson
2020-07-24  9:56 ` [igt-dev] [PATCH i-g-t v3 03/13] tests/gem_caching: adopt to batch flush function cleanup Zbigniew Kempczyński
2020-07-24 12:26   ` Chris Wilson
2020-07-24  9:56 ` [igt-dev] [PATCH i-g-t v3 04/13] lib/rendercopy: remove libdrm dependency Zbigniew Kempczyński
2020-07-24 12:29   ` Chris Wilson
2020-07-24  9:56 ` [igt-dev] [PATCH i-g-t v3 05/13] tests/api_intel_bb: add render tests Zbigniew Kempczyński
2020-07-24  9:56 ` [igt-dev] [PATCH i-g-t v3 06/13] lib/intel_batchbuffer: use canonical addresses for 48bit ppgtt Zbigniew Kempczyński
2020-07-24  9:56 ` [igt-dev] [PATCH i-g-t v3 07/13] lib/igt_draw: remove libdrm dependency Zbigniew Kempczyński
2020-07-24  9:56 ` [igt-dev] [PATCH i-g-t v3 08/13] lib/igt_fb: Removal of " Zbigniew Kempczyński
2020-07-24  9:56 ` [igt-dev] [PATCH i-g-t v3 09/13] tests/gem|kms: remove libdrm dependency (batch 1) Zbigniew Kempczyński
2020-07-24  9:56 ` [igt-dev] [PATCH i-g-t v3 10/13] tests/gem|kms: remove libdrm dependency (batch 2) Zbigniew Kempczyński
2020-07-24  9:56 ` [igt-dev] [PATCH i-g-t v3 11/13] tools/intel_residency: adopt intel_residency to use bufops Zbigniew Kempczyński
2020-07-24  9:56 ` [igt-dev] [PATCH i-g-t v3 12/13] tests/perf: remove libdrm dependency for rendercopy Zbigniew Kempczyński
2020-07-24 11:10   ` Lionel Landwerlin
2020-07-24 11:37     ` Zbigniew Kempczyński
2020-07-24 11:48       ` Lionel Landwerlin
2020-07-24  9:56 ` [igt-dev] [PATCH i-g-t v3 13/13] HAX: run rendercopy tests Zbigniew Kempczyński
2020-07-24 10:46 ` [igt-dev] ✗ Fi.CI.BAT: failure for Remove libdrm in rendercopy (rev3) 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=20200727072440.GA7982@zkempczy-mobl2 \
    --to=zbigniew.kempczynski@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@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