From patchwork Fri May 25 04:45:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nayan Deshmukh X-Patchwork-Id: 10426331 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 74C43602D6 for ; Fri, 25 May 2018 04:46:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64533294D5 for ; Fri, 25 May 2018 04:46:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5844E29559; Fri, 25 May 2018 04:46:39 +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, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM, 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 E994A294D5 for ; Fri, 25 May 2018 04:46:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ACFB66E131; Fri, 25 May 2018 04:46:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0E69D6E131 for ; Fri, 25 May 2018 04:46:34 +0000 (UTC) Received: by mail-pg0-x243.google.com with SMTP id w3-v6so1738510pgv.12 for ; Thu, 24 May 2018 21:46:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=EAPPo/tz219UkfkjqHLaB2wJs6hP83qv4CKEfN9MNXw=; b=QRmkWFMG7BSby+mDC/a72f527O0MN1nTzTUMOT7Ioa3vH3rM2977fc8Tx5c4rMsuzz bliNsY/HNiKLRzuYgcLTBE7XqWmpH20B5+saFI7gRd/7jcWnS1fO/6qVirOIGL/g2CX1 lTLmp1Ddhne0e17YBK6nyD904/KvNpkNYyVUMvlEO1qHuSRF1ECHUYLQXkscwLThN6zC 5czCHafxIiUJOLgOtcOWLYnKsH35GWRomnt5RGOpSXkYngsgCa98SwEN1l9bD5ZJFqqZ MSO5gxPZleh+lfR9XpjwBv8tBzk1Wyu+svuVu4au7r8rNbpSqaDzhNoXjHpsJYt97y4O W2Dg== X-Gm-Message-State: ALKqPwf48rzftWRC4nMnEWTFvmdEm4G6DIIUpZqPhxnqResRfnz7/tDU gQzCX2jfX/MpIh11ztiaw/5K8Ay0 X-Google-Smtp-Source: AB8JxZoIwliXPXgrOB4+tyYffZnycRcuADCofhqam1VzTsU5Kn0k22Iv0OdERbNGHpPCejM38AqeTA== X-Received: by 2002:a63:744c:: with SMTP id e12-v6mr772359pgn.4.1527223594241; Thu, 24 May 2018 21:46:34 -0700 (PDT) Received: from localhost.localdomain ([47.247.106.248]) by smtp.gmail.com with ESMTPSA id p84-v6sm49769133pfi.66.2018.05.24.21.46.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 May 2018 21:46:33 -0700 (PDT) From: Nayan Deshmukh To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/3] drm/scheduler: fix a corner case in dependency optimization Date: Fri, 25 May 2018 10:15:46 +0530 Message-Id: <20180525044548.21014-1-nayan26deshmukh@gmail.com> X-Mailer: git-send-email 2.14.3 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nayan Deshmukh , christian.koenig@amd.com MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP When checking for a dependency fence for belonging to the same entity compare it with scheduled as well finished fence. Earlier we were only comparing it with the scheduled fence. Signed-off-by: Nayan Deshmukh --- drivers/gpu/drm/scheduler/gpu_scheduler.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c index df1578d6f42e..44d480768dfe 100644 --- a/drivers/gpu/drm/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c @@ -349,8 +349,13 @@ static bool drm_sched_entity_add_dependency_cb(struct drm_sched_entity *entity) struct dma_fence * fence = entity->dependency; struct drm_sched_fence *s_fence; - if (fence->context == entity->fence_context) { - /* We can ignore fences from ourself */ + if (fence->context == entity->fence_context || + fence->context == entity->fence_context + 1) { + /* + * Fence is a scheduled/finished fence from a job + * which belongs to the same entity, we can ignore + * fences from ourself + */ dma_fence_put(entity->dependency); return false; }