Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753119AbcC1B0G (ORCPT ); Sun, 27 Mar 2016 21:26:06 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:36607 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752516AbcC1B0E (ORCPT ); Sun, 27 Mar 2016 21:26:04 -0400 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 X-AuditID: cbfee68d-f79e86d0000012da-70-56f888280447 Content-transfer-encoding: 8BIT Message-id: <56F88828.5050304@samsung.com> Date: Mon, 28 Mar 2016 10:26:00 +0900 From: Inki Dae User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 To: Daniel Stone , Rob Clark Cc: Linux Kernel Mailing List , "dri-devel@lists.freedesktop.org" , =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= , Daniel Vetter , Riley Andrews , Gustavo Padovan , John Harrison Subject: Re: [RFC 0/6] drm/fences: add in-fences to DRM References: <1458758847-21170-1-git-send-email-gustavo@padovan.org> <56F3A2DC.8080507@samsung.com> <56F47D01.7040508@samsung.com> In-reply-to: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRmVeSWpSXmKPExsWyRsSkSFej40eYQd8BOYv3f++zWSx8eJfZ 4krrdFaLK1/fs1l8Wt3KbjHp6QM2i8u75rBZvN70l9Hi+cIfzA6cHtt2b2P1+Pv8OovH3m8L WDxefN3G7LFz1l12j8V7XjJ53O8+zuTxeZNcAEcUl01Kak5mWWqRvl0CV8bcswuYCq6rVjT9 P87cwDhProuRk0NCwETiZPN5ZghbTOLCvfVsILaQwApGiRW/UrsYOcBq7s+Q6GLkAgovZZQ4 NG8HC0gNr4CgxI/J91hAapgF5CWOXMqGMNUlpkzJhSh/wChx70w/G0S5lsSjzn9MIDaLgKrE h20PwdayAdkTV9xnA+kVFYiQ6D5RCRIWEfCQeHGzkQlkD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ytOzC0uzUvXS87P3cQITgPPpHYwHtzlfohRgINRiYc3w/JHmBBrYllxZe4hRgkOZiUR 3rVNQCHelMTKqtSi/Pii0pzU4kOMpkD/TWSWEk3OB6aovJJ4Q2MTMyNLI3NDCyNjcyVx3sf/ 14UJCaQnlqRmp6YWpBbB9DFxcEo1MHLMDlfaaaUi5imd57NUplRY4/vc2xxbP+SVb5m8guHk nZofs6K5KpRfcbpenypeOH+p7dQl172YfyzqnCUhMJH95aLpp5PrLOYLPegzFHh+YndO9c1v k45Lbun8xsBi/OBGT9YNbvZm89QDN3qlmiwvur39o9n1qpixvsta10U8KWHRjC0X7ymxFGck GmoxFxUnAgABbLE+GQMAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4734 Lines: 89 Hi Rob and Daniel, 2016년 03월 25일 21:10에 Daniel Stone 이(가) 쓴 글: > Hi all, > > On 25 March 2016 at 11:58, Rob Clark wrote: >> On Thu, Mar 24, 2016 at 7:49 PM, Inki Dae wrote: >>> It's definitely different case. This tries to add new user-space interfaces to expose fences to user-space. At least, implicit interfaces are embedded into drivers. >>> So I'd like to give you a question. Why exposing fences to user-space is required? To provide easy-to-debug solution to rendering pipleline? To provide merge fence feature? >> >> Well, implicit sync and explicit sync are two different cases. >> Implicit sync ofc remains the default, but userspace could opt-in to >> explicit sync instead. For example, on the gpu side of things, >> depending on flags userspace passes in to the submit ioctl we would >> either attach the fence to all the written buffers (implicit) or >> return it as a fence fd to userspace (explicit), which userspace could >> then pass in to atomic ioctl to synchronize pageflip. >> >> And visa-versa, we can pass the pageflip (atomic) completion fence >> back in to gpu so it doesn't start rendering the next frame until the >> buffer is off screen. >> >> fwiw, currently android is the first user of explicit sync (although I >> expect wayland/weston to follow suit). > > Second, really. Vulkan avoids implicit sync entirely, and exposes > fence-like primitives throughout its whole API. These include being > able to pass prerequisite fences for display (what Gustavo is adding > here: something to block on before display), and also when the user > acquires a buffer as a render target, it is given another prerequisite > fence (the other side of what Gustavo is suggesting, i.e. the fence > triggers when the buffer is no longer displayed and becomes available > for rendering). > > In order to implement this correctly, and avoid performance bubbles, > we need a primitive like this exposed through the KMS API, from both > sides. This is especially important when you take the case of > userspace suballocation, where userspace allocates larger blocks and > divides the allocation internally for different uses. Implicit sync > does not work at all for that case. Can you give me more details why implicit sync cannot take care of the case of userspace suballocation? And is there any reason that fence fd shouldn't dependent of DMABUF - now fence fd is a new file, not DMABUF fd? > > As stated before, there are other benefits, including much better > traceability. I would expect Wayland/Weston to also start pushing > support for this API relatively soon. > >> A couple linaro folks have >> android running with an upstream kernel + mesa + atomic/kms hwc on a >> couple devices (nexus7 and db410c with freedreno, and qemu with >> virgl). But there are some limitations due to missing the >> EGL_ANDROID_native_fence_sync extension in mesa. I plan to implement >> that, but I ofc need the fence fd stuff in order to do so ;-) > > Yes, having that would be a godsend for a lot of people. > >>> And if we need really to expose fences to user-space and there is really real user, then we have already good candidates, DMA-BUF-IOCTL-SYNC or maybe fcntl system call because we share already DMA buffer between CPU <-> DMA and DMA <-> DMA using DMABUF. >>> For DMA-BUF-IOCTL-SYNC, I think you remember that was what I tried long time ago because you was there. Several years ago, I tried to couple exposing the fences to user-space with cache operation although at that time, I really misleaded the fence machnism. My trying was also for the potential users. >> >> Note that this is not (just) about sw sync, but also sync between >> multiple hw devices. > > Sync isn't quite good enough, because it's a mandatory blocking point > for userspace. We want to push the explicit fences further down the > line, so userspace can parallelise its work. > > Even if none of the above requirements held true, I don't think being > able to support Android is a bad thing. It's completely right to be > worried about pushing in Android work and APIs for the sake of it - > hence why we didn't take ADF! - but in this case it's definitely a As least Google's ADF boosted up atomic KMS. :) > good thing. This is also the model that ChromeOS is moving towards, so > it becomes more important from that point of view as well. I think Gustavo should had explaned this path series enough to other people when posting them - ie, what relationship explict and implicit fences have, and why implicit fence - which is independent of DMABUF - is required, and what use cases there are in real users, and etc. Thanks, Inki Dae > > Cheers, > Daniel > >