From patchwork Fri Jul 13 06:16:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 1193971 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 4B0743FC5A for ; Fri, 13 Jul 2012 06:59:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 191E0A1021 for ; Thu, 12 Jul 2012 23:59:09 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from cloud01.chad-versace.us (184-106-247-128.static.cloud-ips.com [184.106.247.128]) by gabe.freedesktop.org (Postfix) with ESMTP id E49B4A0F79 for ; Thu, 12 Jul 2012 23:18:19 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by cloud01.chad-versace.us (Postfix) with ESMTP id 960151810C4; Fri, 13 Jul 2012 06:20:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at static.cloud-ips.com X-Spam-Flag: NO X-Spam-Score: -2.9 X-Spam-Level: X-Spam-Status: No, score=-2.9 tagged_above=-100 required=3.5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9] autolearn=ham Received: from cloud01.chad-versace.us ([127.0.0.1]) by localhost (cloud01.static.cloud-ips.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0G6J9eL+6acu; Fri, 13 Jul 2012 06:20:51 +0000 (UTC) Received: from seagal.kumite (static-50-53-63-81.bvtn.or.frontiernet.net [50.53.63.81]) by cloud01.chad-versace.us (Postfix) with ESMTPSA id D46F51810C9; Fri, 13 Jul 2012 06:20:50 +0000 (UTC) From: Ben Widawsky To: intel-gfx@lists.freedesktop.org Date: Thu, 12 Jul 2012 23:16:13 -0700 Message-Id: <1342160176-1807-3-git-send-email-ben@bwidawsk.net> X-Mailer: git-send-email 1.7.11.1 In-Reply-To: <1342160176-1807-1-git-send-email-ben@bwidawsk.net> References: <1342160176-1807-1-git-send-email-ben@bwidawsk.net> Cc: Ben Widawsky Subject: [Intel-gfx] [PATCH 2/5] drm/i915: add cpu_map to i915 object 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+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org mostly for convenience, this will help us clear up a bit of the code in intel_ringbuffer.c Signed-off-by: Ben Widawsky --- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gem.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 627fe35..ff0323c 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -988,6 +988,7 @@ struct drm_i915_gem_object { * This is the same as gtt_space->start */ uint32_t gtt_offset; + void *cpu_map; /* optional kernel mapping */ struct intel_ring_buffer *ring; diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 53c3946..c09df96 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -3542,6 +3542,9 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj) if (gem_obj->import_attach) drm_prime_gem_destroy(gem_obj, obj->sg_table); + if (WARN_ON(obj->cpu_map)) + kunmap(obj->pages[0]); + if (obj->phys_obj) i915_gem_detach_phys_object(dev, obj);