From patchwork Sun Apr 24 07:18:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 8919691 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4F8C19F6FA for ; Sun, 24 Apr 2016 07:19:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 69DC1201C7 for ; Sun, 24 Apr 2016 07:19:30 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 855BE201EC for ; Sun, 24 Apr 2016 07:19:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 742386E108; Sun, 24 Apr 2016 07:19:23 +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 5EAE66E0D4 for ; Sun, 24 Apr 2016 07:19:16 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id w143so13185245wmw.3 for ; Sun, 24 Apr 2016 00:19:16 -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=MUqP/I+BNURwJmGtGmvXEWkr6jUK0Xz66ZZYIj0OwIc=; b=pBQ6C3VgALGyaok0PjVvQ76i0tfidvv6XMhHwU+smUOFs0qSGKZZr8B1QMEiEtPSOH n0LJifniTSH+PZe90Se9wWDXGCZOj78D5L2Z+Q7GmypmvU95t7SiR7pbng5s96sH2WSs 2dkmMZqAvbSosX6aOKMmXfsP6JYlQqMXate/ICiSP40gb9bJ6EylsG4k4fbPew3ZKemq JzKJ7+oyPzIfi2jxgvgokVNyNMklpDx411u6Mp2B2zfHZs34/n+y/EZIiXqmW2kLyjZe dYTVLiY/st7EiGPfkPpyzAq2ZrqpfFDTMqKdIKj+EpQkD37oNmm0Ax8mSs9u1jOsu95h orMw== 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=MUqP/I+BNURwJmGtGmvXEWkr6jUK0Xz66ZZYIj0OwIc=; b=T1JWUA1Rtr7pwaH+TnF1lkX7FV+MtOgmvW6rpnl7NJ7Lhd0VH/2yHxmJIy3So7r8kU ycSXh+P84t8MYE068XskJgXNyKz/vlO89sTnrIPhy2zEMFiND0henvVxYP0Dqb+iG5yg v4gO7VTgbMnEn8NC/I/qpxzJ6sr9ke/KQfhSZ0Nc+RnRBjRNRBVVF4zIgsga1n8XDJWW k8MzkPQil8Nc3FwIbTTWQHQVpekMDN7thVN55i85BS8MVc2ieU2eUEAoh8EF/SaYKxqu j6+T8S5Y7V1F7n84zPi22b9kLjJARyBt3hmmhI/mOKjQ3Rzh148KpwAVo2dGPfBlhgYc dNWw== X-Gm-Message-State: AOPr4FW3+aiA7nRbImKGOfoYVQDsGynGWTrEWQXwwrTCKrEmeyx36cm6Tfke3RCzbHSoUw== X-Received: by 10.28.178.129 with SMTP id b123mr5728911wmf.76.1461482354840; Sun, 24 Apr 2016 00:19:14 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id i11sm16937119wjn.36.2016.04.24.00.19.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 24 Apr 2016 00:19:13 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Sun, 24 Apr 2016 08:18:37 +0100 Message-Id: <1461482332-21975-6-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1461482332-21975-1-git-send-email-chris@chris-wilson.co.uk> References: <1461482332-21975-1-git-send-email-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH 06/21] drm/i915: Use i915_vma_pin_iomap on the ringbuffer object 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-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Similarly to i915_gem_object_pin_map on LLC platforms, we can use the new VMA based io mapping on !LLC to amoritize the cost of ringbuffer pinning and unpinning. Signed-off-by: Tvrtko Ursulin Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Reviewed-by: Joonas Lahtinen --- drivers/gpu/drm/i915/intel_ringbuffer.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 245386e20c52..27ba15acae1e 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c @@ -2084,20 +2084,23 @@ static int init_phys_status_page(struct intel_engine_cs *engine) void intel_unpin_ringbuffer_obj(struct intel_ringbuffer *ringbuf) { + GEM_BUG_ON(ringbuf->vma == NULL); + GEM_BUG_ON(ringbuf->virtual_start == NULL); + if (HAS_LLC(ringbuf->obj->base.dev) && !ringbuf->obj->stolen) i915_gem_object_unpin_map(ringbuf->obj); else - iounmap(ringbuf->virtual_start); + i915_vma_unpin_iomap(ringbuf->vma); ringbuf->virtual_start = NULL; - ringbuf->vma = NULL; + i915_gem_object_ggtt_unpin(ringbuf->obj); + ringbuf->vma = NULL; } int intel_pin_and_map_ringbuffer_obj(struct drm_device *dev, struct intel_ringbuffer *ringbuf) { struct drm_i915_private *dev_priv = to_i915(dev); - struct i915_ggtt *ggtt = &dev_priv->ggtt; struct drm_i915_gem_object *obj = ringbuf->obj; /* Ring wraparound at offset 0 sometimes hangs. No idea why. */ unsigned flags = PIN_OFFSET_BIAS | 4096; @@ -2131,10 +2134,9 @@ int intel_pin_and_map_ringbuffer_obj(struct drm_device *dev, /* Access through the GTT requires the device to be awake. */ assert_rpm_wakelock_held(dev_priv); - addr = ioremap_wc(ggtt->mappable_base + - i915_gem_obj_ggtt_offset(obj), ringbuf->size); - if (addr == NULL) { - ret = -ENOMEM; + addr = i915_vma_pin_iomap(i915_gem_obj_to_ggtt(obj)); + if (IS_ERR(addr)) { + ret = PTR_ERR(addr); goto err_unpin; } }