diff mbox

[2/6] drm/nouveau: Pin bos from imported dma-bufs to GTT.

Message ID 20170329002720.11445-3-raof@ubuntu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Christopher James Halse Rogers March 29, 2017, 12:27 a.m. UTC
From: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>

Attempting to migrate the bo will break the sharing of the buffer.

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
CC: nouveau@lists.freedesktop.org
---
 drivers/gpu/drm/nouveau/nouveau_prime.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Maarten Lankhorst March 29, 2017, 8:45 a.m. UTC | #1
Op 29-03-17 om 02:27 schreef raof@ubuntu.com:
> From: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
>
> Attempting to migrate the bo will break the sharing of the buffer.
>
> Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
> CC: nouveau@lists.freedesktop.org
> ---
>  drivers/gpu/drm/nouveau/nouveau_prime.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c
> index 1fefc93af1d7..5f474ebb4d6d 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_prime.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_prime.c
> @@ -76,6 +76,8 @@ struct drm_gem_object *nouveau_gem_prime_import_sg_table(struct drm_device *dev,
>  		return ERR_PTR(ret);
>  
>  	nvbo->valid_domains = NOUVEAU_GEM_DOMAIN_GART;
> +	/* pin imported buffer to GTT */
> +	nouveau_bo_pin(nvbo, TTM_PL_FLAG_TT, false);
>  
>  	/* Initialize the embedded gem-object. We return a single gem-reference
>  	 * to the caller, instead of a normal nouveau_bo ttm reference. */

Missing error handling here?
diff mbox

Patch

diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c
index 1fefc93af1d7..5f474ebb4d6d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_prime.c
+++ b/drivers/gpu/drm/nouveau/nouveau_prime.c
@@ -76,6 +76,8 @@  struct drm_gem_object *nouveau_gem_prime_import_sg_table(struct drm_device *dev,
 		return ERR_PTR(ret);
 
 	nvbo->valid_domains = NOUVEAU_GEM_DOMAIN_GART;
+	/* pin imported buffer to GTT */
+	nouveau_bo_pin(nvbo, TTM_PL_FLAG_TT, false);
 
 	/* Initialize the embedded gem-object. We return a single gem-reference
 	 * to the caller, instead of a normal nouveau_bo ttm reference. */