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

Merge branch 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-fixes

A couple of bios parser fixes (one for ancient chips, another for new ones - important in Optimus configs). Another to make sure KMS is enabled on certain Optimus configs, and a TTM failure path fix.

* 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6:
drm/nouveau/ttm: prevent double-free in nouveau_sgdma_create_ttm() failure path
drm/nouveau/bios/init: fix thinko in INIT_CONFIGURE_MEM
drm/nouveau/kms: enable for non-vga pci classes
drm/nouveau/bios/init: stub opcode 0xaa

+38 -29
+18 -3
drivers/gpu/drm/nouveau/core/subdev/bios/init.c
··· 579 579 init_reserved(struct nvbios_init *init) 580 580 { 581 581 u8 opcode = nv_ro08(init->bios, init->offset); 582 - trace("RESERVED\t0x%02x\n", opcode); 583 - init->offset += 1; 582 + u8 length, i; 583 + 584 + switch (opcode) { 585 + case 0xaa: 586 + length = 4; 587 + break; 588 + default: 589 + length = 1; 590 + break; 591 + } 592 + 593 + trace("RESERVED 0x%02x\t", opcode); 594 + for (i = 1; i < length; i++) 595 + cont(" 0x%02x", nv_ro08(init->bios, init->offset + i)); 596 + cont("\n"); 597 + init->offset += length; 584 598 } 585 599 586 600 /** ··· 1451 1437 data = init_rdvgai(init, 0x03c4, 0x01); 1452 1438 init_wrvgai(init, 0x03c4, 0x01, data | 0x20); 1453 1439 1454 - while ((addr = nv_ro32(bios, sdata)) != 0xffffffff) { 1440 + for (; (addr = nv_ro32(bios, sdata)) != 0xffffffff; sdata += 4) { 1455 1441 switch (addr) { 1456 1442 case 0x10021c: /* CKE_NORMAL */ 1457 1443 case 0x1002d0: /* CMD_REFRESH */ ··· 2149 2135 [0x99] = { init_zm_auxch }, 2150 2136 [0x9a] = { init_i2c_long_if }, 2151 2137 [0xa9] = { init_gpio_ne }, 2138 + [0xaa] = { init_reserved }, 2152 2139 }; 2153 2140 2154 2141 #define init_opcode_nr (sizeof(init_opcode) / sizeof(init_opcode[0]))
+17 -22
drivers/gpu/drm/nouveau/nouveau_display.c
··· 278 278 { 279 279 struct nouveau_drm *drm = nouveau_drm(dev); 280 280 struct nouveau_display *disp; 281 - u32 pclass = dev->pdev->class >> 8; 282 281 int ret, gen; 283 282 284 283 disp = drm->display = kzalloc(sizeof(*disp), GFP_KERNEL); ··· 339 340 drm_kms_helper_poll_init(dev); 340 341 drm_kms_helper_poll_disable(dev); 341 342 342 - if (nouveau_modeset == 1 || 343 - (nouveau_modeset < 0 && pclass == PCI_CLASS_DISPLAY_VGA)) { 344 - if (drm->vbios.dcb.entries) { 345 - if (nv_device(drm->device)->card_type < NV_50) 346 - ret = nv04_display_create(dev); 347 - else 348 - ret = nv50_display_create(dev); 349 - } else { 350 - ret = 0; 351 - } 352 - 353 - if (ret) 354 - goto disp_create_err; 355 - 356 - if (dev->mode_config.num_crtc) { 357 - ret = drm_vblank_init(dev, dev->mode_config.num_crtc); 358 - if (ret) 359 - goto vblank_err; 360 - } 361 - 362 - nouveau_backlight_init(dev); 343 + if (drm->vbios.dcb.entries) { 344 + if (nv_device(drm->device)->card_type < NV_50) 345 + ret = nv04_display_create(dev); 346 + else 347 + ret = nv50_display_create(dev); 348 + } else { 349 + ret = 0; 363 350 } 364 351 352 + if (ret) 353 + goto disp_create_err; 354 + 355 + if (dev->mode_config.num_crtc) { 356 + ret = drm_vblank_init(dev, dev->mode_config.num_crtc); 357 + if (ret) 358 + goto vblank_err; 359 + } 360 + 361 + nouveau_backlight_init(dev); 365 362 return 0; 366 363 367 364 vblank_err:
+2 -1
drivers/gpu/drm/nouveau/nouveau_fbcon.c
··· 454 454 int preferred_bpp; 455 455 int ret; 456 456 457 - if (!dev->mode_config.num_crtc) 457 + if (!dev->mode_config.num_crtc || 458 + (dev->pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) 458 459 return 0; 459 460 460 461 fbcon = kzalloc(sizeof(struct nouveau_fbdev), GFP_KERNEL);
+1 -3
drivers/gpu/drm/nouveau/nouveau_sgdma.c
··· 104 104 else 105 105 nvbe->ttm.ttm.func = &nv50_sgdma_backend; 106 106 107 - if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page)) { 108 - kfree(nvbe); 107 + if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page)) 109 108 return NULL; 110 - } 111 109 return &nvbe->ttm.ttm; 112 110 }