From patchwork Thu Mar 14 00:21:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 2267051 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 67A603FCF6 for ; Thu, 14 Mar 2013 00:20:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 533B9E5F73 for ; Wed, 13 Mar 2013 17:20:26 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from shiva.localdomain (209-20-75-48.static.cloud-ips.com [209.20.75.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 191BDE5C6D for ; Wed, 13 Mar 2013 17:19:18 -0700 (PDT) Received: by shiva.localdomain (Postfix, from userid 1005) id BCE4C8C04F; Thu, 14 Mar 2013 00:19:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on shiva.chad-versace.us X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=ham version=3.3.2 Received: from localhost.localdomain (unknown [67.232.160.146]) by shiva.localdomain (Postfix) with ESMTPSA id 88EB68C051; Thu, 14 Mar 2013 00:19:15 +0000 (UTC) From: Ben Widawsky To: intel-gfx@lists.freedesktop.org Date: Wed, 13 Mar 2013 17:21:07 -0700 Message-Id: <1363220468-1718-3-git-send-email-ben@bwidawsk.net> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1363220468-1718-1-git-send-email-ben@bwidawsk.net> References: <1363220468-1718-1-git-send-email-ben@bwidawsk.net> Cc: Ben Widawsky Subject: [Intel-gfx] [PATCH 3/4] drm/i915: Make eb do more 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 I've written a couple of versions of this patch, and it's always in prep for some scheduler work I am doing. Only difference this time is a new maintainer to never merge them. Signed-off-by: Ben Widawsky --- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 38 +++++++++++++++++++----------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 354cecf..99ebb36 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -36,10 +36,17 @@ struct eb_objects { struct list_head objects; int and; + + struct drm_file *file; + struct intel_ring_buffer *ring; + struct drm_i915_gem_execbuffer2 *args; + struct drm_i915_gem_exec_object2 *exec; + union { struct drm_i915_gem_object *lut[0]; struct hlist_head buckets[0]; }; + /* NB: don't put anything here */ }; static struct eb_objects * @@ -82,11 +89,11 @@ eb_reset(struct eb_objects *eb) } static int -eb_lookup_objects(struct eb_objects *eb, - struct drm_i915_gem_exec_object2 *exec, - const struct drm_i915_gem_execbuffer2 *args, - struct drm_file *file) +eb_lookup_objects(struct eb_objects *eb) { + struct drm_i915_gem_exec_object2 *exec = eb->exec; + struct drm_i915_gem_execbuffer2 *args = eb->args; + struct drm_file *file = eb->file; int i; spin_lock(&file->table_lock); @@ -572,18 +579,17 @@ err: /* Decrement pin count for bound objects */ } static int -i915_gem_execbuffer_relocate_slow(struct drm_device *dev, - struct drm_i915_gem_execbuffer2 *args, - struct drm_file *file, - struct intel_ring_buffer *ring, - struct eb_objects *eb, - struct drm_i915_gem_exec_object2 *exec) +i915_gem_execbuffer_relocate_slow(struct eb_objects *eb) { struct drm_i915_gem_relocation_entry *reloc; struct drm_i915_gem_object *obj; bool need_relocs; int *reloc_offset; int i, total, ret; + struct drm_device *dev = eb->ring->dev; + struct drm_i915_gem_execbuffer2 *args = eb->args; + struct intel_ring_buffer *ring = eb->ring; + struct drm_i915_gem_exec_object2 *exec = eb->exec; int count = args->buffer_count; /* We may process another execbuffer during the unlock... */ @@ -656,7 +662,7 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev, /* reacquire the objects */ eb_reset(eb); - ret = eb_lookup_objects(eb, exec, args, file); + ret = eb_lookup_objects(eb); if (ret) goto err; @@ -966,8 +972,13 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, goto pre_mutex_err; } + eb->args = args; + eb->exec = exec; + eb->file = file; + eb->ring = ring; + /* Look up object handles */ - ret = eb_lookup_objects(eb, exec, args, file); + ret = eb_lookup_objects(eb); if (ret) goto err; @@ -987,8 +998,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, ret = i915_gem_execbuffer_relocate(eb); if (ret) { if (ret == -EFAULT) { - ret = i915_gem_execbuffer_relocate_slow(dev, args, file, ring, - eb, exec); + ret = i915_gem_execbuffer_relocate_slow(eb); BUG_ON(!mutex_is_locked(&dev->struct_mutex)); } if (ret)