Skip to content

Commit eb493fb

Browse files
LyudeBen Skeggs
authored andcommitted
drm/nouveau: Set DRIVER_ATOMIC cap earlier to fix debugfs
Currently nouveau doesn't actually expose the state debugfs file that's usually provided for any modesetting driver that supports atomic, even if nouveau is loaded with atomic=1. This is due to the fact that the standard debugfs files that DRM creates for atomic drivers is called when drm_get_pci_dev() is called from nouveau_drm.c. This happens well before we've initialized the display core, which is currently responsible for setting the DRIVER_ATOMIC cap. So, move the atomic option into nouveau_drm.c and just add the DRIVER_ATOMIC cap whenever it's enabled on the kernel commandline. This shouldn't cause any actual issues, as the atomic ioctl will still fail as expected even if the display core doesn't disable it until later in the init sequence. This also provides the added benefit of being able to use the state debugfs file to check the current display state even if clients aren't allowed to modify it through anything other than the legacy ioctls. Additionally, disable the DRIVER_ATOMIC cap in nv04's display core, as this was already disabled there previously. Signed-off-by: Lyude Paul <lyude@redhat.com> Cc: stable@vger.kernel.org Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
1 parent 68fe23a commit eb493fb

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

drivers/gpu/drm/nouveau/dispnv04/disp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ nv04_display_create(struct drm_device *dev)
5555
nouveau_display(dev)->init = nv04_display_init;
5656
nouveau_display(dev)->fini = nv04_display_fini;
5757

58+
/* Pre-nv50 doesn't support atomic, so don't expose the ioctls */
59+
dev->driver->driver_features &= ~DRIVER_ATOMIC;
60+
5861
nouveau_hw_save_vga_fonts(dev, 1);
5962

6063
nv04_crtc_create(dev, 0);

drivers/gpu/drm/nouveau/dispnv50/disp.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,10 +2126,6 @@ nv50_display_destroy(struct drm_device *dev)
21262126
kfree(disp);
21272127
}
21282128

2129-
MODULE_PARM_DESC(atomic, "Expose atomic ioctl (default: disabled)");
2130-
static int nouveau_atomic = 0;
2131-
module_param_named(atomic, nouveau_atomic, int, 0400);
2132-
21332129
int
21342130
nv50_display_create(struct drm_device *dev)
21352131
{
@@ -2154,8 +2150,6 @@ nv50_display_create(struct drm_device *dev)
21542150
disp->disp = &nouveau_display(dev)->disp;
21552151
dev->mode_config.funcs = &nv50_disp_func;
21562152
dev->driver->driver_features |= DRIVER_PREFER_XBGR_30BPP;
2157-
if (nouveau_atomic)
2158-
dev->driver->driver_features |= DRIVER_ATOMIC;
21592153

21602154
/* small shared memory area we use for notifiers and semaphores */
21612155
ret = nouveau_bo_new(&drm->client, 4096, 0x1000, TTM_PL_FLAG_VRAM,

drivers/gpu/drm/nouveau/nouveau_drm.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ MODULE_PARM_DESC(modeset, "enable driver (default: auto, "
8181
int nouveau_modeset = -1;
8282
module_param_named(modeset, nouveau_modeset, int, 0400);
8383

84+
MODULE_PARM_DESC(atomic, "Expose atomic ioctl (default: disabled)");
85+
static int nouveau_atomic = 0;
86+
module_param_named(atomic, nouveau_atomic, int, 0400);
87+
8488
MODULE_PARM_DESC(runpm, "disable (0), force enable (1), optimus only default (-1)");
8589
static int nouveau_runtime_pm = -1;
8690
module_param_named(runpm, nouveau_runtime_pm, int, 0400);
@@ -509,6 +513,9 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
509513

510514
pci_set_master(pdev);
511515

516+
if (nouveau_atomic)
517+
driver_pci.driver_features |= DRIVER_ATOMIC;
518+
512519
ret = drm_get_pci_dev(pdev, pent, &driver_pci);
513520
if (ret) {
514521
nvkm_device_del(&device);

0 commit comments

Comments
 (0)