linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
	linux-media@vger.kernel.org, intel-gfx@lists.freedesktop.org,
	daniel@ffwll.ch
Subject: [PATCH 3/5] drm/amdgpu: use allowed_domains for exported DMA-bufs
Date: Mon, 17 Feb 2020 16:45:07 +0100	[thread overview]
Message-ID: <20200217154509.2265-4-christian.koenig@amd.com> (raw)
In-Reply-To: <20200217154509.2265-1-christian.koenig@amd.com>

Avoid that we ping/pong the buffers when we stop to pin DMA-buf
exports by using the allowed domains for exported buffers.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 80ba6dfc54e2..d938d458e22d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -28,6 +28,7 @@
 #include <linux/file.h>
 #include <linux/pagemap.h>
 #include <linux/sync_file.h>
+#include <linux/dma-buf.h>
 
 #include <drm/amdgpu_drm.h>
 #include <drm/drm_syncobj.h>
@@ -417,7 +418,9 @@ static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
 	/* Don't move this buffer if we have depleted our allowance
 	 * to move it. Don't move anything if the threshold is zero.
 	 */
-	if (p->bytes_moved < p->bytes_moved_threshold) {
+	if (p->bytes_moved < p->bytes_moved_threshold &&
+	    (!bo->tbo.base.dma_buf ||
+	    list_empty(&bo->tbo.base.dma_buf->attachments))) {
 		if (!amdgpu_gmc_vram_full_visible(&adev->gmc) &&
 		    (bo->flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED)) {
 			/* And don't move a CPU_ACCESS_REQUIRED BO to limited
-- 
2.17.1


  parent reply	other threads:[~2020-02-17 15:45 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-17 15:45 RFC: Unpinned DMA-buf handling Christian König
2020-02-17 15:45 ` [PATCH 1/5] dma-buf: add dynamic DMA-buf handling v14 Christian König
2020-02-17 15:50   ` Christian König
2020-02-17 15:45 ` [PATCH 2/5] drm/ttm: remove the backing store if no placement is given Christian König
2020-02-17 15:45 ` Christian König [this message]
2020-02-17 15:45 ` [PATCH 4/5] drm/amdgpu: add amdgpu_dma_buf_pin/unpin v2 Christian König
2020-02-17 15:45 ` [PATCH 5/5] drm/amdgpu: implement amdgpu_gem_prime_move_notify v2 Christian König
2020-02-17 17:55   ` Daniel Vetter
2020-02-17 18:58     ` Christian König
2020-02-17 19:38       ` Daniel Vetter
2020-02-18 20:17     ` Thomas Hellström (VMware)
2020-02-18 21:01       ` Daniel Vetter
2020-02-19  6:42         ` Thomas Hellström (VMware)
2020-02-20  9:39           ` Thomas Hellström (VMware)
2020-02-20 18:04             ` Daniel Vetter
2020-02-20 19:46               ` Thomas Hellström (VMware)
2020-02-20 20:08                 ` Daniel Vetter
2020-02-20 22:51                   ` Thomas Hellström (VMware)
2020-02-21 17:12                     ` Daniel Vetter
2020-02-21 19:45                       ` Thomas Hellström (VMware)
2020-02-23 15:45                       ` Christian König
2020-02-23 16:54                         ` Thomas Hellström (VMware)
2020-02-24 18:46                           ` Christian König
2020-02-24 21:11                             ` Thomas Hellström (VMware)
2020-02-25 17:16                             ` Daniel Vetter
2020-02-26 16:32                               ` Daniel Vetter
2020-02-27  9:20                                 ` Christian König
2020-02-27  9:38                                   ` Daniel Vetter
  -- strict thread matches above, loose matches on Subject: below --
2019-10-29 10:40 RFC: Unpinned DMA-buf handling Christian König
2019-10-29 10:40 ` [PATCH 3/5] drm/amdgpu: use allowed_domains for exported DMA-bufs Christian König

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=20200217154509.2265-4-christian.koenig@amd.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-media@vger.kernel.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).