[Intel-gfx] [PATCH] no-primary
Chris Wilson
chris at chris-wilson.co.uk
Fri Mar 15 16:37:04 UTC 2019
---
drivers/gpu/drm/drm_debugfs.c | 2 +-
drivers/gpu/drm/drm_drv.c | 12 ++++++++----
drivers/gpu/drm/drm_prime.c | 2 +-
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index f8468eae0503..f7044ff82f9c 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -443,7 +443,7 @@ int drm_debugfs_connector_add(struct drm_connector *connector)
struct drm_minor *minor = connector->dev->primary;
struct dentry *root, *ent;
- if (!minor->debugfs_root)
+ if (!minor || !minor->debugfs_root)
return -1;
root = debugfs_create_dir(connector->name, minor->debugfs_root);
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index adcb437e602d..737ad75597f1 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -688,9 +688,11 @@ int drm_dev_init(struct drm_device *dev,
goto err_minors;
}
- ret = drm_minor_alloc(dev, DRM_MINOR_PRIMARY);
- if (ret)
- goto err_minors;
+ if (drm_core_check_feature(dev, DRIVER_LEGACY | DRIVER_MODESET)) {
+ ret = drm_minor_alloc(dev, DRM_MINOR_PRIMARY);
+ if (ret)
+ goto err_minors;
+ }
ret = drm_ht_create(&dev->map_hash, 12);
if (ret)
@@ -1008,7 +1010,9 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
driver->name, driver->major, driver->minor,
driver->patchlevel, driver->date,
dev->dev ? dev_name(dev->dev) : "virtual device",
- dev->primary->index);
+ dev->primary ? dev->primary->index :
+ dev->render ? dev->render->index :
+ -1);
goto out_unlock;
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index dc079efb3b0f..9e821a9c607e 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -676,7 +676,7 @@ int drm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
}
/* Used by drm_gem_mmap() to lookup the GEM object */
- priv->minor = obj->dev->primary;
+ priv->minor = obj->dev->primary ?: obj->dev->render;
fil->private_data = priv;
ret = drm_vma_node_allow(&obj->vma_node, priv);
--
2.20.1
More information about the Intel-gfx
mailing list