aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorLyude Paul <lyude@redhat.com>2018-07-03 16:31:41 -0400
committerBen Skeggs <bskeggs@redhat.com>2018-07-16 03:59:59 -0400
commiteb493fbc150f4a28151ae1ee84f24395989f3600 (patch)
treefe289ae558db007c955ec38cb770bcbfd1284792 /drivers/gpu
parent68fe23a626b67b56c912c496ea43ed537ea9708f (diff)
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>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/nouveau/dispnv04/disp.c3
-rw-r--r--drivers/gpu/drm/nouveau/dispnv50/disp.c6
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c7
3 files changed, 10 insertions, 6 deletions
diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c b/drivers/gpu/drm/nouveau/dispnv04/disp.c
index 501d2d290e9c..70dce544984e 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c
@@ -55,6 +55,9 @@ nv04_display_create(struct drm_device *dev)
55 nouveau_display(dev)->init = nv04_display_init; 55 nouveau_display(dev)->init = nv04_display_init;
56 nouveau_display(dev)->fini = nv04_display_fini; 56 nouveau_display(dev)->fini = nv04_display_fini;
57 57
58 /* Pre-nv50 doesn't support atomic, so don't expose the ioctls */
59 dev->driver->driver_features &= ~DRIVER_ATOMIC;
60
58 nouveau_hw_save_vga_fonts(dev, 1); 61 nouveau_hw_save_vga_fonts(dev, 1);
59 62
60 nv04_crtc_create(dev, 0); 63 nv04_crtc_create(dev, 0);
diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 31b12b4f321a..9bae4db84cfb 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -2126,10 +2126,6 @@ nv50_display_destroy(struct drm_device *dev)
2126 kfree(disp); 2126 kfree(disp);
2127} 2127}
2128 2128
2129MODULE_PARM_DESC(atomic, "Expose atomic ioctl (default: disabled)");
2130static int nouveau_atomic = 0;
2131module_param_named(atomic, nouveau_atomic, int, 0400);
2132
2133int 2129int
2134nv50_display_create(struct drm_device *dev) 2130nv50_display_create(struct drm_device *dev)
2135{ 2131{
@@ -2154,8 +2150,6 @@ nv50_display_create(struct drm_device *dev)
2154 disp->disp = &nouveau_display(dev)->disp; 2150 disp->disp = &nouveau_display(dev)->disp;
2155 dev->mode_config.funcs = &nv50_disp_func; 2151 dev->mode_config.funcs = &nv50_disp_func;
2156 dev->driver->driver_features |= DRIVER_PREFER_XBGR_30BPP; 2152 dev->driver->driver_features |= DRIVER_PREFER_XBGR_30BPP;
2157 if (nouveau_atomic)
2158 dev->driver->driver_features |= DRIVER_ATOMIC;
2159 2153
2160 /* small shared memory area we use for notifiers and semaphores */ 2154 /* small shared memory area we use for notifiers and semaphores */
2161 ret = nouveau_bo_new(&drm->client, 4096, 0x1000, TTM_PL_FLAG_VRAM, 2155 ret = nouveau_bo_new(&drm->client, 4096, 0x1000, TTM_PL_FLAG_VRAM,
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 514903338782..f5d3158f0378 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -81,6 +81,10 @@ MODULE_PARM_DESC(modeset, "enable driver (default: auto, "
81int nouveau_modeset = -1; 81int nouveau_modeset = -1;
82module_param_named(modeset, nouveau_modeset, int, 0400); 82module_param_named(modeset, nouveau_modeset, int, 0400);
83 83
84MODULE_PARM_DESC(atomic, "Expose atomic ioctl (default: disabled)");
85static int nouveau_atomic = 0;
86module_param_named(atomic, nouveau_atomic, int, 0400);
87
84MODULE_PARM_DESC(runpm, "disable (0), force enable (1), optimus only default (-1)"); 88MODULE_PARM_DESC(runpm, "disable (0), force enable (1), optimus only default (-1)");
85static int nouveau_runtime_pm = -1; 89static int nouveau_runtime_pm = -1;
86module_param_named(runpm, nouveau_runtime_pm, int, 0400); 90module_param_named(runpm, nouveau_runtime_pm, int, 0400);
@@ -509,6 +513,9 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
509 513
510 pci_set_master(pdev); 514 pci_set_master(pdev);
511 515
516 if (nouveau_atomic)
517 driver_pci.driver_features |= DRIVER_ATOMIC;
518
512 ret = drm_get_pci_dev(pdev, pent, &driver_pci); 519 ret = drm_get_pci_dev(pdev, pent, &driver_pci);
513 if (ret) { 520 if (ret) {
514 nvkm_device_del(&device); 521 nvkm_device_del(&device);