linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Gerd Hoffmann <kraxel@redhat.com>, dri-devel@lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:DRM DRIVER FOR QXL VIRTUAL GPU" 
	<virtualization@lists.linux-foundation.org>,
	"open list:DRM DRIVER FOR QXL VIRTUAL GPU" 
	<spice-devel@lists.freedesktop.org>,
	Dave Airlie <airlied@redhat.com>
Subject: Re: [PATCH v2 03/11] drm/qxl: use ttm bo priorities
Date: Wed, 17 Feb 2021 20:22:25 +0100	[thread overview]
Message-ID: <c29e0af0-8d6d-a024-3aef-93ac613f8829@suse.de> (raw)
In-Reply-To: <20210217123213.2199186-4-kraxel@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 6460 bytes --]



Am 17.02.21 um 13:32 schrieb Gerd Hoffmann:
> 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: Gerd Hoffmann <kraxel@redhat.com>

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
>   drivers/gpu/drm/qxl/qxl_object.h  |  1 +
>   drivers/gpu/drm/qxl/qxl_cmd.c     |  2 +-
>   drivers/gpu/drm/qxl/qxl_display.c |  4 ++--
>   drivers/gpu/drm/qxl/qxl_gem.c     |  2 +-
>   drivers/gpu/drm/qxl/qxl_object.c  |  5 +++--
>   drivers/gpu/drm/qxl/qxl_release.c | 18 ++++++++++++------
>   6 files changed, 20 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/qxl/qxl_object.h b/drivers/gpu/drm/qxl/qxl_object.h
> index e60a8f88e226..dc1659e717f1 100644
> --- a/drivers/gpu/drm/qxl/qxl_object.h
> +++ b/drivers/gpu/drm/qxl/qxl_object.h
> @@ -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);
> diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c
> index 7e22a81bfb36..7b00c955cd82 100644
> --- a/drivers/gpu/drm/qxl/qxl_cmd.c
> +++ b/drivers/gpu/drm/qxl/qxl_cmd.c
> @@ -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;
> diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
> index ec50d2cfd4e1..a1b5cc5918bc 100644
> --- a/drivers/gpu/drm/qxl/qxl_display.c
> +++ b/drivers/gpu/drm/qxl/qxl_display.c
> @@ -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) {
> diff --git a/drivers/gpu/drm/qxl/qxl_gem.c b/drivers/gpu/drm/qxl/qxl_gem.c
> index 48e096285b4c..a08da0bd9098 100644
> --- a/drivers/gpu/drm/qxl/qxl_gem.c
> +++ b/drivers/gpu/drm/qxl/qxl_gem.c
> @@ -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(
> diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm/qxl/qxl_object.c
> index 705b51535492..7eada4ad217b 100644
> --- a/drivers/gpu/drm/qxl/qxl_object.c
> +++ b/drivers/gpu/drm/qxl/qxl_object.c
> @@ -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);
> diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c
> index 579c6de10c8e..716d706ca7f0 100644
> --- a/drivers/gpu/drm/qxl/qxl_release.c
> +++ b/drivers/gpu/drm/qxl/qxl_release.c
> @@ -160,11 +160,12 @@ qxl_release_free(struct qxl_device *qdev,
>   }
>   
>   static int qxl_release_bo_alloc(struct qxl_device *qdev,
> -				struct qxl_bo **bo)
> +				struct qxl_bo **bo,
> +				u32 priority)
>   {
>   	/* pin releases bo's they are too messy to evict */
>   	return qxl_bo_create(qdev, PAGE_SIZE, false, true,
> -			     QXL_GEM_DOMAIN_VRAM, NULL, bo);
> +			     QXL_GEM_DOMAIN_VRAM, priority, NULL, bo);
>   }
>   
>   int qxl_release_list_add(struct qxl_release *release, struct qxl_bo *bo)
> @@ -287,13 +288,18 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size,
>   	int ret = 0;
>   	union qxl_release_info *info;
>   	int cur_idx;
> +	u32 priority;
>   
> -	if (type == QXL_RELEASE_DRAWABLE)
> +	if (type == QXL_RELEASE_DRAWABLE) {
>   		cur_idx = 0;
> -	else if (type == QXL_RELEASE_SURFACE_CMD)
> +		priority = 0;
> +	} else if (type == QXL_RELEASE_SURFACE_CMD) {
>   		cur_idx = 1;
> -	else if (type == QXL_RELEASE_CURSOR_CMD)
> +		priority = 1;
> +	} else if (type == QXL_RELEASE_CURSOR_CMD) {
>   		cur_idx = 2;
> +		priority = 1;
> +	}
>   	else {
>   		DRM_ERROR("got illegal type: %d\n", type);
>   		return -EINVAL;
> @@ -315,7 +321,7 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size,
>   		qdev->current_release_bo[cur_idx] = NULL;
>   	}
>   	if (!qdev->current_release_bo[cur_idx]) {
> -		ret = qxl_release_bo_alloc(qdev, &qdev->current_release_bo[cur_idx]);
> +		ret = qxl_release_bo_alloc(qdev, &qdev->current_release_bo[cur_idx], priority);
>   		if (ret) {
>   			mutex_unlock(&qdev->release_mutex);
>   			qxl_release_free(qdev, *release);
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2021-02-17 19:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210217123213.2199186-1-kraxel@redhat.com>
2021-02-17 12:32 ` [PATCH v2 01/11] drm/qxl: properly handle device init failures Gerd Hoffmann
2021-02-17 12:32 ` [PATCH v2 02/11] drm/qxl: more fence wait rework Gerd Hoffmann
2021-02-17 19:21   ` Thomas Zimmermann
2021-02-17 12:32 ` [PATCH v2 03/11] drm/qxl: use ttm bo priorities Gerd Hoffmann
2021-02-17 19:22   ` Thomas Zimmermann [this message]
2021-02-17 12:32 ` [PATCH v2 04/11] drm/qxl: fix lockdep issue in qxl_alloc_release_reserved Gerd Hoffmann
2021-02-17 19:23   ` Thomas Zimmermann
2021-02-17 12:32 ` [PATCH v2 05/11] drm/qxl: rename qxl_bo_kmap -> qxl_bo_vmap_locked Gerd Hoffmann
2021-02-17 19:24   ` Thomas Zimmermann
2021-02-17 12:32 ` [PATCH v2 06/11] drm/qxl: add qxl_bo_vmap/qxl_bo_vunmap Gerd Hoffmann
2021-02-17 19:24   ` Thomas Zimmermann
2021-02-17 12:32 ` [PATCH v2 07/11] drm/qxl: fix prime vmap Gerd Hoffmann
2021-02-17 12:32 ` [PATCH v2 08/11] drm/qxl: fix monitors object vmap Gerd Hoffmann
2021-02-18 14:42   ` Thomas Zimmermann
2021-02-17 12:32 ` [PATCH v2 09/11] drm/qxl: move shadow handling to new qxl_prepare_shadow() Gerd Hoffmann
2021-02-17 12:32 ` [PATCH v2 10/11] drm/qxl: rework cursor plane Gerd Hoffmann
2021-02-18  8:02   ` Thomas Zimmermann
2021-02-18 11:50     ` Gerd Hoffmann
2021-02-18 13:33       ` Thomas Zimmermann
2021-02-18 14:23         ` Gerd Hoffmann
2021-02-17 12:32 ` [PATCH v2 11/11] drm/qxl: add lock asserts to qxl_bo_vmap_locked + qxl_bo_vunmap_locked Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c29e0af0-8d6d-a024-3aef-93ac613f8829@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@linux.ie \
    --cc=airlied@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spice-devel@lists.freedesktop.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).