Message ID | 20190312031049.23647-5-david1.zhou@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <dri-devel-bounces@lists.freedesktop.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA7BA1515 for <patchwork-dri-devel@patchwork.kernel.org>; Tue, 12 Mar 2019 03:11:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B61CC291A9 for <patchwork-dri-devel@patchwork.kernel.org>; Tue, 12 Mar 2019 03:11:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9BD6294BD; Tue, 12 Mar 2019 03:11:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5ED65291A9 for <patchwork-dri-devel@patchwork.kernel.org>; Tue, 12 Mar 2019 03:11:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 44E8589D86; Tue, 12 Mar 2019 03:11:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-CO1-obe.outbound.protection.outlook.com (mail-co1nam05on060e.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe50::60e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3237489D7C; Tue, 12 Mar 2019 03:11:43 +0000 (UTC) Received: from CY4PR12CA0028.namprd12.prod.outlook.com (2603:10b6:903:129::14) by BY2PR12MB0582.namprd12.prod.outlook.com (2a01:111:e400:52dd::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.20; Tue, 12 Mar 2019 03:11:41 +0000 Received: from DM3NAM03FT010.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::208) by CY4PR12CA0028.outlook.office365.com (2603:10b6:903:129::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.17 via Frontend Transport; Tue, 12 Mar 2019 03:11:41 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by DM3NAM03FT010.mail.protection.outlook.com (10.152.82.65) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1686.19 via Frontend Transport; Tue, 12 Mar 2019 03:11:41 +0000 Received: from zhoucm1.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Mon, 11 Mar 2019 22:11:39 -0500 From: Chunming Zhou <david1.zhou@amd.com> To: <dri-devel@lists.freedesktop.org>, <amd-gfx@lists.freedesktop.org>, <lionel.g.landwerlin@intel.com>, <jason@jlekstrand.net>, <Christian.Koenig@amd.com> Subject: [PATCH 5/9] drm/syncobj: use the timeline point in drm_syncobj_find_fence v3 Date: Tue, 12 Mar 2019 11:10:45 +0800 Message-ID: <20190312031049.23647-5-david1.zhou@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190312031049.23647-1-david1.zhou@amd.com> References: <20190312031049.23647-1-david1.zhou@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(346002)(376002)(136003)(396003)(2980300002)(428003)(189003)(199004)(2870700001)(14444005)(76176011)(50466002)(426003)(2906002)(8936002)(68736007)(356004)(6666004)(53936002)(105586002)(53416004)(50226002)(1076003)(336012)(5820100001)(66574012)(106466001)(47776003)(486006)(478600001)(316002)(54906003)(36756003)(305945005)(446003)(110136005)(72206003)(11346002)(81156014)(7696005)(81166006)(8676002)(4326008)(5660300002)(186003)(86362001)(6636002)(77096007)(97736004)(2201001)(476003)(26005)(23676004)(104016004)(2616005)(126002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0582; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 44d41a43-6040-499e-9b30-08d6a69872f8 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060); SRVR:BY2PR12MB0582; X-MS-TrafficTypeDiagnostic: BY2PR12MB0582: X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0582; 20:5ylRgZSKBypCEofk51Ki+EoEBjZsK1Y4UdW0wFzasuu/0mfTbdR9p40tniaqQZyDC6uhxgGxcHpv9bAF5CInM9JUyY3YPzzObcMAp8xWjEXmEf21lAJ7+ZWSc9rRrY6jRaO6CNh8PRohVmrhno+3OizCTIpK6G+FDiMPmw2+ING19QVfdAGr+tQkc7uQbVcd/Lx0xtj/8EqkFjjF9/8PN8lCp5PVeQRVJcj1Yw+d8rjaus5num35xpB4sKzGZqMIkfojsR4HFwODUnXCPzHjKM2hsM3fYC4IkxTV//4VoCwAlc5nCZU9WkU2ICh3m5mFEV48/UT/jNgUtcSGUc6BjeFL3NmXnz5jU8eDqPJRlGAOyj5E/hwakMqcElaDNaYcFZWqqgRlHuk9YqaKsvkIhOOryVKLFe3GRDQhdprc289d1OyTvQtqMjsWMjNTkxrGzbB1lJSPhJOZdtktvRH6RqQi2lP30ApnrWFrcdClUZbZtwH8mojfEdNFk6vQn7Y6 X-Microsoft-Antispam-PRVS: <BY2PR12MB058272BC052AE89A983D9906B4490@BY2PR12MB0582.namprd12.prod.outlook.com> X-Forefront-PRVS: 09749A275C X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BBY2PR12MB0582=3B23=3AepJ3vDy?= =?utf-8?q?2yjKEaPuBrwaI4jNjmDOPjtdRYlluISRGW5PBHVWCm/ctNVG6tqURH8XswJAEY7ol?= =?utf-8?q?UNrbkPTrJp3Wb2TistYHrA3f1Mff7m7Eexooj8zjJxmDWO1VV3AT069O+GH4O/qhb?= =?utf-8?q?yW/rND5uIVoaxOvB2w5RUHwZ3C7inrnGtKFQ9awYsFLPkklVOgmgfaxdgU//skfFX?= =?utf-8?q?t4NSFqtM7/Jt+g+aTHs+zFBp2JVRYnklCNoUT8DNarQc05bVTUgcbA+uIbgUS7PGI?= =?utf-8?q?ovIC9j6ppA5/hsnqxp2UQGbkEIjyOkX+3x+BjIdBGoL/wNAiy3O9xN6QB0Cr7wXYk?= =?utf-8?q?H0y6DI+/PSFCeTZkOjAebg/rVhOevbaT1oC8LB9ChDIIu5EBcjqBFY1Y86zKxij+O?= =?utf-8?q?P7IVUi+FTY8ewp/+m5hMfNofyu8SC6pQoX/lOOqRSx6qdDaLm+kPZ/loMdil7gAvL?= =?utf-8?q?gXhHtTv6mMpFEBpSF2TT0vaANO7DIAAG11vdsvNYyXMsO1P9lG+1SVOhqwd2adluf?= =?utf-8?q?4bJOvAz5CdrvBjqLu6qiGzXddT80jYHF8/oRVLeNyMtLaREykgzmWDFnTFchUTosg?= =?utf-8?q?cL60ibceL+pcjqE9R/09zezla2npyNSUbB/0iVKGwSD8YfGOKE8juAiu2TuQRZP5d?= =?utf-8?q?Y9O8b4sHkl4M2nt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Aui0sd37Sdty3S7AmPP/azPm3z4zCQCPRn/+QlowpjWKzL0PRNU5bQGWxNJCgHSTzFOlsaScR4HweZl6ZX2wEZ4mMhVwb4p+uL7dqnhRd2XGwQ= X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0582; 20:4MHLKSA3/0YTNyu19ql4l/ocTT5cql/mw37aOPSrP06qVVgPTOhXspaFYUYkV0i6Mx8cl9v68YXdCO4LROk8IA8A29BvAnf6yCbQVVxmslkKKHSqMKdOh9akYTRHpEhZNsGFVwh2dRFOzxO4EU0BAs1PUxESXXAsRhc541LH79zMXt7ajkfaZcloKjFwiznBVjWPu5JlahvDs6WsAg/cOAn7ux8UNMidIJRRBx535iZ/N7LM8QQlNKkpN2QPOKh9 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2019 03:11:41.0396 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 44d41a43-6040-499e-9b30-08d6a69872f8 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0582 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tLBcXvKybbKtgMvbFg/wn60+wVg5OGvVwPQFnK72hyk=; b=LQTXnnRIihvP2zpJXiOt4gPHfUHtlGgZOeAE0C5/R0qa1OIeBW1hX7TOMypAF1/QbFgVSvw+xB6AvKpFFc1LTEIYFSztDlPaM2XYgb2hq+fsOmRmlf5EiURT8Nirv65DlYb5S+pJh5Vup4efQI2vpsxwHrPM2sPh6Axoj7dS2OE= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; jlekstrand.net; dkim=none (message not signed) header.d=none;jlekstrand.net; dmarc=permerror action=none header.from=amd.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development <dri-devel.lists.freedesktop.org> List-Unsubscribe: <https://lists.freedesktop.org/mailman/options/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=unsubscribe> List-Archive: <https://lists.freedesktop.org/archives/dri-devel> List-Post: <mailto:dri-devel@lists.freedesktop.org> List-Help: <mailto:dri-devel-request@lists.freedesktop.org?subject=help> List-Subscribe: <https://lists.freedesktop.org/mailman/listinfo/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=subscribe> Cc: =?utf-8?q?Christian_K=C3=B6nig?= <ckoenig.leichtzumerken@gmail.com>, =?utf-8?q?Christian_K=C3=B6nig?= <christian.koenig@amd.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" <dri-devel-bounces@lists.freedesktop.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
[1/9] dma-buf: add new dma_fence_chain container v5
|
expand
|
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index a5adc7c06caa..673b805ab2e8 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -231,16 +231,53 @@ int drm_syncobj_find_fence(struct drm_file *file_private, struct dma_fence **fence) { struct drm_syncobj *syncobj = drm_syncobj_find(file_private, handle); - int ret = 0; + struct syncobj_wait_entry wait; + int ret; if (!syncobj) return -ENOENT; *fence = drm_syncobj_fence_get(syncobj); - if (!*fence) { + drm_syncobj_put(syncobj); + + if (*fence) { + ret = dma_fence_chain_find_seqno(fence, point); + if (!ret) + return 0; + dma_fence_put(*fence); + } else { ret = -EINVAL; } - drm_syncobj_put(syncobj); + + if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT)) + return ret; + + memset(&wait, 0, sizeof(wait)); + wait.task = current; + wait.point = point; + drm_syncobj_fence_add_wait(syncobj, &wait); + + do { + set_current_state(TASK_INTERRUPTIBLE); + if (wait.fence) { + ret = 0; + break; + } + + if (signal_pending(current)) { + ret = -ERESTARTSYS; + break; + } + + schedule(); + } while (1); + + __set_current_state(TASK_RUNNING); + *fence = wait.fence; + + if (wait.node.next) + drm_syncobj_remove_wait(syncobj, &wait); + return ret; } EXPORT_SYMBOL(drm_syncobj_find_fence);