Skip to content

Commit 4936b17

Browse files
committed
Merge branch 'drm-nouveau-fixes' of git://people.freedesktop.org/git/nouveau/linux-2.6 into drm-fixes
This covers all known nouveau regressions at the moment, along with a fix to not steal the console on headless GPUs. * 'drm-nouveau-fixes' of git://people.freedesktop.org/git/nouveau/linux-2.6: 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
2 parents 8f0d816 + e412e95 commit 4936b17

File tree

11 files changed

+83
-68
lines changed

11 files changed

+83
-68
lines changed

drivers/gpu/drm/nouveau/core/core/mm.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,16 @@ nouveau_mm_init(struct nouveau_mm *mm, u32 offset, u32 length, u32 block)
218218
node = kzalloc(sizeof(*node), GFP_KERNEL);
219219
if (!node)
220220
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+
}
223227

224228
list_add_tail(&node->nl_entry, &mm->nodes);
225229
list_add_tail(&node->fl_entry, &mm->free);
226230
mm->heap_nodes++;
227-
mm->heap_size += length;
228231
return 0;
229232
}
230233

drivers/gpu/drm/nouveau/core/include/core/mm.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ struct nouveau_mm {
1919

2020
u32 block_size;
2121
int heap_nodes;
22-
u32 heap_size;
2322
};
2423

2524
int nouveau_mm_init(struct nouveau_mm *, u32 offset, u32 length, u32 block);

drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,11 @@ nv50_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
219219
((priv->base.ram.size & 0x000000ff) << 32);
220220

221221
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;
226225

227-
nv_debug(priv, "%d compression tags\n", tags);
228-
}
226+
nv_debug(priv, "%d compression tags\n", tags);
229227

230228
size = (priv->base.ram.size >> 12) - rsvd_head - rsvd_tail;
231229
switch (device->chipset) {

drivers/gpu/drm/nouveau/core/subdev/i2c/base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ nouveau_i2c_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
292292
case DCB_I2C_NVIO_BIT:
293293
port->drive = info.drive & 0x0f;
294294
if (device->card_type < NV_D0) {
295-
if (info.drive >= ARRAY_SIZE(nv50_i2c_port))
295+
if (port->drive >= ARRAY_SIZE(nv50_i2c_port))
296296
break;
297297
port->drive = nv50_i2c_port[port->drive];
298298
port->sense = port->drive;

drivers/gpu/drm/nouveau/nouveau_display.c

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ nouveau_display_create(struct drm_device *dev)
290290
struct nouveau_drm *drm = nouveau_drm(dev);
291291
struct nouveau_disp *pdisp = nouveau_disp(drm->device);
292292
struct nouveau_display *disp;
293+
u32 pclass = dev->pdev->class >> 8;
293294
int ret, gen;
294295

295296
disp = drm->display = kzalloc(sizeof(*disp), GFP_KERNEL);
@@ -360,23 +361,27 @@ nouveau_display_create(struct drm_device *dev)
360361
drm_kms_helper_poll_init(dev);
361362
drm_kms_helper_poll_disable(dev);
362363

363-
if (nv_device(drm->device)->card_type < NV_50)
364-
ret = nv04_display_create(dev);
365-
else
366-
if (nv_device(drm->device)->card_type < NV_D0)
367-
ret = nv50_display_create(dev);
368-
else
369-
ret = nvd0_display_create(dev);
370-
if (ret)
371-
goto disp_create_err;
372-
373-
if (dev->mode_config.num_crtc) {
374-
ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
364+
if (nouveau_modeset == 1 ||
365+
(nouveau_modeset < 0 && pclass == PCI_CLASS_DISPLAY_VGA)) {
366+
if (nv_device(drm->device)->card_type < NV_50)
367+
ret = nv04_display_create(dev);
368+
else
369+
if (nv_device(drm->device)->card_type < NV_D0)
370+
ret = nv50_display_create(dev);
371+
else
372+
ret = nvd0_display_create(dev);
375373
if (ret)
376-
goto vblank_err;
374+
goto disp_create_err;
375+
376+
if (dev->mode_config.num_crtc) {
377+
ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
378+
if (ret)
379+
goto vblank_err;
380+
}
381+
382+
nouveau_backlight_init(dev);
377383
}
378384

379-
nouveau_backlight_init(dev);
380385
return 0;
381386

382387
vblank_err:
@@ -395,7 +400,8 @@ nouveau_display_destroy(struct drm_device *dev)
395400
nouveau_backlight_exit(dev);
396401
drm_vblank_cleanup(dev);
397402

398-
disp->dtor(dev);
403+
if (disp->dtor)
404+
disp->dtor(dev);
399405

400406
drm_kms_helper_poll_fini(dev);
401407
drm_mode_config_cleanup(dev);

drivers/gpu/drm/nouveau/nouveau_drm.c

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ MODULE_PARM_DESC(noaccel, "disable kernel/abi16 acceleration");
6363
static int nouveau_noaccel = 0;
6464
module_param_named(noaccel, nouveau_noaccel, int, 0400);
6565

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;
6869
module_param_named(modeset, nouveau_modeset, int, 0400);
6970

7071
static struct drm_driver driver;
@@ -363,7 +364,8 @@ nouveau_drm_unload(struct drm_device *dev)
363364

364365
nouveau_pm_fini(dev);
365366

366-
nouveau_display_fini(dev);
367+
if (dev->mode_config.num_crtc)
368+
nouveau_display_fini(dev);
367369
nouveau_display_destroy(dev);
368370

369371
nouveau_irq_fini(dev);
@@ -403,13 +405,15 @@ nouveau_drm_suspend(struct pci_dev *pdev, pm_message_t pm_state)
403405
pm_state.event == PM_EVENT_PRETHAW)
404406
return 0;
405407

406-
NV_INFO(drm, "suspending fbcon...\n");
407-
nouveau_fbcon_set_suspend(dev, 1);
408+
if (dev->mode_config.num_crtc) {
409+
NV_INFO(drm, "suspending fbcon...\n");
410+
nouveau_fbcon_set_suspend(dev, 1);
408411

409-
NV_INFO(drm, "suspending display...\n");
410-
ret = nouveau_display_suspend(dev);
411-
if (ret)
412-
return ret;
412+
NV_INFO(drm, "suspending display...\n");
413+
ret = nouveau_display_suspend(dev);
414+
if (ret)
415+
return ret;
416+
}
413417

414418
NV_INFO(drm, "evicting buffers...\n");
415419
ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM);
@@ -445,8 +449,10 @@ nouveau_drm_suspend(struct pci_dev *pdev, pm_message_t pm_state)
445449
nouveau_client_init(&cli->base);
446450
}
447451

448-
NV_INFO(drm, "resuming display...\n");
449-
nouveau_display_resume(dev);
452+
if (dev->mode_config.num_crtc) {
453+
NV_INFO(drm, "resuming display...\n");
454+
nouveau_display_resume(dev);
455+
}
450456
return ret;
451457
}
452458

@@ -486,8 +492,10 @@ nouveau_drm_resume(struct pci_dev *pdev)
486492
nouveau_irq_postinstall(dev);
487493
nouveau_pm_resume(dev);
488494

489-
NV_INFO(drm, "resuming display...\n");
490-
nouveau_display_resume(dev);
495+
if (dev->mode_config.num_crtc) {
496+
NV_INFO(drm, "resuming display...\n");
497+
nouveau_display_resume(dev);
498+
}
491499
return 0;
492500
}
493501

@@ -662,9 +670,7 @@ nouveau_drm_init(void)
662670
#ifdef CONFIG_VGA_CONSOLE
663671
if (vgacon_text_force())
664672
nouveau_modeset = 0;
665-
else
666673
#endif
667-
nouveau_modeset = 1;
668674
}
669675

670676
if (!nouveau_modeset)

drivers/gpu/drm/nouveau/nouveau_drm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,6 @@ int nouveau_drm_resume(struct pci_dev *);
141141
nv_info((cli), fmt, ##args); \
142142
} while (0)
143143

144+
extern int nouveau_modeset;
145+
144146
#endif

drivers/gpu/drm/nouveau/nouveau_irq.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,15 @@ nouveau_irq_handler(DRM_IRQ_ARGS)
6161

6262
nv_subdev(pmc)->intr(nv_subdev(pmc));
6363

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+
}
7173
}
7274

7375
return IRQ_HANDLED;

drivers/gpu/drm/nouveau/nv04_dac.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static enum drm_connector_status nv04_dac_detect(struct drm_encoder *encoder,
220220
NVWriteVgaCrtc(dev, 0, NV_CIO_CR_MODE_INDEX, saved_cr_mode);
221221

222222
if (blue == 0x18) {
223-
NV_INFO(drm, "Load detected on head A\n");
223+
NV_DEBUG(drm, "Load detected on head A\n");
224224
return connector_status_connected;
225225
}
226226

@@ -338,8 +338,8 @@ nv17_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector)
338338

339339
if (nv17_dac_sample_load(encoder) &
340340
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));
343343
return connector_status_connected;
344344
} else {
345345
return connector_status_disconnected;
@@ -413,9 +413,9 @@ static void nv04_dac_commit(struct drm_encoder *encoder)
413413

414414
helper->dpms(encoder, DRM_MODE_DPMS_ON);
415415

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));
419419
}
420420

421421
void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable)
@@ -461,8 +461,8 @@ static void nv04_dac_dpms(struct drm_encoder *encoder, int mode)
461461
return;
462462
nv_encoder->last_dpms = mode;
463463

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);
466466

467467
nv04_dac_update_dacclk(encoder, mode == DRM_MODE_DPMS_ON);
468468
}

drivers/gpu/drm/nouveau/nv04_dfp.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,9 @@ static void nv04_dfp_commit(struct drm_encoder *encoder)
476476

477477
helper->dpms(encoder, DRM_MODE_DPMS_ON);
478478

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));
482482
}
483483

484484
static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode)
@@ -520,8 +520,8 @@ static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode)
520520
return;
521521
nv_encoder->last_dpms = mode;
522522

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);
525525

526526
if (was_powersaving && is_powersaving_dpms(mode))
527527
return;
@@ -565,8 +565,8 @@ static void nv04_tmds_dpms(struct drm_encoder *encoder, int mode)
565565
return;
566566
nv_encoder->last_dpms = mode;
567567

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);
570570

571571
nv04_dfp_update_backlight(encoder, mode);
572572
nv04_dfp_update_fp_control(encoder, mode);

0 commit comments

Comments
 (0)