linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Tomasz Figa <tfiga@chromium.org>,
	Ricardo Ribalda <ribalda@chromium.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: Re: [PATCH] v4l-compliance: re-introduce NON_COHERENT and cache hints tests
Date: Fri, 10 Sep 2021 22:31:42 +0900	[thread overview]
Message-ID: <YTtePjJoynZ4imCp@google.com> (raw)
In-Reply-To: <YTtUOXF1qGbL+q0V@google.com>

On (21/09/10 21:48), Sergey Senozhatsky wrote:
> > Streaming ioctls:
> >         test read/write: OK (Not Supported)
> >         test blocking wait: OK
> >         Video Capture: Captured 8 buffers
> >         test MMAP (no poll): OK
> >         Video Capture: Captured 8 buffers
> >         test MMAP (select): OK
> >         Video Capture: Captured 8 buffers
> >         test MMAP (epoll): OK
> >         Video Capture: Captured 8 buffers
> >         test USERPTR (no poll): OK
> >         Video Capture: Captured 8 buffers
> >         test USERPTR (select): OK
> >                 fail: v4l2-test-buffers.cpp(1869): !(flags & V4L2_BUF_FLAG_NO_CACHE_INVALIDATE)
> >                 fail: v4l2-test-buffers.cpp(1932): setupDmaBuf(expbuf_node, node, q, exp_q)
> >         test DMABUF (no poll): FAIL
> >                 fail: v4l2-test-buffers.cpp(1869): !(flags & V4L2_BUF_FLAG_NO_CACHE_INVALIDATE)
> >                 fail: v4l2-test-buffers.cpp(1932): setupDmaBuf(expbuf_node, node, q, exp_q)
> >         test DMABUF (select): FAIL
> > 
> > The same happens with e.g. vivid, but vim2m is quicker to test.
> > 
> > I'm not sure whether this is a bug in this v4l2-compliance patch or whether it is
> > a bug in the v6 series, but it should be checked.
> 
> Looking into it now. I ran v4l2-compliance, but not "contrib/test/test-media"

AFAICT the problem is in v4l2-compliance patch.

We clear request flags if queue does not support user-space cache hints:

	 q->allow_cache_hints && q->memory == VB2_MEMORY_MMAP

But for DMABUF buffers (only) we set cache hints internally in
set_buffer_cache_hints() and always skip cache sync/flush on
prepare/finish regardless of what is passed from the user-space:

       if (q->memory == VB2_MEMORY_DMABUF) {
               vb->skip_cache_sync_on_finish = 1;
               vb->skip_cache_sync_on_prepare = 1;
               return;
       }

Technically we don't support user-space cache hints for DMABUF, so we
clear passed user-space cache hint flags.

I think the fix should look like this (tested with "test-media vivid"):

---

diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp
index 9b87c90f..baa306f1 100644
--- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
+++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
@@ -1865,9 +1865,10 @@ static int setupDmaBuf(struct node *expbuf_node, struct node *node,
 				fail_on_test(!buf.g_bytesused(p));
 		}
 		flags = buf.g_flags();
-		/* We always skip cache sync/flush for DMABUF memory type */
-		fail_on_test(!(flags & V4L2_BUF_FLAG_NO_CACHE_INVALIDATE));
-		fail_on_test(!(flags & V4L2_BUF_FLAG_NO_CACHE_CLEAN));
+
+		/* Make sure that flags are cleared */
+		fail_on_test((flags & V4L2_BUF_FLAG_NO_CACHE_INVALIDATE));
+		fail_on_test((flags & V4L2_BUF_FLAG_NO_CACHE_CLEAN));
 		fail_on_test(flags & V4L2_BUF_FLAG_DONE);
 		fail_on_test(buf.querybuf(node, i));
 		fail_on_test(buf.check(q, Queued, i));

  reply	other threads:[~2021-09-10 13:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-09  9:22 [PATCH] v4l-compliance: re-introduce NON_COHERENT and cache hints tests Sergey Senozhatsky
2021-09-10 12:20 ` Hans Verkuil
2021-09-10 12:48   ` Sergey Senozhatsky
2021-09-10 13:31     ` Sergey Senozhatsky [this message]
2021-09-10 14:16       ` Sergey Senozhatsky
  -- strict thread matches above, loose matches on Subject: below --
2021-04-27 13:20 Sergey Senozhatsky
2021-03-02  0:46 [PATCH 0/8] videobuf2: support new noncontiguous DMA API Sergey Senozhatsky
2021-03-02  0:49 ` [PATCH] v4l-compliance: re-introduce NON_COHERENT and cache hints tests Sergey Senozhatsky
2021-03-02  0:50   ` Sergey Senozhatsky

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=YTtePjJoynZ4imCp@google.com \
    --to=senozhatsky@chromium.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=ribalda@chromium.org \
    --cc=tfiga@chromium.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;
as well as URLs for NNTP newsgroup(s).