diff mbox

[RFC,v3,04/12] drm: Make ioctls available for in-kernel clients part 2

Message ID 20180222200653.19453-5-noralf@tronnes.org (mailing list archive)
State New, archived
Headers show

Commit Message

Noralf Trønnes Feb. 22, 2018, 8:06 p.m. UTC
This is part 2 of making ioctls useable for in-kernel clients.
Make an ioctl wrapper function that calls a function that can be used by
in-kernel clients.

It adjusts the signature of the following functions:
- drm_mode_getcrtc()
- drm_mode_create_dumb_ioctl()
- drm_mode_destroy_dumb_ioctl()
- drm_mode_getencoder()
- drm_mode_addfb2()
- drm_mode_rmfb()
- drm_mode_obj_set_property_ioctl()
- drm_mode_page_flip_ioctl()
- drm_prime_handle_to_fd_ioctl()
- drm_wait_vblank_ioctl()

drm_mode_addfb2() also gets the ability to override the debug name.

There is no functional change from the userspace side.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/drm_crtc.c          | 15 +++++++----
 drivers/gpu/drm/drm_crtc_internal.h | 37 +++++++++++++++++++++------
 drivers/gpu/drm/drm_dumb_buffers.c  | 33 ++++++++++++++++--------
 drivers/gpu/drm/drm_encoder.c       | 10 ++++++--
 drivers/gpu/drm/drm_framebuffer.c   | 50 ++++++++++++++++++++++++-------------
 drivers/gpu/drm/drm_internal.h      |  5 ++++
 drivers/gpu/drm/drm_ioc32.c         |  2 +-
 drivers/gpu/drm/drm_ioctl.c         |  8 +++---
 drivers/gpu/drm/drm_mode_object.c   | 12 ++++++---
 drivers/gpu/drm/drm_plane.c         | 12 ++++++---
 drivers/gpu/drm/drm_prime.c         | 13 +++++++---
 drivers/gpu/drm/drm_vblank.c        | 11 +++++---
 12 files changed, 147 insertions(+), 61 deletions(-)

Comments

Daniel Vetter March 6, 2018, 8:41 a.m. UTC | #1
On Thu, Feb 22, 2018 at 09:06:45PM +0100, Noralf Trønnes wrote:
> This is part 2 of making ioctls useable for in-kernel clients.
> Make an ioctl wrapper function that calls a function that can be used by
> in-kernel clients.
> 
> It adjusts the signature of the following functions:
> - drm_mode_getcrtc()
> - drm_mode_create_dumb_ioctl()
> - drm_mode_destroy_dumb_ioctl()
> - drm_mode_getencoder()
> - drm_mode_addfb2()
> - drm_mode_rmfb()
> - drm_mode_obj_set_property_ioctl()
> - drm_mode_page_flip_ioctl()
> - drm_prime_handle_to_fd_ioctl()
> - drm_wait_vblank_ioctl()
> 
> drm_mode_addfb2() also gets the ability to override the debug name.
> 
> There is no functional change from the userspace side.
> 
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

Do we really need all of these? For in-kernel KMS users I think it would
be much better to keep using the in-kernel KMS interfaces directly (like
the current fbdev emulation code does). Doing all the marshalling and
demarshalling for the generic KMS ioctls looks like lots of fragile code.

I think the only ioctl we really absolutely need are:
- dumb_create/mmap_offset/destroy
- addfb2

As soon as we've called addfb2 we can use the idr lookup to go from the id
to the drm_framebuffer * (including a full reference), and once we have
the drm_framebuffer we don't need any of the other ioctls. Or am I missing
something? Maybe the addfb wrapper for internal clients could even
directly convert to the drm_framebuffer * and never expose the KMS ID.
-Daniel


> ---
>  drivers/gpu/drm/drm_crtc.c          | 15 +++++++----
>  drivers/gpu/drm/drm_crtc_internal.h | 37 +++++++++++++++++++++------
>  drivers/gpu/drm/drm_dumb_buffers.c  | 33 ++++++++++++++++--------
>  drivers/gpu/drm/drm_encoder.c       | 10 ++++++--
>  drivers/gpu/drm/drm_framebuffer.c   | 50 ++++++++++++++++++++++++-------------
>  drivers/gpu/drm/drm_internal.h      |  5 ++++
>  drivers/gpu/drm/drm_ioc32.c         |  2 +-
>  drivers/gpu/drm/drm_ioctl.c         |  8 +++---
>  drivers/gpu/drm/drm_mode_object.c   | 12 ++++++---
>  drivers/gpu/drm/drm_plane.c         | 12 ++++++---
>  drivers/gpu/drm/drm_prime.c         | 13 +++++++---
>  drivers/gpu/drm/drm_vblank.c        | 11 +++++---
>  12 files changed, 147 insertions(+), 61 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index c9ab1cc6b412..61a6a90fae7e 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -387,8 +387,8 @@ EXPORT_SYMBOL(drm_crtc_cleanup);
>  /**
>   * drm_mode_getcrtc - get CRTC configuration
>   * @dev: drm device for the ioctl
> - * @data: data pointer for the ioctl
> - * @file_priv: drm file for the ioctl call
> + * @crtc_resp: pointer to crtc request structure
> + * @file_priv: drm file
>   *
>   * Construct a CRTC configuration structure to return to the user.
>   *
> @@ -397,10 +397,9 @@ EXPORT_SYMBOL(drm_crtc_cleanup);
>   * Returns:
>   * Zero on success, negative errno on failure.
>   */
> -int drm_mode_getcrtc(struct drm_device *dev,
> -		     void *data, struct drm_file *file_priv)
> +int drm_mode_getcrtc(struct drm_device *dev, struct drm_mode_crtc *crtc_resp,
> +		     struct drm_file *file_priv)
>  {
> -	struct drm_mode_crtc *crtc_resp = data;
>  	struct drm_crtc *crtc;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> @@ -451,6 +450,12 @@ int drm_mode_getcrtc(struct drm_device *dev,
>  	return 0;
>  }
>  
> +int drm_mode_getcrtc_ioctl(struct drm_device *dev,
> +			   void *data, struct drm_file *file_priv)
> +{
> +	return drm_mode_getcrtc(dev, data, file_priv);
> +}
> +
>  static int __drm_mode_set_config_internal(struct drm_mode_set *set,
>  					  struct drm_modeset_acquire_ctx *ctx)
>  {
> diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h
> index 29c59ce7e56e..45713af5a015 100644
> --- a/drivers/gpu/drm/drm_crtc_internal.h
> +++ b/drivers/gpu/drm/drm_crtc_internal.h
> @@ -45,12 +45,14 @@ void drm_crtc_unregister_all(struct drm_device *dev);
>  
>  struct dma_fence *drm_crtc_create_fence(struct drm_crtc *crtc);
>  
> +int drm_mode_getcrtc(struct drm_device *dev, struct drm_mode_crtc *crtc_resp,
> +		     struct drm_file *file_priv);
>  int drm_mode_setcrtc(struct drm_device *dev, struct drm_mode_crtc *crtc_req,
>  		     struct drm_file *file_priv, bool user);
>  
>  /* IOCTLs */
> -int drm_mode_getcrtc(struct drm_device *dev,
> -		     void *data, struct drm_file *file_priv);
> +int drm_mode_getcrtc_ioctl(struct drm_device *dev,
> +			   void *data, struct drm_file *file_priv);
>  int drm_mode_setcrtc_ioctl(struct drm_device *dev,
>  			   void *data, struct drm_file *file_priv);
>  
> @@ -68,6 +70,12 @@ int drm_mode_getresources_ioctl(struct drm_device *dev, void *data,
>  
>  
>  /* drm_dumb_buffers.c */
> +int drm_mode_create_dumb(struct drm_device *dev,
> +			 struct drm_mode_create_dumb *args,
> +			 struct drm_file *file_priv);
> +int drm_mode_destroy_dumb(struct drm_device *dev, u32 handle,
> +			  struct drm_file *file_priv);
> +
>  /* IOCTLs */
>  int drm_mode_create_dumb_ioctl(struct drm_device *dev,
>  			       void *data, struct drm_file *file_priv);
> @@ -122,6 +130,9 @@ int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic,
>  				   uint32_t *arg_count_props);
>  struct drm_property *drm_mode_obj_find_prop_id(struct drm_mode_object *obj,
>  					       uint32_t prop_id);
> +int drm_mode_obj_set_property(struct drm_device *dev,
> +			      struct drm_mode_obj_set_property *arg,
> +			      struct drm_file *file_priv);
>  
>  /* IOCTL */
>  
> @@ -133,10 +144,13 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
>  /* drm_encoder.c */
>  int drm_encoder_register_all(struct drm_device *dev);
>  void drm_encoder_unregister_all(struct drm_device *dev);
> +int drm_mode_getencoder(struct drm_device *dev,
> +			struct drm_mode_get_encoder *enc_resp,
> +			struct drm_file *file_priv);
>  
>  /* IOCTL */
> -int drm_mode_getencoder(struct drm_device *dev,
> -			void *data, struct drm_file *file_priv);
> +int drm_mode_getencoder_ioctl(struct drm_device *dev,
> +			      void *data, struct drm_file *file_priv);
>  
>  /* drm_connector.c */
>  void drm_connector_ida_init(void);
> @@ -170,16 +184,20 @@ int drm_framebuffer_check_src_coords(uint32_t src_x, uint32_t src_y,
>  				     const struct drm_framebuffer *fb);
>  void drm_fb_release(struct drm_file *file_priv);
>  
> +int drm_mode_addfb2(struct drm_device *dev, struct drm_mode_fb_cmd2 *r,
> +		    struct drm_file *file_priv, const char *comm);
> +int drm_mode_rmfb(struct drm_device *dev, u32 fb_id,
> +		  struct drm_file *file_priv);
>  int drm_mode_dirtyfb(struct drm_device *dev, struct drm_mode_fb_dirty_cmd *req,
>  		     struct drm_file *file_priv, bool user);
>  
>  /* IOCTL */
>  int drm_mode_addfb(struct drm_device *dev,
>  		   void *data, struct drm_file *file_priv);
> -int drm_mode_addfb2(struct drm_device *dev,
> -		    void *data, struct drm_file *file_priv);
> -int drm_mode_rmfb(struct drm_device *dev,
> -		  void *data, struct drm_file *file_priv);
> +int drm_mode_addfb2_ioctl(struct drm_device *dev,
> +			  void *data, struct drm_file *file_priv);
> +int drm_mode_rmfb_ioctl(struct drm_device *dev,
> +			void *data, struct drm_file *file_priv);
>  int drm_mode_getfb(struct drm_device *dev,
>  		   void *data, struct drm_file *file_priv);
>  int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
> @@ -209,6 +227,9 @@ int drm_plane_register_all(struct drm_device *dev);
>  void drm_plane_unregister_all(struct drm_device *dev);
>  int drm_plane_check_pixel_format(const struct drm_plane *plane,
>  				 u32 format);
> +int drm_mode_page_flip(struct drm_device *dev,
> +		       struct drm_mode_crtc_page_flip_target *page_flip,
> +		       struct drm_file *file_priv);
>  
>  /* drm_bridge.c */
>  void drm_bridge_detach(struct drm_bridge *bridge);
> diff --git a/drivers/gpu/drm/drm_dumb_buffers.c b/drivers/gpu/drm/drm_dumb_buffers.c
> index 39ac15ce4702..eed9687b8698 100644
> --- a/drivers/gpu/drm/drm_dumb_buffers.c
> +++ b/drivers/gpu/drm/drm_dumb_buffers.c
> @@ -53,10 +53,10 @@
>   * a hardware-specific ioctl to allocate suitable buffer objects.
>   */
>  
> -int drm_mode_create_dumb_ioctl(struct drm_device *dev,
> -			       void *data, struct drm_file *file_priv)
> +int drm_mode_create_dumb(struct drm_device *dev,
> +			 struct drm_mode_create_dumb *args,
> +			 struct drm_file *file_priv)
>  {
> -	struct drm_mode_create_dumb *args = data;
>  	u32 cpp, stride, size;
>  
>  	if (!dev->driver->dumb_create)
> @@ -91,6 +91,12 @@ int drm_mode_create_dumb_ioctl(struct drm_device *dev,
>  	return dev->driver->dumb_create(file_priv, dev, args);
>  }
>  
> +int drm_mode_create_dumb_ioctl(struct drm_device *dev,
> +			       void *data, struct drm_file *file_priv)
> +{
> +	return drm_mode_create_dumb(dev, data, file_priv);
> +}
> +
>  /**
>   * drm_mode_mmap_dumb_ioctl - create an mmap offset for a dumb backing storage buffer
>   * @dev: DRM device
> @@ -122,17 +128,22 @@ int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
>  					       &args->offset);
>  }
>  
> +int drm_mode_destroy_dumb(struct drm_device *dev, u32 handle,
> +			  struct drm_file *file_priv)
> +{
> +	if (!dev->driver->dumb_create)
> +		return -ENOSYS;
> +
> +	if (dev->driver->dumb_destroy)
> +		return dev->driver->dumb_destroy(file_priv, dev, handle);
> +	else
> +		return drm_gem_dumb_destroy(file_priv, dev, handle);
> +}
> +
>  int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
>  				void *data, struct drm_file *file_priv)
>  {
>  	struct drm_mode_destroy_dumb *args = data;
>  
> -	if (!dev->driver->dumb_create)
> -		return -ENOSYS;
> -
> -	if (dev->driver->dumb_destroy)
> -		return dev->driver->dumb_destroy(file_priv, dev, args->handle);
> -	else
> -		return drm_gem_dumb_destroy(file_priv, dev, args->handle);
> +	return drm_mode_destroy_dumb(dev, args->handle, file_priv);
>  }
> -
> diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c
> index 273e1c59c54a..466f3e28b3e9 100644
> --- a/drivers/gpu/drm/drm_encoder.c
> +++ b/drivers/gpu/drm/drm_encoder.c
> @@ -214,10 +214,10 @@ static struct drm_crtc *drm_encoder_get_crtc(struct drm_encoder *encoder)
>  	return encoder->crtc;
>  }
>  
> -int drm_mode_getencoder(struct drm_device *dev, void *data,
> +int drm_mode_getencoder(struct drm_device *dev,
> +			struct drm_mode_get_encoder *enc_resp,
>  			struct drm_file *file_priv)
>  {
> -	struct drm_mode_get_encoder *enc_resp = data;
>  	struct drm_encoder *encoder;
>  	struct drm_crtc *crtc;
>  
> @@ -244,3 +244,9 @@ int drm_mode_getencoder(struct drm_device *dev, void *data,
>  
>  	return 0;
>  }
> +
> +int drm_mode_getencoder_ioctl(struct drm_device *dev, void *data,
> +			      struct drm_file *file_priv)
> +{
> +	return drm_mode_getencoder(dev, data, file_priv);
> +}
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index e918c7124dcd..b41770d29e6c 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -121,7 +121,7 @@ int drm_mode_addfb(struct drm_device *dev,
>  	r.pixel_format = drm_mode_legacy_fb_format(or->bpp, or->depth);
>  	r.handles[0] = or->handle;
>  
> -	ret = drm_mode_addfb2(dev, &r, file_priv);
> +	ret = drm_mode_addfb2_ioctl(dev, &r, file_priv);
>  	if (ret)
>  		return ret;
>  
> @@ -305,23 +305,23 @@ drm_internal_framebuffer_create(struct drm_device *dev,
>  
>  /**
>   * drm_mode_addfb2 - add an FB to the graphics configuration
> - * @dev: drm device for the ioctl
> - * @data: data pointer for the ioctl
> - * @file_priv: drm file for the ioctl call
> + * @dev: drm device
> + * @r: pointer to request structure
> + * @file_priv: drm file
> + * @comm: optionally override the allocator name used for debug output
>   *
>   * Add a new FB to the specified CRTC, given a user request with format. This is
>   * the 2nd version of the addfb ioctl, which supports multi-planar framebuffers
>   * and uses fourcc codes as pixel format specifiers.
>   *
> - * Called by the user via ioctl.
> + * Called by the user via ioctl, or by an in-kernel client.
>   *
>   * Returns:
>   * Zero on success, negative errno on failure.
>   */
> -int drm_mode_addfb2(struct drm_device *dev,
> -		    void *data, struct drm_file *file_priv)
> +int drm_mode_addfb2(struct drm_device *dev, struct drm_mode_fb_cmd2 *r,
> +		    struct drm_file *file_priv, const char *comm)
>  {
> -	struct drm_mode_fb_cmd2 *r = data;
>  	struct drm_framebuffer *fb;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> @@ -331,6 +331,9 @@ int drm_mode_addfb2(struct drm_device *dev,
>  	if (IS_ERR(fb))
>  		return PTR_ERR(fb);
>  
> +	if (comm)
> +		strscpy(fb->comm, comm, TASK_COMM_LEN);
> +
>  	DRM_DEBUG_KMS("[FB:%d]\n", fb->base.id);
>  	r->fb_id = fb->base.id;
>  
> @@ -342,6 +345,12 @@ int drm_mode_addfb2(struct drm_device *dev,
>  	return 0;
>  }
>  
> +int drm_mode_addfb2_ioctl(struct drm_device *dev,
> +			  void *data, struct drm_file *file_priv)
> +{
> +	return drm_mode_addfb2(dev, data, file_priv, NULL);
> +}
> +
>  struct drm_mode_rmfb_work {
>  	struct work_struct work;
>  	struct list_head fbs;
> @@ -362,29 +371,28 @@ static void drm_mode_rmfb_work_fn(struct work_struct *w)
>  
>  /**
>   * drm_mode_rmfb - remove an FB from the configuration
> - * @dev: drm device for the ioctl
> - * @data: data pointer for the ioctl
> - * @file_priv: drm file for the ioctl call
> + * @dev: drm device
> + * @fb_id: id of framebuffer to remove
> + * @file_priv: drm file
>   *
> - * Remove the FB specified by the user.
> + * Remove the specified FB.
>   *
> - * Called by the user via ioctl.
> + * Called by the user via ioctl, or by an in-kernel client.
>   *
>   * Returns:
>   * Zero on success, negative errno on failure.
>   */
> -int drm_mode_rmfb(struct drm_device *dev,
> -		   void *data, struct drm_file *file_priv)
> +int drm_mode_rmfb(struct drm_device *dev, u32 fb_id,
> +		  struct drm_file *file_priv)
>  {
>  	struct drm_framebuffer *fb = NULL;
>  	struct drm_framebuffer *fbl = NULL;
> -	uint32_t *id = data;
>  	int found = 0;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
>  		return -EINVAL;
>  
> -	fb = drm_framebuffer_lookup(dev, file_priv, *id);
> +	fb = drm_framebuffer_lookup(dev, file_priv, fb_id);
>  	if (!fb)
>  		return -ENOENT;
>  
> @@ -430,6 +438,14 @@ int drm_mode_rmfb(struct drm_device *dev,
>  	return -ENOENT;
>  }
>  
> +int drm_mode_rmfb_ioctl(struct drm_device *dev,
> +			void *data, struct drm_file *file_priv)
> +{
> +	uint32_t *fb_id = data;
> +
> +	return drm_mode_rmfb(dev, *fb_id, file_priv);
> +}
> +
>  /**
>   * drm_mode_getfb - get FB info
>   * @dev: drm device for the ioctl
> diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
> index 40179c5fc6b8..043814cbd286 100644
> --- a/drivers/gpu/drm/drm_internal.h
> +++ b/drivers/gpu/drm/drm_internal.h
> @@ -37,6 +37,9 @@ void drm_pci_agp_destroy(struct drm_device *dev);
>  int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master);
>  
>  /* drm_prime.c */
> +int drm_prime_handle_to_fd(struct drm_device *dev,
> +			   struct drm_prime_handle *args,
> +			   struct drm_file *file_priv);
>  int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
>  				 struct drm_file *file_priv);
>  int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
> @@ -59,6 +62,8 @@ int drm_gem_name_info(struct seq_file *m, void *data);
>  /* drm_vblank.c */
>  void drm_vblank_disable_and_save(struct drm_device *dev, unsigned int pipe);
>  void drm_vblank_cleanup(struct drm_device *dev);
> +int drm_wait_vblank(struct drm_device *dev, union drm_wait_vblank *vblwait,
> +		    struct drm_file *file_priv);
>  
>  /* IOCTLS */
>  int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
> diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c
> index f8e96e648acf..576d00b7dad5 100644
> --- a/drivers/gpu/drm/drm_ioc32.c
> +++ b/drivers/gpu/drm/drm_ioc32.c
> @@ -884,7 +884,7 @@ static int compat_drm_mode_addfb2(struct file *file, unsigned int cmd,
>  			   sizeof(req64.modifier)))
>  		return -EFAULT;
>  
> -	err = drm_ioctl_kernel(file, drm_mode_addfb2, &req64,
> +	err = drm_ioctl_kernel(file, drm_mode_addfb2_ioctl, &req64,
>  				DRM_CONTROL_ALLOW|DRM_UNLOCKED);
>  	if (err)
>  		return err;
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 346b8060df7c..726fbdb8a4b0 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -619,14 +619,14 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
>  	DRM_IOCTL_DEF(DRM_IOCTL_PRIME_FD_TO_HANDLE, drm_prime_fd_to_handle_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW),
>  
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANERESOURCES, drm_mode_getplane_res, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> -	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCRTC, drm_mode_getcrtc, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> +	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCRTC, drm_mode_getcrtc_ioctl, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETCRTC, drm_mode_setcrtc_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANE, drm_mode_getplane, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPLANE, drm_mode_setplane, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_CURSOR, drm_mode_cursor_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETGAMMA, drm_mode_gamma_get_ioctl, DRM_UNLOCKED),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETGAMMA, drm_mode_gamma_set_ioctl, DRM_MASTER|DRM_UNLOCKED),
> -	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETENCODER, drm_mode_getencoder, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> +	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETENCODER, drm_mode_getencoder_ioctl, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCONNECTOR, drm_mode_getconnector_ioctl, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_ATTACHMODE, drm_noop, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_DETACHMODE, drm_noop, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> @@ -635,8 +635,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPBLOB, drm_mode_getblob_ioctl, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB, drm_mode_getfb, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB, drm_mode_addfb, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> -	DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB2, drm_mode_addfb2, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> -	DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> +	DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB2, drm_mode_addfb2_ioctl, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> +	DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb_ioctl, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_PAGE_FLIP, drm_mode_page_flip_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_DIRTYFB, drm_mode_dirtyfb_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_CREATE_DUMB, drm_mode_create_dumb_ioctl, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c
> index ce4d2fb32810..2bf7a9e8ac08 100644
> --- a/drivers/gpu/drm/drm_mode_object.c
> +++ b/drivers/gpu/drm/drm_mode_object.c
> @@ -496,10 +496,10 @@ static int set_property_atomic(struct drm_mode_object *obj,
>  	return ret;
>  }
>  
> -int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
> -				    struct drm_file *file_priv)
> +int drm_mode_obj_set_property(struct drm_device *dev,
> +			      struct drm_mode_obj_set_property *arg,
> +			      struct drm_file *file_priv)
>  {
> -	struct drm_mode_obj_set_property *arg = data;
>  	struct drm_mode_object *arg_obj;
>  	struct drm_property *property;
>  	int ret = -EINVAL;
> @@ -527,3 +527,9 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
>  	drm_mode_object_put(arg_obj);
>  	return ret;
>  }
> +
> +int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
> +				    struct drm_file *file_priv)
> +{
> +	return drm_mode_obj_set_property(dev, data, file_priv);
> +}
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 22b54663b6e7..b1f55556e196 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -907,10 +907,10 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
>  	return drm_mode_cursor_common(dev, req, file_priv);
>  }
>  
> -int drm_mode_page_flip_ioctl(struct drm_device *dev,
> -			     void *data, struct drm_file *file_priv)
> +int drm_mode_page_flip(struct drm_device *dev,
> +		       struct drm_mode_crtc_page_flip_target *page_flip,
> +		       struct drm_file *file_priv)
>  {
> -	struct drm_mode_crtc_page_flip_target *page_flip = data;
>  	struct drm_crtc *crtc;
>  	struct drm_framebuffer *fb = NULL;
>  	struct drm_pending_vblank_event *e = NULL;
> @@ -1082,3 +1082,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  
>  	return ret;
>  }
> +
> +int drm_mode_page_flip_ioctl(struct drm_device *dev,
> +			     void *data, struct drm_file *file_priv)
> +{
> +	return drm_mode_page_flip(dev, data, file_priv);
> +}
> diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> index e82a976f0fba..eaf8392ef815 100644
> --- a/drivers/gpu/drm/drm_prime.c
> +++ b/drivers/gpu/drm/drm_prime.c
> @@ -853,11 +853,10 @@ int drm_gem_prime_fd_to_handle(struct drm_device *dev,
>  }
>  EXPORT_SYMBOL(drm_gem_prime_fd_to_handle);
>  
> -int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
> -				 struct drm_file *file_priv)
> +int drm_prime_handle_to_fd(struct drm_device *dev,
> +			   struct drm_prime_handle *args,
> +			   struct drm_file *file_priv)
>  {
> -	struct drm_prime_handle *args = data;
> -
>  	if (!drm_core_check_feature(dev, DRIVER_PRIME))
>  		return -EINVAL;
>  
> @@ -872,6 +871,12 @@ int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
>  			args->handle, args->flags, &args->fd);
>  }
>  
> +int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
> +				 struct drm_file *file_priv)
> +{
> +	return drm_prime_handle_to_fd(dev, data, file_priv);
> +}
> +
>  int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
>  				 struct drm_file *file_priv)
>  {
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 32d9bcf5be7f..ef41508bc539 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -1445,12 +1445,11 @@ static void drm_wait_vblank_reply(struct drm_device *dev, unsigned int pipe,
>  	reply->tval_usec = ts.tv_nsec / 1000;
>  }
>  
> -int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
> -			  struct drm_file *file_priv)
> +int drm_wait_vblank(struct drm_device *dev, union drm_wait_vblank *vblwait,
> +		    struct drm_file *file_priv)
>  {
>  	struct drm_crtc *crtc;
>  	struct drm_vblank_crtc *vblank;
> -	union drm_wait_vblank *vblwait = data;
>  	int ret;
>  	u64 req_seq, seq;
>  	unsigned int pipe_index;
> @@ -1567,6 +1566,12 @@ int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
>  	return ret;
>  }
>  
> +int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
> +			  struct drm_file *file_priv)
> +{
> +	return drm_wait_vblank_ioctl(dev, data, file_priv);
> +}
> +
>  static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
>  {
>  	struct drm_pending_vblank_event *e, *t;
> -- 
> 2.15.1
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index c9ab1cc6b412..61a6a90fae7e 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -387,8 +387,8 @@  EXPORT_SYMBOL(drm_crtc_cleanup);
 /**
  * drm_mode_getcrtc - get CRTC configuration
  * @dev: drm device for the ioctl
- * @data: data pointer for the ioctl
- * @file_priv: drm file for the ioctl call
+ * @crtc_resp: pointer to crtc request structure
+ * @file_priv: drm file
  *
  * Construct a CRTC configuration structure to return to the user.
  *
@@ -397,10 +397,9 @@  EXPORT_SYMBOL(drm_crtc_cleanup);
  * Returns:
  * Zero on success, negative errno on failure.
  */
-int drm_mode_getcrtc(struct drm_device *dev,
-		     void *data, struct drm_file *file_priv)
+int drm_mode_getcrtc(struct drm_device *dev, struct drm_mode_crtc *crtc_resp,
+		     struct drm_file *file_priv)
 {
-	struct drm_mode_crtc *crtc_resp = data;
 	struct drm_crtc *crtc;
 
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
@@ -451,6 +450,12 @@  int drm_mode_getcrtc(struct drm_device *dev,
 	return 0;
 }
 
+int drm_mode_getcrtc_ioctl(struct drm_device *dev,
+			   void *data, struct drm_file *file_priv)
+{
+	return drm_mode_getcrtc(dev, data, file_priv);
+}
+
 static int __drm_mode_set_config_internal(struct drm_mode_set *set,
 					  struct drm_modeset_acquire_ctx *ctx)
 {
diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h
index 29c59ce7e56e..45713af5a015 100644
--- a/drivers/gpu/drm/drm_crtc_internal.h
+++ b/drivers/gpu/drm/drm_crtc_internal.h
@@ -45,12 +45,14 @@  void drm_crtc_unregister_all(struct drm_device *dev);
 
 struct dma_fence *drm_crtc_create_fence(struct drm_crtc *crtc);
 
+int drm_mode_getcrtc(struct drm_device *dev, struct drm_mode_crtc *crtc_resp,
+		     struct drm_file *file_priv);
 int drm_mode_setcrtc(struct drm_device *dev, struct drm_mode_crtc *crtc_req,
 		     struct drm_file *file_priv, bool user);
 
 /* IOCTLs */
-int drm_mode_getcrtc(struct drm_device *dev,
-		     void *data, struct drm_file *file_priv);
+int drm_mode_getcrtc_ioctl(struct drm_device *dev,
+			   void *data, struct drm_file *file_priv);
 int drm_mode_setcrtc_ioctl(struct drm_device *dev,
 			   void *data, struct drm_file *file_priv);
 
@@ -68,6 +70,12 @@  int drm_mode_getresources_ioctl(struct drm_device *dev, void *data,
 
 
 /* drm_dumb_buffers.c */
+int drm_mode_create_dumb(struct drm_device *dev,
+			 struct drm_mode_create_dumb *args,
+			 struct drm_file *file_priv);
+int drm_mode_destroy_dumb(struct drm_device *dev, u32 handle,
+			  struct drm_file *file_priv);
+
 /* IOCTLs */
 int drm_mode_create_dumb_ioctl(struct drm_device *dev,
 			       void *data, struct drm_file *file_priv);
@@ -122,6 +130,9 @@  int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic,
 				   uint32_t *arg_count_props);
 struct drm_property *drm_mode_obj_find_prop_id(struct drm_mode_object *obj,
 					       uint32_t prop_id);
+int drm_mode_obj_set_property(struct drm_device *dev,
+			      struct drm_mode_obj_set_property *arg,
+			      struct drm_file *file_priv);
 
 /* IOCTL */
 
@@ -133,10 +144,13 @@  int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
 /* drm_encoder.c */
 int drm_encoder_register_all(struct drm_device *dev);
 void drm_encoder_unregister_all(struct drm_device *dev);
+int drm_mode_getencoder(struct drm_device *dev,
+			struct drm_mode_get_encoder *enc_resp,
+			struct drm_file *file_priv);
 
 /* IOCTL */
-int drm_mode_getencoder(struct drm_device *dev,
-			void *data, struct drm_file *file_priv);
+int drm_mode_getencoder_ioctl(struct drm_device *dev,
+			      void *data, struct drm_file *file_priv);
 
 /* drm_connector.c */
 void drm_connector_ida_init(void);
@@ -170,16 +184,20 @@  int drm_framebuffer_check_src_coords(uint32_t src_x, uint32_t src_y,
 				     const struct drm_framebuffer *fb);
 void drm_fb_release(struct drm_file *file_priv);
 
+int drm_mode_addfb2(struct drm_device *dev, struct drm_mode_fb_cmd2 *r,
+		    struct drm_file *file_priv, const char *comm);
+int drm_mode_rmfb(struct drm_device *dev, u32 fb_id,
+		  struct drm_file *file_priv);
 int drm_mode_dirtyfb(struct drm_device *dev, struct drm_mode_fb_dirty_cmd *req,
 		     struct drm_file *file_priv, bool user);
 
 /* IOCTL */
 int drm_mode_addfb(struct drm_device *dev,
 		   void *data, struct drm_file *file_priv);
-int drm_mode_addfb2(struct drm_device *dev,
-		    void *data, struct drm_file *file_priv);
-int drm_mode_rmfb(struct drm_device *dev,
-		  void *data, struct drm_file *file_priv);
+int drm_mode_addfb2_ioctl(struct drm_device *dev,
+			  void *data, struct drm_file *file_priv);
+int drm_mode_rmfb_ioctl(struct drm_device *dev,
+			void *data, struct drm_file *file_priv);
 int drm_mode_getfb(struct drm_device *dev,
 		   void *data, struct drm_file *file_priv);
 int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
@@ -209,6 +227,9 @@  int drm_plane_register_all(struct drm_device *dev);
 void drm_plane_unregister_all(struct drm_device *dev);
 int drm_plane_check_pixel_format(const struct drm_plane *plane,
 				 u32 format);
+int drm_mode_page_flip(struct drm_device *dev,
+		       struct drm_mode_crtc_page_flip_target *page_flip,
+		       struct drm_file *file_priv);
 
 /* drm_bridge.c */
 void drm_bridge_detach(struct drm_bridge *bridge);
diff --git a/drivers/gpu/drm/drm_dumb_buffers.c b/drivers/gpu/drm/drm_dumb_buffers.c
index 39ac15ce4702..eed9687b8698 100644
--- a/drivers/gpu/drm/drm_dumb_buffers.c
+++ b/drivers/gpu/drm/drm_dumb_buffers.c
@@ -53,10 +53,10 @@ 
  * a hardware-specific ioctl to allocate suitable buffer objects.
  */
 
-int drm_mode_create_dumb_ioctl(struct drm_device *dev,
-			       void *data, struct drm_file *file_priv)
+int drm_mode_create_dumb(struct drm_device *dev,
+			 struct drm_mode_create_dumb *args,
+			 struct drm_file *file_priv)
 {
-	struct drm_mode_create_dumb *args = data;
 	u32 cpp, stride, size;
 
 	if (!dev->driver->dumb_create)
@@ -91,6 +91,12 @@  int drm_mode_create_dumb_ioctl(struct drm_device *dev,
 	return dev->driver->dumb_create(file_priv, dev, args);
 }
 
+int drm_mode_create_dumb_ioctl(struct drm_device *dev,
+			       void *data, struct drm_file *file_priv)
+{
+	return drm_mode_create_dumb(dev, data, file_priv);
+}
+
 /**
  * drm_mode_mmap_dumb_ioctl - create an mmap offset for a dumb backing storage buffer
  * @dev: DRM device
@@ -122,17 +128,22 @@  int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
 					       &args->offset);
 }
 
+int drm_mode_destroy_dumb(struct drm_device *dev, u32 handle,
+			  struct drm_file *file_priv)
+{
+	if (!dev->driver->dumb_create)
+		return -ENOSYS;
+
+	if (dev->driver->dumb_destroy)
+		return dev->driver->dumb_destroy(file_priv, dev, handle);
+	else
+		return drm_gem_dumb_destroy(file_priv, dev, handle);
+}
+
 int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
 				void *data, struct drm_file *file_priv)
 {
 	struct drm_mode_destroy_dumb *args = data;
 
-	if (!dev->driver->dumb_create)
-		return -ENOSYS;
-
-	if (dev->driver->dumb_destroy)
-		return dev->driver->dumb_destroy(file_priv, dev, args->handle);
-	else
-		return drm_gem_dumb_destroy(file_priv, dev, args->handle);
+	return drm_mode_destroy_dumb(dev, args->handle, file_priv);
 }
-
diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c
index 273e1c59c54a..466f3e28b3e9 100644
--- a/drivers/gpu/drm/drm_encoder.c
+++ b/drivers/gpu/drm/drm_encoder.c
@@ -214,10 +214,10 @@  static struct drm_crtc *drm_encoder_get_crtc(struct drm_encoder *encoder)
 	return encoder->crtc;
 }
 
-int drm_mode_getencoder(struct drm_device *dev, void *data,
+int drm_mode_getencoder(struct drm_device *dev,
+			struct drm_mode_get_encoder *enc_resp,
 			struct drm_file *file_priv)
 {
-	struct drm_mode_get_encoder *enc_resp = data;
 	struct drm_encoder *encoder;
 	struct drm_crtc *crtc;
 
@@ -244,3 +244,9 @@  int drm_mode_getencoder(struct drm_device *dev, void *data,
 
 	return 0;
 }
+
+int drm_mode_getencoder_ioctl(struct drm_device *dev, void *data,
+			      struct drm_file *file_priv)
+{
+	return drm_mode_getencoder(dev, data, file_priv);
+}
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index e918c7124dcd..b41770d29e6c 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -121,7 +121,7 @@  int drm_mode_addfb(struct drm_device *dev,
 	r.pixel_format = drm_mode_legacy_fb_format(or->bpp, or->depth);
 	r.handles[0] = or->handle;
 
-	ret = drm_mode_addfb2(dev, &r, file_priv);
+	ret = drm_mode_addfb2_ioctl(dev, &r, file_priv);
 	if (ret)
 		return ret;
 
@@ -305,23 +305,23 @@  drm_internal_framebuffer_create(struct drm_device *dev,
 
 /**
  * drm_mode_addfb2 - add an FB to the graphics configuration
- * @dev: drm device for the ioctl
- * @data: data pointer for the ioctl
- * @file_priv: drm file for the ioctl call
+ * @dev: drm device
+ * @r: pointer to request structure
+ * @file_priv: drm file
+ * @comm: optionally override the allocator name used for debug output
  *
  * Add a new FB to the specified CRTC, given a user request with format. This is
  * the 2nd version of the addfb ioctl, which supports multi-planar framebuffers
  * and uses fourcc codes as pixel format specifiers.
  *
- * Called by the user via ioctl.
+ * Called by the user via ioctl, or by an in-kernel client.
  *
  * Returns:
  * Zero on success, negative errno on failure.
  */
-int drm_mode_addfb2(struct drm_device *dev,
-		    void *data, struct drm_file *file_priv)
+int drm_mode_addfb2(struct drm_device *dev, struct drm_mode_fb_cmd2 *r,
+		    struct drm_file *file_priv, const char *comm)
 {
-	struct drm_mode_fb_cmd2 *r = data;
 	struct drm_framebuffer *fb;
 
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
@@ -331,6 +331,9 @@  int drm_mode_addfb2(struct drm_device *dev,
 	if (IS_ERR(fb))
 		return PTR_ERR(fb);
 
+	if (comm)
+		strscpy(fb->comm, comm, TASK_COMM_LEN);
+
 	DRM_DEBUG_KMS("[FB:%d]\n", fb->base.id);
 	r->fb_id = fb->base.id;
 
@@ -342,6 +345,12 @@  int drm_mode_addfb2(struct drm_device *dev,
 	return 0;
 }
 
+int drm_mode_addfb2_ioctl(struct drm_device *dev,
+			  void *data, struct drm_file *file_priv)
+{
+	return drm_mode_addfb2(dev, data, file_priv, NULL);
+}
+
 struct drm_mode_rmfb_work {
 	struct work_struct work;
 	struct list_head fbs;
@@ -362,29 +371,28 @@  static void drm_mode_rmfb_work_fn(struct work_struct *w)
 
 /**
  * drm_mode_rmfb - remove an FB from the configuration
- * @dev: drm device for the ioctl
- * @data: data pointer for the ioctl
- * @file_priv: drm file for the ioctl call
+ * @dev: drm device
+ * @fb_id: id of framebuffer to remove
+ * @file_priv: drm file
  *
- * Remove the FB specified by the user.
+ * Remove the specified FB.
  *
- * Called by the user via ioctl.
+ * Called by the user via ioctl, or by an in-kernel client.
  *
  * Returns:
  * Zero on success, negative errno on failure.
  */
-int drm_mode_rmfb(struct drm_device *dev,
-		   void *data, struct drm_file *file_priv)
+int drm_mode_rmfb(struct drm_device *dev, u32 fb_id,
+		  struct drm_file *file_priv)
 {
 	struct drm_framebuffer *fb = NULL;
 	struct drm_framebuffer *fbl = NULL;
-	uint32_t *id = data;
 	int found = 0;
 
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
 		return -EINVAL;
 
-	fb = drm_framebuffer_lookup(dev, file_priv, *id);
+	fb = drm_framebuffer_lookup(dev, file_priv, fb_id);
 	if (!fb)
 		return -ENOENT;
 
@@ -430,6 +438,14 @@  int drm_mode_rmfb(struct drm_device *dev,
 	return -ENOENT;
 }
 
+int drm_mode_rmfb_ioctl(struct drm_device *dev,
+			void *data, struct drm_file *file_priv)
+{
+	uint32_t *fb_id = data;
+
+	return drm_mode_rmfb(dev, *fb_id, file_priv);
+}
+
 /**
  * drm_mode_getfb - get FB info
  * @dev: drm device for the ioctl
diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
index 40179c5fc6b8..043814cbd286 100644
--- a/drivers/gpu/drm/drm_internal.h
+++ b/drivers/gpu/drm/drm_internal.h
@@ -37,6 +37,9 @@  void drm_pci_agp_destroy(struct drm_device *dev);
 int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master);
 
 /* drm_prime.c */
+int drm_prime_handle_to_fd(struct drm_device *dev,
+			   struct drm_prime_handle *args,
+			   struct drm_file *file_priv);
 int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
 				 struct drm_file *file_priv);
 int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
@@ -59,6 +62,8 @@  int drm_gem_name_info(struct seq_file *m, void *data);
 /* drm_vblank.c */
 void drm_vblank_disable_and_save(struct drm_device *dev, unsigned int pipe);
 void drm_vblank_cleanup(struct drm_device *dev);
+int drm_wait_vblank(struct drm_device *dev, union drm_wait_vblank *vblwait,
+		    struct drm_file *file_priv);
 
 /* IOCTLS */
 int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c
index f8e96e648acf..576d00b7dad5 100644
--- a/drivers/gpu/drm/drm_ioc32.c
+++ b/drivers/gpu/drm/drm_ioc32.c
@@ -884,7 +884,7 @@  static int compat_drm_mode_addfb2(struct file *file, unsigned int cmd,
 			   sizeof(req64.modifier)))
 		return -EFAULT;
 
-	err = drm_ioctl_kernel(file, drm_mode_addfb2, &req64,
+	err = drm_ioctl_kernel(file, drm_mode_addfb2_ioctl, &req64,
 				DRM_CONTROL_ALLOW|DRM_UNLOCKED);
 	if (err)
 		return err;
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 346b8060df7c..726fbdb8a4b0 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -619,14 +619,14 @@  static const struct drm_ioctl_desc drm_ioctls[] = {
 	DRM_IOCTL_DEF(DRM_IOCTL_PRIME_FD_TO_HANDLE, drm_prime_fd_to_handle_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW),
 
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANERESOURCES, drm_mode_getplane_res, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
-	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCRTC, drm_mode_getcrtc, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
+	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCRTC, drm_mode_getcrtc_ioctl, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETCRTC, drm_mode_setcrtc_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANE, drm_mode_getplane, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPLANE, drm_mode_setplane, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_CURSOR, drm_mode_cursor_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETGAMMA, drm_mode_gamma_get_ioctl, DRM_UNLOCKED),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETGAMMA, drm_mode_gamma_set_ioctl, DRM_MASTER|DRM_UNLOCKED),
-	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETENCODER, drm_mode_getencoder, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
+	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETENCODER, drm_mode_getencoder_ioctl, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCONNECTOR, drm_mode_getconnector_ioctl, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_ATTACHMODE, drm_noop, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_DETACHMODE, drm_noop, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
@@ -635,8 +635,8 @@  static const struct drm_ioctl_desc drm_ioctls[] = {
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPBLOB, drm_mode_getblob_ioctl, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB, drm_mode_getfb, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB, drm_mode_addfb, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
-	DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB2, drm_mode_addfb2, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
-	DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
+	DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB2, drm_mode_addfb2_ioctl, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
+	DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb_ioctl, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_PAGE_FLIP, drm_mode_page_flip_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_DIRTYFB, drm_mode_dirtyfb_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_CREATE_DUMB, drm_mode_create_dumb_ioctl, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c
index ce4d2fb32810..2bf7a9e8ac08 100644
--- a/drivers/gpu/drm/drm_mode_object.c
+++ b/drivers/gpu/drm/drm_mode_object.c
@@ -496,10 +496,10 @@  static int set_property_atomic(struct drm_mode_object *obj,
 	return ret;
 }
 
-int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
-				    struct drm_file *file_priv)
+int drm_mode_obj_set_property(struct drm_device *dev,
+			      struct drm_mode_obj_set_property *arg,
+			      struct drm_file *file_priv)
 {
-	struct drm_mode_obj_set_property *arg = data;
 	struct drm_mode_object *arg_obj;
 	struct drm_property *property;
 	int ret = -EINVAL;
@@ -527,3 +527,9 @@  int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
 	drm_mode_object_put(arg_obj);
 	return ret;
 }
+
+int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
+				    struct drm_file *file_priv)
+{
+	return drm_mode_obj_set_property(dev, data, file_priv);
+}
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 22b54663b6e7..b1f55556e196 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -907,10 +907,10 @@  int drm_mode_cursor2_ioctl(struct drm_device *dev,
 	return drm_mode_cursor_common(dev, req, file_priv);
 }
 
-int drm_mode_page_flip_ioctl(struct drm_device *dev,
-			     void *data, struct drm_file *file_priv)
+int drm_mode_page_flip(struct drm_device *dev,
+		       struct drm_mode_crtc_page_flip_target *page_flip,
+		       struct drm_file *file_priv)
 {
-	struct drm_mode_crtc_page_flip_target *page_flip = data;
 	struct drm_crtc *crtc;
 	struct drm_framebuffer *fb = NULL;
 	struct drm_pending_vblank_event *e = NULL;
@@ -1082,3 +1082,9 @@  int drm_mode_page_flip_ioctl(struct drm_device *dev,
 
 	return ret;
 }
+
+int drm_mode_page_flip_ioctl(struct drm_device *dev,
+			     void *data, struct drm_file *file_priv)
+{
+	return drm_mode_page_flip(dev, data, file_priv);
+}
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index e82a976f0fba..eaf8392ef815 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -853,11 +853,10 @@  int drm_gem_prime_fd_to_handle(struct drm_device *dev,
 }
 EXPORT_SYMBOL(drm_gem_prime_fd_to_handle);
 
-int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
-				 struct drm_file *file_priv)
+int drm_prime_handle_to_fd(struct drm_device *dev,
+			   struct drm_prime_handle *args,
+			   struct drm_file *file_priv)
 {
-	struct drm_prime_handle *args = data;
-
 	if (!drm_core_check_feature(dev, DRIVER_PRIME))
 		return -EINVAL;
 
@@ -872,6 +871,12 @@  int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
 			args->handle, args->flags, &args->fd);
 }
 
+int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
+				 struct drm_file *file_priv)
+{
+	return drm_prime_handle_to_fd(dev, data, file_priv);
+}
+
 int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
 				 struct drm_file *file_priv)
 {
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 32d9bcf5be7f..ef41508bc539 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -1445,12 +1445,11 @@  static void drm_wait_vblank_reply(struct drm_device *dev, unsigned int pipe,
 	reply->tval_usec = ts.tv_nsec / 1000;
 }
 
-int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
-			  struct drm_file *file_priv)
+int drm_wait_vblank(struct drm_device *dev, union drm_wait_vblank *vblwait,
+		    struct drm_file *file_priv)
 {
 	struct drm_crtc *crtc;
 	struct drm_vblank_crtc *vblank;
-	union drm_wait_vblank *vblwait = data;
 	int ret;
 	u64 req_seq, seq;
 	unsigned int pipe_index;
@@ -1567,6 +1566,12 @@  int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
 	return ret;
 }
 
+int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
+			  struct drm_file *file_priv)
+{
+	return drm_wait_vblank_ioctl(dev, data, file_priv);
+}
+
 static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
 {
 	struct drm_pending_vblank_event *e, *t;