summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_prime.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2019-08-27 09:10:30 +0200
committerDave Airlie <airlied@redhat.com>2019-08-27 09:21:04 +0200
commitc87237110f2553b4200a8b3401a01198edfcf0d9 (patch)
treeac4af3166e019c5cd46c12743d8d3bbcd9391332 /drivers/gpu/drm/nouveau/nouveau_prime.c
parentMerge tag 'drm-hisilicon-hibmc-next-2019-08-26' of https://github.com/xin3lia... (diff)
parentomapdrm: no need to check return value of debugfs_create functions (diff)
downloadlinux-c87237110f2553b4200a8b3401a01198edfcf0d9.tar.xz
linux-c87237110f2553b4200a8b3401a01198edfcf0d9.zip
Merge tag 'drm-misc-next-2019-08-23' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-next for 5.4: UAPI Changes: Cross-subsystem Changes: Core Changes: - dma-buf: dma-fence selftests Driver Changes: - kirin: Various cleanups and reworks - komeda: Add support for DT memory-regions - meson: Rely on the compatible to detect vpu features - omap: Implement alpha and pixel blend mode properties - panfrost: Implement per-fd address spaces, various fixes - rockchip: DSI DT binding rework - fbdev: Various cleanups Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maxime Ripard <maxime.ripard@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190823083509.c7mduqdqjnxc7ubb@flea
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_prime.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_prime.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c
index 6a222cdf2935..84658d434225 100644
--- a/drivers/gpu/drm/nouveau/nouveau_prime.c
+++ b/drivers/gpu/drm/nouveau/nouveau_prime.c
@@ -62,28 +62,34 @@ struct drm_gem_object *nouveau_gem_prime_import_sg_table(struct drm_device *dev,
struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_bo *nvbo;
struct dma_resv *robj = attach->dmabuf->resv;
+ size_t size = attach->dmabuf->size;
u32 flags = 0;
int ret;
flags = TTM_PL_FLAG_TT;
dma_resv_lock(robj, NULL);
- ret = nouveau_bo_new(&drm->client, attach->dmabuf->size, 0, flags, 0, 0,
- sg, robj, &nvbo);
+ nvbo = nouveau_bo_alloc(&drm->client, size, flags, 0, 0);
dma_resv_unlock(robj);
- if (ret)
- return ERR_PTR(ret);
+ if (IS_ERR(nvbo))
+ return ERR_CAST(nvbo);
nvbo->valid_domains = NOUVEAU_GEM_DOMAIN_GART;
/* Initialize the embedded gem-object. We return a single gem-reference
* to the caller, instead of a normal nouveau_bo ttm reference. */
- ret = drm_gem_object_init(dev, &nvbo->bo.base, nvbo->bo.mem.size);
+ ret = drm_gem_object_init(dev, &nvbo->bo.base, size);
if (ret) {
nouveau_bo_ref(NULL, &nvbo);
return ERR_PTR(-ENOMEM);
}
+ ret = nouveau_bo_init(nvbo, size, 0, flags, sg, robj);
+ if (ret) {
+ nouveau_bo_ref(NULL, &nvbo);
+ return ERR_PTR(ret);
+ }
+
return &nvbo->bo.base;
}