Re: [PATCH] drm/core: add ioctl to query device/driver capabilities

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Feb 20, 2011 at 8:17 PM, Ben Skeggs <skeggsb@xxxxxxxxx> wrote:
> From: Ben Skeggs <bskeggs@xxxxxxxxxx>
>
> We're coming to see a need to have a set of generic capability checks in
> the core DRM, in addition to the driver-specific ioctls that already
> exist.

Looks good to me, just one comment: I don't think we need the driver
callout.  We only need the drm get cap for generic drm features and
drm itself should know whether or not it has the support, typically by
looking at the driver_features flags.

Kristian

> This patch defines an ioctl to do as such, but does not yet define any
> capabilities.
>
> Signed-off-by: Ben Skeggs <bskeggs@xxxxxxxxxx>
> ---
> Âdrivers/gpu/drm/drm_drv.c  |  Â1 +
> Âdrivers/gpu/drm/drm_ioctl.c | Â 13 +++++++++++++
> Âinclude/drm/drm.h      |  Â7 +++++++
> Âinclude/drm/drmP.h     Â|  Â9 +++++++++
> Â4 files changed, 30 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 271835a..ad86135 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -67,6 +67,7 @@ static struct drm_ioctl_desc drm_ioctls[] = {
> Â Â Â ÂDRM_IOCTL_DEF(DRM_IOCTL_GET_MAP, drm_getmap, 0),
> Â Â Â ÂDRM_IOCTL_DEF(DRM_IOCTL_GET_CLIENT, drm_getclient, 0),
> Â Â Â ÂDRM_IOCTL_DEF(DRM_IOCTL_GET_STATS, drm_getstats, 0),
> + Â Â Â DRM_IOCTL_DEF(DRM_IOCTL_GET_CAP, drm_getcap, 0),
> Â Â Â ÂDRM_IOCTL_DEF(DRM_IOCTL_SET_VERSION, drm_setversion, DRM_MASTER),
>
> Â Â Â ÂDRM_IOCTL_DEF(DRM_IOCTL_SET_UNIQUE, drm_setunique, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 47db4df..15a244b 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -365,6 +365,19 @@ int drm_getstats(struct drm_device *dev, void *data,
> Â}
>
> Â/**
> + * Get device/driver capabilities
> + */
> +int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
> +{
> + Â Â Â struct drm_get_cap *req = data;
> +
> + Â Â Â req->value = 0;
> + Â Â Â if (dev->driver->get_cap)
> + Â Â Â Â Â Â Â req->value = (*dev->driver->get_cap)(dev, req->capability);
> + Â Â Â return 0;
> +}
> +
> +/**
> Â* Setversion ioctl.
> Â*
> Â* \param inode device inode.
> diff --git a/include/drm/drm.h b/include/drm/drm.h
> index e5f7061..7254f1a 100644
> --- a/include/drm/drm.h
> +++ b/include/drm/drm.h
> @@ -608,6 +608,12 @@ struct drm_gem_open {
> Â Â Â Â__u64 size;
> Â};
>
> +/** DRM_IOCTL_GET_CAP ioctl argument type */
> +struct drm_get_cap {
> + Â Â Â __u64 capability;
> + Â Â Â __u64 value;
> +};
> +
> Â#include "drm_mode.h"
>
> Â#define DRM_IOCTL_BASE Â Â Â Â Â Â Â Â 'd'
> @@ -628,6 +634,7 @@ struct drm_gem_open {
> Â#define DRM_IOCTL_GEM_CLOSE Â Â Â Â Â ÂDRM_IOW (0x09, struct drm_gem_close)
> Â#define DRM_IOCTL_GEM_FLINK Â Â Â Â Â ÂDRM_IOWR(0x0a, struct drm_gem_flink)
> Â#define DRM_IOCTL_GEM_OPEN Â Â Â Â Â Â DRM_IOWR(0x0b, struct drm_gem_open)
> +#define DRM_IOCTL_GET_CAP Â Â Â Â Â Â ÂDRM_IOWR(0x0c, struct drm_get_cap)
>
> Â#define DRM_IOCTL_SET_UNIQUE Â Â Â Â Â DRM_IOW( 0x10, struct drm_unique)
> Â#define DRM_IOCTL_AUTH_MAGIC Â Â Â Â Â DRM_IOW( 0x11, struct drm_auth)
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index fe29aad..a3d5ce8 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -869,6 +869,13 @@ struct drm_driver {
> Â Â Â Âvoid (*debugfs_cleanup)(struct drm_minor *minor);
>
> Â Â Â Â/**
> + Â Â Â Â* Driver-specific routine to query capabilities of device/driver.
> + Â Â Â Â*
> + Â Â Â Â* If not present, core drm will assume a return value of 0.
> + Â Â Â Â*/
> + Â Â Â u64 (*get_cap)(struct drm_device *dev, u64 cap);
> +
> + Â Â Â /**
> Â Â Â Â * Driver-specific constructor for drm_gem_objects, to set up
> Â Â Â Â * obj->driver_private.
> Â Â Â Â *
> @@ -1264,6 +1271,8 @@ extern int drm_getclient(struct drm_device *dev, void *data,
> Â Â Â Â Â Â Â Â Â Â Â Â struct drm_file *file_priv);
> Âextern int drm_getstats(struct drm_device *dev, void *data,
> Â Â Â Â Â Â Â Â Â Â Â Âstruct drm_file *file_priv);
> +extern int drm_getcap(struct drm_device *dev, void *data,
> + Â Â Â Â Â Â Â Â Â Â struct drm_file *file_priv);
> Âextern int drm_setversion(struct drm_device *dev, void *data,
> Â Â Â Â Â Â Â Â Â Â Â Â Âstruct drm_file *file_priv);
> Âextern int drm_noop(struct drm_device *dev, void *data,
> --
> 1.7.4
>
>
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux