Re: [PATCH 02/41] drm/dumb-buffers: Add defaults for .dumb_map_offset and .dumb_destroy

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

 



On Sun, Jul 23, 2017 at 09:16:18PM +0200, Noralf Trønnes wrote:
> Almost everyone did end up using GEM as bo, so this adds defaults
> for the drm_driver.dumb_destroy and drm_driver.dumb_map_offset
> callbacks.
> 
> Signed-off-by: Noralf Trønnes <noralf@xxxxxxxxxxx>

With Eric's suggestion:

Reviewed-by: Sean Paul <seanpaul@xxxxxxxxxxxx>

> ---
>  drivers/gpu/drm/drm_dumb_buffers.c | 26 ++++++++++++++++++--------
>  1 file changed, 18 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_dumb_buffers.c b/drivers/gpu/drm/drm_dumb_buffers.c
> index 10307cc..cd68ab4 100644
> --- a/drivers/gpu/drm/drm_dumb_buffers.c
> +++ b/drivers/gpu/drm/drm_dumb_buffers.c
> @@ -24,6 +24,7 @@
>   */
>  
>  #include <drm/drmP.h>
> +#include <drm/drm_gem.h>
>  
>  #include "drm_crtc_internal.h"
>  
> @@ -42,9 +43,10 @@
>   * create dumb buffers suitable for scanout, which can then be used to create
>   * KMS frame buffers.
>   *
> - * To support dumb objects drivers must implement the &drm_driver.dumb_create,
> - * &drm_driver.dumb_destroy and &drm_driver.dumb_map_offset operations. See
> - * there for further details.
> + * To support dumb objects drivers must implement the &drm_driver.dumb_create
> + * operation. &drm_driver.dumb_destroy defaults to drm_gem_dumb_destroy() if
> + * not set and &drm_driver.dumb_map_offset operations to
> + * drm_gem_dumb_map_offset(). See the callbacks for further details.
>   *
>   * Note that dumb objects may not be used for gpu acceleration, as has been
>   * attempted on some ARM embedded platforms. Such drivers really must have
> @@ -108,11 +110,16 @@ int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
>  {
>  	struct drm_mode_map_dumb *args = data;
>  
> -	/* call driver ioctl to get mmap offset */
> -	if (!dev->driver->dumb_map_offset)
> +	if (!dev->driver->dumb_create)
>  		return -ENOSYS;
>  
> -	return dev->driver->dumb_map_offset(file_priv, dev, args->handle, &args->offset);
> +	if (dev->driver->dumb_map_offset)
> +		return dev->driver->dumb_map_offset(file_priv, dev,
> +						    args->handle,
> +						    &args->offset);
> +	else
> +		return drm_gem_dumb_map_offset(file_priv, dev, args->handle,
> +					       &args->offset);
>  }
>  
>  int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
> @@ -120,9 +127,12 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
>  {
>  	struct drm_mode_destroy_dumb *args = data;
>  
> -	if (!dev->driver->dumb_destroy)
> +	if (!dev->driver->dumb_create)
>  		return -ENOSYS;
>  
> -	return dev->driver->dumb_destroy(file_priv, dev, args->handle);
> +	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);
>  }
>  
> -- 
> 2.7.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://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