Support render-node only drivers
Subsystems (8)
cover Support render-node only drivers
From: Thierry Reding <[email protected]>
This series builds on top of David's reliable DRM minor series:
[PATCH 00/13] DRM Reliable Minor-IDs
Tegra K1 has a Kepler-type GPU without any display engine. Instead it reuses the Tegra display engine. That means that effectively the GPU becomes a render-node only device. In order to reflect that, it would be preferable for the associated /dev/dri/cardX node not to show up.
To achieve that, the DRIVER_MODESET feature needs to be removed from the GPU driver, but that unfortunately implies activating a bunch of legacy behaviour for pre-KMS drivers. To allow for drivers that don't support modesetting IOCTLs (because they drive no output) but which aren't legacy either, the meaning of the DRIVER_MODESET needs to be redefined.
This series attempts to do so by first renaming DRM_MINOR_LEGACY to DRM_MINOR_PRIMARY to more accurately reflect its purpose. Legacy and modesetting are then decoupled by introducing a DRIVER_LEGACY driver feature that can be set by truly legacy drivers. This allows the old DRIVER_MODESET feature to advertise support only for modesetting functionality, without implying that it is a non-legacy driver.
After all the drivers have been updated, the core can be modified to create the primary minor only when DRIVER_MODESET is available.
The remainder of the series cleans up some drm_core_check_feature() usage and drop some unused code related to that.
Thierry
Thierry Reding (12):
drm: Rename DRM_MINOR_LEGACY to DRM_MINOR_PRIMARY
drm: Introduce DRIVER_LEGACY feature
drm/i915: Mark as legacy if KMS is disabled
drm: Separate DRIVER_MODESET and DRIVER_LEGACY
drm: Create primary minor only if mode-setting is supported
drm: Remove gratuituous blank line
drm: Use drm_core_check_feature() where possible drm/exynos: Remove dead code
drm/gma500: Remove dead code
drm/i810: Remove dead code
drm/i915: Remove dead code
drm/qxl: Remove dead code
drivers/gpu/drm/drm_bufs.c | 12 +++++------ drivers/gpu/drm/drm_crtc.c | 1 - drivers/gpu/drm/drm_dma.c | 4 ++-- drivers/gpu/drm/drm_fops.c | 14 ++++++------ drivers/gpu/drm/drm_gem.c | 6 +++--- drivers/gpu/drm/drm_irq.c | 12 +++++------ drivers/gpu/drm/drm_pci.c | 12 +++++------ drivers/gpu/drm/drm_scatter.c | 6 +++--- drivers/gpu/drm/drm_stub.c | 24 +++++++++++---------- drivers/gpu/drm/drm_sysfs.c | 8 +++---- drivers/gpu/drm/exynos/exynos_drm_gem.c | 10 --------- drivers/gpu/drm/gma500/gem.c | 3 --- drivers/gpu/drm/i810/i810_dma.c | 7 ------ drivers/gpu/drm/i810/i810_drv.c | 3 ++- drivers/gpu/drm/i915/i915_dma.c | 38 ++++++++++++++++----------------- drivers/gpu/drm/i915/i915_drv.c | 18 ++++++++++------ drivers/gpu/drm/i915/i915_gem.c | 17 +++++++-------- drivers/gpu/drm/i915/i915_gem_context.c | 6 ------ drivers/gpu/drm/i915/i915_irq.c | 6 +++--- drivers/gpu/drm/i915/i915_suspend.c | 15 ++++++------- drivers/gpu/drm/i915/intel_ringbuffer.c | 2 +- drivers/gpu/drm/mga/mga_drv.c | 3 ++- drivers/gpu/drm/qxl/qxl_kms.c | 4 ---- drivers/gpu/drm/radeon/radeon_drv.c | 3 ++- drivers/gpu/drm/savage/savage_drv.c | 2 +- drivers/gpu/drm/sis/sis_drv.c | 2 +- drivers/gpu/drm/tdfx/tdfx_drv.c | 1 + drivers/gpu/drm/via/via_drv.c | 2 +- include/drm/drmP.h | 3 ++- 29 files changed, 112 insertions(+), 132 deletions(-)
Signature · 1 line
1.8.4.2
RFC 1/12 drm: Rename DRM_MINOR_LEGACY to DRM_MINOR_PRIMARY
From: Thierry Reding <[email protected]>
The term "legacy" is overloaded in the context of DRM. DRM_MINOR_LEGACY doesn't accurately describe the use of the minor. The associated minor is the primary minor for a device, as reflected by the .primary field of struct drm_device. For consistency, rename the enumeration value to DRM_MINOR_PRIMARY.
--- drivers/gpu/drm/drm_stub.c | 16 ++++++++-------- drivers/gpu/drm/drm_sysfs.c | 4 ++-- include/drm/drmP.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/drm_stub.c +8 -8
@@ -319,7 +319,7 @@ static struct drm_minor **drm_minor_get_slot(struct drm_device *dev, unsigned int type) {switch (type) { -case DRM_MINOR_LEGACY : +case DRM_MINOR_PRIMARY :return &dev->primary;case DRM_MINOR_RENDER :return &dev->render;
@@ -493,7 +493,7 @@ EXPORT_SYMBOL(drm_put_dev);void drm_unplug_dev (struct drm_device *dev) {/* for a USB device */ -drm_minor_unregister (dev,DRM_MINOR_LEGACY ); +drm_minor_unregister (dev,DRM_MINOR_PRIMARY );drm_minor_unregister (dev,DRM_MINOR_RENDER );drm_minor_unregister (dev,DRM_MINOR_CONTROL );
@@ -564,7 +564,7 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver, goto err_minors; } - ret =drm_minor_alloc (dev,DRM_MINOR_LEGACY ); + ret =drm_minor_alloc (dev,DRM_MINOR_PRIMARY );if (ret) goto err_minors;
@@ -592,7 +592,7 @@ err_ctxbitmap: err_ht:drm_ht_remove (&dev->map_hash); err_minors: -drm_minor_free (dev,DRM_MINOR_LEGACY ); +drm_minor_free (dev,DRM_MINOR_PRIMARY );drm_minor_free (dev,DRM_MINOR_RENDER );drm_minor_free (dev,DRM_MINOR_CONTROL );drm_minor_free_base (dev);
@@ -618,7 +618,7 @@ static void drm_dev_free(struct drm_device *dev)drm_ctxbitmap_cleanup (dev);drm_ht_remove (&dev->map_hash); -drm_minor_free (dev,DRM_MINOR_LEGACY ); +drm_minor_free (dev,DRM_MINOR_PRIMARY );drm_minor_free (dev,DRM_MINOR_RENDER );drm_minor_free (dev,DRM_MINOR_CONTROL );drm_minor_free_base (dev);
@@ -692,7 +692,7 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)if (ret) goto err_minors; - ret =drm_minor_register (dev,DRM_MINOR_LEGACY ); + ret =drm_minor_register (dev,DRM_MINOR_PRIMARY );if (ret) goto err_minors;
@@ -718,7 +718,7 @@ err_unload:if (dev->driver->unload) dev->driver->unload (dev); err_minors: -drm_minor_unregister (dev,DRM_MINOR_LEGACY ); +drm_minor_unregister (dev,DRM_MINOR_PRIMARY );drm_minor_unregister (dev,DRM_MINOR_RENDER );drm_minor_unregister (dev,DRM_MINOR_CONTROL ); out_unlock:
@@ -752,7 +752,7 @@ void drm_dev_unregister(struct drm_device *dev)list_for_each_entry_safe (r_list, list_temp, &dev->maplist, head)drm_rmmap (dev, r_list->map); -drm_minor_unregister (dev,DRM_MINOR_LEGACY ); +drm_minor_unregister (dev,DRM_MINOR_PRIMARY );drm_minor_unregister (dev,DRM_MINOR_RENDER );drm_minor_unregister (dev,DRM_MINOR_CONTROL ); }
drivers/gpu/drm/drm_sysfs.c +2 -2
@@ -43,7 +43,7 @@ static int __drm_class_suspend(struct device *dev, pm_message_t state)struct drm_minor *drm_minor =to_drm_minor (dev);struct drm_device *drm_dev = drm_minor->dev; -if (drm_minor->type ==DRM_MINOR_LEGACY && +if (drm_minor->type ==DRM_MINOR_PRIMARY && !drm_core_check_feature (drm_dev,DRIVER_MODESET ) && drm_dev->driver->suspend)return drm_dev->driver->suspend (drm_dev, state);
@@ -84,7 +84,7 @@ static int drm_class_resume(struct device *dev)struct drm_minor *drm_minor =to_drm_minor (dev);struct drm_device *drm_dev = drm_minor->dev; -if (drm_minor->type ==DRM_MINOR_LEGACY && +if (drm_minor->type ==DRM_MINOR_PRIMARY && !drm_core_check_feature (drm_dev,DRIVER_MODESET ) && drm_dev->driver->resume)return drm_dev->driver->resume (drm_dev);
include/drm/drmP.h +1 -1
@@ -1010,7 +1010,7 @@ struct drm_driver { };enum drm_minor_type { -DRM_MINOR_LEGACY , +DRM_MINOR_PRIMARY ,DRM_MINOR_CONTROL ,DRM_MINOR_RENDER ,DRM_MINOR_CNT ,
Signature · 1 line
1.8.4.2
RFC 2/12 drm: Introduce DRIVER_LEGACY feature
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Currently drivers that set the DRIVER_MODESET feature are considered to be non-legacy drivers. At the same time DRIVER_MODESET implies that the mode-setting IOCTLs are available. It is therefore not possible to distinguish between a non-legacy driver with full mode-setting support and a non-legacy driver without mode-setting functionality.
To separate the meaning of "legacy" and "modeset", a new driver feature is introduced: DRIVER_LEGACY. The meaning of DRIVER_MODESET can then be changed to apply to the mode-setting functionality only, irrespective of whether it is legacy or not.
Mark all legacy drivers appropriately.
--- drivers/gpu/drm/i810/i810_drv.c | 3 ++- drivers/gpu/drm/mga/mga_drv.c | 3 ++- drivers/gpu/drm/radeon/radeon_drv.c | 3 ++- drivers/gpu/drm/savage/savage_drv.c | 2 +- drivers/gpu/drm/sis/sis_drv.c | 2 +- drivers/gpu/drm/tdfx/tdfx_drv.c | 1 + drivers/gpu/drm/via/via_drv.c | 2 +- include/drm/drmP.h | 1 + 8 files changed, 11 insertions(+), 6 deletions(-)
drivers/gpu/drm/i810/i810_drv.c +2 -1
@@ -58,7 +58,8 @@ static const struct file_operations i810_driver_fops = {static struct drm_driver driver = { .driver_features =DRIVER_USE_AGP | -DRIVER_HAVE_DMA , +DRIVER_HAVE_DMA | +DRIVER_LEGACY , .dev_priv_size =sizeof (drm_i810_buf_priv_t), .load = i810_driver_load, .lastclose = i810_driver_lastclose,
drivers/gpu/drm/mga/mga_drv.c +2 -1
@@ -59,7 +59,8 @@ static const struct file_operations mga_driver_fops = {static struct drm_driver driver = { .driver_features =DRIVER_USE_AGP |DRIVER_PCI_DMA | -DRIVER_HAVE_DMA |DRIVER_HAVE_IRQ |DRIVER_IRQ_SHARED , +DRIVER_HAVE_DMA |DRIVER_HAVE_IRQ |DRIVER_IRQ_SHARED | +DRIVER_LEGACY , .dev_priv_size =sizeof (drm_mga_buf_priv_t), .load = mga_driver_load, .unload = mga_driver_unload,
drivers/gpu/drm/radeon/radeon_drv.c +2 -1
@@ -292,7 +292,8 @@ static const struct file_operations radeon_driver_old_fops = {static struct drm_driver driver_old = { .driver_features =DRIVER_USE_AGP |DRIVER_PCI_DMA |DRIVER_SG | -DRIVER_HAVE_IRQ |DRIVER_HAVE_DMA |DRIVER_IRQ_SHARED , +DRIVER_HAVE_IRQ |DRIVER_HAVE_DMA |DRIVER_IRQ_SHARED | +DRIVER_LEGACY , .dev_priv_size =sizeof (drm_radeon_buf_priv_t), .load = radeon_driver_load, .firstopen = radeon_driver_firstopen,
drivers/gpu/drm/savage/savage_drv.c +1 -1
@@ -50,7 +50,7 @@ static const struct file_operations savage_driver_fops = {static struct drm_driver driver = { .driver_features = -DRIVER_USE_AGP |DRIVER_HAVE_DMA |DRIVER_PCI_DMA , +DRIVER_USE_AGP |DRIVER_HAVE_DMA |DRIVER_PCI_DMA |DRIVER_LEGACY , .dev_priv_size =sizeof (drm_savage_buf_priv_t), .load = savage_driver_load, .firstopen = savage_driver_firstopen,
drivers/gpu/drm/sis/sis_drv.c +1 -1
@@ -102,7 +102,7 @@ static void sis_driver_postclose(struct drm_device *dev, struct drm_file *file) }static struct drm_driver driver = { - .driver_features =DRIVER_USE_AGP , + .driver_features =DRIVER_USE_AGP |DRIVER_LEGACY , .load = sis_driver_load, .unload = sis_driver_unload, .open = sis_driver_open,
drivers/gpu/drm/tdfx/tdfx_drv.c +1 -0
@@ -55,6 +55,7 @@ static const struct file_operations tdfx_driver_fops = { };static struct drm_driver driver = { + .features =DRIVER_LEGACY , .fops = &tdfx_driver_fops, .name =DRIVER_NAME , .desc =DRIVER_DESC ,
drivers/gpu/drm/via/via_drv.c +1 -1
@@ -73,7 +73,7 @@ static const struct file_operations via_driver_fops = {static struct drm_driver driver = { .driver_features =DRIVER_USE_AGP |DRIVER_HAVE_IRQ | -DRIVER_IRQ_SHARED , +DRIVER_IRQ_SHARED |DRIVER_LEGACY , .load = via_driver_load, .unload = via_driver_unload, .open = via_driver_open,
include/drm/drmP.h +1 -0
@@ -147,6 +147,7 @@ int drm_err(const char *func, const char *format, ...);#define DRIVER_MODESET 0x2000#define DRIVER_PRIME 0x4000#define DRIVER_RENDER 0x8000 +#define DRIVER_LEGACY 0x10000#define DRIVER_BUS_PCI 0x1#define DRIVER_BUS_PLATFORM 0x2
Signature · 1 line
1.8.4.2
RFC 3/12 drm/i915: Mark as legacy if KMS is disabled
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
When kernel mode-setting is disabled, mark the driver as legacy to pick up the special semantics required for userspace mode-setting.
--- drivers/gpu/drm/i915/i915_drv.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +7 -1
@@ -985,13 +985,19 @@ static int __init i915_init(void)#if defined(CONFIG_DRM_I915_KMS )if (i915.modeset !=0 ) driver.driver_features |=DRIVER_MODESET ; +else + driver.driver_features |=DRIVER_LEGACY ;#endif if (i915.modeset ==1 ) driver.driver_features |=DRIVER_MODESET ; +else + driver.driver_features |=DRIVER_LEGACY ;#ifdef CONFIG_VGA_CONSOLE -if (vgacon_text_force () && i915.modeset ==-1 ) +if (vgacon_text_force () && i915.modeset ==-1 ) { driver.driver_features &= ~DRIVER_MODESET ; + driver.driver_features |=DRIVER_LEGACY ; + }#endif if (!(driver.driver_features &DRIVER_MODESET )) {
Signature · 1 line
1.8.4.2
Re: [RFC 03/12] drm/i915: Mark as legacy if KMS is disabled
Quoted 15 lines · Thierry Reding
From: Thierry Reding <[email protected]>
When kernel mode-setting is disabled, mark the driver as legacy to pick up the special semantics required for userspace mode-setting.
Signed-off-by Thierry Reding <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_drv.c +0
-0
drivers/gpu/drm/i915/i915_drv.c static int __init i915_init(void) · line 994
Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.c +4
-0@@ -985,13 +985,19 @@ static int __init i915_init(void)#if defined(CONFIG_DRM_I915_KMS )if (i915.modeset !=0 ) driver.driver_features |=DRIVER_MODESET ; +else + driver.driver_features |=DRIVER_LEGACY ;#endif if (i915.modeset ==1 ) driver.driver_features |=DRIVER_MODESET ; +else + driver.driver_features |=DRIVER_LEGACY ;
If i915.modeset == -1 (which seems like a legal value as per the hunk below, and I'm guessing the default), it'll end up with both MODESET and LEGACY. Is that a legal combination?
Quoted 17 lines
drivers/gpu/drm/i915/i915_drv.c +3
-2#ifdef CONFIG_VGA_CONSOLE -if (vgacon_text_force () && i915.modeset ==-1 ) +if (vgacon_text_force () && i915.modeset ==-1 ) { driver.driver_features &= ~DRIVER_MODESET ; + driver.driver_features |=DRIVER_LEGACY ; + }#endif if (!(driver.driver_features &DRIVER_MODESET )) { --1.8.4.2
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC 03/12] drm/i915: Mark as legacy if KMS is disabled
Quoted 23 lines · Ilia Mirkin
Quoted 21 lines · Thierry Reding
From: Thierry Reding <[email protected]>
When kernel mode-setting is disabled, mark the driver as legacy to pick up the special semantics required for userspace mode-setting.
Signed-off-by Thierry Reding <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_drv.c +2
-0@@ -985,13 +985,19 @@ static int __init i915_init(void)#if defined(CONFIG_DRM_I915_KMS )if (i915.modeset !=0 ) driver.driver_features |=DRIVER_MODESET ; +else + driver.driver_features |=DRIVER_LEGACY ;#endif
Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.c static int __init i915_init(void) · line 994
Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.c +2
-0if (i915.modeset ==1 ) driver.driver_features |=DRIVER_MODESET ; +else + driver.driver_features |=DRIVER_LEGACY ;If i915.modeset == -1 (which seems like a legal value as per the hunk below, and I'm guessing the default), it'll end up with both MODESET and LEGACY. Is that a legal combination?
I don't see a reason why the combination would be illegal, but it doesn't make a lot of sense either. So I think the above hunk should be turned into this instead:
+ if (i915.modeset == 0)
+ driver.driver_features |= DRIVER_LEGACY;
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC 4/12 drm: Separate DRIVER_MODESET and DRIVER_LEGACY
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Support non-legacy drivers without mode-setting functionality by using the new DRIVER_LEGACY feature to separate out legacy code, rather than relying on DRIVER_MODESET not being advertised.
--- drivers/gpu/drm/drm_bufs.c | 12 +++++------ drivers/gpu/drm/drm_dma.c | 4 ++-- drivers/gpu/drm/drm_fops.c | 6 +++--- drivers/gpu/drm/drm_irq.c | 12 +++++------ drivers/gpu/drm/drm_pci.c | 12 +++++------ drivers/gpu/drm/drm_scatter.c | 6 +++--- drivers/gpu/drm/drm_sysfs.c | 4 ++-- drivers/gpu/drm/i915/i915_dma.c | 38 ++++++++++++++++----------------- drivers/gpu/drm/i915/i915_drv.c | 10 ++++----- drivers/gpu/drm/i915/i915_gem.c | 17 +++++++-------- drivers/gpu/drm/i915/i915_irq.c | 6 +++--- drivers/gpu/drm/i915/i915_suspend.c | 15 ++++++------- drivers/gpu/drm/i915/intel_ringbuffer.c | 2 +- 13 files changed, 71 insertions(+), 73 deletions(-)
drivers/gpu/drm/drm_bufs.c +6 -6
@@ -1141,7 +1141,7 @@ int drm_addbufs(struct drm_device *dev, void *data,struct drm_buf_desc *request = data;int ret; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return -EINVAL ;if (!drm_core_check_feature (dev,DRIVER_HAVE_DMA ))
@@ -1187,7 +1187,7 @@ int drm_infobufs(struct drm_device *dev, void *data,int i;int count; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return -EINVAL ;if (!drm_core_check_feature (dev,DRIVER_HAVE_DMA ))
@@ -1269,7 +1269,7 @@ int drm_markbufs(struct drm_device *dev, void *data,int order;struct drm_buf_entry *entry; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return -EINVAL ;if (!drm_core_check_feature (dev,DRIVER_HAVE_DMA ))
@@ -1317,7 +1317,7 @@ int drm_freebufs(struct drm_device *dev, void *data,int idx;struct drm_buf *buf; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return -EINVAL ;if (!drm_core_check_feature (dev,DRIVER_HAVE_DMA ))
@@ -1372,7 +1372,7 @@ int drm_mapbufs(struct drm_device *dev, void *data,struct drm_buf_map *request = data;int i; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return -EINVAL ;if (!drm_core_check_feature (dev,DRIVER_HAVE_DMA ))
@@ -1452,7 +1452,7 @@ int drm_mapbufs(struct drm_device *dev, void *data,int drm_dma_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv) { -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return -EINVAL ;if (dev->driver->dma_ioctl)
drivers/gpu/drm/drm_dma.c +2 -2
@@ -49,7 +49,7 @@ int drm_legacy_dma_setup(struct drm_device *dev)int i;if (!drm_core_check_feature (dev,DRIVER_HAVE_DMA ) || -drm_core_check_feature (dev,DRIVER_MODESET )) { + !drm_core_check_feature (dev,DRIVER_LEGACY )) {return 0 ; }
@@ -80,7 +80,7 @@ void drm_legacy_dma_takedown(struct drm_device *dev)int i, j;if (!drm_core_check_feature (dev,DRIVER_HAVE_DMA ) || -drm_core_check_feature (dev,DRIVER_MODESET )) { + !drm_core_check_feature (dev,DRIVER_LEGACY )) {return ; }
drivers/gpu/drm/drm_fops.c +3 -3
@@ -50,8 +50,8 @@ static int drm_setup(struct drm_device * dev) {int ret; -if (dev->driver->firstopen && - !drm_core_check_feature (dev,DRIVER_MODESET )) { +if (drm_core_check_feature (dev,DRIVER_LEGACY ) && + dev->driver->firstopen) { ret = dev->driver->firstopen (dev);if (ret !=0 )return ret;
@@ -386,7 +386,7 @@ static void drm_events_release(struct drm_file *file_priv)*/ static void drm_legacy_dev_reinit (struct drm_device *dev) { -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return ; dev->sigdata.lock =NULL ;
drivers/gpu/drm/drm_irq.c +6 -6
@@ -321,7 +321,7 @@ int drm_irq_install(struct drm_device *dev)return ret; } -if (!drm_core_check_feature (dev,DRIVER_MODESET )) +if (drm_core_check_feature (dev,DRIVER_LEGACY ))vga_client_register (dev->pdev, (void *)dev, drm_irq_vgaarb_nokms,NULL );/* After installing handler */
@@ -332,7 +332,7 @@ int drm_irq_install(struct drm_device *dev)mutex_lock (&dev->struct_mutex); dev->irq_enabled = false;mutex_unlock (&dev->struct_mutex); -if (!drm_core_check_feature (dev,DRIVER_MODESET )) +if (drm_core_check_feature (dev,DRIVER_LEGACY ))vga_client_register (dev->pdev,NULL ,NULL ,NULL );free_irq (drm_dev_to_irq (dev), dev); }
@@ -381,7 +381,7 @@ int drm_irq_uninstall(struct drm_device *dev)DRM_DEBUG ("irq=%d\n" ,drm_dev_to_irq (dev)); -if (!drm_core_check_feature (dev,DRIVER_MODESET )) +if (drm_core_check_feature (dev,DRIVER_LEGACY ))vga_client_register (dev->pdev,NULL ,NULL ,NULL );if (dev->driver->irq_uninstall)
@@ -418,7 +418,7 @@ int drm_control(struct drm_device *dev, void *data,case DRM_INST_HANDLER :if (!drm_core_check_feature (dev,DRIVER_HAVE_IRQ ))return 0 ; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return 0 ;if (dev->if_version <DRM_IF_VERSION (1 ,2 ) && ctl->irq !=drm_dev_to_irq (dev))
@@ -427,7 +427,7 @@ int drm_control(struct drm_device *dev, void *data,case DRM_UNINST_HANDLER :if (!drm_core_check_feature (dev,DRIVER_HAVE_IRQ ))return 0 ; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return 0 ;return drm_irq_uninstall (dev);default :
@@ -1048,7 +1048,7 @@ int drm_modeset_ctl(struct drm_device *dev, void *data,return 0 ;/* KMS drivers handle this internally */ -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return 0 ; crtc = modeset->crtc;
drivers/gpu/drm/drm_pci.c +6 -6
@@ -327,7 +327,7 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent, dev->hose = pdev->sysdata;#endif -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))pci_set_drvdata (pdev, dev);drm_pci_agp_init (dev);
@@ -342,7 +342,7 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,/* No locking needed since shadow-attach is single-threaded since it may * only be called from the per-driver module init hook. */ -if (!drm_core_check_feature (dev,DRIVER_MODESET )) +if (drm_core_check_feature (dev,DRIVER_LEGACY ))list_add_tail (&dev->legacy_dev_list, &driver->legacy_dev_list);return 0 ;
@@ -378,7 +378,7 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver) driver->kdriver.pci = pdriver; driver->bus = &drm_pci_bus; -if (driver->driver_features &DRIVER_MODESET ) +if ((driver->driver_features &DRIVER_LEGACY ) ==0 )return pci_register_driver (pdriver);/* If not using KMS, fall back to stealth mode manual scanning. */
@@ -463,14 +463,14 @@ void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver)struct drm_device *dev, *tmp;DRM_DEBUG ("\n" ); -if (driver->driver_features &DRIVER_MODESET ) { -pci_unregister_driver (pdriver); - }else { +if (driver->driver_features &DRIVER_LEGACY ) {list_for_each_entry_safe (dev, tmp, &driver->legacy_dev_list, legacy_dev_list) {drm_put_dev (dev);list_del (&dev->legacy_dev_list); } + }else { +pci_unregister_driver (pdriver); }DRM_INFO ("Module unloaded\n" ); }
drivers/gpu/drm/drm_scatter.c +3 -3
@@ -67,7 +67,7 @@ static void drm_sg_cleanup(struct drm_sg_mem * entry)void drm_legacy_sg_cleanup (struct drm_device *dev) {if (drm_core_check_feature (dev,DRIVER_SG ) && dev->sg && - !drm_core_check_feature (dev,DRIVER_MODESET )) { +drm_core_check_feature (dev,DRIVER_LEGACY )) {drm_sg_cleanup (dev->sg); dev->sg =NULL ; }
@@ -87,7 +87,7 @@ int drm_sg_alloc(struct drm_device *dev, void *data,DRM_DEBUG ("\n" ); -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return -EINVAL ;if (!drm_core_check_feature (dev,DRIVER_SG ))
@@ -200,7 +200,7 @@ int drm_sg_free(struct drm_device *dev, void *data,struct drm_scatter_gather *request = data;struct drm_sg_mem *entry; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return -EINVAL ;if (!drm_core_check_feature (dev,DRIVER_SG ))
drivers/gpu/drm/drm_sysfs.c +2 -2
@@ -44,7 +44,7 @@ static int __drm_class_suspend(struct device *dev, pm_message_t state)struct drm_device *drm_dev = drm_minor->dev;if (drm_minor->type ==DRM_MINOR_PRIMARY && - !drm_core_check_feature (drm_dev,DRIVER_MODESET ) && +drm_core_check_feature (drm_dev,DRIVER_LEGACY ) && drm_dev->driver->suspend)return drm_dev->driver->suspend (drm_dev, state); }
@@ -85,7 +85,7 @@ static int drm_class_resume(struct device *dev)struct drm_device *drm_dev = drm_minor->dev;if (drm_minor->type ==DRM_MINOR_PRIMARY && - !drm_core_check_feature (drm_dev,DRIVER_MODESET ) && +drm_core_check_feature (drm_dev,DRIVER_LEGACY ) && drm_dev->driver->resume)return drm_dev->driver->resume (drm_dev); }
drivers/gpu/drm/i915/i915_dma.c +19 -19
@@ -90,7 +90,7 @@ void i915_update_dri1_breadcrumb(struct drm_device *dev)* Instead of trying to fix this (this is by far not the only ums issue) * just don't do the update in kms mode. */ -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return ;if (dev->primary->master) {
@@ -145,7 +145,7 @@ void i915_kernel_lost_context(struct drm_device * dev)* We should never lose context on the ring with modesetting * as we don't expose it to userspace */ -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return ; ring->head =I915_READ_HEAD (ring) &HEAD_ADDR ;
@@ -267,7 +267,7 @@ static int i915_dma_init(struct drm_device *dev, void *data,drm_i915_init_t *init = data;int retcode =0 ; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return -ENODEV ;switch (init->func) {
@@ -610,7 +610,7 @@ static int i915_flush_ioctl(struct drm_device *dev, void *data, {int ret; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return -ENODEV ;RING_LOCK_TEST_WITH_RETURN (dev, file_priv);
@@ -632,7 +632,7 @@ static int i915_batchbuffer(struct drm_device *dev, void *data,int ret;struct drm_clip_rect *cliprects =NULL ; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return -ENODEV ; master_priv = dev->primary->master->driver_priv;
@@ -694,7 +694,7 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,DRM_DEBUG_DRIVER ("i915 cmdbuffer, buf %p sz %d cliprects %d\n" , cmdbuf->buf, cmdbuf->sz, cmdbuf->num_cliprects); -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return -ENODEV ; master_priv = dev->primary->master->driver_priv;
@@ -820,7 +820,7 @@ static int i915_irq_emit(struct drm_device *dev, void *data,drm_i915_irq_emit_t *emit = data;int result; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return -ENODEV ;if (!dev_priv || !LP_RING (dev_priv)->virtual_start) {
@@ -850,7 +850,7 @@ static int i915_irq_wait(struct drm_device *dev, void *data,drm_i915_private_t *dev_priv = dev->dev_private;drm_i915_irq_wait_t *irqwait = data; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return -ENODEV ;if (!dev_priv) {
@@ -867,7 +867,7 @@ static int i915_vblank_pipe_get(struct drm_device *dev, void *data,drm_i915_private_t *dev_priv = dev->dev_private;drm_i915_vblank_pipe_t *pipe = data; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return -ENODEV ;if (!dev_priv) {
@@ -908,7 +908,7 @@ static int i915_flip_bufs(struct drm_device *dev, void *data, {int ret; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return -ENODEV ;DRM_DEBUG_DRIVER ("%s\n" , __func__);
@@ -1072,7 +1072,7 @@ static int i915_set_status_page(struct drm_device *dev, void *data,drm_i915_hws_addr_t *hws = data;struct intel_ring_buffer *ring; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return -ENODEV ;if (!I915_NEED_GFX_HWS (dev))
@@ -1083,7 +1083,7 @@ static int i915_set_status_page(struct drm_device *dev, void *data,return -EINVAL ; } -if (drm_core_check_feature (dev,DRIVER_MODESET )) { +if (!drm_core_check_feature (dev,DRIVER_LEGACY )) {WARN (1 ,"tried to set status page when mode setting active\n" );return 0 ; }
@@ -1536,14 +1536,14 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) info = (struct intel_device_info *) flags;/* Refuse to load on gen6+ without kms enabled. */ -if (info->gen >=6 && !drm_core_check_feature (dev,DRIVER_MODESET )) { +if (info->gen >=6 &&drm_core_check_feature (dev,DRIVER_LEGACY )) {DRM_INFO ("Your hardware requires kernel modesetting (KMS)\n" );DRM_INFO ("See CONFIG_DRM_I915_KMS, nomodeset, and i915.modeset parameters\n" );return -ENODEV ; }/* UMS needs agp support. */ -if (!drm_core_check_feature (dev,DRIVER_MODESET ) && !dev->agp) +if (drm_core_check_feature (dev,DRIVER_LEGACY ) && !dev->agp)return -EINVAL ; dev_priv =kzalloc (sizeof (*dev_priv),GFP_KERNEL );
@@ -1615,7 +1615,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)if (ret) goto out_regs; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))i915_kick_out_firmware_fb (dev_priv);pci_set_master (dev->pdev);
@@ -1704,7 +1704,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)intel_power_domains_init (dev); -if (drm_core_check_feature (dev,DRIVER_MODESET )) { +if (!drm_core_check_feature (dev,DRIVER_LEGACY )) { ret =i915_load_modeset_init (dev);if (ret <0 ) {DRM_ERROR ("failed to init modeset\n" );
@@ -1794,7 +1794,7 @@ int i915_driver_unload(struct drm_device *dev)acpi_video_unregister (); -if (drm_core_check_feature (dev,DRIVER_MODESET )) { +if (!drm_core_check_feature (dev,DRIVER_LEGACY )) {intel_fbdev_fini (dev);intel_modeset_cleanup (dev);cancel_work_sync (&dev_priv->console_resume_work);
@@ -1825,7 +1825,7 @@ int i915_driver_unload(struct drm_device *dev)intel_opregion_fini (dev); -if (drm_core_check_feature (dev,DRIVER_MODESET )) { +if (!drm_core_check_feature (dev,DRIVER_LEGACY )) {/* Flush any outstanding unpin_work. */ flush_workqueue (dev_priv->wq);
@@ -1900,7 +1900,7 @@ void i915_driver_lastclose(struct drm_device * dev)if (!dev_priv)return ; -if (drm_core_check_feature (dev,DRIVER_MODESET )) { +if (!drm_core_check_feature (dev,DRIVER_LEGACY )) {intel_fbdev_restore_mode (dev);vga_switcheroo_process_delayed_switch ();return ;
drivers/gpu/drm/i915/i915_drv.c +5 -5
@@ -549,7 +549,7 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings)intel_uncore_sanitize (dev); -if (drm_core_check_feature (dev,DRIVER_MODESET ) && +if (!drm_core_check_feature (dev,DRIVER_LEGACY ) && restore_gtt_mappings) {mutex_lock (&dev->struct_mutex);i915_gem_restore_gtt_mappings (dev);
@@ -620,7 +620,7 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings)static int i915_drm_thaw (struct drm_device *dev) { -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))i915_check_and_clear_faults (dev);return __i915_drm_thaw (dev, true);
@@ -715,7 +715,7 @@ int i915_reset(struct drm_device *dev)* was running at the time of the reset (i.e. we weren't VT * switched away). */ -if (drm_core_check_feature (dev,DRIVER_MODESET ) || +if (!drm_core_check_feature (dev,DRIVER_LEGACY ) || !dev_priv->ums.mm_suspended) { dev_priv->ums.mm_suspended =0 ;
@@ -1000,7 +1000,7 @@ static int __init i915_init(void) }#endif -if (!(driver.driver_features &DRIVER_MODESET )) { +if (driver.driver_features &DRIVER_LEGACY ) { driver.get_vblank_timestamp =NULL ;#ifndef CONFIG_DRM_I915_UMS /* Silently fail loading to not upset userspace. */
@@ -1014,7 +1014,7 @@ static int __init i915_init(void) static void __exit i915_exit(void) {#ifndef CONFIG_DRM_I915_UMS -if (!(driver.driver_features &DRIVER_MODESET )) +if (driver.driver_features &DRIVER_LEGACY )return ;/* Never loaded a driver. */ #endif
drivers/gpu/drm/i915/i915_gem.c +8 -9
@@ -166,7 +166,7 @@ i915_gem_init_ioctl(struct drm_device *dev, void *data,struct drm_i915_private *dev_priv = dev->dev_private;struct drm_i915_gem_init *args = data; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return -ENODEV ; if (args->gtt_start >= args->gtt_end ||
@@ -4234,7 +4234,7 @@ i915_gem_suspend(struct drm_device *dev)i915_gem_retire_requests (dev);/* Under UMS, be paranoid and evict. */ -if (!drm_core_check_feature (dev,DRIVER_MODESET )) +if (drm_core_check_feature (dev,DRIVER_LEGACY ))i915_gem_evict_everything (dev);i915_kernel_lost_context (dev);
@@ -4244,8 +4244,7 @@ i915_gem_suspend(struct drm_device *dev)* We need to replace this with a semaphore, or something. * And not confound ums.mm_suspended! */ - dev_priv->ums.mm_suspended = !drm_core_check_feature (dev, -DRIVER_MODESET ); + dev_priv->ums.mm_suspended =drm_core_check_feature (dev,DRIVER_LEGACY );mutex_unlock (&dev->struct_mutex);del_timer_sync (&dev_priv->gpu_error.hangcheck_timer);
@@ -4466,7 +4465,7 @@ int i915_gem_init(struct drm_device *dev) }/* Allow hardware batchbuffers unless told otherwise, but not for KMS. */ -if (!drm_core_check_feature (dev,DRIVER_MODESET )) +if (drm_core_check_feature (dev,DRIVER_LEGACY )) dev_priv->dri1.allow_batchbuffer =1 ;return 0 ; }
@@ -4489,7 +4488,7 @@ i915_gem_entervt_ioctl(struct drm_device *dev, void *data,struct drm_i915_private *dev_priv = dev->dev_private;int ret; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return 0 ;if (i915_reset_in_progress (&dev_priv->gpu_error)) {
@@ -4528,7 +4527,7 @@ int i915_gem_leavevt_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { - if (drm_core_check_feature(dev, DRIVER_MODESET)) + if (!drm_core_check_feature(dev, DRIVER_LEGACY)) return 0; drm_irq_uninstall(dev);
@@ -4541,7 +4540,7 @@ i915_gem_lastclose(struct drm_device *dev) {int ret; -if (drm_core_check_feature (dev,DRIVER_MODESET )) +if (!drm_core_check_feature (dev,DRIVER_LEGACY ))return ; ret =i915_gem_suspend (dev);
@@ -4606,7 +4605,7 @@ i915_gem_load(struct drm_device *dev) dev_priv->relative_constants_mode =I915_EXEC_CONSTANTS_REL_GENERAL ;/* Old X drivers will take 0-2 for front, back, depth buffers */ -if (!drm_core_check_feature (dev,DRIVER_MODESET )) +if (drm_core_check_feature (dev,DRIVER_LEGACY )) dev_priv->fence_reg_start =3 ;if (INTEL_INFO (dev)->gen >=7 && !IS_VALLEYVIEW (dev))
drivers/gpu/drm/i915/i915_irq.c +3 -3
@@ -614,7 +614,7 @@ i915_pipe_enabled(struct drm_device *dev, int pipe) {drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; -if (drm_core_check_feature (dev,DRIVER_MODESET )) { +if (!drm_core_check_feature (dev,DRIVER_LEGACY )) {/* Locking is horribly broken here, but whatever. */ struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];struct intel_crtc *intel_crtc =to_intel_crtc (crtc);
@@ -647,7 +647,7 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, int pipe)return 0 ; } -if (drm_core_check_feature (dev,DRIVER_MODESET )) { +if (!drm_core_check_feature (dev,DRIVER_LEGACY )) {struct intel_crtc *intel_crtc =to_intel_crtc (dev_priv->pipe_to_crtc_mapping[pipe]); const struct drm_display_mode *mode =
@@ -3936,7 +3936,7 @@ void intel_irq_init(struct drm_device *dev) dev->max_vblank_count =0xffffff ;/* only 24 bits of frame count */ } -if (drm_core_check_feature (dev,DRIVER_MODESET )) { +if (!drm_core_check_feature (dev,DRIVER_LEGACY )) { dev->driver->get_vblank_timestamp = i915_get_vblank_timestamp; dev->driver->get_scanout_position = i915_get_crtc_scanoutpos; }
drivers/gpu/drm/i915/i915_suspend.c +7 -8
@@ -199,7 +199,7 @@ static void i915_save_display(struct drm_device *dev)/* This is only meaningful in non-KMS mode */ /* Don't regfile.save them in KMS mode */ -if (!drm_core_check_feature (dev,DRIVER_MODESET )) +if (drm_core_check_feature (dev,DRIVER_LEGACY ))i915_save_display_reg (dev);/* LVDS state */
@@ -240,7 +240,7 @@ static void i915_save_display(struct drm_device *dev)if (HAS_FBC (dev) &&INTEL_INFO (dev)->gen <=4 && !IS_G4X (dev)) dev_priv->regfile.saveFBC_CONTROL =I915_READ (FBC_CONTROL ); -if (!drm_core_check_feature (dev,DRIVER_MODESET )) +if (drm_core_check_feature (dev,DRIVER_LEGACY ))i915_save_vga (dev); }
@@ -253,10 +253,9 @@ static void i915_restore_display(struct drm_device *dev)if (INTEL_INFO (dev)->gen <=4 )I915_WRITE (DSPARB , dev_priv->regfile.saveDSPARB); -if (!drm_core_check_feature (dev,DRIVER_MODESET )) +if (drm_core_check_feature (dev,DRIVER_LEGACY ))i915_restore_display_reg (dev); - -if (drm_core_check_feature (dev,DRIVER_MODESET )) +else mask = ~LVDS_PORT_EN ;if (HAS_PCH_IBX (dev) ||HAS_PCH_CPT (dev))
@@ -295,7 +294,7 @@ static void i915_restore_display(struct drm_device *dev)if (HAS_FBC (dev) &&INTEL_INFO (dev)->gen <=4 && !IS_G4X (dev))I915_WRITE (FBC_CONTROL , dev_priv->regfile.saveFBC_CONTROL); -if (!drm_core_check_feature (dev,DRIVER_MODESET )) +if (drm_core_check_feature (dev,DRIVER_LEGACY ))i915_restore_vga (dev);else i915_redisable_vga (dev);
@@ -310,7 +309,7 @@ int i915_save_state(struct drm_device *dev)i915_save_display (dev); -if (!drm_core_check_feature (dev,DRIVER_MODESET )) { +if (drm_core_check_feature (dev,DRIVER_LEGACY )) {/* Interrupt state */ if (HAS_PCH_SPLIT (dev)) { dev_priv->regfile.saveDEIER =I915_READ (DEIER );
@@ -360,7 +359,7 @@ int i915_restore_state(struct drm_device *dev)i915_gem_restore_fences (dev);i915_restore_display (dev); -if (!drm_core_check_feature (dev,DRIVER_MODESET )) { +if (drm_core_check_feature (dev,DRIVER_LEGACY )) {/* Interrupt state */ if (HAS_PCH_SPLIT (dev)) {I915_WRITE (DEIER , dev_priv->regfile.saveDEIER);
drivers/gpu/drm/i915/intel_ringbuffer.c +1 -1
@@ -499,7 +499,7 @@ static int init_ring_common(struct intel_ring_buffer *ring) goto out; } -if (!drm_core_check_feature (ring->dev,DRIVER_MODESET )) +if (drm_core_check_feature (ring->dev,DRIVER_LEGACY ))i915_kernel_lost_context (ring->dev);else { ring->head =I915_READ_HEAD (ring);
Signature · 1 line
1.8.4.2
RFC 5/12 drm: Create primary minor only if mode-setting is supported
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Non-legacy devices may not always support mode-setting functionality, so create the primary minor conditionally.
One setup where this happens is the Tegra K1, where the Tegra DRM driver exposes the display engine via standard KMS IOCTLs, and nouveau drives the Kepler-type GPU that has no display capabilities.
--- drivers/gpu/drm/drm_stub.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_stub.c +5 -3
@@ -564,9 +564,11 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver, goto err_minors; } - ret =drm_minor_alloc (dev,DRM_MINOR_PRIMARY ); -if (ret) - goto err_minors; +if (drm_core_check_feature (dev,DRIVER_MODESET )) { + ret =drm_minor_alloc (dev,DRM_MINOR_PRIMARY ); +if (ret) + goto err_minors; + }if (drm_ht_create (&dev->map_hash,12 )) goto err_minors;
Signature · 1 line
1.8.4.2
Re: [RFC 05/12] drm: Create primary minor only if mode-setting is supported
Hi
Quoted 20 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Non-legacy devices may not always support mode-setting functionality, so create the primary minor conditionally.
One setup where this happens is the Tegra K1, where the Tegra DRM driver exposes the display engine via standard KMS IOCTLs, and nouveau drives the Kepler-type GPU that has no display capabilities.
Signed-off-by Thierry Reding <[email protected]>--- drivers/gpu/drm/drm_stub.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_stub.c +0
-0@@ -564,9 +564,11 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver, goto err_minors;
drivers/gpu/drm/drm_stub.c struct drm_device *drm_dev_alloc(struct drm_driver *driver, · line 571
Quoted 10 lines
drivers/gpu/drm/drm_stub.c +5
-3} - ret =drm_minor_alloc (dev,DRM_MINOR_PRIMARY ); -if (ret) - goto err_minors; +if (drm_core_check_feature (dev,DRIVER_MODESET )) { + ret =drm_minor_alloc (dev,DRM_MINOR_PRIMARY ); +if (ret) + goto err_minors; + }
There's a lot of code accessing dev->primary for debug messages (to print stuff like "error on card0: bla"). I just want to make sure you checked for all that. I tried renaming "->primary" to "->primary2" locally just to find these and I doubt this is safe for most drivers. I haven't looked for nouveau in particular, though. Anyhow, the patch is the right thing to do.
Thanks
David
Quoted 6 lines
drivers/gpu/drm/drm_stub.c +0
-1if (drm_ht_create (&dev->map_hash,12 )) goto err_minors; --1.8.4.2
Re: [RFC 05/12] drm: Create primary minor only if mode-setting is supported
Quoted 26 lines · David Herrmann
Hi
Quoted 22 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Non-legacy devices may not always support mode-setting functionality, so create the primary minor conditionally.
One setup where this happens is the Tegra K1, where the Tegra DRM driver exposes the display engine via standard KMS IOCTLs, and nouveau drives the Kepler-type GPU that has no display capabilities.
Signed-off-by Thierry Reding <[email protected]>--- drivers/gpu/drm/drm_stub.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_stub.c +0
-0@@ -564,9 +564,11 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver, goto err_minors; }
Quoted 15 lines
drivers/gpu/drm/drm_stub.c struct drm_device *drm_dev_alloc(struct drm_driver *driver, · line 571
Quoted 8 lines
drivers/gpu/drm/drm_stub.c +5
-3- ret =drm_minor_alloc (dev,DRM_MINOR_PRIMARY ); -if (ret) - goto err_minors; +if (drm_core_check_feature (dev,DRIVER_MODESET )) { + ret =drm_minor_alloc (dev,DRM_MINOR_PRIMARY ); +if (ret) + goto err_minors; + }There's a lot of code accessing
dev->primaryfor debug messages (to print stuff like "error on card0: bla"). I just want to make sure you checked for all that. I tried renaming "->primary" to "->primary2" locally just to find these and I doubt this is safe for most drivers. I haven't looked for nouveau in particular, though. Anyhow, the patch is the right thing to do.
I've looked into this a little more to find out where the drm_device's .primary field is used, with the following results:
1) DRM core:
- drm_bufs.c: Used in drm_find_matching_map() and drm_addmap_core(). This code is exclusively used by drivers that advertise the LEGACY feature as far as I can tell. So these would be candidates where not allocating the primary minor will cause problems. But I don't understanding of the legacy code paths well enough to propose a solution that could be applied here.
- drm_fb_helper.c: This is only used by drivers advertising the MODESET feature, so shouldn't be an issue.
- drm_stub.c: All accesses to the primary minor are protected by a check for the MODESET feature.
- drm_sysfs.c: Used primarily for hotplug events, which from what I can tell are MODESET only.
One oddity here is the __drm_class_suspend() function, which checks for:
46 if (drm_minor->type == DRM_MINOR_PRIMARY &&
47 drm_core_check_feature(drm_dev, DRIVER_LEGACY) &&
48 drm_dev->driver->suspend)
Which is somewhat confusing to me. drm_class_resume() performs the same check.
2) DRM drivers:
- armada, ast, bochs, cirrus, exynos, i810, imx-drm, mga, mgag200, msm, nouveau, omapdrm, r128, rcar-du, savage, shmobile, sis, tdfx, tildc, udl, via and vmwgfx don't use the primary directly at all.
- i915:
- i915_dma.c and i915_irq.c protect all accesses to the primary minor with LEGACY feature checks
- intel_display.c: uses it for SAREA code, but I think that's scheduled to be removed (I do remember some discussion about this on IRC not so long ago). Adding Daniel on Cc, maybe he knows more about this.
- intel_ringbuffer.c: This seems to be SAREA related as well.
- i915_sysfs.c: sysfs code is used by both legacy and non-legacy drivers, so this could be problematic.
- qxl: Uses the primary minor for debugfs support, but the driver is unconditonally MODESET so it shouldn't be an issue.
- radeon: Uses the primary minor for debugfs support but all paths that initialize debugfs support are conditionally MODESET.
- tegra: Uses the primary minor for debugfs support, but the driver is unconditionally MODESET so it shouldn't be an issue.
One pretty common pattern, even though it shouldn't be problematic, is how drivers use the primary minor for debugfs support. That means that if the primary minor weren't registered, there'd be no place for these drivers to put their debugfs files. In all the above cases, the driver uses debugfs only for things that are modesetting related, so I guess there isn't an immediate problem.
Interestingly nouveau seems to side-step this issue entirely by simply setting up debugfs for every minor. For other drivers it seems like the solution wouldn't be as easy, since there are many more files in debugfs and they can come from subdevices as well.
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC 6/12 drm: Remove gratuituous blank line
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
--- drivers/gpu/drm/drm_crtc.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_crtc.c +0 -1
@@ -1426,7 +1426,6 @@ int drm_mode_getresources(struct drm_device *dev, void *data,if (!drm_core_check_feature (dev,DRIVER_MODESET ))return -EINVAL ; -mutex_lock (&file_priv->fbs_lock);/* * For the non-control nodes we need to limit the list of resources
Signature · 1 line
1.8.4.2
RFC 7/12 drm: Use drm_core_check_feature() where possible
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Wherever possible, use drm_core_check_feature() for consistency.
--- drivers/gpu/drm/drm_fops.c | 8 ++++---- drivers/gpu/drm/drm_gem.c | 6 +++--- drivers/gpu/drm/drm_stub.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_gem.c | 4 ++-- drivers/gpu/drm/gma500/gem.c | 2 +- drivers/gpu/drm/i915/i915_gem_context.c | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-)
drivers/gpu/drm/drm_fops.c +4 -4
@@ -242,7 +242,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp,init_waitqueue_head (&priv->event_wait); priv->event_space =4096 ;/* set aside 4k for event buffer */ -if (dev->driver->driver_features &DRIVER_GEM ) +if (drm_core_check_feature (dev,DRIVER_GEM ))drm_gem_open (dev, priv);if (drm_core_check_feature (dev,DRIVER_PRIME ))
@@ -333,7 +333,7 @@ out_close: out_prime_destroy:if (drm_core_check_feature (dev,DRIVER_PRIME ))drm_prime_destroy_file_private (&priv->prime); -if (dev->driver->driver_features &DRIVER_GEM ) +if (drm_core_check_feature (dev,DRIVER_GEM ))drm_gem_release (dev, priv);put_pid (priv->pid);kfree (priv);
@@ -490,10 +490,10 @@ int drm_release(struct inode *inode, struct file *filp)drm_events_release (file_priv); -if (dev->driver->driver_features &DRIVER_MODESET ) +if (drm_core_check_feature (dev,DRIVER_MODESET ))drm_fb_release (file_priv); -if (dev->driver->driver_features &DRIVER_GEM ) +if (drm_core_check_feature (dev,DRIVER_GEM ))drm_gem_release (dev, file_priv);mutex_lock (&dev->ctxlist_mutex);
drivers/gpu/drm/drm_gem.c +3 -3
@@ -545,7 +545,7 @@ drm_gem_close_ioctl(struct drm_device *dev, void *data,struct drm_gem_close *args = data;int ret; -if (!(dev->driver->driver_features &DRIVER_GEM )) +if (!drm_core_check_feature (dev,DRIVER_GEM ))return -ENODEV ; ret =drm_gem_handle_delete (file_priv, args->handle);
@@ -567,7 +567,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,struct drm_gem_object *obj;int ret; -if (!(dev->driver->driver_features &DRIVER_GEM )) +if (!drm_core_check_feature (dev,DRIVER_GEM ))return -ENODEV ; obj =drm_gem_object_lookup (dev, file_priv, args->handle);
@@ -615,7 +615,7 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,int ret;u32 handle; -if (!(dev->driver->driver_features &DRIVER_GEM )) +if (!drm_core_check_feature (dev,DRIVER_GEM ))return -ENODEV ;mutex_lock (&dev->object_name_lock);
drivers/gpu/drm/drm_stub.c +1 -1
@@ -614,7 +614,7 @@ EXPORT_SYMBOL(drm_dev_alloc);*/ static void drm_dev_free (struct drm_device *dev) { -if (dev->driver->driver_features &DRIVER_GEM ) +if (drm_core_check_feature (dev,DRIVER_GEM ))drm_gem_destroy (dev);drm_ctxbitmap_cleanup (dev);
drivers/gpu/drm/exynos/exynos_drm_gem.c +2 -2
@@ -329,7 +329,7 @@ int exynos_drm_gem_map_offset_ioctl(struct drm_device *dev, void *data,DRM_DEBUG_KMS ("handle = 0x%x, offset = 0x%lx\n" , args->handle, (unsigned long )args->offset); -if (!(dev->driver->driver_features &DRIVER_GEM )) { +if (!drm_core_check_feature (dev,DRIVER_GEM )) {DRM_ERROR ("does not support GEM.\n" );return -ENODEV ; }
@@ -396,7 +396,7 @@ int exynos_drm_gem_mmap_ioctl(struct drm_device *dev, void *data,struct file *anon_filp;unsigned long addr; -if (!(dev->driver->driver_features &DRIVER_GEM )) { +if (!drm_core_check_feature (dev,DRIVER_GEM )) {DRM_ERROR ("does not support GEM.\n" );return -ENODEV ; }
drivers/gpu/drm/gma500/gem.c +1 -1
@@ -62,7 +62,7 @@ int psb_gem_dumb_map_gtt(struct drm_file *file, struct drm_device *dev,int ret =0 ;struct drm_gem_object *obj; -if (!(dev->driver->driver_features &DRIVER_GEM )) +if (!drm_core_check_feature (dev,DRIVER_GEM ))return -ENODEV ;mutex_lock (&dev->struct_mutex);
drivers/gpu/drm/i915/i915_gem_context.c +2 -2
@@ -746,7 +746,7 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,struct i915_hw_context *ctx;int ret; -if (!(dev->driver->driver_features &DRIVER_GEM )) +if (!drm_core_check_feature (dev,DRIVER_GEM ))return -ENODEV ;if (!HAS_HW_CONTEXTS (dev))
@@ -775,7 +775,7 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,struct i915_hw_context *ctx;int ret; -if (!(dev->driver->driver_features &DRIVER_GEM )) +if (!drm_core_check_feature (dev,DRIVER_GEM ))return -ENODEV ;if (args->ctx_id ==DEFAULT_CONTEXT_ID )
Signature · 1 line
1.8.4.2
RFC 8/12 drm/exynos: Remove dead code
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
The Exynos driver always sets DRIVER_GEM, so testing for the absence of the feature will always fail.
--- drivers/gpu/drm/exynos/exynos_drm_gem.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_gem.c +0 -10
@@ -329,11 +329,6 @@ int exynos_drm_gem_map_offset_ioctl(struct drm_device *dev, void *data,DRM_DEBUG_KMS ("handle = 0x%x, offset = 0x%lx\n" , args->handle, (unsigned long )args->offset); -if (!drm_core_check_feature (dev,DRIVER_GEM )) { -DRM_ERROR ("does not support GEM.\n" ); -return -ENODEV ; - } -return exynos_drm_gem_dumb_map_offset (file_priv, dev, args->handle, &args->offset); }
@@ -396,11 +391,6 @@ int exynos_drm_gem_mmap_ioctl(struct drm_device *dev, void *data,struct file *anon_filp;unsigned long addr; -if (!drm_core_check_feature (dev,DRIVER_GEM )) { -DRM_ERROR ("does not support GEM.\n" ); -return -ENODEV ; - } -mutex_lock (&dev->struct_mutex); obj =drm_gem_object_lookup (dev, file_priv, args->handle);
Signature · 1 line
1.8.4.2
RFC 9/12 drm/gma500: Remove dead code
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
The gma500 driver sets DRIVER_GEM unconditionally, so testing for the absence of the feature will always fail.
--- drivers/gpu/drm/gma500/gem.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/gma500/gem.c +0 -3
@@ -62,9 +62,6 @@ int psb_gem_dumb_map_gtt(struct drm_file *file, struct drm_device *dev,int ret =0 ;struct drm_gem_object *obj; -if (!drm_core_check_feature (dev,DRIVER_GEM )) -return -ENODEV ; -mutex_lock (&dev->struct_mutex);/* GEM does all our handle to object mapping */
Signature · 1 line
1.8.4.2
Re: [RFC 09/12] drm/gma500: Remove dead code
Quoted 6 lines · Thierry Reding
From: Thierry Reding <[email protected]>
The gma500 driver sets
DRIVER_GEMunconditionally, so testing for the absence of the feature will always fail.Signed-off-by Thierry Reding <[email protected]>
Queued for -next
Thanks
Patrik
Quoted 25 lines
--- drivers/gpu/drm/gma500/gem.c | 3 --- 1 file changed, 3 deletions(-)drivers/gpu/drm/gma500/gem.c +0
-4@@ -62,9 +62,6 @@ int psb_gem_dumb_map_gtt(struct drm_file *file, struct drm_device *dev,int ret =0 ;struct drm_gem_object *obj; -if (!drm_core_check_feature (dev,DRIVER_GEM )) -return -ENODEV ; -mutex_lock (&dev->struct_mutex);/* GEM does all our handle to object mapping */ --1.8.4.2
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC 10/12 drm/i810: Remove dead code
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
The i810 driver never sets DRIVER_HAVE_IRQ, so testing for the presence of the feature will always fail.
--- drivers/gpu/drm/i810/i810_dma.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/gpu/drm/i810/i810_dma.c +0 -7
@@ -200,13 +200,6 @@ static int i810_dma_cleanup(struct drm_device *dev) {struct drm_device_dma *dma = dev->dma; -/* Make sure interrupts are disabled here because the uninstall ioctl -* may not have been called from userspace and after dev_private -* is freed, it's too late. -*/ -if (drm_core_check_feature (dev,DRIVER_HAVE_IRQ ) && dev->irq_enabled) -drm_irq_uninstall (dev); -if (dev->dev_private) {int i; drm_i810_private_t *dev_priv =
Signature · 1 line
1.8.4.2
RFC 11/12 drm/i915: Remove dead code
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
The i915 driver sets DRIVER_GEM unconditionally, so testing for the feature will always fail.
--- drivers/gpu/drm/i915/i915_gem_context.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/gpu/drm/i915/i915_gem_context.c +0 -6
@@ -746,9 +746,6 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,struct i915_hw_context *ctx;int ret; -if (!drm_core_check_feature (dev,DRIVER_GEM )) -return -ENODEV ; -if (!HAS_HW_CONTEXTS (dev))return -ENODEV ;
@@ -775,9 +772,6 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,struct i915_hw_context *ctx;int ret; -if (!drm_core_check_feature (dev,DRIVER_GEM )) -return -ENODEV ; -if (args->ctx_id ==DEFAULT_CONTEXT_ID )return -ENOENT ;
Signature · 1 line
1.8.4.2
Daniel Vetter
AppliedRe: [RFC 11/12] drm/i915: Remove dead code
Quoted 6 lines · Thierry Reding
From: Thierry Reding <[email protected]>
The i915 driver sets
DRIVER_GEMunconditionally, so testing for the feature will always fail.Signed-off-by Thierry Reding <[email protected]>
Queued for -next, thanks for the patch.
-Daniel
Quoted 35 lines
--- drivers/gpu/drm/i915/i915_gem_context.c | 6 ------ 1 file changed, 6 deletions(-)drivers/gpu/drm/i915/i915_gem_context.c +0
-6@@ -746,9 +746,6 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,struct i915_hw_context *ctx;int ret; -if (!drm_core_check_feature (dev,DRIVER_GEM )) -return -ENODEV ; -if (!HAS_HW_CONTEXTS (dev))return -ENODEV ;@@ -775,9 +772,6 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,struct i915_hw_context *ctx;int ret; -if (!drm_core_check_feature (dev,DRIVER_GEM )) -return -ENODEV ; -if (args->ctx_id ==DEFAULT_CONTEXT_ID )return -ENOENT ;Signature · 6 lines
1.8.4.2 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
RFC 12/12 drm/qxl: Remove dead code
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
The QXL driver sets DRIVER_MODESET unconditionally, so testing for the absence of the feature will always fail.
--- drivers/gpu/drm/qxl/qxl_kms.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/qxl/qxl_kms.c +0 -4
@@ -310,10 +310,6 @@ int qxl_driver_load(struct drm_device *dev, unsigned long flags)struct qxl_device *qdev;int r; -/* require kms */ -if (!drm_core_check_feature (dev,DRIVER_MODESET )) -return -ENODEV ; - qdev =kzalloc (sizeof (struct qxl_device ),GFP_KERNEL );if (qdev ==NULL )return -ENOMEM ;
Signature · 1 line
1.8.4.2
Hi
Quoted 25 lines · Thierry Reding
From: Thierry Reding <[email protected]>
This series builds on top of David's reliable DRM minor series:
[PATCH 00/13] DRM Reliable Minor-IDs
Tegra K1 has a Kepler-type GPU without any display engine. Instead it reuses the Tegra display engine. That means that effectively the GPU becomes a render-node only device. In order to reflect that, it would be preferable for the associated
/dev/dri/cardXnode not to show up.To achieve that, the
DRIVER_MODESETfeature needs to be removed from the GPU driver, but that unfortunately implies activating a bunch of legacy behaviour for pre-KMS drivers. To allow for drivers that don't support modesetting IOCTLs (because they drive no output) but which aren't legacy either, the meaning of theDRIVER_MODESETneeds to be redefined.This series attempts to do so by first renaming
DRM_MINOR_LEGACYtoDRM_MINOR_PRIMARYto more accurately reflect its purpose. Legacy and modesetting are then decoupled by introducing aDRIVER_LEGACYdriver feature that can be set by truly legacy drivers. This allows the oldDRIVER_MODESETfeature to advertise support only for modesetting functionality, without implying that it is a non-legacy driver.
Quoted 5 lines
After all the drivers have been updated, the core can be modified to create the primary minor only when
DRIVER_MODESETis available.The remainder of the series cleans up some
drm_core_check_feature()usage and drop some unused code related to that.
The series looks fine to me. Apart from "drm: Separate DRIVER_MODESET and DRIVER_LEGACY" (and with Ilja's comment on 04/12):
Regarding the DRIVER_ flag splitting, I haven't really checked whether you caught all places. The patch looks correct, though. I might have some time this week for a closer look.
Thanks
David
Quoted 50 lines
Thierry
Thierry Reding (12):
drm: RenameDRM_MINOR_LEGACYtoDRM_MINOR_PRIMARY
drm: IntroduceDRIVER_LEGACYfeature
drm/i915: Mark as legacy if KMS is disabled
drm: SeparateDRIVER_MODESETandDRIVER_LEGACY
drm: Create primary minor only if mode-setting is supported
drm: Remove gratuituous blank line
drm: Usedrm_core_check_feature()where possible drm/exynos: Remove dead code
drm/gma500: Remove dead code
drm/i810: Remove dead code
drm/i915: Remove dead code
drm/qxl: Remove dead codedrivers/gpu/drm/drm_bufs.c | 12 +++++------ drivers/gpu/drm/drm_crtc.c | 1 - drivers/gpu/drm/drm_dma.c | 4 ++-- drivers/gpu/drm/drm_fops.c | 14 ++++++------ drivers/gpu/drm/drm_gem.c | 6 +++--- drivers/gpu/drm/drm_irq.c | 12 +++++------ drivers/gpu/drm/drm_pci.c | 12 +++++------ drivers/gpu/drm/drm_scatter.c | 6 +++--- drivers/gpu/drm/drm_stub.c | 24 +++++++++++---------- drivers/gpu/drm/drm_sysfs.c | 8 +++---- drivers/gpu/drm/exynos/exynos_drm_gem.c | 10 --------- drivers/gpu/drm/gma500/gem.c | 3 --- drivers/gpu/drm/i810/i810_dma.c | 7 ------ drivers/gpu/drm/i810/i810_drv.c | 3 ++- drivers/gpu/drm/i915/i915_dma.c | 38 ++++++++++++++++----------------- drivers/gpu/drm/i915/i915_drv.c | 18 ++++++++++------ drivers/gpu/drm/i915/i915_gem.c | 17 +++++++-------- drivers/gpu/drm/i915/i915_gem_context.c | 6 ------ drivers/gpu/drm/i915/i915_irq.c | 6 +++--- drivers/gpu/drm/i915/i915_suspend.c | 15 ++++++------- drivers/gpu/drm/i915/intel_ringbuffer.c | 2 +- drivers/gpu/drm/mga/mga_drv.c | 3 ++- drivers/gpu/drm/qxl/qxl_kms.c | 4 ---- drivers/gpu/drm/radeon/radeon_drv.c | 3 ++- drivers/gpu/drm/savage/savage_drv.c | 2 +- drivers/gpu/drm/sis/sis_drv.c | 2 +- drivers/gpu/drm/tdfx/tdfx_drv.c | 1 + drivers/gpu/drm/via/via_drv.c | 2 +- include/drm/drmP.h | 3 ++- 29 files changed, 112 insertions(+), 132 deletions(-)--
1.8.4.2
Quoted 10 lines · Thierry Reding
From: Thierry Reding <[email protected]>
This series builds on top of David's reliable DRM minor series:
[PATCH 00/13] DRM Reliable Minor-IDs
Tegra K1 has a Kepler-type GPU without any display engine. Instead it reuses the Tegra display engine. That means that effectively the GPU becomes a render-node only device. In order to reflect that, it would be preferable for the associated
/dev/dri/cardXnode not to show up.
Why would it be preferable exactly?
- There's not really a security risk if we have it around as long as you sufficiently lock down access rights to it.
- Older userspace would still need the legacy node for e.g. X prime support using just dri2.
i915 (and iirc also radeon) can run on hw without any outputs, and simply not registering any crtcs or other modeset objects is all that's needed really. Of course userspace could still create kms framebuffer objects, but those don't really hurt anyone.
Quoted 7 lines
To achieve that, the
DRIVER_MODESETfeature needs to be removed from the GPU driver, but that unfortunately implies activating a bunch of legacy behaviour for pre-KMS drivers. To allow for drivers that don't support modesetting IOCTLs (because they drive no output) but which aren't legacy either, the meaning of theDRIVER_MODESETneeds to be redefined.
Quoted 6 lines
This series attempts to do so by first renaming
DRM_MINOR_LEGACYtoDRM_MINOR_PRIMARYto more accurately reflect its purpose. Legacy and modesetting are then decoupled by introducing aDRIVER_LEGACYdriver feature that can be set by truly legacy drivers. This allows the oldDRIVER_MODESETfeature to advertise support only for modesetting functionality, without implying that it is a non-legacy driver.
I haven't done a full review but the crux with a catch-all DRIVER_LEGACY is that there's shocking amounts of userspace out there which require a shocking mix of modeset ioctls and legacy ioctls. At least I've burned my fingers a few times already trying to sort this stuff out and patches had to be reverted ...
Cheers, Daniel
Quoted 60 lines
After all the drivers have been updated, the core can be modified to create the primary minor only when
DRIVER_MODESETis available.The remainder of the series cleans up some
drm_core_check_feature()usage and drop some unused code related to that.Thierry
Thierry Reding (12):
drm: RenameDRM_MINOR_LEGACYtoDRM_MINOR_PRIMARY
drm: IntroduceDRIVER_LEGACYfeature
drm/i915: Mark as legacy if KMS is disabled
drm: SeparateDRIVER_MODESETandDRIVER_LEGACY
drm: Create primary minor only if mode-setting is supported
drm: Remove gratuituous blank line
drm: Usedrm_core_check_feature()where possible drm/exynos: Remove dead code
drm/gma500: Remove dead code
drm/i810: Remove dead code
drm/i915: Remove dead code
drm/qxl: Remove dead codedrivers/gpu/drm/drm_bufs.c | 12 +++++------ drivers/gpu/drm/drm_crtc.c | 1 - drivers/gpu/drm/drm_dma.c | 4 ++-- drivers/gpu/drm/drm_fops.c | 14 ++++++------ drivers/gpu/drm/drm_gem.c | 6 +++--- drivers/gpu/drm/drm_irq.c | 12 +++++------ drivers/gpu/drm/drm_pci.c | 12 +++++------ drivers/gpu/drm/drm_scatter.c | 6 +++--- drivers/gpu/drm/drm_stub.c | 24 +++++++++++---------- drivers/gpu/drm/drm_sysfs.c | 8 +++---- drivers/gpu/drm/exynos/exynos_drm_gem.c | 10 --------- drivers/gpu/drm/gma500/gem.c | 3 --- drivers/gpu/drm/i810/i810_dma.c | 7 ------ drivers/gpu/drm/i810/i810_drv.c | 3 ++- drivers/gpu/drm/i915/i915_dma.c | 38 ++++++++++++++++----------------- drivers/gpu/drm/i915/i915_drv.c | 18 ++++++++++------ drivers/gpu/drm/i915/i915_gem.c | 17 +++++++-------- drivers/gpu/drm/i915/i915_gem_context.c | 6 ------ drivers/gpu/drm/i915/i915_irq.c | 6 +++--- drivers/gpu/drm/i915/i915_suspend.c | 15 ++++++------- drivers/gpu/drm/i915/intel_ringbuffer.c | 2 +- drivers/gpu/drm/mga/mga_drv.c | 3 ++- drivers/gpu/drm/qxl/qxl_kms.c | 4 ---- drivers/gpu/drm/radeon/radeon_drv.c | 3 ++- drivers/gpu/drm/savage/savage_drv.c | 2 +- drivers/gpu/drm/sis/sis_drv.c | 2 +- drivers/gpu/drm/tdfx/tdfx_drv.c | 1 + drivers/gpu/drm/via/via_drv.c | 2 +- include/drm/drmP.h | 3 ++- 29 files changed, 112 insertions(+), 132 deletions(-)Signature · 6 lines
1.8.4.2 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch