Skip to content

Commit eae76da

Browse files
committed
subdirectory gem is at linu 5.6.19 now.
1 parent f3e0bc8 commit eae76da

4 files changed

Lines changed: 35 additions & 12 deletions

File tree

sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_domain.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ static void i915_gem_object_bump_inactive_ggtt(struct drm_i915_gem_object *obj)
373373
struct drm_i915_private *i915 = to_i915(obj->base.dev);
374374
struct i915_vma *vma;
375375

376-
GEM_BUG_ON(!i915_gem_object_has_pinned_pages(obj));
377376
if (!atomic_read(&obj->bind_count))
378377
return;
379378

@@ -405,12 +404,8 @@ static void i915_gem_object_bump_inactive_ggtt(struct drm_i915_gem_object *obj)
405404
void
406405
i915_gem_object_unpin_from_display_plane(struct i915_vma *vma)
407406
{
408-
struct drm_i915_gem_object *obj = vma->obj;
409-
410-
assert_object_held(obj);
411-
412407
/* Bump the LRU to try and avoid premature eviction whilst flipping */
413-
i915_gem_object_bump_inactive_ggtt(obj);
408+
i915_gem_object_bump_inactive_ggtt(vma->obj);
414409

415410
i915_vma_unpin(vma);
416411
}

sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_tiling.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,21 +189,35 @@ i915_gem_object_fence_prepare(struct drm_i915_gem_object *obj,
189189
int tiling_mode, unsigned int stride)
190190
{
191191
struct i915_ggtt *ggtt = &to_i915(obj->base.dev)->ggtt;
192-
struct i915_vma *vma;
192+
struct i915_vma *vma, *vn;
193+
LIST_HEAD(unbind);
193194
int ret = 0;
194195

195196
if (tiling_mode == I915_TILING_NONE)
196197
return 0;
197198

198199
mutex_lock(&ggtt->vm.mutex);
200+
201+
spin_lock(&obj->vma.lock);
199202
for_each_ggtt_vma(vma, obj) {
203+
GEM_BUG_ON(vma->vm != &ggtt->vm);
204+
200205
if (i915_vma_fence_prepare(vma, tiling_mode, stride))
201206
continue;
202207

208+
list_move(&vma->vm_link, &unbind);
209+
}
210+
spin_unlock(&obj->vma.lock);
211+
212+
list_for_each_entry_safe(vma, vn, &unbind, vm_link) {
203213
ret = __i915_vma_unbind(vma);
204-
if (ret)
214+
if (ret) {
215+
/* Restore the remaining vma on an error */
216+
list_splice(&unbind, &ggtt->vm.bound_list);
205217
break;
218+
}
206219
}
220+
207221
mutex_unlock(&ggtt->vm.mutex);
208222

209223
return ret;
@@ -275,6 +289,7 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj,
275289
}
276290
mutex_unlock(&obj->mm.lock);
277291

292+
spin_lock(&obj->vma.lock);
278293
for_each_ggtt_vma(vma, obj) {
279294
vma->fence_size =
280295
i915_gem_fence_size(i915, vma->size, tiling, stride);
@@ -285,6 +300,7 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj,
285300
if (vma->fence)
286301
vma->fence->dirty = true;
287302
}
303+
spin_unlock(&obj->vma.lock);
288304

289305
obj->tiling_and_stride = tiling | stride;
290306
i915_gem_object_unlock(obj);

sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_userptr.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,14 @@ static int i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj)
649649
GFP_KERNEL |
650650
__GFP_NORETRY |
651651
__GFP_NOWARN);
652+
/*
653+
* Using __get_user_pages_fast() with a read-only
654+
* access is questionable. A read-only page may be
655+
* COW-broken, and then this might end up giving
656+
* the wrong side of the COW..
657+
*
658+
* We may or may not care.
659+
*/
652660
if (pvec) /* defer to worker if malloc fails */
653661
pinned = __get_user_pages_fast(obj->userptr.ptr,
654662
num_pages,

sys/external/bsd/drm2/dist/drm/i915/gem/selftests/huge_pages.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,8 +1583,10 @@ static int igt_ppgtt_pin_update(void *arg)
15831583
unsigned int page_size = BIT(first);
15841584

15851585
obj = i915_gem_object_create_internal(dev_priv, page_size);
1586-
if (IS_ERR(obj))
1587-
return PTR_ERR(obj);
1586+
if (IS_ERR(obj)) {
1587+
err = PTR_ERR(obj);
1588+
goto out_vm;
1589+
}
15881590

15891591
vma = i915_vma_instance(obj, vm, NULL);
15901592
if (IS_ERR(vma)) {
@@ -1637,8 +1639,10 @@ static int igt_ppgtt_pin_update(void *arg)
16371639
}
16381640

16391641
obj = i915_gem_object_create_internal(dev_priv, PAGE_SIZE);
1640-
if (IS_ERR(obj))
1641-
return PTR_ERR(obj);
1642+
if (IS_ERR(obj)) {
1643+
err = PTR_ERR(obj);
1644+
goto out_vm;
1645+
}
16421646

16431647
vma = i915_vma_instance(obj, vm, NULL);
16441648
if (IS_ERR(vma)) {

0 commit comments

Comments
 (0)