Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp405327imu; Fri, 21 Dec 2018 00:55:23 -0800 (PST) X-Google-Smtp-Source: ALg8bN5rb4ZDvAuoV0gnfP3eujUaM4986VNHR4HZcuUl/su1Y+Wws5L0KLaZbZwWTgfmqlTCZ1dg X-Received: by 2002:a17:902:24d:: with SMTP id 71mr1590242plc.225.1545382523152; Fri, 21 Dec 2018 00:55:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545382523; cv=none; d=google.com; s=arc-20160816; b=Pa7OP3AGavfEDqmthudldhqrV9bShnBKzRUn0+yFGxBDx/NK0kH/ob4YWZK2hNFewc 1dTd/6906f88xA9Jx27AZSlFrqYMdomIEB2yhwA+H60auxmN4JgKp/d7dRd9aACafpZv vLmwukkrqbaGQHk5u0n3oZqeSWs5EMAY629wy2OzOb7hH01HgTruD+sjvbgFRb/TocaN cO+skO+KhZ78yUKLPgiyWjlfVeEUplc3qg0A0t8CpAo/bqOOsAESqdwc8BjD/YSrYI9I BzI8Z2iHyhhvimEiShRk0A/HqXL0RBZDfR+r6bkxWWWSUC8x2mjuW9gz6N/zepqVxxkC WQOA== 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=VcOlkMUhw8kXIfqcy8OogdgXsgC7ccy5T4AjrxiTixw=; b=L3+603mVfxbTtkBt1W665Tc5eRc1Vmu+aHfTETKq1I1pyuc19lH0qYY69v7JW//UAl M85J+ObrZvLZguENE/0QuPZ781MiXsCVpygsDiFeTfF0gHB6EZSIKS9CsQTmHCn2vrRH f2KnPwo66OplBQ9WX4YlJCT1XPw4ceCkASJNqSSpi37tAvHqyDn9NcRgI3yoTQZmblmo s85Fa+dNDtzpNZmKSYhZ16ZHWayFvr/pM3qZI4LZBIndNK39FqTFgly31fYfpeJlgLWH RLjvR2+OrwHymrtf/cPUJXJNWeeZEjc98ZYZUPMc9S7K00Eg5CYoYVj51YHi2T5xNgkB XCKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=MJ+ympuq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c3si19498999pls.73.2018.12.21.00.55.07; Fri, 21 Dec 2018 00:55:23 -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=@chromium.org header.s=google header.b=MJ+ympuq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389092AbeLUDvV (ORCPT + 99 others); Thu, 20 Dec 2018 22:51:21 -0500 Received: from mail-yb1-f193.google.com ([209.85.219.193]:41916 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388989AbeLUDvV (ORCPT ); Thu, 20 Dec 2018 22:51:21 -0500 Received: by mail-yb1-f193.google.com with SMTP id e124so1586172ybb.8 for ; Thu, 20 Dec 2018 19:51:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=VcOlkMUhw8kXIfqcy8OogdgXsgC7ccy5T4AjrxiTixw=; b=MJ+ympuqgwFYqKZ7Lon8ZWblglA/ZYP2nG67bkGbV4G0MT734+FSiKyrrUSP0z09NA bKHdDaUtXYASrY4wlYXUA+2pEobUsXegaP1vXzlL0lVVsf+VXvQ1NPG6rWmNW8pIlO9P jLf60tzaRL+c3kTD2+VdrfdBzKdQyIFg/7BoE= 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=VcOlkMUhw8kXIfqcy8OogdgXsgC7ccy5T4AjrxiTixw=; b=Guvi6PR9aX5627jW8ndP9ydLaY8HoN+FOGho36J14mQfLAZcar3e2X1N/cU890Nnr+ 3VK7m918zln0zpXM5MiY/QR6OD69Cz+bmIj9dIpUAvkvJjlaIVU7hTOz1Q5l5V8W2K77 vGaBef5XmDcpRciCB3j7f40p4R9dGU/BsRE8vHtFGzfP3mxhw5Z/adqNGfrVx4Z1Dstq mKx39mzbFy03f779YR9so+/d7hlHGNoOCOQJK7b49hMMQG0hrYBFz00ZLAJg5SCZQFj2 BkmdaH/e1mGYHZ0P5Bt41cWn/7HBO5YEnKpmdgBtKMiargNkJkUAiQTNdvVS1IzTMOb0 dLLA== X-Gm-Message-State: AJcUukcTBrpa5nzlkyZ9vIOqEx0uABCLLnUMYRQZD5kuoQ/7LaC7rPxz wgW2CeXnong8whsELWoSnIQyt1vt25OZ7g== X-Received: by 2002:a25:9bc9:: with SMTP id w9mr848869ybo.13.1545364279895; Thu, 20 Dec 2018 19:51:19 -0800 (PST) Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com. [209.85.219.173]) by smtp.gmail.com with ESMTPSA id 131sm8108956ywn.88.2018.12.20.19.51.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Dec 2018 19:51:18 -0800 (PST) Received: by mail-yb1-f173.google.com with SMTP id r11so1579960ybp.12 for ; Thu, 20 Dec 2018 19:51:17 -0800 (PST) X-Received: by 2002:a25:910f:: with SMTP id v15mr825769ybl.285.1545364276711; Thu, 20 Dec 2018 19:51:16 -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> In-Reply-To: From: Tomasz Figa Date: Fri, 21 Dec 2018 12:51:05 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] drm: add capability DRM_CAP_ASYNC_UPDATE To: Daniel Vetter , =?UTF-8?Q?St=C3=A9phane_Marchesin?= , dnicoara@chromium.org, Sean Paul , dcastagna@chromium.org Cc: helen.koike@collabora.com, Alexandros Frantzis , David Airlie , Linux Kernel Mailing List , dri-devel , Gustavo Padovan , 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 7:47 PM Daniel Vetter wrote: > > On Thu, Dec 20, 2018 at 10:07 AM Tomasz Figa wrote: > > > > 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 update. > > > >>> > > > >>> And what exactly is an "async update"? > > > >> > > > >> I agree we are lacking docs on this, I'll send in the next version= as > > > >> soon as we agree on a name (please see below). > > > >> > > > >> For reference: > > > >> https://lists.freedesktop.org/archives/dri-devel/2017-April/138586= .html > > > >> > > > >>> > > > >>> I keep asking people to come up with the a better name for this, = and to > > > >>> document what it actually means. Recently I've been think we shou= ld > > > >>> maybe just adopt the vulkan terminology (immediate/fifo/mailbox) = 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 bas= ically > > > >> allows userspace to complement an update previously sent (i.e. its= in > > > >> the queue and wasn't commited yet), it allows adding a plane updat= e to > > > >> the next commit. So what do you think in renaming it to "atomic am= end"? > > > > > > > > Note that it doesn't seem to be what the code currently is doing. F= or > > > > example, for cursor updates, it doesn't seem to be working on the > > > > currently pending commit, but just directly issues an atomic async > > > > update call to the planes. The code actually seems to fall back to = a > > > > normal sync commit, if there is an already pending commit touching = 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_check= () > > > in the previous patch which would fallback to a normal commit if ther= e > > > 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/263712= / > > > this got removed, but which means that async update will be enabled > > > 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_chec= k(dev, state); > > > > > > Does it make sense? If yes I'll fix this in the next version of the > > > Atomic IOCTL patch (and also those two patches should be in the same > > > 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 amend= ", > > > 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. As > > 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 sure > if we want to support having a normal atomic commit and a cursor > update in the same atomic ioctl, coming up with reasonable semantics > for that will be complicated. > > Pointer to code that uses this would be better ofc. Sorry, let me clarify that I was mostly referring to the respective kernel functionality here, not the userspace extension. As far as I know, Chromium still uses the legacy cursor ioctls and we have our drivers implement them directly, bypassing the atomic commit mechanism. However, it sounds like this async commit could let us remove the custom implementations from the drivers and have a common helper for it, which would be a good step forward. Daniel, Daniele, Sean, Stephane, could you clarify what are our needs for this userspace interface? > -Daniel > > > Best regards, > > Tomasz > > > > > > > > Helen > > > > > > > > > > > Best regards, > > > > Tomasz > > > > > > > >> Or do you suggest another name? I am not familiar with vulkan term= inology. > > > >> > > > >> > > > >> 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 fro= m the > > > >>>> discussion regarding DRM_MODE_ATOMIC_AMEND on [1], to allow user= to > > > >>>> figure that async_update exists. > > > >>>> > > > >>>> This was tested using a small program that exercises the uAPI fo= r easy > > > >>>> sanity testing. The program was created by Alexandros and modifi= ed by > > > >>>> Enric to test the capability flag [2]. > > > >>>> > > > >>>> The test worked on a rockchip Ficus v1.1 board on top of mainlin= e plus > > > >>>> the patch to update cursors asynchronously through atomic plus t= he patch > > > >>>> that introduces the ATOMIC_AMEND flag for the drm/rockchip drive= r. > > > >>>> > > > >>>> 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/as= ync-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/drm_i= octl.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 *de= v, 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.plane_= list, head) { > > > >>>> + if (!plane->helper_private->atomic_async_up= date) { > > > >>>> + 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