Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp261464imu; Thu, 20 Dec 2018 21:48:01 -0800 (PST) X-Google-Smtp-Source: ALg8bN64pYjzYOdHBNTo/QKXKux5qUh+NAiO2aQHEpBut0H6MO5JY62XUjy5A2W3ewTwJhuvBL3d X-Received: by 2002:a63:2d82:: with SMTP id t124mr1107870pgt.260.1545371281650; Thu, 20 Dec 2018 21:48:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545371281; cv=none; d=google.com; s=arc-20160816; b=oZQiZ9Efkrd2S0oaF7UfUzvXHWwxd9CFc8CGU4NP5qW5C7oFZMfmmpWBfmkAaUqDnS W5cUN0Kx8f6AjjYMFEPsK7zxyj7gCHAE5wAViUk06Y1YcVIhu9KlJGilFvLOt+fPlQ8l f54KB2QjOpuYF6FyidjKHsBgRReJD6ZkXJvAUbxULh8J3+4KuLtAPzpMYbiobeQ0SmeQ S9gJm/WhZxdimvi675RIt3fSy2X7h7OwocwAtgOVVerTBJ7BUho4CgH2GaBlb/3PTfrX zBnxbBWN+za30U+T9uDZJHE3d6khcGPgN/C3tG593yjm42oco/qHsZypnYD5wFJYgZKl hkOw== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=z8PKdq2TcZ8biCf40v/ySwm7B2s3MWHWOsE4eSWRybk=; b=wd0UuoCBqDGZbE1WxraxRKAq2Aon2CPgvVrzVaRMUNVAGRupS9pjWYdiO3mh2KcmU+ Za70qA9zEwjP52LJfbt9GRoAliAiXSOy/nBoGf7FyN+ktCEka/OtG0il6vWQfO5yoPlG Sb8QqmUHTPsiifIlAp4seR8rt6SYLNB03LUXfjup3LupbWrdDPd7mPdCuZsuquq15VjF vqYni4lO6J2suRo7wS46mbr5ZS6FPjHsFNvubHpkir5qWFqlyN5ojdlK/kTD+qUwZQgl UpnlhCSo0eCcI0wdsduIbx9V2FjP3Mdgfya+qVfEMNRpyF7H7rS+KD8oueZAgcjUQVOD bqQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=iIyHHnTr; 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 e69si20556526pfg.137.2018.12.20.21.47.06; Thu, 20 Dec 2018 21:48:01 -0800 (PST) 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=@ffwll.ch header.s=google header.b=iIyHHnTr; 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 S2389203AbeLTSef (ORCPT + 99 others); Thu, 20 Dec 2018 13:34:35 -0500 Received: from mail-it1-f194.google.com ([209.85.166.194]:40012 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725869AbeLTSef (ORCPT ); Thu, 20 Dec 2018 13:34:35 -0500 Received: by mail-it1-f194.google.com with SMTP id h193so3137714ita.5 for ; Thu, 20 Dec 2018 10:34:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=z8PKdq2TcZ8biCf40v/ySwm7B2s3MWHWOsE4eSWRybk=; b=iIyHHnTrDiUlznaBNamZVJMO0wMIdTYTRMCmul3zNLvlUCBD6w9F2g9zYyjceweJ19 fQe5giVkm196iyMQIdN8L3dUUfn+uzrD1UHwy23IoOm0jnd9qHuBENEisFdN6McqEsZj MLKmnD3R2L5OwJ6rYayeOTGwFYRwMXTfyPkFI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=z8PKdq2TcZ8biCf40v/ySwm7B2s3MWHWOsE4eSWRybk=; b=jkFUA7bikcRquFEZjBO3cbuUy3xgIcHdP6gx5jaKLeny462/ne5of5kuGgNn1BOWtr 7VUS9YNgcgkXCHMI93QR/+1TsgZWpbROR/USnHsOlEHwxaD8hHR7bj7CurDsYUN5N9Ps HvgS7qqbjbke5aFg1WiVpMa5mmRiIkGXOpdO+AFrhlDQ50PkNoaZKGDQBfSTGRVPPcEH 1jO1vEFNR28zIZVXJq44GX/BZGoQ5wJ7t0v+cFy8qiYO7H+9pGl6fhwUiMtwvOQvPVbJ uFmVB2wflIAls4QbNEgCh9rp5BjdoETNlRbmbIajJjHeWV7xQuRF5HZUOH5qU0Weg6HH wAaw== X-Gm-Message-State: AA+aEWbGtlzbo6POC3rLtyRAr/bPdb0tgNGKwqVgEH+uxp0kEvX6NaiS Ti0N1eGKxNWfniA1qNwvMolutas6YXKmXT7moAxufQ== X-Received: by 2002:a02:781e:: with SMTP id p30mr24368512jac.85.1545330873187; Thu, 20 Dec 2018 10:34:33 -0800 (PST) MIME-Version: 1.0 References: <20181123215326.14274-1-helen.koike@collabora.com> <20181127133418.GT9144@intel.com> <6aa39654-6949-88b3-b949-b338d915ffd2@collabora.com> <0a0a35bf-69e4-8dcd-46fc-7053081480d5@collabora.com> <0bbee54e-7666-3d83-c80a-8ed2b4cc737d@amd.com> In-Reply-To: <0bbee54e-7666-3d83-c80a-8ed2b4cc737d@amd.com> From: Daniel Vetter Date: Thu, 20 Dec 2018 19:34:21 +0100 Message-ID: Subject: Re: [PATCH] drm: add capability DRM_CAP_ASYNC_UPDATE To: "Kazlauskas, Nicholas" Cc: Alex Deucher , "Wentland, Harry" , Tomasz Figa , "dnicoara@chromium.org" , =?UTF-8?Q?St=C3=A9phane_Marchesin?= , Sean Paul , Alexandros Frantzis , David Airlie , Linux Kernel Mailing List , dri-devel , Gustavo Padovan , Helen Koike , "kernel@collabora.com" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 20, 2018 at 6:38 PM Kazlauskas, Nicholas wrote: > > On 12/20/18 12:09 PM, Daniel Vetter wrote: > > On Thu, Dec 20, 2018 at 6:03 PM Alex Deucher wr= ote: > >> > >> + Harry > >> > >> On Thu, Dec 20, 2018 at 11:54 AM Daniel Vetter wrote= : > >>> > >>> On Thu, Dec 20, 2018 at 5:40 PM Alex Deucher = wrote: > >>>> > >>>> + Nicholas > >>>> > >>>> On Thu, Dec 20, 2018 at 5:47 AM Daniel Vetter wrot= e: > >>>>> > >>>>> On Thu, Dec 20, 2018 at 10:07 AM Tomasz Figa w= rote: > >>>>>> > >>>>>> Hi Helen, > >>>>>> > >>>>>> On Fri, Dec 14, 2018 at 10:35 AM Helen Koike wrote: > >>>>>>> > >>>>>>> Hi Tomasz, > >>>>>>> > >>>>>>> On 12/13/18 2:02 AM, Tomasz Figa wrote: > >>>>>>>> On Thu, Dec 6, 2018 at 1:12 AM Helen Koike wrote: > >>>>>>>>> > >>>>>>>>> Hi Ville > >>>>>>>>> > >>>>>>>>> On 11/27/18 11:34 AM, Ville Syrj=C3=A4l=C3=A4 wrote: > >>>>>>>>>> On Fri, Nov 23, 2018 at 07:53:26PM -0200, Helen Koike wrote: > >>>>>>>>>>> Allow userspace to identify if the driver supports async upda= te. > >>>>>>>>>> > >>>>>>>>>> And what exactly is an "async update"? > >>>>>>>>> > >>>>>>>>> I agree we are lacking docs on this, I'll send in the next vers= ion as > >>>>>>>>> soon as we agree on a name (please see below). > >>>>>>>>> > >>>>>>>>> For reference: > >>>>>>>>> https://lists.freedesktop.org/archives/dri-devel/2017-April/138= 586.html > >>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> I keep asking people to come up with the a better name for thi= s, and to > >>>>>>>>>> document what it actually means. Recently I've been think we s= hould > >>>>>>>>>> maybe just adopt the vulkan terminology (immediate/fifo/mailbo= x) to > >>>>>>>>>> avoid introducing yet another set of names for the same thing.= We'd > >>>>>>>>>> still want to document things properly though. > >>>>>>>>> > >>>>>>>>> Another name it was suggested was "atomic amend", this feature = basically > >>>>>>>>> allows userspace to complement an update previously sent (i.e. = its in > >>>>>>>>> the queue and wasn't commited yet), it allows adding a plane up= date to > >>>>>>>>> the next commit. So what do you think in renaming it to "atomic= amend"? > >>>>>>>> > >>>>>>>> Note that it doesn't seem to be what the code currently is doing= . For > >>>>>>>> example, for cursor updates, it doesn't seem to be working on th= e > >>>>>>>> currently pending commit, but just directly issues an atomic asy= nc > >>>>>>>> update call to the planes. The code actually seems to fall back = to a > >>>>>>>> normal sync commit, if there is an already pending commit touchi= ng the > >>>>>>>> same plane or including a modeset. > >>>>>>> > >>>>>>> It should fail as discussed at: > >>>>>>> https://patchwork.freedesktop.org/patch/243088/ > >>>>>>> > >>>>>>> There was the following code inside the drm_atomic_helper_async_c= heck() > >>>>>>> in the previous patch which would fallback to a normal commit if = there > >>>>>>> isn't any pending commit to amend: > >>>>>>> > >>>>>>> + if (!old_plane_state->commit) > >>>>>>> + return -EINVAL; > >>>>>>> > >>>>>>> In the v2 of the patch https://patchwork.freedesktop.org/patch/26= 3712/ > >>>>>>> this got removed, but which means that async update will be enabl= ed > >>>>>>> anyway. So the following code is wrong: > >>>>>>> > >>>>>>> - if (state->legacy_cursor_update) > >>>>>>> + if (state->async_update || state->legacy_cursor_update) > >>>>>>> state->async_update =3D !drm_atomic_helper_async= _check(dev, state); > >>>>>>> > >>>>>>> Does it make sense? If yes I'll fix this in the next version of t= he > >>>>>>> Atomic IOCTL patch (and also those two patches should be in the s= ame > >>>>>>> series, I'll send them together next time). > >>>>>>> > >>>>>>> Thanks for pointing this out. > >>>>>>> > >>>>>>> Please let me know if you still don't agree on the name "atomic a= mend", > >>>>>>> or if I am missing something. > >>>>>> > >>>>>> I'll defer it to the DRM maintainers. From Chrome OS perspective, = we > >>>>>> need a way to commit the cursor plane asynchronously from other > >>>>>> commits any time the cursor changes its position or framebuffer. A= s > >>>>>> long as the new API allows that and the maintainers are fine with = it, > >>>>>> I think I should be okay with it too. > >>>>> > >>>>> If this is just about the cursor, why is the current legacy cursor > >>>>> ioctl not good enough? It's 2 ioctls instead of one, but I'm not su= re > >>>>> if we want to support having a normal atomic commit and a cursor > >>>>> update in the same atomic ioctl, coming up with reasonable semantic= s > >>>>> for that will be complicated. > >>>>> > >>>>> Pointer to code that uses this would be better ofc. > >>>> > >>>> I haven't followed this thread too closely, but we ended up needing = to > >>>> add a fast patch for cursor updates to amdgpu's atomic support to > >>>> avoid stuttering issues. Other drivers may end up being affected by > >>>> this as well. See: > >>>> https://bugs.freedesktop.org/show_bug.cgi?id=3D106175 > >>>> Unfortunately, the fast path requires some hacks to handle the ref > >>>> counting properly on cursor fbs: > >>>> https://patchwork.freedesktop.org/patch/266138/ > >>>> https://patchwork.freedesktop.org/patch/268298/ > >>>> It looks like gamma may need similar treatment: > >>>> https://bugs.freedesktop.org/show_bug.cgi?id=3D108917 > >>> > >>> Can we get these patches cc'ed to dri-devel so that there's some > >>> common solution? Everyone hacking legacy_cursor_update hacks on their > >>> own doesn't really work well. Or would at least give some visibility > >>> into what's all going on. > >> > >> Agreed. > > > > Bit more detail: The legacy_cursor_update hacks all over is probably > > the worst part of atomic, and everyone seems unhappy with it. Except > > all efforts to address it fall short by a lot. I think Gustavo from > > Collabora once had a patch series, but it only ever got merged > > partially, and now we're back with a slightly different pick of color > > it seems. Hence why I'm somewhat grumpy on this here. > > I was planning on submitting a patch that added the old->fb =3D=3D new->f= b > check for the async check in drm helpers but haven't gotten around to it > yet. Async update behavior always prepares the new plane fb and cleans > up the new plane fb, so you end up with a sequence like the following: > > - Fast update, fb1 prepare, fb1 cleanup > - Fast update, fb2 prepare, fb2 cleanup > - Slow update, fb1 prepare, fb2 cleanup > - Fast update, fb2 cleanup -> double cleanup, potential use after free Hm yeah that's not going to work well. > The only driver that still expects to be doing fb changes in their fast > path is vc4 from what I can tell, but they'd likely run into an issue > with interleaving fbs as well. > > The fast path on i915 skips the async helpers and implements this a lot > better (even though it ends up grabbing the struct mutex lock) since it > always calls cleanup on the old plane state like the slow path does. It > also swaps the old plane state with the new one. > > But since async_update is in place it can't do that (the old plane state > is the existing plane state). There's not a really good way of emulating > i915 here without changing the whole concept of async update. Might need to align the async update stuff with what i915 does then. The idea of that was to make things easier for drivers, not even more buggy. > >>> Not sure about the gamma thing since we had opposite bugs on i915 > >>> about gamma not being vsynced and tearing terribly. Cursor is special > >>> since it tends to be too small to notice tearing. > >> > >> Our cursor hw (and possibly gamma as well Nicholas? Harry?) is double > >> buffered, so we can update it any time for the most part and the > >> changes won't take affect until the next vupdate period. > > I haven't really investigated too much into the gamma stuttering issue, > but I think it's similar to the cursor update - a high volume of atomic > updates that ends up skipping over a vblank or two. Yeah, from the description that's exactly what's going on. > > Hm, I guess we could make the gamma update optionally async, and let > > drivers deal. The issue is that the current async helper stuff won't > > cope with gamma updates (it's aimed at plane updates only, not at crtc > > property updates). Or we get userspace to do proper atomic updates. Or > > we do some faking in the kernel, e.g. waiting with the gamma update > > until the next atomic update happens. But that kinda breaks > > ->atomic_check. > > -Daniel > > The in-place update method can work for us for gamma updates I believe, > but there's likely a lot more drivers would have to be careful about > with in-place updates on the CRTC state. > > A full state swap on the object itself would probably be best for > tackling it this way. It's what I'd like to happen for the existing > plane API at least (and which I think is fine since the plane is locked > anyway). Swapping it wreaks the synchronization of subsequent atomic updates. They only check the preceeding state for anything to synchronize against. If you swap it (instead of overwriting) things get really complicated. Or that's the vague memory I have of why we've done this, might be lost in the past. As mentioned, the entire thing is lots of duct-tape all around unfortunately :-/ -Daniel > > Nicholas Kazlauskas > > > > >> > >> Alex > >> > >>> > >>> Thanks, Daniel > >>> > >>>> Alex > >>>> > >>>> > >>>>> -Daniel > >>>>> > >>>>>> Best regards, > >>>>>> Tomasz > >>>>>> > >>>>>>> > >>>>>>> Helen > >>>>>>> > >>>>>>>> > >>>>>>>> Best regards, > >>>>>>>> Tomasz > >>>>>>>> > >>>>>>>>> Or do you suggest another name? I am not familiar with vulkan t= erminology. > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> Thanks > >>>>>>>>> Helen > >>>>>>>>> > >>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> Signed-off-by: Enric Balletbo i Serra > >>>>>>>>>>> [prepared for upstream] > >>>>>>>>>>> Signed-off-by: Helen Koike > >>>>>>>>>>> > >>>>>>>>>>> --- > >>>>>>>>>>> Hi, > >>>>>>>>>>> > >>>>>>>>>>> This patch introduces the ASYNC_UPDATE cap, which originated = from the > >>>>>>>>>>> discussion regarding DRM_MODE_ATOMIC_AMEND on [1], to allow u= ser to > >>>>>>>>>>> figure that async_update exists. > >>>>>>>>>>> > >>>>>>>>>>> This was tested using a small program that exercises the uAPI= for easy > >>>>>>>>>>> sanity testing. The program was created by Alexandros and mod= ified by > >>>>>>>>>>> Enric to test the capability flag [2]. > >>>>>>>>>>> > >>>>>>>>>>> The test worked on a rockchip Ficus v1.1 board on top of main= line plus > >>>>>>>>>>> the patch to update cursors asynchronously through atomic plu= s the patch > >>>>>>>>>>> that introduces the ATOMIC_AMEND flag for the drm/rockchip dr= iver. > >>>>>>>>>>> > >>>>>>>>>>> To test, just build the program and use the --atomic flag to = use the cursor > >>>>>>>>>>> plane with the ATOMIC_AMEND flag. E.g. > >>>>>>>>>>> > >>>>>>>>>>> drm_cursor --atomic > >>>>>>>>>>> > >>>>>>>>>>> [1] https://patchwork.freedesktop.org/patch/243088/ > >>>>>>>>>>> [2] https://gitlab.collabora.com/eballetbo/drm-cursor/commits= /async-capability > >>>>>>>>>>> > >>>>>>>>>>> Thanks > >>>>>>>>>>> Helen > >>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> drivers/gpu/drm/drm_ioctl.c | 11 +++++++++++ > >>>>>>>>>>> include/uapi/drm/drm.h | 1 + > >>>>>>>>>>> 2 files changed, 12 insertions(+) > >>>>>>>>>>> > >>>>>>>>>>> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/dr= m_ioctl.c > >>>>>>>>>>> index 94bd872d56c4..4a7e0f874171 100644 > >>>>>>>>>>> --- a/drivers/gpu/drm/drm_ioctl.c > >>>>>>>>>>> +++ b/drivers/gpu/drm/drm_ioctl.c > >>>>>>>>>>> @@ -31,6 +31,7 @@ > >>>>>>>>>>> #include > >>>>>>>>>>> #include > >>>>>>>>>>> #include > >>>>>>>>>>> +#include > >>>>>>>>>>> #include "drm_legacy.h" > >>>>>>>>>>> #include "drm_internal.h" > >>>>>>>>>>> #include "drm_crtc_internal.h" > >>>>>>>>>>> @@ -229,6 +230,7 @@ static int drm_getcap(struct drm_device *= dev, void *data, struct drm_file *file_ > >>>>>>>>>>> { > >>>>>>>>>>> struct drm_get_cap *req =3D data; > >>>>>>>>>>> struct drm_crtc *crtc; > >>>>>>>>>>> + struct drm_plane *plane; > >>>>>>>>>>> > >>>>>>>>>>> req->value =3D 0; > >>>>>>>>>>> > >>>>>>>>>>> @@ -292,6 +294,15 @@ static int drm_getcap(struct drm_device = *dev, void *data, struct drm_file *file_ > >>>>>>>>>>> case DRM_CAP_CRTC_IN_VBLANK_EVENT: > >>>>>>>>>>> req->value =3D 1; > >>>>>>>>>>> break; > >>>>>>>>>>> + case DRM_CAP_ASYNC_UPDATE: > >>>>>>>>>>> + req->value =3D 1; > >>>>>>>>>>> + list_for_each_entry(plane, &dev->mode_config.pla= ne_list, head) { > >>>>>>>>>>> + if (!plane->helper_private->atomic_async= _update) { > >>>>>>>>>>> + req->value =3D 0; > >>>>>>>>>>> + break; > >>>>>>>>>>> + } > >>>>>>>>>>> + } > >>>>>>>>>>> + break; > >>>>>>>>>>> default: > >>>>>>>>>>> return -EINVAL; > >>>>>>>>>>> } > >>>>>>>>>>> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h > >>>>>>>>>>> index 300f336633f2..ff01540cbb1d 100644 > >>>>>>>>>>> --- a/include/uapi/drm/drm.h > >>>>>>>>>>> +++ b/include/uapi/drm/drm.h > >>>>>>>>>>> @@ -649,6 +649,7 @@ struct drm_gem_open { > >>>>>>>>>>> #define DRM_CAP_PAGE_FLIP_TARGET 0x11 > >>>>>>>>>>> #define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12 > >>>>>>>>>>> #define DRM_CAP_SYNCOBJ 0x13 > >>>>>>>>>>> +#define DRM_CAP_ASYNC_UPDATE 0x14 > >>>>>>>>>>> > >>>>>>>>>>> /** DRM_IOCTL_GET_CAP ioctl argument type */ > >>>>>>>>>>> struct drm_get_cap { > >>>>>>>>>>> -- > >>>>>>>>>>> 2.19.1 > >>>>>>>>>>> > >>>>>>>>>>> _______________________________________________ > >>>>>>>>>>> dri-devel mailing list > >>>>>>>>>>> dri-devel@lists.freedesktop.org > >>>>>>>>>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel > >>>>>>>>>> > >>>>>> _______________________________________________ > >>>>>> dri-devel mailing list > >>>>>> dri-devel@lists.freedesktop.org > >>>>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel > >>>>> > >>>>> > >>>>> > >>>>> -- > >>>>> Daniel Vetter > >>>>> Software Engineer, Intel Corporation > >>>>> +41 (0) 79 365 57 48 - http://blog.ffwll.ch > >>>>> _______________________________________________ > >>>>> dri-devel mailing list > >>>>> dri-devel@lists.freedesktop.org > >>>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel > >>> > >>> > >>> > >>> -- > >>> Daniel Vetter > >>> Software Engineer, Intel Corporation > >>> +41 (0) 79 365 57 48 - http://blog.ffwll.ch > >>> > >>> On Thu, Dec 20, 2018 at 5:40 PM Alex Deucher = wrote: > >>>> > >>>> + Nicholas > >>>> > >>>> On Thu, Dec 20, 2018 at 5:47 AM Daniel Vetter wrot= e: > >>>>> > >>>>> On Thu, Dec 20, 2018 at 10:07 AM Tomasz Figa w= rote: > >>>>>> > >>>>>> Hi Helen, > >>>>>> > >>>>>> On Fri, Dec 14, 2018 at 10:35 AM Helen Koike wrote: > >>>>>>> > >>>>>>> Hi Tomasz, > >>>>>>> > >>>>>>> On 12/13/18 2:02 AM, Tomasz Figa wrote: > >>>>>>>> On Thu, Dec 6, 2018 at 1:12 AM Helen Koike wrote: > >>>>>>>>> > >>>>>>>>> Hi Ville > >>>>>>>>> > >>>>>>>>> On 11/27/18 11:34 AM, Ville Syrj=C3=A4l=C3=A4 wrote: > >>>>>>>>>> On Fri, Nov 23, 2018 at 07:53:26PM -0200, Helen Koike wrote: > >>>>>>>>>>> Allow userspace to identify if the driver supports async upda= te. > >>>>>>>>>> > >>>>>>>>>> And what exactly is an "async update"? > >>>>>>>>> > >>>>>>>>> I agree we are lacking docs on this, I'll send in the next vers= ion as > >>>>>>>>> soon as we agree on a name (please see below). > >>>>>>>>> > >>>>>>>>> For reference: > >>>>>>>>> https://lists.freedesktop.org/archives/dri-devel/2017-April/138= 586.html > >>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> I keep asking people to come up with the a better name for thi= s, and to > >>>>>>>>>> document what it actually means. Recently I've been think we s= hould > >>>>>>>>>> maybe just adopt the vulkan terminology (immediate/fifo/mailbo= x) to > >>>>>>>>>> avoid introducing yet another set of names for the same thing.= We'd > >>>>>>>>>> still want to document things properly though. > >>>>>>>>> > >>>>>>>>> Another name it was suggested was "atomic amend", this feature = basically > >>>>>>>>> allows userspace to complement an update previously sent (i.e. = its in > >>>>>>>>> the queue and wasn't commited yet), it allows adding a plane up= date to > >>>>>>>>> the next commit. So what do you think in renaming it to "atomic= amend"? > >>>>>>>> > >>>>>>>> Note that it doesn't seem to be what the code currently is doing= . For > >>>>>>>> example, for cursor updates, it doesn't seem to be working on th= e > >>>>>>>> currently pending commit, but just directly issues an atomic asy= nc > >>>>>>>> update call to the planes. The code actually seems to fall back = to a > >>>>>>>> normal sync commit, if there is an already pending commit touchi= ng the > >>>>>>>> same plane or including a modeset. > >>>>>>> > >>>>>>> It should fail as discussed at: > >>>>>>> https://patchwork.freedesktop.org/patch/243088/ > >>>>>>> > >>>>>>> There was the following code inside the drm_atomic_helper_async_c= heck() > >>>>>>> in the previous patch which would fallback to a normal commit if = there > >>>>>>> isn't any pending commit to amend: > >>>>>>> > >>>>>>> + if (!old_plane_state->commit) > >>>>>>> + return -EINVAL; > >>>>>>> > >>>>>>> In the v2 of the patch https://patchwork.freedesktop.org/patch/26= 3712/ > >>>>>>> this got removed, but which means that async update will be enabl= ed > >>>>>>> anyway. So the following code is wrong: > >>>>>>> > >>>>>>> - if (state->legacy_cursor_update) > >>>>>>> + if (state->async_update || state->legacy_cursor_update) > >>>>>>> state->async_update =3D !drm_atomic_helper_async= _check(dev, state); > >>>>>>> > >>>>>>> Does it make sense? If yes I'll fix this in the next version of t= he > >>>>>>> Atomic IOCTL patch (and also those two patches should be in the s= ame > >>>>>>> series, I'll send them together next time). > >>>>>>> > >>>>>>> Thanks for pointing this out. > >>>>>>> > >>>>>>> Please let me know if you still don't agree on the name "atomic a= mend", > >>>>>>> or if I am missing something. > >>>>>> > >>>>>> I'll defer it to the DRM maintainers. From Chrome OS perspective, = we > >>>>>> need a way to commit the cursor plane asynchronously from other > >>>>>> commits any time the cursor changes its position or framebuffer. A= s > >>>>>> long as the new API allows that and the maintainers are fine with = it, > >>>>>> I think I should be okay with it too. > >>>>> > >>>>> If this is just about the cursor, why is the current legacy cursor > >>>>> ioctl not good enough? It's 2 ioctls instead of one, but I'm not su= re > >>>>> if we want to support having a normal atomic commit and a cursor > >>>>> update in the same atomic ioctl, coming up with reasonable semantic= s > >>>>> for that will be complicated. > >>>>> > >>>>> Pointer to code that uses this would be better ofc. > >>>> > >>>> I haven't followed this thread too closely, but we ended up needing = to > >>>> add a fast patch for cursor updates to amdgpu's atomic support to > >>>> avoid stuttering issues. Other drivers may end up being affected by > >>>> this as well. See: > >>>> https://bugs.freedesktop.org/show_bug.cgi?id=3D106175 > >>>> Unfortunately, the fast path requires some hacks to handle the ref > >>>> counting properly on cursor fbs: > >>>> https://patchwork.freedesktop.org/patch/266138/ > >>>> https://patchwork.freedesktop.org/patch/268298/ > >>>> It looks like gamma may need similar treatment: > >>>> https://bugs.freedesktop.org/show_bug.cgi?id=3D108917 > >>>> > >>>> Alex > >>>> > >>>> > >>>>> -Daniel > >>>>> > >>>>>> Best regards, > >>>>>> Tomasz > >>>>>> > >>>>>>> > >>>>>>> Helen > >>>>>>> > >>>>>>>> > >>>>>>>> Best regards, > >>>>>>>> Tomasz > >>>>>>>> > >>>>>>>>> Or do you suggest another name? I am not familiar with vulkan t= erminology. > >>>>>>>>> > >>>>>>>>> > >>>>>>>>> Thanks > >>>>>>>>> Helen > >>>>>>>>> > >>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> Signed-off-by: Enric Balletbo i Serra > >>>>>>>>>>> [prepared for upstream] > >>>>>>>>>>> Signed-off-by: Helen Koike > >>>>>>>>>>> > >>>>>>>>>>> --- > >>>>>>>>>>> Hi, > >>>>>>>>>>> > >>>>>>>>>>> This patch introduces the ASYNC_UPDATE cap, which originated = from the > >>>>>>>>>>> discussion regarding DRM_MODE_ATOMIC_AMEND on [1], to allow u= ser to > >>>>>>>>>>> figure that async_update exists. > >>>>>>>>>>> > >>>>>>>>>>> This was tested using a small program that exercises the uAPI= for easy > >>>>>>>>>>> sanity testing. The program was created by Alexandros and mod= ified by > >>>>>>>>>>> Enric to test the capability flag [2]. > >>>>>>>>>>> > >>>>>>>>>>> The test worked on a rockchip Ficus v1.1 board on top of main= line plus > >>>>>>>>>>> the patch to update cursors asynchronously through atomic plu= s the patch > >>>>>>>>>>> that introduces the ATOMIC_AMEND flag for the drm/rockchip dr= iver. > >>>>>>>>>>> > >>>>>>>>>>> To test, just build the program and use the --atomic flag to = use the cursor > >>>>>>>>>>> plane with the ATOMIC_AMEND flag. E.g. > >>>>>>>>>>> > >>>>>>>>>>> drm_cursor --atomic > >>>>>>>>>>> > >>>>>>>>>>> [1] https://patchwork.freedesktop.org/patch/243088/ > >>>>>>>>>>> [2] https://gitlab.collabora.com/eballetbo/drm-cursor/commits= /async-capability > >>>>>>>>>>> > >>>>>>>>>>> Thanks > >>>>>>>>>>> Helen > >>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> drivers/gpu/drm/drm_ioctl.c | 11 +++++++++++ > >>>>>>>>>>> include/uapi/drm/drm.h | 1 + > >>>>>>>>>>> 2 files changed, 12 insertions(+) > >>>>>>>>>>> > >>>>>>>>>>> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/dr= m_ioctl.c > >>>>>>>>>>> index 94bd872d56c4..4a7e0f874171 100644 > >>>>>>>>>>> --- a/drivers/gpu/drm/drm_ioctl.c > >>>>>>>>>>> +++ b/drivers/gpu/drm/drm_ioctl.c > >>>>>>>>>>> @@ -31,6 +31,7 @@ > >>>>>>>>>>> #include > >>>>>>>>>>> #include > >>>>>>>>>>> #include > >>>>>>>>>>> +#include > >>>>>>>>>>> #include "drm_legacy.h" > >>>>>>>>>>> #include "drm_internal.h" > >>>>>>>>>>> #include "drm_crtc_internal.h" > >>>>>>>>>>> @@ -229,6 +230,7 @@ static int drm_getcap(struct drm_device *= dev, void *data, struct drm_file *file_ > >>>>>>>>>>> { > >>>>>>>>>>> struct drm_get_cap *req =3D data; > >>>>>>>>>>> struct drm_crtc *crtc; > >>>>>>>>>>> + struct drm_plane *plane; > >>>>>>>>>>> > >>>>>>>>>>> req->value =3D 0; > >>>>>>>>>>> > >>>>>>>>>>> @@ -292,6 +294,15 @@ static int drm_getcap(struct drm_device = *dev, void *data, struct drm_file *file_ > >>>>>>>>>>> case DRM_CAP_CRTC_IN_VBLANK_EVENT: > >>>>>>>>>>> req->value =3D 1; > >>>>>>>>>>> break; > >>>>>>>>>>> + case DRM_CAP_ASYNC_UPDATE: > >>>>>>>>>>> + req->value =3D 1; > >>>>>>>>>>> + list_for_each_entry(plane, &dev->mode_config.pla= ne_list, head) { > >>>>>>>>>>> + if (!plane->helper_private->atomic_async= _update) { > >>>>>>>>>>> + req->value =3D 0; > >>>>>>>>>>> + break; > >>>>>>>>>>> + } > >>>>>>>>>>> + } > >>>>>>>>>>> + break; > >>>>>>>>>>> default: > >>>>>>>>>>> return -EINVAL; > >>>>>>>>>>> } > >>>>>>>>>>> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h > >>>>>>>>>>> index 300f336633f2..ff01540cbb1d 100644 > >>>>>>>>>>> --- a/include/uapi/drm/drm.h > >>>>>>>>>>> +++ b/include/uapi/drm/drm.h > >>>>>>>>>>> @@ -649,6 +649,7 @@ struct drm_gem_open { > >>>>>>>>>>> #define DRM_CAP_PAGE_FLIP_TARGET 0x11 > >>>>>>>>>>> #define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12 > >>>>>>>>>>> #define DRM_CAP_SYNCOBJ 0x13 > >>>>>>>>>>> +#define DRM_CAP_ASYNC_UPDATE 0x14 > >>>>>>>>>>> > >>>>>>>>>>> /** DRM_IOCTL_GET_CAP ioctl argument type */ > >>>>>>>>>>> struct drm_get_cap { > >>>>>>>>>>> -- > >>>>>>>>>>> 2.19.1 > >>>>>>>>>>> > >>>>>>>>>>> _______________________________________________ > >>>>>>>>>>> dri-devel mailing list > >>>>>>>>>>> dri-devel@lists.freedesktop.org > >>>>>>>>>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel > >>>>>>>>>> > >>>>>> _______________________________________________ > >>>>>> dri-devel mailing list > >>>>>> dri-devel@lists.freedesktop.org > >>>>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel > >>>>> > >>>>> > >>>>> > >>>>> -- > >>>>> Daniel Vetter > >>>>> Software Engineer, Intel Corporation > >>>>> +41 (0) 79 365 57 48 - http://blog.ffwll.ch > >>>>> _______________________________________________ > >>>>> dri-devel mailing list > >>>>> dri-devel@lists.freedesktop.org > >>>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel > >>> > >>> > >>> > >>> -- > >>> Daniel Vetter > >>> Software Engineer, Intel Corporation > >>> +41 (0) 79 365 57 48 - http://blog.ffwll.ch > > > > > > > --=20 Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch