nouveau.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Nouveau] [PATCH] drm/nouveau: init the base GEM fields for internal BOs
@ 2021-06-09 17:29 Christian König
  2021-06-09 17:45 ` Mikko Perttunen
  2021-06-10  9:20 ` Matthew Auld
  0 siblings, 2 replies; 5+ messages in thread
From: Christian König @ 2021-06-09 17:29 UTC (permalink / raw)
  To: imirkin, cyndis, linux-tegra, nouveau, ray.huang, matthew.auld,
	dri-devel

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@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

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Nouveau] [PATCH] drm/nouveau: init the base GEM fields for internal BOs
  2021-06-09 17:29 [Nouveau] [PATCH] drm/nouveau: init the base GEM fields for internal BOs Christian König
@ 2021-06-09 17:45 ` Mikko Perttunen
  2021-06-10  8:08   ` Christian König
  2021-06-10  9:20 ` Matthew Auld
  1 sibling, 1 reply; 5+ messages in thread
From: Mikko Perttunen @ 2021-06-09 17:45 UTC (permalink / raw)
  To: Christian König, imirkin, linux-tegra, nouveau, ray.huang,
	matthew.auld, dri-devel

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@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@nvidia.com>

Mikko
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Nouveau] [PATCH] drm/nouveau: init the base GEM fields for internal BOs
  2021-06-09 17:45 ` Mikko Perttunen
@ 2021-06-10  8:08   ` Christian König
  2021-06-10  9:43     ` Huang Rui
  0 siblings, 1 reply; 5+ messages in thread
From: Christian König @ 2021-06-10  8:08 UTC (permalink / raw)
  To: Mikko Perttunen, imirkin, linux-tegra, nouveau, ray.huang,
	matthew.auld, dri-devel



Am 09.06.21 um 19:45 schrieb Mikko Perttunen:
> 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@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@nvidia.com>

Thanks. Can anybody give me an rb that I can push this to drm-misc-next 
before the weekend?

Regards,
Christian.

>
> Mikko

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Nouveau] [PATCH] drm/nouveau: init the base GEM fields for internal BOs
  2021-06-09 17:29 [Nouveau] [PATCH] drm/nouveau: init the base GEM fields for internal BOs Christian König
  2021-06-09 17:45 ` Mikko Perttunen
@ 2021-06-10  9:20 ` Matthew Auld
  1 sibling, 0 replies; 5+ messages in thread
From: Matthew Auld @ 2021-06-10  9:20 UTC (permalink / raw)
  To: Christian König
  Cc: nouveau, ML dri-devel, ray.huang, Matthew Auld, linux-tegra

On Wed, 9 Jun 2021 at 18:29, Christian König
<ckoenig.leichtzumerken@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@amd.com>

fwiw,
Reviewed-by: Matthew Auld <matthew.auld@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
>
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Nouveau] [PATCH] drm/nouveau: init the base GEM fields for internal BOs
  2021-06-10  8:08   ` Christian König
@ 2021-06-10  9:43     ` Huang Rui
  0 siblings, 0 replies; 5+ messages in thread
From: Huang Rui @ 2021-06-10  9:43 UTC (permalink / raw)
  To: Koenig, Christian; +Cc: nouveau, dri-devel, matthew.auld, linux-tegra

On Thu, Jun 10, 2021 at 04:08:40PM +0800, Koenig, Christian wrote:
> 
> 
> Am 09.06.21 um 19:45 schrieb Mikko Perttunen:
> > 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@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@nvidia.com>

Reviewed-by: Huang Rui <ray.huang@amd.com>

> 
> Thanks. Can anybody give me an rb that I can push this to drm-misc-next 
> before the weekend?
> 
> Regards,
> Christian.
> 
> >
> > Mikko
> 
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-27  3:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 17:29 [Nouveau] [PATCH] drm/nouveau: init the base GEM fields for internal BOs Christian König
2021-06-09 17:45 ` Mikko Perttunen
2021-06-10  8:08   ` Christian König
2021-06-10  9:43     ` Huang Rui
2021-06-10  9:20 ` Matthew Auld

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).