|
@@ -41,15 +41,15 @@
|
|
|
|
|
|
/**
|
|
/**
|
|
* i915_gem_batch_pool_init() - initialize a batch buffer pool
|
|
* i915_gem_batch_pool_init() - initialize a batch buffer pool
|
|
- * @dev: the drm device
|
|
|
|
|
|
+ * @engine: the associated request submission engine
|
|
* @pool: the batch buffer pool
|
|
* @pool: the batch buffer pool
|
|
*/
|
|
*/
|
|
-void i915_gem_batch_pool_init(struct drm_device *dev,
|
|
|
|
|
|
+void i915_gem_batch_pool_init(struct intel_engine_cs *engine,
|
|
struct i915_gem_batch_pool *pool)
|
|
struct i915_gem_batch_pool *pool)
|
|
{
|
|
{
|
|
int n;
|
|
int n;
|
|
|
|
|
|
- pool->dev = dev;
|
|
|
|
|
|
+ pool->engine = engine;
|
|
|
|
|
|
for (n = 0; n < ARRAY_SIZE(pool->cache_list); n++)
|
|
for (n = 0; n < ARRAY_SIZE(pool->cache_list); n++)
|
|
INIT_LIST_HEAD(&pool->cache_list[n]);
|
|
INIT_LIST_HEAD(&pool->cache_list[n]);
|
|
@@ -65,7 +65,7 @@ void i915_gem_batch_pool_fini(struct i915_gem_batch_pool *pool)
|
|
{
|
|
{
|
|
int n;
|
|
int n;
|
|
|
|
|
|
- WARN_ON(!mutex_is_locked(&pool->dev->struct_mutex));
|
|
|
|
|
|
+ lockdep_assert_held(&pool->engine->i915->drm.struct_mutex);
|
|
|
|
|
|
for (n = 0; n < ARRAY_SIZE(pool->cache_list); n++) {
|
|
for (n = 0; n < ARRAY_SIZE(pool->cache_list); n++) {
|
|
struct drm_i915_gem_object *obj, *next;
|
|
struct drm_i915_gem_object *obj, *next;
|
|
@@ -101,7 +101,7 @@ i915_gem_batch_pool_get(struct i915_gem_batch_pool *pool,
|
|
struct list_head *list;
|
|
struct list_head *list;
|
|
int n;
|
|
int n;
|
|
|
|
|
|
- WARN_ON(!mutex_is_locked(&pool->dev->struct_mutex));
|
|
|
|
|
|
+ lockdep_assert_held(&pool->engine->i915->drm.struct_mutex);
|
|
|
|
|
|
/* Compute a power-of-two bucket, but throw everything greater than
|
|
/* Compute a power-of-two bucket, but throw everything greater than
|
|
* 16KiB into the same bucket: i.e. the the buckets hold objects of
|
|
* 16KiB into the same bucket: i.e. the the buckets hold objects of
|
|
@@ -114,7 +114,8 @@ i915_gem_batch_pool_get(struct i915_gem_batch_pool *pool,
|
|
|
|
|
|
list_for_each_entry_safe(tmp, next, list, batch_pool_link) {
|
|
list_for_each_entry_safe(tmp, next, list, batch_pool_link) {
|
|
/* The batches are strictly LRU ordered */
|
|
/* The batches are strictly LRU ordered */
|
|
- if (tmp->active)
|
|
|
|
|
|
+ if (!i915_gem_active_is_idle(&tmp->last_read[pool->engine->id],
|
|
|
|
+ &tmp->base.dev->struct_mutex))
|
|
break;
|
|
break;
|
|
|
|
|
|
/* While we're looping, do some clean up */
|
|
/* While we're looping, do some clean up */
|
|
@@ -133,7 +134,7 @@ i915_gem_batch_pool_get(struct i915_gem_batch_pool *pool,
|
|
if (obj == NULL) {
|
|
if (obj == NULL) {
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
- obj = i915_gem_object_create(pool->dev, size);
|
|
|
|
|
|
+ obj = i915_gem_object_create(&pool->engine->i915->drm, size);
|
|
if (IS_ERR(obj))
|
|
if (IS_ERR(obj))
|
|
return obj;
|
|
return obj;
|
|
|
|
|