[RFC 05/12] drm: Create primary minor only if mode-setting is supported
David Herrmann
dh.herrmann at gmail.com
Mon Feb 24 02:39:33 PST 2014
Hi
On Fri, Feb 21, 2014 at 8:55 AM, Thierry Reding
<thierry.reding at gmail.com> wrote:
> From: Thierry Reding <treding at nvidia.com>
>
> 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 <treding at nvidia.com>
> ---
> drivers/gpu/drm/drm_stub.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
> index fd2f1758366d..839460b774c5 100644
> --- a/drivers/gpu/drm/drm_stub.c
> +++ b/drivers/gpu/drm/drm_stub.c
> @@ -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;
> + }
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
>
> if (drm_ht_create(&dev->map_hash, 12))
> goto err_minors;
> --
> 1.8.4.2
>
More information about the dri-devel
mailing list