From patchwork Wed Aug 10 11:54:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9272947 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 4BA11600CB for ; Wed, 10 Aug 2016 11:54:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E52627D5E for ; Wed, 10 Aug 2016 11:54:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3335428066; Wed, 10 Aug 2016 11:54:53 +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]) (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 EFFF227D5E for ; Wed, 10 Aug 2016 11:54:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ECDA36E746; Wed, 10 Aug 2016 11:54:51 +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 892106E0DD for ; Wed, 10 Aug 2016 11:54:48 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id i5so9062869wmg.2 for ; Wed, 10 Aug 2016 04:54:48 -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=jaNKoeDeavMXwGT+z3Lo+mHbhKUbE6ZLEQs4iwcT7sQ=; b=XlduDvYCKRQIk5Mn8q412Xb5pvhyoIi/sfJTfN9n811ObTtKYtdVZLW2uLmb7QjImo fKdxGgLveM9JygdfIlKlBv3cqJTOqmJh8tV7yRTxQZBWh0pPoVdu6SEKythPDR0616y+ xAezIjJiqA/rILbdXEXT0DDRUPHQ9y1/XEAuGwp9Xv24F6FCL+lRjI7UF/q+UzL9wXMX xmwzVLgK5Ot0scTgEjRg5Nf/ypdr1AJyhKavD4nBcp4z4teTYw7DMrCK2PPsYj8nKIZG 3HXvGvFn38jraxECsTHhkYJ8pmJ7TwFwxZ9BeJ8tKKDXwSZK/Xawak5SNBvV2lNYnUMm 8Wtw== 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=jaNKoeDeavMXwGT+z3Lo+mHbhKUbE6ZLEQs4iwcT7sQ=; b=dHMOeUOVfZa+MxJgpzE2vTMJ/ecfnWH1FMx6FLO+eqh62DsUkTK0dHLKM1LzkwNIKS swPyFFROox5GCQdjocihA4l3xppzz1P7h5keSVgc8ro73cRUnsWF6SjdxipLltaPrfyO rdpvbo3AlVhIzksw6kThLoNpfdubvuXlBkZZ428U/2IcYdvgEUzMDT9pYV0dLq6TIfR5 avKDaNMpNClJJbVHA3Tt9GvaRg2AYVodbWMR7q75lTRWlrW31NFk7bcsLf3E7hVHuJL/ LIh4nDHq3Z6+lTi5sf60W7LQHB2aiuOuT1MHLYzYrxmh7jy/M+NoCU5MOrAIeqMGwFeW eNoA== X-Gm-Message-State: AEkooutDVNFQzzhwR19r34w6XyRTh9SCGsA9sOK6cSgB2G1pS8orIzbC5+boC/aZK4MxKQ== X-Received: by 10.195.2.42 with SMTP id bl10mr97687wjd.21.1470830087219; Wed, 10 Aug 2016 04:54:47 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id ex14sm42711844wjc.30.2016.08.10.04.54.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Aug 2016 04:54:46 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Wed, 10 Aug 2016 12:54:27 +0100 Message-Id: <1470830073-7407-4-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1470830073-7407-1-git-send-email-chris@chris-wilson.co.uk> References: <1470830073-7407-1-git-send-email-chris@chris-wilson.co.uk> Cc: mika.kuoppala@intel.com Subject: [Intel-gfx] [PATCH 3/9] drm/i915: Before accessing an object via the cpu, flush GTT writes 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 we want to read the pages directly via the CPU, we have to be sure that we have to flush the writes via the GTT (as the CPU can not see the address aliasing). Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/i915_gem.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index f2b330d3539c..887dc33ae6d4 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -613,6 +613,8 @@ int i915_gem_obj_prepare_shmem_read(struct drm_i915_gem_object *obj, if (ret) return ret; + i915_gem_object_flush_gtt_write_domain(obj); + /* If we're not in the cpu read domain, set ourself into the gtt * read domain and manually flush cachelines (if required). This * optimizes for the case when the gpu will dirty the data @@ -653,6 +655,8 @@ int i915_gem_obj_prepare_shmem_write(struct drm_i915_gem_object *obj, if (ret) return ret; + i915_gem_object_flush_gtt_write_domain(obj); + /* If we're not in the cpu write domain, set ourself into the * gtt write domain and manually flush cachelines (as required). * This optimizes for the case when the gpu will use the data