Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06fbca71 authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter
Browse files

drm/i915: Split the batch pool by engine



I woke up one morning and found 50k objects sitting in the batch pool
and every search seemed to iterate the entire list... Painting the
screen in oils would provide a more fluid display.

One issue with the current design is that we only check for retirements
on the current ring when preparing to submit a new batch. This means
that we can have thousands of "active" batches on another ring that we
have to walk over. The simplest way to avoid that is to split the pools
per ring and then our LRU execution ordering will also ensure that the
inactive buffers remain at the front.

v2: execlists still requires duplicate code.
v3: execlists requires more duplicate code

Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent de4e783a
Loading
Loading
Loading
Loading
+20 −13
Original line number Diff line number Diff line
@@ -377,13 +377,17 @@ static void print_batch_pool_stats(struct seq_file *m,
{
	struct drm_i915_gem_object *obj;
	struct file_stats stats;
	struct intel_engine_cs *ring;
	int i;

	memset(&stats, 0, sizeof(stats));

	for_each_ring(ring, dev_priv, i) {
		list_for_each_entry(obj,
			    &dev_priv->mm.batch_pool.cache_list,
				    &ring->batch_pool.cache_list,
				    batch_pool_list)
			per_file_stats(0, obj, &stats);
	}

	print_file_stats(m, "batch pool", stats);
}
@@ -613,22 +617,25 @@ static int i915_gem_batch_pool_info(struct seq_file *m, void *data)
	struct drm_device *dev = node->minor->dev;
	struct drm_i915_private *dev_priv = dev->dev_private;
	struct drm_i915_gem_object *obj;
	struct intel_engine_cs *ring;
	int count = 0;
	int ret;
	int ret, i;

	ret = mutex_lock_interruptible(&dev->struct_mutex);
	if (ret)
		return ret;

	seq_puts(m, "cache:\n");
	for_each_ring(ring, dev_priv, i) {
		seq_printf(m, "%s cache:\n", ring->name);
		list_for_each_entry(obj,
			    &dev_priv->mm.batch_pool.cache_list,
				    &ring->batch_pool.cache_list,
				    batch_pool_list) {
			seq_puts(m, "   ");
			describe_obj(m, obj);
			seq_putc(m, '\n');
			count++;
		}
	}

	seq_printf(m, "total: %d\n", count);

+0 −1
Original line number Diff line number Diff line
@@ -1072,7 +1072,6 @@ int i915_driver_unload(struct drm_device *dev)

	mutex_lock(&dev->struct_mutex);
	i915_gem_cleanup_ringbuffer(dev);
	i915_gem_batch_pool_fini(&dev_priv->mm.batch_pool);
	i915_gem_context_fini(dev);
	mutex_unlock(&dev->struct_mutex);
	i915_gem_cleanup_stolen(dev);
+0 −8
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@
#include "intel_bios.h"
#include "intel_ringbuffer.h"
#include "intel_lrc.h"
#include "i915_gem_batch_pool.h"
#include "i915_gem_gtt.h"
#include "i915_gem_render_state.h"
#include <linux/io-mapping.h>
@@ -1156,13 +1155,6 @@ struct i915_gem_mm {
	 */
	struct list_head unbound_list;

	/*
	 * A pool of objects to use as shadow copies of client batch buffers
	 * when the command parser is enabled. Prevents the client from
	 * modifying the batch contents after software parsing.
	 */
	struct i915_gem_batch_pool batch_pool;

	/** Usable portion of the GTT for GEM */
	unsigned long stolen_base; /* limited to low memory (32-bit) */

+0 −2
Original line number Diff line number Diff line
@@ -5021,8 +5021,6 @@ i915_gem_load(struct drm_device *dev)

	i915_gem_shrinker_init(dev_priv);

	i915_gem_batch_pool_init(dev, &dev_priv->mm.batch_pool);

	mutex_init(&dev_priv->fb_tracking.lock);
}

+2 −1
Original line number Diff line number Diff line
@@ -96,8 +96,9 @@ i915_gem_batch_pool_get(struct i915_gem_batch_pool *pool,

	list_for_each_entry_safe(tmp, next,
				 &pool->cache_list, batch_pool_list) {
		/* The batches are strictly LRU ordered */
		if (tmp->active)
			continue;
			break;

		/* While we're looping, do some clean up */
		if (tmp->madv == __I915_MADV_PURGED) {
Loading