All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 01/10] drm: Extract drm_dumb_buffers.c
Date: Tue, 15 Nov 2016 10:42:08 +0000	[thread overview]
Message-ID: <20161115104208.GQ30410@nuc-i3427.alporthouse.com> (raw)
In-Reply-To: <20161114115825.22050-2-daniel.vetter@ffwll.ch>

On Mon, Nov 14, 2016 at 12:58:16PM +0100, Daniel Vetter wrote:
> Just code movement, doc cleanup will follow up later.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/Makefile            |   3 +-
>  drivers/gpu/drm/drm_crtc.c          | 109 -----------------------------
>  drivers/gpu/drm/drm_crtc_internal.h |  18 ++---
>  drivers/gpu/drm/drm_dumb_buffers.c  | 135 ++++++++++++++++++++++++++++++++++++
>  4 files changed, 147 insertions(+), 118 deletions(-)
>  create mode 100644 drivers/gpu/drm/drm_dumb_buffers.c
> 
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index f217274754d4..adcfc8f922e3 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -15,7 +15,8 @@ drm-y       :=	drm_auth.o drm_bufs.o drm_cache.o \
>  		drm_modeset_lock.o drm_atomic.o drm_bridge.o \
>  		drm_framebuffer.o drm_connector.o drm_blend.o \
>  		drm_encoder.o drm_mode_object.o drm_property.o \
> -		drm_plane.o drm_color_mgmt.o drm_print.o
> +		drm_plane.o drm_color_mgmt.o drm_print.o \
> +		drm_dumb_buffers.o
>  
>  drm-$(CONFIG_COMPAT) += drm_ioc32.o
>  drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 4f34d9a34190..0ece33cc0dc6 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -960,115 +960,6 @@ void drm_mode_config_reset(struct drm_device *dev)
>  EXPORT_SYMBOL(drm_mode_config_reset);
>  
>  /**
> - * drm_mode_create_dumb_ioctl - create a dumb backing storage buffer
> - * @dev: DRM device
> - * @data: ioctl data
> - * @file_priv: DRM file info
> - *
> - * This creates a new dumb buffer in the driver's backing storage manager (GEM,
> - * TTM or something else entirely) and returns the resulting buffer handle. This
> - * handle can then be wrapped up into a framebuffer modeset object.
> - *
> - * Note that userspace is not allowed to use such objects for render
> - * acceleration - drivers must create their own private ioctls for such a use
> - * case.
> - *
> - * Called by the user via ioctl.
> - *
> - * Returns:
> - * Zero on success, negative errno on failure.
> - */
> -int drm_mode_create_dumb_ioctl(struct drm_device *dev,
> -			       void *data, struct drm_file *file_priv)
> -{
> -	struct drm_mode_create_dumb *args = data;
> -	u32 cpp, stride, size;
> -
> -	if (!dev->driver->dumb_create)
> -		return -ENOSYS;
> -	if (!args->width || !args->height || !args->bpp)
> -		return -EINVAL;
> -
> -	/* overflow checks for 32bit size calculations */
> -	/* NOTE: DIV_ROUND_UP() can overflow */
> -	cpp = DIV_ROUND_UP(args->bpp, 8);
> -	if (!cpp || cpp > 0xffffffffU / args->width)
> -		return -EINVAL;
> -	stride = cpp * args->width;
> -	if (args->height > 0xffffffffU / stride)
> -		return -EINVAL;
> -
> -	/* test for wrap-around */
> -	size = args->height * stride;
> -	if (PAGE_ALIGN(size) == 0)
> -		return -EINVAL;
> -
> -	/*
> -	 * handle, pitch and size are output parameters. Zero them out to
> -	 * prevent drivers from accidentally using uninitialized data. Since
> -	 * not all existing userspace is clearing these fields properly we
> -	 * cannot reject IOCTL with garbage in them.
> -	 */
> -	args->handle = 0;
> -	args->pitch = 0;
> -	args->size = 0;
> -
> -	return dev->driver->dumb_create(file_priv, dev, args);
> -}
> -
> -/**
> - * drm_mode_mmap_dumb_ioctl - create an mmap offset for a dumb backing storage buffer
> - * @dev: DRM device
> - * @data: ioctl data
> - * @file_priv: DRM file info
> - *
> - * Allocate an offset in the drm device node's address space to be able to
> - * memory map a dumb buffer.
> - *
> - * Called by the user via ioctl.
> - *
> - * Returns:
> - * Zero on success, negative errno on failure.
> - */
> -int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
> -			     void *data, struct drm_file *file_priv)
> -{
> -	struct drm_mode_map_dumb *args = data;
> -
> -	/* call driver ioctl to get mmap offset */
> -	if (!dev->driver->dumb_map_offset)
> -		return -ENOSYS;
> -
> -	return dev->driver->dumb_map_offset(file_priv, dev, args->handle, &args->offset);
> -}
> -
> -/**
> - * drm_mode_destroy_dumb_ioctl - destroy a dumb backing strage buffer
> - * @dev: DRM device
> - * @data: ioctl data
> - * @file_priv: DRM file info
> - *
> - * This destroys the userspace handle for the given dumb backing storage buffer.
> - * Since buffer objects must be reference counted in the kernel a buffer object
> - * won't be immediately freed if a framebuffer modeset object still uses it.
> - *
> - * Called by the user via ioctl.
> - *
> - * Returns:
> - * Zero on success, negative errno on failure.
> - */
> -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_destroy)
> -		return -ENOSYS;
> -
> -	return dev->driver->dumb_destroy(file_priv, dev, args->handle);
> -}
> -
> -/**
>   * drm_mode_config_init - initialize DRM mode_configuration structure
>   * @dev: DRM device
>   *
> diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h
> index b076ef58635d..3d23a473ec35 100644
> --- a/drivers/gpu/drm/drm_crtc_internal.h
> +++ b/drivers/gpu/drm/drm_crtc_internal.h
> @@ -43,14 +43,6 @@ int drm_crtc_check_viewport(const struct drm_crtc *crtc,
>  
>  void drm_fb_release(struct drm_file *file_priv);
>  
> -/* dumb buffer support IOCTLs */
> -int drm_mode_create_dumb_ioctl(struct drm_device *dev,
> -			       void *data, struct drm_file *file_priv);
> -int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
> -			     void *data, struct drm_file *file_priv);
> -int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
> -				void *data, struct drm_file *file_priv);
> -
>  /* IOCTLs */
>  int drm_mode_getresources(struct drm_device *dev,
>  			  void *data, struct drm_file *file_priv);
> @@ -59,6 +51,16 @@ int drm_mode_getcrtc(struct drm_device *dev,
>  int drm_mode_setcrtc(struct drm_device *dev,
>  		     void *data, struct drm_file *file_priv);
>  
> +/* drm_dumb_buffers.c */
> +
> +/* IOCTLs */
> +int drm_mode_create_dumb_ioctl(struct drm_device *dev,
> +			       void *data, struct drm_file *file_priv);
> +int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
> +			     void *data, struct drm_file *file_priv);
> +int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
> +				void *data, struct drm_file *file_priv);
> +
>  /* drm_color_mgmt.c */
>  
>  /* IOCTLs */
> diff --git a/drivers/gpu/drm/drm_dumb_buffers.c b/drivers/gpu/drm/drm_dumb_buffers.c
> new file mode 100644
> index 000000000000..4b4364b61c8d
> --- /dev/null
> +++ b/drivers/gpu/drm/drm_dumb_buffers.c
> @@ -0,0 +1,135 @@
> +/*
> + * Copyright (c) 2016 Intel Corporation

I've mentioned this elsewhere, but we should also retain the original
copyright statements for the code we are copying.

Otherwise,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-11-15 10:42 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-14 11:58 [PATCH 00/10] drm_crtc.[hc] cleanup and documenation Daniel Vetter
2016-11-14 11:58 ` [PATCH 01/10] drm: Extract drm_dumb_buffers.c Daniel Vetter
2016-11-15 10:42   ` Chris Wilson [this message]
2016-11-15 11:47     ` Daniel Vetter
2016-11-15 11:58       ` [Intel-gfx] " Chris Wilson
2016-11-14 11:58 ` [PATCH 02/10] drm/i915: Fixup kerneldoc includes Daniel Vetter
2016-11-15 10:44   ` Chris Wilson
2016-11-15 10:56     ` Daniel Vetter
2016-11-15 14:28     ` Daniel Vetter
2016-11-14 11:58 ` [PATCH 03/10] doc/dma-buf: Fix up include directives Daniel Vetter
2016-11-15 10:45   ` Chris Wilson
2016-11-14 11:58 ` [PATCH 04/10] drm: Extract drm_drv.h Daniel Vetter
2016-11-15 10:29   ` [Intel-gfx] " Chris Wilson
2016-11-14 11:58 ` [PATCH 05/10] drm: Clean up kerneldoc for struct drm_driver Daniel Vetter
2016-11-15 10:35   ` [Intel-gfx] " Chris Wilson
2016-11-14 11:58 ` [PATCH 06/10] drm: Consolidate dumb buffer docs Daniel Vetter
2016-11-15 10:29   ` [Intel-gfx] " Chris Wilson
2016-11-14 11:58 ` [PATCH 07/10] drm/print: Move kerneldoc next to definition Daniel Vetter
2016-11-15 10:37   ` [Intel-gfx] " Chris Wilson
2016-11-15 11:53     ` Daniel Vetter
2016-11-15 11:58       ` [Intel-gfx] " Daniel Vetter
2016-11-14 11:58 ` [PATCH 08/10] drm: Extract drm_mode_config.[hc] Daniel Vetter
2016-11-15 10:32   ` [Intel-gfx] " Chris Wilson
2016-11-15 14:28     ` Daniel Vetter
2016-11-14 11:58 ` [PATCH 09/10] drm: Move tile group code into drm_connector.c Daniel Vetter
2016-11-15 10:40   ` Chris Wilson
2016-11-14 11:58 ` [PATCH 10/10] drm: Drop externs from drm_crtc.h Daniel Vetter
2016-11-15 10:33   ` Chris Wilson
2016-11-14 12:47 ` ✗ Fi.CI.BAT: warning for drm_crtc.[hc] cleanup and documenation Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161115104208.GQ30410@nuc-i3427.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --subject='Re: [PATCH 01/10] drm: Extract drm_dumb_buffers.c' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.