Christian König
2021-Jun-09 17:29 UTC
[Nouveau] [PATCH] drm/nouveau: init the base GEM fields for internal BOs
TTMs buffer objects are based on GEM objects for quite a while and rely on initializing those fields before initializing the TTM BO. Noveau now doesn't init the GEM object for internally allocated BOs, so make sure that we at least initialize some necessary fields. Signed-off-by: Christian K?nig <christian.koenig at amd.com> --- drivers/gpu/drm/nouveau/nouveau_bo.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 520b1ea9d16c..085023624fb0 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -149,6 +149,8 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo) */ if (bo->base.dev) drm_gem_object_release(&bo->base); + else + dma_resv_fini(&bo->base._resv); kfree(nvbo); } @@ -330,6 +332,10 @@ nouveau_bo_new(struct nouveau_cli *cli, u64 size, int align, if (IS_ERR(nvbo)) return PTR_ERR(nvbo); + nvbo->bo.base.size = size; + dma_resv_init(&nvbo->bo.base._resv); + drm_vma_node_reset(&nvbo->bo.base.vma_node); + ret = nouveau_bo_init(nvbo, size, align, domain, sg, robj); if (ret) return ret; -- 2.25.1
Mikko Perttunen
2021-Jun-09 17:45 UTC
[Nouveau] [PATCH] drm/nouveau: init the base GEM fields for internal BOs
On 6/9/21 8:29 PM, Christian K?nig wrote:> TTMs buffer objects are based on GEM objects for quite a while > and rely on initializing those fields before initializing the TTM BO. > > Noveau now doesn't init the GEM object for internally allocated BOs,Nouveau> so make sure that we at least initialize some necessary fields. > > Signed-off-by: Christian K?nig <christian.koenig at amd.com> > --- > drivers/gpu/drm/nouveau/nouveau_bo.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c > index 520b1ea9d16c..085023624fb0 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_bo.c > +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c > @@ -149,6 +149,8 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo) > */ > if (bo->base.dev) > drm_gem_object_release(&bo->base); > + else > + dma_resv_fini(&bo->base._resv); > > kfree(nvbo); > } > @@ -330,6 +332,10 @@ nouveau_bo_new(struct nouveau_cli *cli, u64 size, int align, > if (IS_ERR(nvbo)) > return PTR_ERR(nvbo); > > + nvbo->bo.base.size = size; > + dma_resv_init(&nvbo->bo.base._resv); > + drm_vma_node_reset(&nvbo->bo.base.vma_node); > + > ret = nouveau_bo_init(nvbo, size, align, domain, sg, robj); > if (ret) > return ret; >That works, thanks for the fix! Tested-by: Mikko Perttunen <mperttunen at nvidia.com> Mikko
Matthew Auld
2021-Jun-10 09:21 UTC
[Nouveau] [PATCH] drm/nouveau: init the base GEM fields for internal BOs
On Wed, 9 Jun 2021 at 18:29, Christian K?nig <ckoenig.leichtzumerken at gmail.com> wrote:> > TTMs buffer objects are based on GEM objects for quite a while > and rely on initializing those fields before initializing the TTM BO. > > Noveau now doesn't init the GEM object for internally allocated BOs, > so make sure that we at least initialize some necessary fields. > > Signed-off-by: Christian K?nig <christian.koenig at amd.com>fwiw, Reviewed-by: Matthew Auld <matthew.auld at intel.com>> --- > drivers/gpu/drm/nouveau/nouveau_bo.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c > index 520b1ea9d16c..085023624fb0 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_bo.c > +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c > @@ -149,6 +149,8 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo) > */ > if (bo->base.dev) > drm_gem_object_release(&bo->base); > + else > + dma_resv_fini(&bo->base._resv); > > kfree(nvbo); > } > @@ -330,6 +332,10 @@ nouveau_bo_new(struct nouveau_cli *cli, u64 size, int align, > if (IS_ERR(nvbo)) > return PTR_ERR(nvbo); > > + nvbo->bo.base.size = size; > + dma_resv_init(&nvbo->bo.base._resv); > + drm_vma_node_reset(&nvbo->bo.base.vma_node); > + > ret = nouveau_bo_init(nvbo, size, align, domain, sg, robj); > if (ret) > return ret; > -- > 2.25.1 >