Skip to content

Commit

Permalink
drm/nouveau: fetch memory type indices that we care about for ttm
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Ben Skeggs committed Nov 2, 2017
1 parent 325a728 commit 658c71f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
3 changes: 3 additions & 0 deletions drivers/gpu/drm/nouveau/nouveau_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ struct nouveau_drm {
struct nouveau_channel *chan;
struct nvif_object copy;
int mtrr;
int type_vram;
int type_host;
int type_ncoh;
} ttm;

/* GEM interface support */
Expand Down
30 changes: 29 additions & 1 deletion drivers/gpu/drm/nouveau/nouveau_ttm.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,36 @@ nouveau_ttm_init(struct nouveau_drm *drm)
{
struct nvkm_device *device = nvxx_device(&drm->client.device);
struct nvkm_pci *pci = device->pci;
struct nvif_mmu *mmu = &drm->client.mmu;
struct drm_device *dev = drm->dev;
int ret;
int typei, ret;

typei = nvif_mmu_type(mmu, NVIF_MEM_HOST | NVIF_MEM_MAPPABLE |
NVIF_MEM_COHERENT);
if (typei < 0)
return -ENOSYS;

drm->ttm.type_host = typei;

typei = nvif_mmu_type(mmu, NVIF_MEM_HOST | NVIF_MEM_MAPPABLE);
if (typei < 0)
return -ENOSYS;

drm->ttm.type_ncoh = typei;

if (drm->client.device.info.platform != NV_DEVICE_INFO_V0_SOC &&
drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA) {
typei = nvif_mmu_type(mmu, NVIF_MEM_VRAM | NVIF_MEM_MAPPABLE |
NVIF_MEM_KIND |
NVIF_MEM_COMP |
NVIF_MEM_DISP);
if (typei < 0)
return -ENOSYS;

drm->ttm.type_vram = typei;
} else {
drm->ttm.type_vram = -1;
}

if (pci && pci->agp.bridge) {
drm->agp.bridge = pci->agp.bridge;
Expand Down

0 comments on commit 658c71f

Please sign in to comment.