Commit 4fff19ae authored by Gerd Hoffmann's avatar Gerd Hoffmann
Browse files

drm/qxl: use ttm bo priorities



Allow to set priorities for buffer objects.  Use priority 1 for surface
and cursor command releases.  Use priority 0 for drawing command
releases.  That way the short-living drawing commands are first in line
when it comes to eviction, making it *much* less likely that
ttm_bo_mem_force_space() picks something which can't be evicted and
throws an error after waiting a while without success.

Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20210217123213.2199186-4-kraxel@redhat.com
parent 42c4551a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -269,7 +269,7 @@ int qxl_alloc_bo_reserved(struct qxl_device *qdev,
	int ret;

	ret = qxl_bo_create(qdev, size, false /* not kernel - device */,
			    false, QXL_GEM_DOMAIN_VRAM, NULL, &bo);
			    false, QXL_GEM_DOMAIN_VRAM, 0, NULL, &bo);
	if (ret) {
		DRM_ERROR("failed to allocate VRAM BO\n");
		return ret;
+2 −2
Original line number Diff line number Diff line
@@ -799,8 +799,8 @@ static int qxl_plane_prepare_fb(struct drm_plane *plane,
				qdev->dumb_shadow_bo = NULL;
			}
			qxl_bo_create(qdev, surf.height * surf.stride,
				      true, true, QXL_GEM_DOMAIN_SURFACE, &surf,
				      &qdev->dumb_shadow_bo);
				      true, true, QXL_GEM_DOMAIN_SURFACE, 0,
				      &surf, &qdev->dumb_shadow_bo);
		}
		if (user_bo->shadow != qdev->dumb_shadow_bo) {
			if (user_bo->shadow) {
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ int qxl_gem_object_create(struct qxl_device *qdev, int size,
	/* At least align on page size */
	if (alignment < PAGE_SIZE)
		alignment = PAGE_SIZE;
	r = qxl_bo_create(qdev, size, kernel, false, initial_domain, surf, &qbo);
	r = qxl_bo_create(qdev, size, kernel, false, initial_domain, 0, surf, &qbo);
	if (r) {
		if (r != -ERESTARTSYS)
			DRM_ERROR(
+3 −2
Original line number Diff line number Diff line
@@ -103,8 +103,8 @@ static const struct drm_gem_object_funcs qxl_object_funcs = {
	.print_info = drm_gem_ttm_print_info,
};

int qxl_bo_create(struct qxl_device *qdev,
		  unsigned long size, bool kernel, bool pinned, u32 domain,
int qxl_bo_create(struct qxl_device *qdev, unsigned long size,
		  bool kernel, bool pinned, u32 domain, u32 priority,
		  struct qxl_surface *surf,
		  struct qxl_bo **bo_ptr)
{
@@ -137,6 +137,7 @@ int qxl_bo_create(struct qxl_device *qdev,

	qxl_ttm_placement_from_domain(bo, domain);

	bo->tbo.priority = priority;
	r = ttm_bo_init_reserved(&qdev->mman.bdev, &bo->tbo, size, type,
				 &bo->placement, 0, &ctx, NULL, NULL,
				 &qxl_ttm_bo_destroy);
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ static inline u64 qxl_bo_mmap_offset(struct qxl_bo *bo)
extern int qxl_bo_create(struct qxl_device *qdev,
			 unsigned long size,
			 bool kernel, bool pinned, u32 domain,
			 u32 priority,
			 struct qxl_surface *surf,
			 struct qxl_bo **bo_ptr);
extern int qxl_bo_kmap(struct qxl_bo *bo, struct dma_buf_map *map);
Loading