[PATCH 11/13] drm/nouveau: switch the TTM backends to self alloc

Christian König ckoenig.leichtzumerken at gmail.com
Mon May 3 11:14:46 UTC 2021


Am 30.04.21 um 17:02 schrieb Matthew Auld:
> On Fri, 30 Apr 2021 at 10:25, Christian König
> <ckoenig.leichtzumerken at gmail.com> wrote:
>> Similar to the TTM range manager.
>>
>> Signed-off-by: Christian König <christian.koenig at amd.com>
>> ---
>>   drivers/gpu/drm/nouveau/nouveau_mem.h | 1 +
>>   drivers/gpu/drm/nouveau/nouveau_ttm.c | 4 ++++
>>   2 files changed, 5 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.h b/drivers/gpu/drm/nouveau/nouveau_mem.h
>> index 7df3848e85aa..3a6a1be2ed52 100644
>> --- a/drivers/gpu/drm/nouveau/nouveau_mem.h
>> +++ b/drivers/gpu/drm/nouveau/nouveau_mem.h
>> @@ -13,6 +13,7 @@ nouveau_mem(struct ttm_resource *reg)
>>   }
>>
>>   struct nouveau_mem {
>> +       struct ttm_resource base;
>>          struct nouveau_cli *cli;
>>          u8 kind;
>>          u8 comp;
>> diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c
>> index 15c7627f8f58..5e5ce2ec89f0 100644
>> --- a/drivers/gpu/drm/nouveau/nouveau_ttm.c
>> +++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c
>> @@ -59,6 +59,8 @@ nouveau_vram_manager_new(struct ttm_resource_manager *man,
>>          if (ret)
>>                  return ret;
>>
>> +       ttm_resource_init(bo, place, reg->mm_node);
>> +
> What happened here? I assume this needs to be nouveau_mem.base not the mm_node?

Same like the other backends I'm first changing the allocation so that 
we allocate ttm_resource and the private housekeeping together and then 
flip the switch in the last patch.

So reg->mm_node is temporary pointing to the ttm_resource object until 
it is removed in the last patch.

Christian.

>
>>          ret = nouveau_mem_vram(reg, nvbo->contig, nvbo->page);
>>          if (ret) {
>>                  nouveau_mem_del(reg);
>> @@ -87,6 +89,7 @@ nouveau_gart_manager_new(struct ttm_resource_manager *man,
>>          if (ret)
>>                  return ret;
>>
>> +       ttm_resource_init(bo, place, reg->mm_node);
>>          reg->start = 0;
>>          return 0;
>>   }
>> @@ -112,6 +115,7 @@ nv04_gart_manager_new(struct ttm_resource_manager *man,
>>          if (ret)
>>                  return ret;
>>
>> +       ttm_resource_init(bo, place, reg->mm_node);
>>          ret = nvif_vmm_get(&mem->cli->vmm.vmm, PTES, false, 12, 0,
>>                             (long)reg->num_pages << PAGE_SHIFT, &mem->vma[0]);
>>          if (ret) {
>> --
>> 2.25.1
>>



More information about the dri-devel mailing list