From patchwork Thu Jan 9 05:31:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: akash.goel@intel.com X-Patchwork-Id: 3457441 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B4C7EC02DC for ; Thu, 9 Jan 2014 05:30:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ED14F20165 for ; Thu, 9 Jan 2014 05:30:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2A2502015F for ; Thu, 9 Jan 2014 05:30:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 61374106792; Wed, 8 Jan 2014 21:30:07 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 1C0241067AD for ; Wed, 8 Jan 2014 21:30:04 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 08 Jan 2014 21:30:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,628,1384329600"; d="scan'208";a="455881617" Received: from akashgoe-desktop.iind.intel.com ([10.223.82.34]) by fmsmga001.fm.intel.com with ESMTP; 08 Jan 2014 21:29:56 -0800 From: akash.goel@intel.com To: intel-gfx@lists.freedesktop.org Date: Thu, 9 Jan 2014 11:01:45 +0530 Message-Id: <1389245505-11152-1-git-send-email-akash.goel@intel.com> X-Mailer: git-send-email 1.8.5.2 Cc: Akash Goel Subject: [Intel-gfx] [PATCH 6/7] drm/i915/vlv: Clear out contents of Frame buffer allocations from Stolen area X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 From: Akash Goel On VLV the User frame buffers could also get allocated from stolen area, but there was no zeroing-out of the contents done, whereas by default any allocation from shmem is zeroed out. Now the contents of Frame buffers allocated from stolen area are also cleared, otherwise there are corruptions observed in the display. Signed-off-by: Akash Goel --- drivers/gpu/drm/i915/i915_gem_stolen.c | 40 +++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index 29c22f9..253a39a 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c @@ -371,6 +371,41 @@ i915_gem_object_create_stolen(struct drm_device *dev, u32 size) return NULL; } +static void i915_memset_stolen_obj(struct drm_i915_gem_object *obj) +{ + int ret; + char __iomem *base; + int size = obj->base.size; + struct drm_i915_private *dev_priv = obj->base.dev->dev_private; + unsigned alignment = 0; + bool map_and_fenceable = true; + bool nonblocking = false; + + ret = i915_gem_obj_ggtt_pin(obj, alignment, map_and_fenceable, + nonblocking); + if (ret) { + DRM_ERROR("Mapping of User FB to GTT failed\n"); + return; + } + + /* Get the CPU virtual address of the frame buffer */ + base = ioremap_wc(dev_priv->gtt.mappable_base + + i915_gem_obj_ggtt_offset(obj), size); + if (base == NULL) { + DRM_ERROR("Mapping of User FB to CPU failed\n"); + i915_gem_object_ggtt_unpin(obj); + return; + } + + memset_io(base, 0, size); + + iounmap(base); + i915_gem_object_ggtt_unpin(obj); + + DRM_DEBUG_DRIVER("User FB obj ptr=%p cleared using CPU virt add %p\n", + obj, base); +} + void i915_gem_object_move_to_stolen(struct drm_i915_gem_object *obj) { @@ -454,7 +489,10 @@ i915_gem_object_move_to_stolen(struct drm_i915_gem_object *obj) obj->base.read_domains = I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT; obj->cache_level = HAS_LLC(dev) ? I915_CACHE_LLC : I915_CACHE_NONE; - /* No zeroing-out of buffers allocated from stolen area */ + /* Zero-out the contents of the stolen object, otherwise we observe + * corruptions in the display. + */ + i915_memset_stolen_obj(obj); return; cleanup: