diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index e3132a2ce34d..e2170efb672b 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c @@ -4443,11 +4443,13 @@ nv50_display_create(struct drm_device *dev) /* create crtc objects to represent the hw heads */ if (disp->disp->oclass >= GF110_DISP) - crtcs = nvif_rd32(&device->object, 0x022448); + crtcs = nvif_rd32(&device->object, 0x612004) & 0xf; else - crtcs = 2; + crtcs = 0x3; - for (i = 0; i < crtcs; i++) { + for (i = 0; i < fls(crtcs); i++) { + if (!(crtcs & (1 << i))) + continue; ret = nv50_head_create(dev, i); if (ret) goto out; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c index d8765b57180b..415987e9fb77 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c @@ -168,7 +168,7 @@ int gf119_disp_new_(const struct nv50_disp_func *func, struct nvkm_device *device, int index, struct nvkm_disp **pdisp) { - u32 heads = nvkm_rd32(device, 0x022448); + u32 heads = fls(nvkm_rd32(device, 0x612004) & 0xf); return nv50_disp_new_(func, device, index, heads, pdisp); } diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/headgf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/headgf119.c index b33552757647..8d44bdf63034 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/headgf119.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/headgf119.c @@ -92,5 +92,7 @@ gf119_head = { int gf119_head_new(struct nvkm_disp *disp, int id) { - return nvkm_head_new_(&gf119_head, disp, id); + if (nvkm_rd32(disp->engine.subdev.device, 0x612004) & 0xf & (1 << id)) + return nvkm_head_new_(&gf119_head, disp, id); + return 0; }