Commit 369a7210 authored by Christian König's avatar Christian König
Browse files

drm/qxl: fix usage of ttm_bo_init



We need to use ttm_bo_init_reserved here to make sure
that the BO is pinned before it becomes visible on the LRU.

Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Tested-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/392561/?series=82199&rev=1
parent ccc22d41
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ int qxl_bo_create(struct qxl_device *qdev,
		  struct qxl_surface *surf,
		  struct qxl_bo **bo_ptr)
{
	struct ttm_operation_ctx ctx = { !kernel, false };
	struct qxl_bo *bo;
	enum ttm_bo_type type;
	int r;
@@ -134,8 +135,8 @@ int qxl_bo_create(struct qxl_device *qdev,

	qxl_ttm_placement_from_domain(bo, domain);

	r = ttm_bo_init(&qdev->mman.bdev, &bo->tbo, size, type,
			&bo->placement, 0, !kernel, size,
	r = ttm_bo_init_reserved(&qdev->mman.bdev, &bo->tbo, size, type,
				 &bo->placement, 0, &ctx, size,
				 NULL, NULL, &qxl_ttm_bo_destroy);
	if (unlikely(r != 0)) {
		if (r != -ERESTARTSYS)
@@ -146,6 +147,7 @@ int qxl_bo_create(struct qxl_device *qdev,
	}
	if (pinned)
		ttm_bo_pin(&bo->tbo);
	ttm_bo_unreserve(&bo->tbo);
	*bo_ptr = bo;
	return 0;
}