From patchwork Fri Jun 28 22:23:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 2802601 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 BD918BF4A1 for ; Fri, 28 Jun 2013 22:22:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E4BF82028F for ; Fri, 28 Jun 2013 22:22:30 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 243ED20286 for ; Fri, 28 Jun 2013 22:22:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 24A0BE6346 for ; Fri, 28 Jun 2013 15:22:30 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from shiva.localdomain (unknown [209.20.75.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 77607E624E for ; Fri, 28 Jun 2013 15:20:35 -0700 (PDT) Received: by shiva.localdomain (Postfix, from userid 99) id 1B0EC8864E; Fri, 28 Jun 2013 22:20:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lundgren.kumite (c-24-21-100-90.hsd1.or.comcast.net [24.21.100.90]) by shiva.localdomain (Postfix) with ESMTPSA id 1858C8862F; Fri, 28 Jun 2013 22:20:33 +0000 (UTC) From: Ben Widawsky To: Intel GFX Date: Fri, 28 Jun 2013 15:23:35 -0700 Message-Id: <1372458217-2053-5-git-send-email-ben@bwidawsk.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1372458217-2053-1-git-send-email-ben@bwidawsk.net> References: <1372458217-2053-1-git-send-email-ben@bwidawsk.net> Cc: Paul Berry , Ben Widawsky Subject: [Intel-gfx] [PATCH 4/6] drm/i915: Synchronous execbuf for debug 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 X-Virus-Scanned: ClamAV using ClamSMTP In order to be able to hit the previously introduced page faults, userspace may also want to make sure it's buffers are evicted, so that it doesn't get lucky on accident. This debug feature will have a horrible performance implication (I measure roughly 3x in the negative direction for some basic tests). Signed-off-by: Ben Widawsky --- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gem_execbuffer.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index b99087f8..c9e38a6 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1179,6 +1179,7 @@ typedef struct drm_i915_private { #define I915_DEBUG_NONE 0 #define I915_SCRATCH_FAULTS (1<<0) +#define I915_SYNC_EXECBUF (1<<1) u64 debug_flags; } drm_i915_private_t; diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 87a3227..fe3bb5f 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -150,7 +150,8 @@ eb_get_object(struct eb_objects *eb, unsigned long handle) } static void -eb_destroy(struct eb_objects *eb) +eb_destroy(struct drm_i915_private *dev_priv, + struct eb_objects *eb) { while (!list_empty(&eb->objects)) { struct drm_i915_gem_object *obj; @@ -158,6 +159,8 @@ eb_destroy(struct eb_objects *eb) obj = list_first_entry(&eb->objects, struct drm_i915_gem_object, exec_list); + if (unlikely(dev_priv->debug_flags & I915_SYNC_EXECBUF)) + i915_gem_object_unbind(obj); list_del_init(&obj->exec_list); drm_gem_object_unreference(&obj->base); } @@ -1087,7 +1090,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, i915_gem_execbuffer_retire_commands(dev, file, ring, batch_obj); err: - eb_destroy(eb); + eb_destroy(dev_priv, eb); mutex_unlock(&dev->struct_mutex);