Received: by 10.213.65.68 with SMTP id h4csp662510imn; Wed, 4 Apr 2018 05:16:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx49AMw3B2MimBETOcD0IEyEO72kskhI5x7S5sRAd//LF6c3Ka3TvLR4feexvezRnpIf1VBqW X-Received: by 2002:a17:902:8646:: with SMTP id y6-v6mr18694175plt.182.1522844189152; Wed, 04 Apr 2018 05:16:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522844189; cv=none; d=google.com; s=arc-20160816; b=h8vsYQmkm4GIWnMTQfN7BOy7qeBa60drkPSBQtCEK76VC5RRxx9vzA5Q+VYZ/rtZhS nCHbxg0v5vLUyUtrk02z97Qcq8F/ASqvXNmzZG4RUW97MCGudiS6EqavVyXEUW7pcpf3 LOnBuF7Wn/SfXkqorreNo4E0p3mG3pGnXHigAVjRJ1YaexHjW3BUkxViOFgCDsaWBkJu 2XEX3HrNaAAPh86GEFJhpPxzSQGAOGPnuNehjsLH6PlQDwHAceCuoW40wzCqcB1aVC5r eABXx/HxhhECsxlptK6Yo4BZ7SQHZ+ze2Y+YArKfH6auG1t0h4r09t5SlWpoUcUZjGJM FbOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=+RYV+oto4+FEWSj+8n60MU4wK/7W/7hwWYK2fFDaJJg=; b=x4CMO089uK54NcTQpbnlKZ5Z4CfTQekL0FYotba8w0n/DEPSG2l85lpXMjHxIlzwWi tDr/AZbqMp35Vn9ESXIl97Al2fi3IwzrlW5om+aT6qfxRVgNRTI1cJAarF4uX5OjvLpD xag4ARDKaUrHI+SU4q81i4aC5ywnXVpn8aKZUJgwVjZklpnoKWTaqldGFxfCDPJcRWT7 JnbbnmdU7Kal7GAwuO/eHm9w3Im2KeOHRoXkg0NWzHkLubPTod0DyWvy/7JrbKf/9Tdi f2g3tSlw6wGoFRYoo8TCoKnJdfhHTH+HkKOHC6tAmnrY60UFkkSnqZNw7zeg2PopA5s7 XWdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=hgIM/Zbp; 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 s2si3887665pfh.11.2018.04.04.05.16.14; Wed, 04 Apr 2018 05:16:29 -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=fail header.i=@ffwll.ch header.s=google header.b=hgIM/Zbp; 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 S1751265AbeDDMN6 (ORCPT + 99 others); Wed, 4 Apr 2018 08:13:58 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:40177 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751155AbeDDMN4 (ORCPT ); Wed, 4 Apr 2018 08:13:56 -0400 Received: by mail-wm0-f48.google.com with SMTP id x4so41821157wmh.5 for ; Wed, 04 Apr 2018 05:13:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=+RYV+oto4+FEWSj+8n60MU4wK/7W/7hwWYK2fFDaJJg=; b=hgIM/ZbpqLN/3xlg/H/iiuzKe9UZWIpYFRrmtAmlWnlANjPEse4MrNlkgkdzHUstHH fRxRpJkmB3o8Ujnr7zNUDbC5/DFsuVUeQZVf6YKvMuIO/pTyy2Cfxp3hOdvb5XYrmLeW MaXmPXKHc4HLGTt4lB+Fpiu/+lEcFggy23/IM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=+RYV+oto4+FEWSj+8n60MU4wK/7W/7hwWYK2fFDaJJg=; b=KD8BN74yjPY1mEKoikiV+818NexhOmJHJyxzrtlyFhkOmJYQxJ/3yvixOGHVuRU2MV QVZn2isFkiukP+F/xymKBB/Fvadn1l6VrdKe5fTFNev6gTRV+GSVXhCF/e1g7ogNKXOi BAFSQ2uegE3IVp1HdsBn0024QPOU+ZEzmRWHzzZUXgq7BgTq38d56dMUFkkF5v6DnNSC ZXITvZXZD7t5nua5zAeWY7eYIs2yNYruF+M/SUmHK2TWp4VXkGIIXCgioU69ra3a0OSv Qs8RH4XzrjBfdkDi02PFElQcw7kmqRiu2pAsbMcELKnigff81q0jLbdNJ48QYUmX7/2g 2dDw== X-Gm-Message-State: ALQs6tCUQFkpMFqFgL26L0ym92s9VlGNeX1X0pBjo8WbwH+EITvg78mn otDVp7k+c1g58O8lhNmIBzjm3A== X-Received: by 10.80.203.71 with SMTP id h7mr5940504edi.118.1522844034831; Wed, 04 Apr 2018 05:13:54 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-109.fiber7.init7.net. [212.51.149.109]) by smtp.gmail.com with ESMTPSA id d12sm3235047edi.7.2018.04.04.05.13.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Apr 2018 05:13:53 -0700 (PDT) Date: Wed, 4 Apr 2018 14:13:51 +0200 From: Daniel Vetter To: Thomas Hellstrom Cc: Rob Clark , Noralf =?iso-8859-1?Q?Tr=F8nnes?= , dri-devel , freedreno , linux-arm-msm , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Lukasz Spintzyk , Deepak Singh Rawat , Gustavo Padovan , Maarten Lankhorst , Sean Paul , David Airlie , Linux Kernel Mailing List Subject: Re: [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb Message-ID: <20180404121351.GJ3881@phenom.ffwll.local> Mail-Followup-To: Thomas Hellstrom , Rob Clark , Noralf =?iso-8859-1?Q?Tr=F8nnes?= , dri-devel , freedreno , linux-arm-msm , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Lukasz Spintzyk , Deepak Singh Rawat , Gustavo Padovan , Maarten Lankhorst , Sean Paul , David Airlie , Linux Kernel Mailing List References: <20180403224225.26776-1-robdclark@gmail.com> <307adb15-412a-1fe2-f116-27fe5b4a657d@shipmail.org> <20180404084320.GA3881@phenom.ffwll.local> <20180404095604.GD3881@phenom.ffwll.local> <9b731e33-32fd-e7e7-952f-75b87ff26f8a@shipmail.org> <61931c2e-4c81-0d94-fd45-f4f7dd91cb13@shipmail.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <61931c2e-4c81-0d94-fd45-f4f7dd91cb13@shipmail.org> X-Operating-System: Linux phenom 4.15.0-1-amd64 User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 04, 2018 at 01:46:37PM +0200, Thomas Hellstrom wrote: > On 04/04/2018 12:28 PM, Thomas Hellstrom wrote: > > On 04/04/2018 11:56 AM, Daniel Vetter wrote: > > > On Wed, Apr 04, 2018 at 11:10:08AM +0200, Thomas Hellstrom wrote: > > > > On 04/04/2018 10:43 AM, Daniel Vetter wrote: > > > > > On Wed, Apr 04, 2018 at 10:22:21AM +0200, Thomas Hellstrom wrote: > > > > > > Hi, > > > > > > > > > > > > On 04/04/2018 08:58 AM, Daniel Vetter wrote: > > > > > > > On Wed, Apr 4, 2018 at 12:42 AM, Rob Clark > > > > > > > wrote: > > > > > > > > Add an atomic helper to implement dirtyfb > > > > > > > > support.? This is needed to > > > > > > > > support DSI command-mode panels with x11 > > > > > > > > userspace (ie. when we can't > > > > > > > > rely on pageflips to trigger a flush to the panel). > > > > > > > > > > > > > > > > To signal to the driver that the async atomic update needs to > > > > > > > > synchronize with fences, even though the fb didn't change, the > > > > > > > > drm_atomic_state::dirty flag is added. > > > > > > > > > > > > > > > > Signed-off-by: Rob Clark > > > > > > > > --- > > > > > > > > Background: there are a number of different > > > > > > > > folks working on getting > > > > > > > > upstream kernel working on various different > > > > > > > > phones/tablets with qcom > > > > > > > > SoC's.. many of them have command mode panels, so we kind of need a > > > > > > > > way to support the legacy dirtyfb ioctl for x11 support. > > > > > > > > > > > > > > > > I know there is work on a proprer non-legacy atomic property for > > > > > > > > userspace to communicate dirty-rect(s) to the kernel, so this can > > > > > > > > be improved from triggering a full-frame flush once that is in > > > > > > > > place.? But we kinda needa a stop-gap solution. > > > > > > > > > > > > > > > > I had considered an in-driver solution for this, but things get a > > > > > > > > bit tricky if userspace ands up combining dirtyfb ioctls with page- > > > > > > > > flips, because we need to synchronize setting > > > > > > > > various CTL.FLUSH bits > > > > > > > > with setting the CTL.START bit.? (ie. really all we need to do for > > > > > > > > cmd mode panels is bang CTL.START, but is this ends up racing with > > > > > > > > pageflips setting FLUSH bits, then bad things.)? The easiest soln > > > > > > > > is to wrap this up as an atomic commit and rely on the worker to > > > > > > > > serialize things.? Hence adding an atomic dirtyfb helper. > > > > > > > > > > > > > > > > I guess at least the helper, with some small addition to translate > > > > > > > > and pass-thru the dirty rect(s) is useful to the > > > > > > > > final atomic dirty- > > > > > > > > rect property solution.? Depending on how far off that is, a stop- > > > > > > > > gap solution could be useful. > > > > > > > Adding Noralf, who iirc already posted the full > > > > > > > dirty helpers already somewhere. > > > > > > > -Daniel > > > > > > I've asked Deepak to RFC the core changes suggested for > > > > > > the full dirty blob > > > > > > on dri-devel. It builds on DisplayLink's suggestion, > > > > > > with a simple helper to > > > > > > get to the desired coordinates. > > > > > > > > > > > > One thing to perhaps discuss is how we would like to fit this with > > > > > > front-buffer rendering and the dirty ioctl. In the > > > > > > page-flip context, the > > > > > > dirty rects, like egl's swapbuffer_with_damage is a hint > > > > > > to restrict the > > > > > > damage region that can be fully ignored by the driver, new content is > > > > > > indicated by a new framebuffer. > > > > > > > > > > > > We could do the same for frontbuffer rendering: Either > > > > > > set a dirty flag like > > > > > > you do here, or provide a content_age state member. > > > > > > Since we clear the dirty > > > > > > flag on state copies, I guess that would be sufficient. > > > > > > The blob rectangles > > > > > > would then become a hint to restrict the damage region. > > > > > I'm not entirely following here - I thought for frontbuffer > > > > > rendering the > > > > > dirty rects have always just been a hint, and that the > > > > > driver was always > > > > > free to re-upload the entire buffer to the screen. > > > > > > > > > > And through a helper like Rob's proposing here (and have > > > > > floated around in > > > > > different versions already) we'd essentially map a frontbuffer dirtyfb > > > > > call to a fake flip with dirty rect. Manual upload drivers > > > > > already need to > > > > > upload the entire screen if they get a flip, since some userspace uses > > > > > that to flush out frontbuffer rendering (instead of calling dirtyfb). > > > > > > > > > > So from that pov the new dirty flag is kinda not necessary imo. > > > > > > > > > > > Another approach would be to have the presence of dirty rects without > > > > > > framebuffer change to indicate frontbuffer rendering. > > > > > > > > > > > > I think I like the first approach best, although it may > > > > > > be tempting for > > > > > > user-space apps to just set the dirty bit instead of > > > > > > providing the full > > > > > > damage region. > > > > > Or I'm not following you here, because I don't quite see the > > > > > difference > > > > > between dirtyfb and a flip. > > > > > -Daniel > > > > OK, let me rephrase: > > > > > > > > ?From the driver's point-of-view, in the atomic world, new > > > > content and the > > > > need for manual upload is indicated by a change in fb attached > > > > to the plane. > > > > > > > > With Rob's patch here, (correct me if I'm wrong) in addition new > > > > content and > > > > the need for manual upload is identified by the dirty flag, > > > > (since the fb > > > > stays the same and the driver thus never identifies a page-flip). > > > Hm, I'm not entirely sure Rob's approach is correct. Imo a pageflip > > > (atomic or not) should result in the entire buffer getting uploaded. The > > > dirty flag is kinda redundant, a flip with the same buffer works the > > > same > > > way as a dirtyfb with the entire buffer as the dirty rectangle. > > > > > > > In both these situations, clip rects can provide a hint to restrict the > > > > dirty region. > > > > > > > > Now I was thinking about the preferred way for user-space to > > > > communicate > > > > front buffer rendering through the atomic ioctl: > > > > > > > > 1) Expose a dirty (or content_age property) > > > > 2) Attach a clip-rect blob property. > > > > 3) Fake a page-flip by ping-ponging two frame-buffers pointing > > > > to the same > > > > underlying buffer object. > > > > > > > > Are you saying that people are already using 3) and we should > > > > keep using > > > > that? > > > I'm saying they're using 3b), flip the same buffer wrapped in the same > > > drm_framebuffer, and expect it to work. > > > > > > The only advantage dirtyfb has is that it allows you to supply the > > > optimized upload rectangles, but at the cost of a funny api (it's > > > working > > > on the fb, not the plane/crtc you want to upload) and lack of > > > drm_event to > > > confirm when exactly you uploaded your stuff. But imo they should be the > > > same underlying operation. > > > > > > Also note that atomic helpers don't optimize out plane flips for same > > > buffers. We only optimize out some of the waiting, in a failed > > > attempt at > > > making cursors stall less, but that's not fixed with the async plane > > > update stuff. And we can obviously optimize out the prepare/cleanup > > > hooks, > > > because the buffer should be pinned already. > > > > > > > I'm a bit confused. > > > > Apparently we have different opinions in when an uploading driver should > > assume altered plane content and the need for re-upload. > > vmwgfx is from what I know currently assuming that this happens only on > > changed fb attachment (what we call a page-flip) whereas if I understand > > you correctly it should happen on each atomic state commit? > > > > If we should assume the latter, then it has odd implications, let's say > > you have 8 screens up, and you pan one of them on the large fb, why > > would you upload the contents of the other 7? > > > > Likewise for cursors,? why would you want to upload the cursor image on > > each cursor move? > > > > So in my POW, option 1) is the option that aligns with the current > > vmwgfx implementation and from what I can tell, what Rob has implemented > > in his patch. > > > > Hmm. > > After doing some apparently well needed reading up on the code it looks like > vmwgfx is actually doing a full upload on each plane state change, > only those planes that actually got changed are referenced in the update. So > that takes care of the panning example, assuming user-space is smart enough > to leave the unchanged planes / crtcs out of the update. > > However, the cursor example still holds, and IMHO we should have a better > way to define content change than plane state update... We're definitely inconsistent here. I guess for manual upload drivers on real hw panning isn't a note-worthy special case, since if you pan you need to upload the entire damaged area on the screen anyway. But virtual hw drivers like vmwgfx are different this way, since panning only means you transmit the new position to the host driver, but don't have to upload the entire thing. And the legacy cursor ioctl seems to be the only thing with that expectation (although I think funny experiments on i915 used gpu rendering for that too). Simply for robustness reasons I'd say that with maybe the exception of cursors, we should assume that a flip must upload the entire buffer that's getting flipped, since that's how it works on most drivers. And then we can add the dirty rectangle stuff so that clever userspace and clever drives can optimize this all again. And preferrably the cursor trick would be implemented by having an empty dirty rect, instead of one that spans the entire fb. -Daniel > > /Thomas > > > > > /Thomas > > > > > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch