Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5926776pxv; Thu, 29 Jul 2021 01:47:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNomzXrBYiULsrbO7t3/pMSRiie1e8x8BJkFC5vWFiogvFxHVimFARDgdwf+6Q/Zg41vkV X-Received: by 2002:a05:6402:270d:: with SMTP id y13mr4851296edd.66.1627548439105; Thu, 29 Jul 2021 01:47:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1627548439; cv=pass; d=google.com; s=arc-20160816; b=zG7hB2vgPr3qr4I7En3dabVWex93UaDisv6qVrXMA4pCKmDUBoZbn8BP7f+ynFYD1a 0zUGxC5w3pMg5fTjiqftSrEwHT91VJZgCgbcsL2WvJn5cW3N5a98iL7SqfRZQ+2VdEuO XWeqNIOJvM2U67dHsZMAh5LgiARZvmecIeJ1l/D5c0Gc1FZL8VMgn/VUEmJtLJGC4tC8 gBhGq6M85neBWC2ynLpHi/M5it9rvg1FK6E2/gToU01/cu9N7QtU8MH94oAbwwMBZB1B p+EHYB9RWoPLJT5LCKSo5bbye2sl6y1BFbd/J5LQ9gU2qL2mjqmz18shTUA4w47mNgu/ S8Ug== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-language :content-transfer-encoding:in-reply-to:user-agent:date:message-id :from:references:cc:to:subject:dkim-signature; bh=wN4jFALw7xgibT7SY6MP8qoVWR2GlybbLVfVTmZCRK0=; b=eqxEvg0mnUhOMr996WfJrYJVQPtbOC16rSQycpoou/BTHp2HyBSCsfd+WOU6jKPnbv PnVoKSCyFMjoZfuyML3Ndzeo/U5ZHsgVIhE5FLEqYRas1WSEd8IEhFvaYvXPgXo9lD4M 0dct5FfgNI1tVyK2Ex7Obj/wwmg6y9Ev/0Rir8RBKsgBR+uP6CNXv7ZPntAQ1lSqcLxC e7n2ufCCc4Nvuf0uY3YChuFbWUOPEfWcGoljJJ8eNEQ3qvKU+cM/0VkMwCuOPRKS7R+D MEBUliBePcxMjtDN/hGuzUdUscOyoa2mbJ3PgAlWmnSlwwsb101vK5ccTN7wGxtnjPtY Jq8Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=i26wralu; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rn22si1660884ejb.190.2021.07.29.01.46.56; Thu, 29 Jul 2021 01:47:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=i26wralu; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235197AbhG2Inl (ORCPT + 99 others); Thu, 29 Jul 2021 04:43:41 -0400 Received: from mail-bn8nam11on2046.outbound.protection.outlook.com ([40.107.236.46]:41089 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234880AbhG2Inj (ORCPT ); Thu, 29 Jul 2021 04:43:39 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ODz9ibhulbCrKlHoDgrPmF0ob7ZS6jzNUXDtCg1b8CkQwU7Wrw4+xUqP6LUdTwoLaY0XMxrSTWBr7FyX4akJe4zd5Ac1wXA+YQUeBSA5zSd4/5uYbpYZjy54ldEujdts5m6ufho5SVo2bInS5RN9NIhWMjnckTLfCfRD69iw7M0tOkRvaVve7muVPqheuGsm16P0/q19W6duvDogUkAhQKv9pDsp9q3LUU08BbpiNT5B7+VqVMCfx7bq8NrWA4zT5j22W+EvfxD5fyrj0Y23W1+uLj4r4yHmDydi/0lIDG6mFFbg0moLqh0uJxgZhWqz5BIX/gaGpt8pktEuJAki0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wN4jFALw7xgibT7SY6MP8qoVWR2GlybbLVfVTmZCRK0=; b=kBOhFm1N0H0kvy1q68XxiZlxLjBlciV1ERCoUvx79FCREL8XfkObmHYHLQT2l3Rgvf+2kq6HF8QS9nn0n1MT6yXdqk0WyuVeODnluCfra8cpOucAbVGYn2hw+A4zLdMR68nAARVemFhwKqUK/M7XL6S4YK/J7xTLB3IXLA4OHCq48gB+FoM0bGn5anJW9NlWuG5ZAIwQtQ99Ke04mXznZJXz+6Gb3doIe+fRquP8qbVrFD3lxepVDFLJau0KL4JxIll64sbYJH0hPhmyQeQtQCKwAj4WU9pcw9gT8LY+F2o4BuBqwSQNUcoGBNgq2aaU5CS3zTNkkIzyLLceomzehA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wN4jFALw7xgibT7SY6MP8qoVWR2GlybbLVfVTmZCRK0=; b=i26wraluJEygr7z7/XRnYxiAA3aVG8Jg5DgucD5tDsOCGyNnjQTuNpwcejdOhkg6zefhA4LMb5Ry02S5De89SluDg4mvG1HN+kLMkKd/0YD69r8DedFOIBwp9SEo5XefxtTBQ3gpuNcL7+Nn6tGCzM4mw8qtc17mW35HDUvZNvc= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from BY5PR12MB3764.namprd12.prod.outlook.com (2603:10b6:a03:1ac::17) by BYAPR12MB2888.namprd12.prod.outlook.com (2603:10b6:a03:137::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.18; Thu, 29 Jul 2021 08:43:31 +0000 Received: from BY5PR12MB3764.namprd12.prod.outlook.com ([fe80::6c58:1598:e768:d45e]) by BY5PR12MB3764.namprd12.prod.outlook.com ([fe80::6c58:1598:e768:d45e%7]) with mapi id 15.20.4373.021; Thu, 29 Jul 2021 08:43:30 +0000 Subject: Re: [RFC 0/4] dma-fence: Deadline awareness To: Pekka Paalanen Cc: =?UTF-8?Q?Michel_D=c3=a4nzer?= , =?UTF-8?Q?Christian_K=c3=b6nig?= , Rob Clark , Matthew Brost , Jack Zhang , Gustavo Padovan , open list , dri-devel , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Luben Tuikov , Roy Sun , Alex Deucher , Tian Tao , Lee Jones , "open list:DMA BUFFER SHARING FRAMEWORK" References: <20210726233854.2453899-1-robdclark@gmail.com> <28ca4167-4a65-0ccc-36be-5fb017f6f49d@daenzer.net> <99984703-c3ca-6aae-5888-5997d7046112@daenzer.net> <04d44873-d8e6-6ae7-f0f9-17bcb484d697@amd.com> <9d5f4415-d470-3bc1-7d52-61ba739706ae@daenzer.net> <20210728165700.38c39cf8@eldfell> <74e310fa-e544-889f-2389-5abe06f80eb8@amd.com> <20210729112358.237651ff@eldfell> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <3675d530-c9fc-7ec9-e157-b6abeeec7c2a@amd.com> Date: Thu, 29 Jul 2021 10:43:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 In-Reply-To: <20210729112358.237651ff@eldfell> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-ClientProxiedBy: PR3P191CA0040.EURP191.PROD.OUTLOOK.COM (2603:10a6:102:55::15) To BY5PR12MB3764.namprd12.prod.outlook.com (2603:10b6:a03:1ac::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [IPv6:2a02:908:1252:fb60:4b10:6e80:f619:9837] (2a02:908:1252:fb60:4b10:6e80:f619:9837) by PR3P191CA0040.EURP191.PROD.OUTLOOK.COM (2603:10a6:102:55::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.23 via Frontend Transport; Thu, 29 Jul 2021 08:43:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2dc70b4c-ef44-4f79-69a1-08d9526cf0fa X-MS-TrafficTypeDiagnostic: BYAPR12MB2888: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n9pe2bhXPaPVpAgkr7dlt7J1AQN9kHsZqmjwtQr3dskT+e1wYMsVQMoSXMhIH/qiOeBthdYBsJywWpTK0JgEFgwSgy/n9cuYN8voBE8tLMgm/rpKSZeHGATyvg2+c2xbUhOOmeSrc1yLa2pc8OC70NcfIrNeXn4C3g1YhkwUsooJxjQ2E+SOnKPLq/Mjqijm8vI7yTsLMBqZ4UqtbLvp5KDQFV9Eei83/GJqyPQFdyf75NC8c7r4FRKxjKHKW8b06poLN75hAYFlUuUDn6/mkBkKHsYv9T+m5wGTUnweIqcqbnWJRHbfNE/IaTvoVsw06OzbmiuKxmXrchuuf8r4wb1pJrCQCEv4GGniXmISGSk0WPP3MRCk8kjKQQoPePSKSOme4ThPRd++4ERIs4i4O94Vr4LURJ6CVWTyEtk21ipOLOSPgjg74qxceGzGpNPd8jAkPRIIzYv4l101a8E3uOBBaNkNfvLfP2zVGfqrC/Kj3r7Ep6QtPTj406UR6rRvd7iistqLpI3qA/ggRZOwETVbswMYadJAgyPDUVMzOGbDRdU5qnRQBRF0N/qVlRITvn81rYZ8lEHf8S5JNl1A0KWlLt1IQUmPNzkjhGTqT9QJkMh7uw8SNBrWATLDeFD1g5n+IJFOqXOBFxQrEbC4lBXL2HQl+Paffxm6vu+o8vTmcCbuqAB1HYVgeaYmkeM7B6A5QdIGGZXmvU0Uz+QimUUQDEGh+UdQjtOUEtcr3TX4H0aVI/2Xsadt0xWU364b X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR12MB3764.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(366004)(136003)(396003)(346002)(376002)(54906003)(53546011)(8936002)(7416002)(86362001)(5660300002)(31696002)(8676002)(6916009)(83380400001)(66574015)(66946007)(316002)(38100700002)(6486002)(186003)(66476007)(36756003)(2616005)(66556008)(6666004)(31686004)(4326008)(478600001)(2906002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dWZ3ODR2SWJNbDg2YnBLOU1idkV4MlNxU2ovS0hjYkN1SkYzNDZnUGordUFu?= =?utf-8?B?YjdwaEg3WU1oR21rcXk4eDVHTjFkcUkzYUI3V01sU21XZ05tdU4xNlZVMGdw?= =?utf-8?B?MTlqdXh5K3NTVUp0QmJCWklQa083UzRtdHJMYXczNEZue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44-4f79-69a1-08d9526cf0fa X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB3764.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2021 08:43:30.5922 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UJOwJyg2ELIru++ps3q8fMk9tJsn5PUNeEyxMicJFp6HG5TUAutdgLoNsSZB1zVT X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2888 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 29.07.21 um 10:23 schrieb Pekka Paalanen: > On Wed, 28 Jul 2021 16:30:13 +0200 > Christian König wrote: > >> Am 28.07.21 um 15:57 schrieb Pekka Paalanen: >>> On Wed, 28 Jul 2021 15:31:41 +0200 >>> Christian König wrote: >>> >>>> Am 28.07.21 um 15:24 schrieb Michel Dänzer: >>>>> On 2021-07-28 3:13 p.m., Christian König wrote: >>>>>> Am 28.07.21 um 15:08 schrieb Michel Dänzer: >>>>>>> On 2021-07-28 1:36 p.m., Christian König wrote: >>>>>>>> At least AMD hardware is already capable of flipping frames on GPU events like finishing rendering (or uploading etc). >>>>>>>> >>>>>>>> By waiting in userspace on the CPU before send the frame to the hardware you are completely killing of such features. >>>>>>>> >>>>>>>> For composing use cases that makes sense, but certainly not for full screen applications as far as I can see. >>>>>>> Even for fullscreen, the current KMS API only allows queuing a single page flip per CRTC, with no way to cancel or otherwise modify it. Therefore, a Wayland compositor has to set a deadline for the next refresh cycle, and when the deadline passes, it has to select the best buffer available for the fullscreen surface. To make sure the flip will not miss the next refresh cycle, the compositor has to pick an idle buffer. If it picks a non-idle buffer, and the pending rendering does not finish in time for vertical blank, the flip will be delayed by at least one refresh cycle, which results in visible stuttering. >>>>>>> >>>>>>> (Until the deadline passes, the Wayland compositor can't even know if a previously fullscreen surface will still be fullscreen for the next refresh cycle) >>>>>> Well then let's extend the KMS API instead of hacking together workarounds in userspace. >>>>> That's indeed a possible solution for the fullscreen / direct scanout case. >>>>> >>>>> Not for the general compositing case though, since a compositor does not want to composite multiple output frames per display refresh cycle, so it has to make sure the one frame hits the target. >>>> Yeah, that's true as well. >>>> >>>> At least as long as nobody invents a mechanism to do this decision on >>>> the GPU instead. >>> That would mean putting the whole window manager into the GPU. >> Not really. You only need to decide if you want to use the new backing >> store or the old one based on if the new surface is ready or not. > Except that a window content update in Wayland must be synchronised with > all the possible and arbitrary other window system state changes, that > will affect how and where other windows will get drawn *this frame*, > how input events are routed, and more. > > But, if the window manager made sure that *only* window contents are > about to change and *all* other state remains as it was, then it would > be possible to let the GPU decide which frame it uses. As long as it > also tells back which one it actually did, so that presentation > feedback etc. can trigger the right Wayland events. > > Wayland has "atomic commits" to windows, and arbitrary protocol > extensions can add arbitrary state to be tracked with it. A bit like KMS > properties. Even atomic commits affecting multiple windows together are > a thing, and they must be latched either all or none. > > So it's quite a lot of work to determine if one can allow the GPU to > choose the buffer it will texture from, or not. But how does it then help to wait on the CPU instead? See what I'm proposing is to either render the next state of the window or compose from the old state (including all atomic properties). E.g. what do you do if you timeout and can't have the new window content on time? What's the fallback here? Regards, Christian. > > > Thanks, > pq