From patchwork Fri Jun 3 16:37:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9153629 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 EAF2460865 for ; Fri, 3 Jun 2016 16:39:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCD7A27BFA for ; Fri, 3 Jun 2016 16:39:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D252428332; Fri, 3 Jun 2016 16:39:08 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E80E27BFA for ; Fri, 3 Jun 2016 16:39:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CF7976EE50; Fri, 3 Jun 2016 16:38:54 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 940766E17A for ; Fri, 3 Jun 2016 16:38:22 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id a136so632428wme.0 for ; Fri, 03 Jun 2016 09:38:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=VAhaXhJ3XighL2SkDeZbD9lSCKtPRYX6xlPu6KSorNs=; b=Pr/rTjn+oCazVDkCUDSN8nh2+vVR9r7hFPbyTo8tFUVYHPPzeDcUL/YoFYztV37woH HzFv8leZiK5bk7/l+zQpHbR1Bv6oYMLu0EF1plp75VhPRr/96EdaywtJvL3VUqmr6S0+ 3sKYeMbZLd0Or2hN1n1E1igS6hxRG82VGTQDtxDCA9ium0FtZAh3PEywepLfJ459af1s F/v4SJX7wdj4XotSgVgCpAv8a3DB6QZMimtmQPL+aWtNXoZQQLFakIk4A3NDcNMFRrHK OCR1yHqsdyubFu0LokPfx15nPi3d0gGSauh1v0khkP+KlLCX3jm5jdeo28oA3+B6q9gY G8Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=VAhaXhJ3XighL2SkDeZbD9lSCKtPRYX6xlPu6KSorNs=; b=VfSQn7jLwhWiXbbrNyjTWuJTvx78kisKgcKM2PZITrBIWXFNvifINhHuJxmdci94W5 mC1pdnbrgQ6f2DnBkC2qTbLkjuxqXSfNa19dqlV6Opd1s7oto/+N73c0kSkTceJg3Nl5 SSi/NMroSeqtxfo8Y86/cvQQWPAqAKWC+OX0K7FsyRCEmxjdc/TDtg7zl10OI9j3FHIa xpjSdxfl5UYDMOrrGDnOsn7/ukvs0y54gdvFCGZJ6LejJi/pTWrKcaTRJydjMPUzFJ+p wiZc2KbSvsDVpE1xg1FhYv3DtEnTPpo3ONfsodfLtPinV05Fx7fAoLoX2Gvn+a2VpjI8 sNjQ== X-Gm-Message-State: ALyK8tJsYQXatZJEIEuidfbMMuU4AmYXVT1SXf/lkmOik4RgnHBWXENXm5p+Qq5VgptBVQ== X-Received: by 10.28.154.10 with SMTP id c10mr380474wme.63.1464971900852; Fri, 03 Jun 2016 09:38:20 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id l9sm6565607wjm.0.2016.06.03.09.38.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Jun 2016 09:38:20 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 3 Jun 2016 17:37:15 +0100 Message-Id: <1464971847-15809-51-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1464971847-15809-1-git-send-email-chris@chris-wilson.co.uk> References: <1464971847-15809-1-git-send-email-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH 50/62] drm/i915: Double check activity before relocations X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP If the object is active and we need to perform a relocation upon it, we need to take the slow relocation path. Before we do, double check the active requests to see if they have completed. Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 5c7eb3c93a86..6fa13c618a6b 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -411,6 +411,20 @@ relocate_entry_clflush(struct drm_i915_gem_object *obj, return 0; } +static bool object_is_idle(struct drm_i915_gem_object *obj) +{ + unsigned long active = obj->active; + int idx; + + for_each_active(active, idx) { + if (!i915_gem_active_is_idle(&obj->last_read[idx], + &obj->base.dev->struct_mutex)) + return false; + } + + return true; +} + static int i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj, struct eb_vmas *eb, @@ -494,7 +508,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj, } /* We can't wait for rendering with pagefaults disabled */ - if (obj->active && pagefault_disabled()) + if (pagefault_disabled() && !object_is_idle(obj)) return -EFAULT; if (use_cpu_reloc(obj))