Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux

Pull nouveau fixes from Dave Airlie:
"Just a nouveau set, since we have a couple of reports on lkml and
dri-devel of regressions that this should fix I sent it along on its
own."

* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
drm/nouveau: headless mode by default if pci class != vga display
drm/nouveau: resurrect headless mode since rework
drm/nv50/fb: prevent oops on chipsets without compression tags
drm/nouveau: allow creation of zero-sized mm
drm/nouveau/i2c: fix typo when checking nvio i2c port validity
drm/nouveau: silence modesetting spam on pre-gf8 chipsets

+83 -68
+6 -3
drivers/gpu/drm/nouveau/core/core/mm.c
··· 218 218 node = kzalloc(sizeof(*node), GFP_KERNEL); 219 219 if (!node) 220 220 return -ENOMEM; 221 - node->offset = roundup(offset, mm->block_size); 222 - node->length = rounddown(offset + length, mm->block_size) - node->offset; 221 + 222 + if (length) { 223 + node->offset = roundup(offset, mm->block_size); 224 + node->length = rounddown(offset + length, mm->block_size); 225 + node->length -= node->offset; 226 + } 223 227 224 228 list_add_tail(&node->nl_entry, &mm->nodes); 225 229 list_add_tail(&node->fl_entry, &mm->free); 226 230 mm->heap_nodes++; 227 - mm->heap_size += length; 228 231 return 0; 229 232 } 230 233
-1
drivers/gpu/drm/nouveau/core/include/core/mm.h
··· 19 19 20 20 u32 block_size; 21 21 int heap_nodes; 22 - u32 heap_size; 23 22 }; 24 23 25 24 int nouveau_mm_init(struct nouveau_mm *, u32 offset, u32 length, u32 block);
+4 -6
drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c
··· 219 219 ((priv->base.ram.size & 0x000000ff) << 32); 220 220 221 221 tags = nv_rd32(priv, 0x100320); 222 - if (tags) { 223 - ret = nouveau_mm_init(&priv->base.tags, 0, tags, 1); 224 - if (ret) 225 - return ret; 222 + ret = nouveau_mm_init(&priv->base.tags, 0, tags, 1); 223 + if (ret) 224 + return ret; 226 225 227 - nv_debug(priv, "%d compression tags\n", tags); 228 - } 226 + nv_debug(priv, "%d compression tags\n", tags); 229 227 230 228 size = (priv->base.ram.size >> 12) - rsvd_head - rsvd_tail; 231 229 switch (device->chipset) {
+1 -1
drivers/gpu/drm/nouveau/core/subdev/i2c/base.c
··· 292 292 case DCB_I2C_NVIO_BIT: 293 293 port->drive = info.drive & 0x0f; 294 294 if (device->card_type < NV_D0) { 295 - if (info.drive >= ARRAY_SIZE(nv50_i2c_port)) 295 + if (port->drive >= ARRAY_SIZE(nv50_i2c_port)) 296 296 break; 297 297 port->drive = nv50_i2c_port[port->drive]; 298 298 port->sense = port->drive;
+21 -15
drivers/gpu/drm/nouveau/nouveau_display.c
··· 290 290 struct nouveau_drm *drm = nouveau_drm(dev); 291 291 struct nouveau_disp *pdisp = nouveau_disp(drm->device); 292 292 struct nouveau_display *disp; 293 + u32 pclass = dev->pdev->class >> 8; 293 294 int ret, gen; 294 295 295 296 disp = drm->display = kzalloc(sizeof(*disp), GFP_KERNEL); ··· 361 360 drm_kms_helper_poll_init(dev); 362 361 drm_kms_helper_poll_disable(dev); 363 362 364 - if (nv_device(drm->device)->card_type < NV_50) 365 - ret = nv04_display_create(dev); 366 - else 367 - if (nv_device(drm->device)->card_type < NV_D0) 368 - ret = nv50_display_create(dev); 369 - else 370 - ret = nvd0_display_create(dev); 371 - if (ret) 372 - goto disp_create_err; 373 - 374 - if (dev->mode_config.num_crtc) { 375 - ret = drm_vblank_init(dev, dev->mode_config.num_crtc); 363 + if (nouveau_modeset == 1 || 364 + (nouveau_modeset < 0 && pclass == PCI_CLASS_DISPLAY_VGA)) { 365 + if (nv_device(drm->device)->card_type < NV_50) 366 + ret = nv04_display_create(dev); 367 + else 368 + if (nv_device(drm->device)->card_type < NV_D0) 369 + ret = nv50_display_create(dev); 370 + else 371 + ret = nvd0_display_create(dev); 376 372 if (ret) 377 - goto vblank_err; 373 + goto disp_create_err; 374 + 375 + if (dev->mode_config.num_crtc) { 376 + ret = drm_vblank_init(dev, dev->mode_config.num_crtc); 377 + if (ret) 378 + goto vblank_err; 379 + } 380 + 381 + nouveau_backlight_init(dev); 378 382 } 379 383 380 - nouveau_backlight_init(dev); 381 384 return 0; 382 385 383 386 vblank_err: ··· 400 395 nouveau_backlight_exit(dev); 401 396 drm_vblank_cleanup(dev); 402 397 403 - disp->dtor(dev); 398 + if (disp->dtor) 399 + disp->dtor(dev); 404 400 405 401 drm_kms_helper_poll_fini(dev); 406 402 drm_mode_config_cleanup(dev);
+21 -15
drivers/gpu/drm/nouveau/nouveau_drm.c
··· 63 63 static int nouveau_noaccel = 0; 64 64 module_param_named(noaccel, nouveau_noaccel, int, 0400); 65 65 66 - MODULE_PARM_DESC(modeset, "enable driver"); 67 - static int nouveau_modeset = -1; 66 + MODULE_PARM_DESC(modeset, "enable driver (default: auto, " 67 + "0 = disabled, 1 = enabled, 2 = headless)"); 68 + int nouveau_modeset = -1; 68 69 module_param_named(modeset, nouveau_modeset, int, 0400); 69 70 70 71 static struct drm_driver driver; ··· 364 363 365 364 nouveau_pm_fini(dev); 366 365 367 - nouveau_display_fini(dev); 366 + if (dev->mode_config.num_crtc) 367 + nouveau_display_fini(dev); 368 368 nouveau_display_destroy(dev); 369 369 370 370 nouveau_irq_fini(dev); ··· 405 403 pm_state.event == PM_EVENT_PRETHAW) 406 404 return 0; 407 405 408 - NV_INFO(drm, "suspending fbcon...\n"); 409 - nouveau_fbcon_set_suspend(dev, 1); 406 + if (dev->mode_config.num_crtc) { 407 + NV_INFO(drm, "suspending fbcon...\n"); 408 + nouveau_fbcon_set_suspend(dev, 1); 410 409 411 - NV_INFO(drm, "suspending display...\n"); 412 - ret = nouveau_display_suspend(dev); 413 - if (ret) 414 - return ret; 410 + NV_INFO(drm, "suspending display...\n"); 411 + ret = nouveau_display_suspend(dev); 412 + if (ret) 413 + return ret; 414 + } 415 415 416 416 NV_INFO(drm, "evicting buffers...\n"); 417 417 ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM); ··· 449 445 nouveau_client_init(&cli->base); 450 446 } 451 447 452 - NV_INFO(drm, "resuming display...\n"); 453 - nouveau_display_resume(dev); 448 + if (dev->mode_config.num_crtc) { 449 + NV_INFO(drm, "resuming display...\n"); 450 + nouveau_display_resume(dev); 451 + } 454 452 return ret; 455 453 } 456 454 ··· 492 486 nouveau_irq_postinstall(dev); 493 487 nouveau_pm_resume(dev); 494 488 495 - NV_INFO(drm, "resuming display...\n"); 496 - nouveau_display_resume(dev); 489 + if (dev->mode_config.num_crtc) { 490 + NV_INFO(drm, "resuming display...\n"); 491 + nouveau_display_resume(dev); 492 + } 497 493 return 0; 498 494 } 499 495 ··· 670 662 #ifdef CONFIG_VGA_CONSOLE 671 663 if (vgacon_text_force()) 672 664 nouveau_modeset = 0; 673 - else 674 665 #endif 675 - nouveau_modeset = 1; 676 666 } 677 667 678 668 if (!nouveau_modeset)
+2
drivers/gpu/drm/nouveau/nouveau_drm.h
··· 141 141 nv_info((cli), fmt, ##args); \ 142 142 } while (0) 143 143 144 + extern int nouveau_modeset; 145 + 144 146 #endif
+9 -7
drivers/gpu/drm/nouveau/nouveau_irq.c
··· 61 61 62 62 nv_subdev(pmc)->intr(nv_subdev(pmc)); 63 63 64 - if (device->card_type >= NV_D0) { 65 - if (nv_rd32(device, 0x000100) & 0x04000000) 66 - nvd0_display_intr(dev); 67 - } else 68 - if (device->card_type >= NV_50) { 69 - if (nv_rd32(device, 0x000100) & 0x04000000) 70 - nv50_display_intr(dev); 64 + if (dev->mode_config.num_crtc) { 65 + if (device->card_type >= NV_D0) { 66 + if (nv_rd32(device, 0x000100) & 0x04000000) 67 + nvd0_display_intr(dev); 68 + } else 69 + if (device->card_type >= NV_50) { 70 + if (nv_rd32(device, 0x000100) & 0x04000000) 71 + nv50_display_intr(dev); 72 + } 71 73 } 72 74 73 75 return IRQ_HANDLED;
+8 -8
drivers/gpu/drm/nouveau/nv04_dac.c
··· 220 220 NVWriteVgaCrtc(dev, 0, NV_CIO_CR_MODE_INDEX, saved_cr_mode); 221 221 222 222 if (blue == 0x18) { 223 - NV_INFO(drm, "Load detected on head A\n"); 223 + NV_DEBUG(drm, "Load detected on head A\n"); 224 224 return connector_status_connected; 225 225 } 226 226 ··· 338 338 339 339 if (nv17_dac_sample_load(encoder) & 340 340 NV_PRAMDAC_TEST_CONTROL_SENSEB_ALLHI) { 341 - NV_INFO(drm, "Load detected on output %c\n", 342 - '@' + ffs(dcb->or)); 341 + NV_DEBUG(drm, "Load detected on output %c\n", 342 + '@' + ffs(dcb->or)); 343 343 return connector_status_connected; 344 344 } else { 345 345 return connector_status_disconnected; ··· 413 413 414 414 helper->dpms(encoder, DRM_MODE_DPMS_ON); 415 415 416 - NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n", 417 - drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), 418 - nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); 416 + NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n", 417 + drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), 418 + nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); 419 419 } 420 420 421 421 void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable) ··· 461 461 return; 462 462 nv_encoder->last_dpms = mode; 463 463 464 - NV_INFO(drm, "Setting dpms mode %d on vga encoder (output %d)\n", 465 - mode, nv_encoder->dcb->index); 464 + NV_DEBUG(drm, "Setting dpms mode %d on vga encoder (output %d)\n", 465 + mode, nv_encoder->dcb->index); 466 466 467 467 nv04_dac_update_dacclk(encoder, mode == DRM_MODE_DPMS_ON); 468 468 }
+7 -7
drivers/gpu/drm/nouveau/nv04_dfp.c
··· 476 476 477 477 helper->dpms(encoder, DRM_MODE_DPMS_ON); 478 478 479 - NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n", 480 - drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), 481 - nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); 479 + NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n", 480 + drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), 481 + nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); 482 482 } 483 483 484 484 static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode) ··· 520 520 return; 521 521 nv_encoder->last_dpms = mode; 522 522 523 - NV_INFO(drm, "Setting dpms mode %d on lvds encoder (output %d)\n", 524 - mode, nv_encoder->dcb->index); 523 + NV_DEBUG(drm, "Setting dpms mode %d on lvds encoder (output %d)\n", 524 + mode, nv_encoder->dcb->index); 525 525 526 526 if (was_powersaving && is_powersaving_dpms(mode)) 527 527 return; ··· 565 565 return; 566 566 nv_encoder->last_dpms = mode; 567 567 568 - NV_INFO(drm, "Setting dpms mode %d on tmds encoder (output %d)\n", 569 - mode, nv_encoder->dcb->index); 568 + NV_DEBUG(drm, "Setting dpms mode %d on tmds encoder (output %d)\n", 569 + mode, nv_encoder->dcb->index); 570 570 571 571 nv04_dfp_update_backlight(encoder, mode); 572 572 nv04_dfp_update_fp_control(encoder, mode);
+4 -5
drivers/gpu/drm/nouveau/nv04_tv.c
··· 75 75 struct nv04_mode_state *state = &nv04_display(dev)->mode_reg; 76 76 uint8_t crtc1A; 77 77 78 - NV_INFO(drm, "Setting dpms mode %d on TV encoder (output %d)\n", 79 - mode, nv_encoder->dcb->index); 78 + NV_DEBUG(drm, "Setting dpms mode %d on TV encoder (output %d)\n", 79 + mode, nv_encoder->dcb->index); 80 80 81 81 state->pllsel &= ~(PLLSEL_TV_CRTC1_MASK | PLLSEL_TV_CRTC2_MASK); 82 82 ··· 167 167 168 168 helper->dpms(encoder, DRM_MODE_DPMS_ON); 169 169 170 - NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n", 171 - drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), nv_crtc->index, 172 - '@' + ffs(nv_encoder->dcb->or)); 170 + NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n", 171 + drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); 173 172 } 174 173 175 174 static void nv04_tv_destroy(struct drm_encoder *encoder)