All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Airlie <airlied@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Dave Airlie <airlied@redhat.com>
Subject: [PATCH 3/4] nouveau: populate buffers before exporting them.
Date: Thu,  4 Sep 2025 12:16:41 +1000	[thread overview]
Message-ID: <20250904021643.2050497-3-airlied@gmail.com> (raw)
In-Reply-To: <20250904021643.2050497-1-airlied@gmail.com>

From: Dave Airlie <airlied@redhat.com>

Before exporting a buffer, make sure it has been populated with
pages at least once.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/nouveau/nouveau_prime.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c
index cd95446d6851..caab60fc62f6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_prime.c
+++ b/drivers/gpu/drm/nouveau/nouveau_prime.c
@@ -108,9 +108,21 @@ struct dma_buf *nouveau_gem_prime_export(struct drm_gem_object *gobj,
 					 int flags)
 {
 	struct nouveau_bo *nvbo = nouveau_gem_object(gobj);
+	struct ttm_operation_ctx ctx = {
+		.interruptible = true,
+		.no_wait_gpu = true,
+		/* We opt to avoid OOM on system pages allocations */
+		.gfp_retry_mayfail = true,
+		.allow_res_evict = false,
+	};
+	int ret;
 
 	if (nvbo->no_share)
 		return ERR_PTR(-EPERM);
 
+	ret = ttm_bo_setup_export(&nvbo->bo, &ctx);
+	if (ret)
+		return ERR_PTR(ret);
+
 	return drm_gem_prime_export(gobj, flags);
 }
-- 
2.50.1


  parent reply	other threads:[~2025-09-04  2:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04  2:16 [PATCH 1/4] ttm/bo: add an API to populate a bo before exporting Dave Airlie
2025-09-04  2:16 ` [PATCH 2/4] amdgpu: populate buffers before exporting them Dave Airlie
2025-09-04  2:16 ` Dave Airlie [this message]
2025-09-09  7:33   ` [PATCH 3/4] nouveau: " Danilo Krummrich
2025-09-04  2:16 ` [PATCH 4/4] xe: " Dave Airlie
2025-09-04  7:26   ` Thomas Hellström
2025-09-04  7:20 ` [PATCH 1/4] ttm/bo: add an API to populate a bo before exporting Thomas Hellström
2025-09-04 11:13 ` Christian König
2025-09-09  7:31 ` Danilo Krummrich
2025-09-09  7:39   ` David Airlie

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=20250904021643.2050497-3-airlied@gmail.com \
    --to=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=dri-devel@lists.freedesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.