Received: by 10.213.65.68 with SMTP id h4csp684843imn; Tue, 13 Mar 2018 18:11:07 -0700 (PDT) X-Google-Smtp-Source: AG47ELvEs33CZbJQO9J5pnbGkvD1OhoSOLuB+nfelLgnZI8nW8ohbOAxi3RMgT4Wtj5dpUhuF6au X-Received: by 2002:a17:902:7f0c:: with SMTP id d12-v6mr2275347plm.350.1520989867196; Tue, 13 Mar 2018 18:11:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520989867; cv=none; d=google.com; s=arc-20160816; b=sAmZs6A8AFMFa2YiJ4vM6y9gK5ClJYUc1FX23AI46uWiKl63wKnMCeVLDEEQiHN1ns 91fqNNGjkzOdPXI7LIZxIogPPEKbK5Cs6OIH9gPnTAbMHiB0TLOMa4vHDyJSDLrjLeIz RYjYypbUyr6AYCw1Uf+QMoFUgAm0Bc7dNJca/4Gen+56yVuL+gA0TWYgWd4nKZMfSyIX eeOp4YJxA3jdALsmHGB10ls+OMfT3+tCber4wHMlhm3y3LcMubISzifrCe+DYewpskpI t3wP1Mr6XbVB6WwoUOLFba9k2CUXUCrpHcqgXLuCmxPiNCII6zAZCXtaD3aVUpiTeTSs Us1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature:arc-authentication-results; bh=7uEaGu55bdvh0YwtAZ4zOusrZRpwUYMHHAuRvFXM2ZI=; b=BwJLRe6Hm2pPhw2MbSWlChsiGTDlP6Rqavw9+/jr4TU19TCBZd3IqzWBFxpZaFfzcJ +2w7aKn7WEag0LZhMcD7AwYpnJCuts3BfnWjxijm7PFrW1MBYRJpH8h7KpVy326eqWKt ea0aAdV9kFj8yPW7WtgtIXQ/eAlbjWd/PI0pjnUZDt1u6FtMQv7RpXMB/3wBkkD/KrpS NlDeP2ZqJZPZJSLmkFuw8XTn+CuS7VYqLFZgGBJ3UainUBPf/fL4rG9K5io24kfWsSwc 7xlBl5d2urJM5YR2RtCauDzcsyF72Fa+ItimI3HIt5c8MBPK9F8wYhuwYvQYyUe1hvdy bNzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ndufresne-ca.20150623.gappssmtp.com header.s=20150623 header.b=MeIxItD4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l73si1124243pfj.45.2018.03.13.18.10.53; Tue, 13 Mar 2018 18:11:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ndufresne-ca.20150623.gappssmtp.com header.s=20150623 header.b=MeIxItD4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933040AbeCNBJu (ORCPT + 99 others); Tue, 13 Mar 2018 21:09:50 -0400 Received: from mail-qt0-f179.google.com ([209.85.216.179]:39216 "EHLO mail-qt0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932992AbeCNBJs (ORCPT ); Tue, 13 Mar 2018 21:09:48 -0400 Received: by mail-qt0-f179.google.com with SMTP id a26so1786633qtj.6 for ; Tue, 13 Mar 2018 18:09:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ndufresne-ca.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=7uEaGu55bdvh0YwtAZ4zOusrZRpwUYMHHAuRvFXM2ZI=; b=MeIxItD4b8/EwHhPK67Ce/BtiZz52EmXYYWZHEn67hHxPq7cl8FcuWAHuGt9gE4NVX xNQYmcWImhv8CgAjiI+fV3q8trav4abwib7nIcdN6sf2MhF+BFqZIXrQUAuV63voSSG5 B/WwCCwn7xrXSbULlCsvqJw5fFhq9VmE+W7oUEaBGaxSt3jvqctI0kTmDYKdiHKLi+I5 cNGvh+WT9C4/6tedC9AAwi6WmOZ1x7ya4BL5yzovcmb5os/ZrA2QMBTEW4gSY6RNx2UB ZUYTTRhVdC4fRgdrsW3VZ1hM5b8Aq4D9qq5sajpgvGKEBIHUxugus5GpbBYNMlCrrWiO xmww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=7uEaGu55bdvh0YwtAZ4zOusrZRpwUYMHHAuRvFXM2ZI=; b=Eur3BtoP9h1XFsB+fUg6ePfl6FIO9JVAtJoV44iYPF+bUYWf15CguEZBJD6NE+BmQi hILZLGtJp8Cnni0LVFxWr5+D6EACfbRWBf6nPWrP5olV6nYW0T5s/jtMfKOl6J4yS89u nBqRIGXfWdYE5+OhAGgkspGyamVyZWrNjcYXYHftyPvOqTZUa2dT71ToYmjPoWuhMUJ+ s3fpYbVHbRhPZfTysl5cPXo7iqkZWQpoh7F231FppvUb3eDweM7THBKN30YkGkjeDnVN Zf6LrYthkxplIkSyW0O4t0JdFYN7yNaa00utyexd+aR+4oJIm8FBEkraMb0GKCYCkhdS /GTQ== X-Gm-Message-State: AElRT7ErVWXsPvYS+bH6zILdhk9LzP2JH4qoOOuCKy0/ybeUIzMPf5Jj rGB9hCR1FZ2TYDhpEQ4zZHtiqQ== X-Received: by 10.237.46.69 with SMTP id j63mr4433718qtd.257.1520989787556; Tue, 13 Mar 2018 18:09:47 -0700 (PDT) Received: from skullcanyon (cable-192.222.221.38.electronicbox.net. [192.222.221.38]) by smtp.gmail.com with ESMTPSA id 92sm1195344qta.5.2018.03.13.18.09.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 18:09:46 -0700 (PDT) Message-ID: <1520989785.5128.16.camel@ndufresne.ca> Subject: Re: [PATCH] media: vb2: unify calling of set_page_dirty_lock From: Nicolas Dufresne To: Stanimir Varbanov , Sakari Ailus Cc: Mauro Carvalho Chehab , Pawel Osciak , Marek Szyprowski , Kyungmin Park , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 13 Mar 2018 21:09:45 -0400 In-Reply-To: <1520988249.5128.13.camel@ndufresne.ca> References: <20170829112603.32732-1-stanimir.varbanov@linaro.org> <1507650010.2784.11.camel@ndufresne.ca> <20171015204014.2awhhygw6hi3lxas@valkosipuli.retiisi.org.uk> <1508108964.4502.6.camel@ndufresne.ca> <20171017101420.5a5cvyhkadmcqgfy@valkosipuli.retiisi.org.uk> <1508249953.19297.4.camel@ndufresne.ca> <8f1eda59-fc51-b77e-ae43-9603b5759b14@linaro.org> <1520988249.5128.13.camel@ndufresne.ca> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.5 (3.26.5-1.fc27) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le mardi 13 mars 2018 à 20:44 -0400, Nicolas Dufresne a écrit : > Le mercredi 18 octobre 2017 à 11:34 +0300, Stanimir Varbanov a écrit > : > > > > On 10/17/2017 05:19 PM, Nicolas Dufresne wrote: > > > Le mardi 17 octobre 2017 à 13:14 +0300, Sakari Ailus a écrit : > > > > On Sun, Oct 15, 2017 at 07:09:24PM -0400, Nicolas Dufresne > > > > wrote: > > > > > Le dimanche 15 octobre 2017 à 23:40 +0300, Sakari Ailus a > > > > > écrit > > > > > : > > > > > > Hi Nicolas, > > > > > > > > > > > > On Tue, Oct 10, 2017 at 11:40:10AM -0400, Nicolas Dufresne > > > > > > wrote: > > > > > > > Le mardi 29 août 2017 à 14:26 +0300, Stanimir Varbanov a > > > > > > > écrit : > > > > > > > > Currently videobuf2-dma-sg checks for dma direction for > > > > > > > > every single page and videobuf2-dc lacks any dma > > > > > > > > direction > > > > > > > > checks and calls set_page_dirty_lock unconditionally. > > > > > > > > > > > > > > > > Thus unify and align the invocations of > > > > > > > > set_page_dirty_lock > > > > > > > > for videobuf2-dc, videobuf2-sg memory allocators with > > > > > > > > videobuf2-vmalloc, i.e. the pattern used in vmalloc has > > > > > > > > been > > > > > > > > copied to dc and dma-sg. > > > > > > > > > > > > > > Just before we go too far in "doing like vmalloc", I > > > > > > > would > > > > > > > like to > > > > > > > share this small video that display coherency issues when > > > > > > > rendering > > > > > > > vmalloc backed DMABuf over various KMS/DRM driver. I can > > > > > > > reproduce > > > > > > > this > > > > > > > easily with Intel and MSM display drivers using UVC or > > > > > > > Vivid as > > > > > > > source. > > > > > > > > > > > > > > The following is an HDMI capture of the following > > > > > > > GStreamer > > > > > > > pipeline > > > > > > > running on Dragonboard 410c. > > > > > > > > > > > > > > gst-launch-1.0 -v v4l2src device=/dev/video2 ! > > > > > > > video/x- > > > > > > > raw,format=NV16,width=1280,height=720 ! kmssink > > > > > > > https://people.collabora.com/~nicolas/vmalloc-issue.m > > > > > > > ov > > > > > > > > > > > > > > Feedback on this issue would be more then welcome. It's > > > > > > > not > > > > > > > clear > > > > > > > to me > > > > > > > who's bug is this (v4l2, drm or iommu). The software is > > > > > > > unlikely to > > > > > > > be > > > > > > > blamed as this same pipeline works fine with non-vmalloc > > > > > > > based > > > > > > > sources. > > > > > > > > > > > > Could you elaborate this a little bit more? Which Intel CPU > > > > > > do you > > > > > > have > > > > > > there? > > > > > > > > > > I have tested with Skylake and Ivy Bridge and on Dragonboard > > > > > 410c > > > > > (Qualcomm APQ8016 SoC) (same visual artefact) > > > > > > > > I presume kmssink draws on the display. Which GPU did you use? > > > > > > In order, GPU will be Iris Pro 580, Intel® Ivybridge Mobile and > > > an > > > Adreno (3x ?). Why does it matter ? I'm pretty sure the GPU is > > > not > > > used > > > on the DB410c for this use case. > > > > Nicolas, for me this looks like a problem in v4l2. In the case of > > vivid > > the stats overlay (where the coherency issues are observed, and > > most > > probably the issue will be observed on the whole image but > > fortunately > > it is a static image pattern) are filled by the CPU but I cannot > > see > > where the cache is flushed. Also I'm wondering why .finish method > > is > > missing for dma-vmalloc mem_ops. > > > > To be sure that the problem is in vmalloc v4l2 allocator, could you > > change the allocator to dma-contig, there is a module param for > > that > > called 'allocators'. > > I've looked into this again. I have hit the same issue but with CPU > to > DRM, using DMABuf allocated from DRM Dumb buffers. In that case, > using > DMA_BUF_IOCTL_SYNC fixes the issues. > > This raises a lot of question around the model used in V4L2. As you > mention, prepare/finish are missing in dma-vmalloc mem_ops. I'll give > a > try implementing that, it should cover my initial use case, but then > I > believe it will fail if my pipeline is: > > UVC -> in plane CPU modification -> DRM > > Because we don't implement begin/end_cpu_access on our exported > DMABuf. > It should also fail for the following use case: > > UVC (importer) -> DRM > > UVC driver won't call the remote dmabuf being/end_cpu_access method. > This one is difficult because UVC driver and vivid don't seem to be > aware of being an importer, exported or simply exporting to CPU > (through mmap). I believe what we have now pretty much assumes the > what > we export as vmalloc is to be used by CPU only. Also, the usual > direction used by prepare/finish ops won't work for drivers like > vivid > and UVC that write into the buffers using the cpu. > > To be continued ... While I was writing that, I was already outdated, as of now, we only have one ops, called sync. This implements the to_cpu direction only. > > Nicolas > >