Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1402138
| From | Daniel Vetter <daniel@ffwll.ch> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v4 2/3] drm/fb-cma-helper: Add function drm_fb_cma_create_with_funcs() |
| Date | 2016-05-17 09:10 +0200 |
| Message-ID | <rzHiG-1ph-3@gated-at.bofh.it> (permalink) |
| References | <ry3x0-2P0-5@gated-at.bofh.it> <ry3x0-2P0-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, May 12, 2016 at 08:25:22PM +0200, Noralf Trønnes wrote:
> Add drm_fb_cma_create_with_funcs() for drivers that need to set the
> dirty() callback.
>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Merged the first 2 patches to drm-misc, thanks.
-Daniel
> ---
>
> Changes since v3:
> - funcs argument should be const
>
> Changes since v1:
> - Expand docs
>
> drivers/gpu/drm/drm_fb_cma_helper.c | 31 +++++++++++++++++++++++++------
> include/drm/drm_fb_cma_helper.h | 3 +++
> 2 files changed, 28 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
> index 815c72f..2248c32 100644
> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> @@ -159,13 +159,17 @@ static struct drm_fb_cma *drm_fb_cma_alloc(struct drm_device *dev,
> }
>
> /**
> - * drm_fb_cma_create() - (struct drm_mode_config_funcs *)->fb_create callback function
> + * drm_fb_cma_create_with_funcs() - helper function for the
> + * &drm_mode_config_funcs ->fb_create
> + * callback function
> *
> - * If your hardware has special alignment or pitch requirements these should be
> - * checked before calling this function.
> + * This can be used to set &drm_framebuffer_funcs for drivers that need the
> + * dirty() callback. Use drm_fb_cma_create() if you don't need to change
> + * &drm_framebuffer_funcs.
> */
> -struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev,
> - struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd)
> +struct drm_framebuffer *drm_fb_cma_create_with_funcs(struct drm_device *dev,
> + struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd,
> + const struct drm_framebuffer_funcs *funcs)
> {
> struct drm_fb_cma *fb_cma;
> struct drm_gem_cma_object *objs[4];
> @@ -202,7 +206,7 @@ struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev,
> objs[i] = to_drm_gem_cma_obj(obj);
> }
>
> - fb_cma = drm_fb_cma_alloc(dev, mode_cmd, objs, i, &drm_fb_cma_funcs);
> + fb_cma = drm_fb_cma_alloc(dev, mode_cmd, objs, i, funcs);
> if (IS_ERR(fb_cma)) {
> ret = PTR_ERR(fb_cma);
> goto err_gem_object_unreference;
> @@ -215,6 +219,21 @@ err_gem_object_unreference:
> drm_gem_object_unreference_unlocked(&objs[i]->base);
> return ERR_PTR(ret);
> }
> +EXPORT_SYMBOL_GPL(drm_fb_cma_create_with_funcs);
> +
> +/**
> + * drm_fb_cma_create() - &drm_mode_config_funcs ->fb_create callback function
> + *
> + * If your hardware has special alignment or pitch requirements these should be
> + * checked before calling this function. Use drm_fb_cma_create_with_funcs() if
> + * you need to set &drm_framebuffer_funcs ->dirty.
> + */
> +struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev,
> + struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd)
> +{
> + return drm_fb_cma_create_with_funcs(dev, file_priv, mode_cmd,
> + &drm_fb_cma_funcs);
> +}
> EXPORT_SYMBOL_GPL(drm_fb_cma_create);
>
> /**
> diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
> index ac38a05..fd0dde9 100644
> --- a/include/drm/drm_fb_cma_helper.h
> +++ b/include/drm/drm_fb_cma_helper.h
> @@ -31,6 +31,9 @@ void drm_fb_cma_destroy(struct drm_framebuffer *fb);
> int drm_fb_cma_create_handle(struct drm_framebuffer *fb,
> struct drm_file *file_priv, unsigned int *handle);
>
> +struct drm_framebuffer *drm_fb_cma_create_with_funcs(struct drm_device *dev,
> + struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd,
> + const struct drm_framebuffer_funcs *funcs);
> struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev,
> struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd);
>
> --
> 2.8.2
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v4 0/3] drm: Add various helpers for simple drivers Noralf Trønnes <noralf@tronnes.org> - 2016-05-12 20:30 +0200
[PATCH v4 2/3] drm/fb-cma-helper: Add function drm_fb_cma_create_with_funcs() Noralf Trønnes <noralf@tronnes.org> - 2016-05-12 20:30 +0200
Re: [PATCH v4 2/3] drm/fb-cma-helper: Add function drm_fb_cma_create_with_funcs() Daniel Vetter <daniel@ffwll.ch> - 2016-05-17 09:10 +0200
[PATCH v4 3/3] drm: Add helper for simple display pipeline Noralf Trønnes <noralf@tronnes.org> - 2016-05-12 20:30 +0200
Re: [PATCH v4 3/3] drm: Add helper for simple display pipeline Ville Syrjälä <ville.syrjala@linux.intel.com> - 2016-05-12 20:40 +0200
Re: [PATCH v4 3/3] drm: Add helper for simple display pipeline Daniel Vetter <daniel@ffwll.ch> - 2016-05-17 09:10 +0200
Re: [PATCH v4 3/3] drm: Add helper for simple display pipeline Ville Syrjälä <ville.syrjala@linux.intel.com> - 2016-05-17 09:50 +0200
Re: [PATCH v4 3/3] drm: Add helper for simple display pipeline Daniel Vetter <daniel@ffwll.ch> - 2016-05-17 10:00 +0200
Re: [PATCH v4 3/3] drm: Add helper for simple display pipeline Noralf Trønnes <noralf@tronnes.org> - 2016-05-17 14:10 +0200
Re: [PATCH v4 3/3] drm: Add helper for simple display pipeline Ville Syrjälä <ville.syrjala@linux.intel.com> - 2016-05-17 14:20 +0200
Re: [PATCH v4 3/3] drm: Add helper for simple display pipeline Noralf Trønnes <noralf@tronnes.org> - 2016-05-17 14:30 +0200
Re: [PATCH v4 3/3] drm: Add helper for simple display pipeline Daniel Vetter <daniel@ffwll.ch> - 2016-05-17 15:10 +0200
Re: [PATCH v4 3/3] drm: Add helper for simple display pipeline Ville Syrjälä <ville.syrjala@linux.intel.com> - 2016-05-17 15:20 +0200
Re: [PATCH v4 3/3] drm: Add helper for simple display pipeline Daniel Vetter <daniel@ffwll.ch> - 2016-05-17 15:20 +0200
Re: [PATCH v4 3/3] drm: Add helper for simple display pipeline Ville Syrjälä <ville.syrjala@linux.intel.com> - 2016-05-17 16:50 +0200
Re: [PATCH v4 3/3] drm: Add helper for simple display pipeline Noralf Trønnes <noralf@tronnes.org> - 2016-05-29 17:40 +0200
Re: [PATCH v4 3/3] drm: Add helper for simple display pipeline Daniel Vetter <daniel@ffwll.ch> - 2016-05-30 10:20 +0200
[PATCH v4 1/3] drm/fb-cma-helper: Use const for drm_framebuffer_funcs argument Noralf Trønnes <noralf@tronnes.org> - 2016-05-12 20:30 +0200
Re: [PATCH v4 0/3] drm: Add various helpers for simple drivers Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2016-05-12 21:10 +0200
csiph-web