[PATCH v2 01/22] drm: Add GEM backed framebuffer library

Joe Kniss djmk at google.com
Thu Aug 10 18:30:26 UTC 2017


A few nits.

On Wed, Aug 9, 2017 at 3:12 AM,
<dri-devel-request at lists.freedesktop.org> wrote:
> Send dri-devel mailing list submissions to
>         dri-devel at lists.freedesktop.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://lists.freedesktop.org/mailman/listinfo/dri-devel
> or, via email, send a message with subject or body 'help' to
>         dri-devel-request at lists.freedesktop.org
>
> You can reach the person managing the list at
>         dri-devel-owner at lists.freedesktop.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of dri-devel digest..."
>
>
> Today's Topics:
>
>    1. [PATCH v2 06/22] drm/arm/mali: Use drm_gem_fb_create()
>       (Noralf Trønnes)
>    2. [PATCH v2 01/22] drm: Add GEM backed framebuffer library
>       (Noralf Trønnes)
>    3. [PATCH v2 04/22] drm/arc: Use drm_gem_fb_create()
>       (Noralf Trønnes)
>    4. [PATCH v2 09/22] drm/hisilicon/kirin: Use drm_gem_fb_create()
>       (Noralf Trønnes)
>    5. [PATCH v2 03/22] drm/tinydrm: Use drm_gem_framebuffer_helper
>       (Noralf Trønnes)
>    6. [PATCH v2 05/22] drm/arm/hdlcd: Use drm_gem_fb_create()
>       (Noralf Trønnes)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed,  9 Aug 2017 12:11:09 +0200
> From: Noralf Trønnes <noralf at tronnes.org>
> To: dri-devel at lists.freedesktop.org
> Cc: narmstrong at baylibre.com, liviu.dudau at arm.com,
>         laurent.pinchart at ideasonboard.com, marex at denx.de,
>         boris.brezillon at free-electrons.com, abrodkin at synopsys.com,
>         z.liuxinliang at hisilicon.com, kong.kongxinwei at hisilicon.com,
>         tomi.valkeinen at ti.com, puck.chen at hisilicon.com, jsarha at ti.com,
>         vincent.abriou at st.com, alison.wang at freescale.com,
>         philippe.cornu at st.com, yannick.fertre at st.com, zourongrong at gmail.com,
>         maxime.ripard at free-electrons.com, shawnguo at kernel.org
> Subject: [PATCH v2 06/22] drm/arm/mali: Use drm_gem_fb_create()
> Message-ID: <1502273485-62636-7-git-send-email-noralf at tronnes.org>
> Content-Type: text/plain; charset=UTF-8
>
> drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
> so use the function directly.
>
> Cc: Liviu Dudau <liviu.dudau at arm.com>
> Cc: Brian Starkey <brian.starkey at arm.com>
> Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
> ---
>  drivers/gpu/drm/arm/malidp_drv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> index 1a57cc2..b894466 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.c
> +++ b/drivers/gpu/drm/arm/malidp_drv.c
> @@ -26,6 +26,7 @@
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_fb_cma_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
> +#include <drm/drm_gem_framebuffer_helper.h>
>  #include <drm/drm_of.h>
>
>  #include "malidp_drv.h"
> @@ -249,7 +250,7 @@ static const struct drm_mode_config_helper_funcs malidp_mode_config_helpers = {
>  };
>
>  static const struct drm_mode_config_funcs malidp_mode_config_funcs = {
> -       .fb_create = drm_fb_cma_create,
> +       .fb_create = drm_gem_fb_create,
>         .output_poll_changed = malidp_output_poll_changed,
>         .atomic_check = drm_atomic_helper_check,
>         .atomic_commit = drm_atomic_helper_commit,
> --
> 2.7.4
>
>
>
> ------------------------------
>
> Message: 2
> Date: Wed,  9 Aug 2017 12:11:04 +0200
> From: Noralf Trønnes <noralf at tronnes.org>
> To: dri-devel at lists.freedesktop.org
> Cc: narmstrong at baylibre.com, liviu.dudau at arm.com,
>         laurent.pinchart at ideasonboard.com, marex at denx.de,
>         boris.brezillon at free-electrons.com, abrodkin at synopsys.com,
>         z.liuxinliang at hisilicon.com, kong.kongxinwei at hisilicon.com,
>         tomi.valkeinen at ti.com, puck.chen at hisilicon.com, jsarha at ti.com,
>         vincent.abriou at st.com, alison.wang at freescale.com,
>         philippe.cornu at st.com, yannick.fertre at st.com, zourongrong at gmail.com,
>         maxime.ripard at free-electrons.com, shawnguo at kernel.org
> Subject: [PATCH v2 01/22] drm: Add GEM backed framebuffer library
> Message-ID: <1502273485-62636-2-git-send-email-noralf at tronnes.org>
> Content-Type: text/plain; charset=UTF-8
>
> This library provides helpers for drivers that don't subclass
> drm_framebuffer and are backed by drm_gem_object. The code is
> taken from drm_fb_cma_helper.
>
> Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
> ---
>  Documentation/gpu/drm-kms-helpers.rst        |   9 +
>  drivers/gpu/drm/Makefile                     |   2 +-
>  drivers/gpu/drm/drm_gem_framebuffer_helper.c | 252 +++++++++++++++++++++++++++
>  include/drm/drm_framebuffer.h                |   4 +
>  include/drm/drm_gem_framebuffer_helper.h     |  35 ++++
>  5 files changed, 301 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/gpu/drm/drm_gem_framebuffer_helper.c
>  create mode 100644 include/drm/drm_gem_framebuffer_helper.h
>
> diff --git a/Documentation/gpu/drm-kms-helpers.rst b/Documentation/gpu/drm-kms-helpers.rst
> index 7c5e254..13dd237 100644
> --- a/Documentation/gpu/drm-kms-helpers.rst
> +++ b/Documentation/gpu/drm-kms-helpers.rst
> @@ -296,3 +296,12 @@ Auxiliary Modeset Helpers
>
>  .. kernel-doc:: drivers/gpu/drm/drm_modeset_helper.c
>     :export:
> +
> +Framebuffer GEM Helper Reference
> +================================
> +
> +.. kernel-doc:: drivers/gpu/drm/drm_gem_framebuffer_helper.c
> +   :doc: overview
> +
> +.. kernel-doc:: drivers/gpu/drm/drm_gem_framebuffer_helper.c
> +   :export:
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 24a066e..a8acc19 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -33,7 +33,7 @@ drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \
>                 drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o \
>                 drm_kms_helper_common.o drm_dp_dual_mode_helper.o \
>                 drm_simple_kms_helper.o drm_modeset_helper.o \
> -               drm_scdc_helper.o
> +               drm_scdc_helper.o drm_gem_framebuffer_helper.o
>
>  drm_kms_helper-$(CONFIG_DRM_PANEL_BRIDGE) += bridge/panel.o
>  drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
> diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
> new file mode 100644
> index 0000000..41a506c
> --- /dev/null
> +++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
> @@ -0,0 +1,252 @@
> +/*
> + * drm gem framebuffer helper functions
> + *
> + * Copyright (C) 2017 Noralf Trønnes
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#include <linux/dma-buf.h>
> +#include <linux/dma-fence.h>
> +#include <linux/reservation.h>
> +#include <linux/slab.h>
> +
> +#include <drm/drmP.h>
> +#include <drm/drm_atomic.h>
> +#include <drm/drm_fb_helper.h>
> +#include <drm/drm_fourcc.h>
> +#include <drm/drm_framebuffer.h>
> +#include <drm/drm_gem.h>
> +#include <drm/drm_gem_framebuffer_helper.h>
> +#include <drm/drm_modeset_helper.h>
> +
> +/**
> + * DOC: overview
> + *
> + * This library provides helpers for drivers that don't subclass
> + * &drm_framebuffer and are backed by &drm_gem_object.
> + */
> +
> +/**
> + * drm_gem_fb_get_obj() - Get GEM object for framebuffer
> + * @fb: The framebuffer
> + * @plane: Which plane
> + *
> + * Returns the GEM object for given framebuffer.
> + */
> +struct drm_gem_object *drm_gem_fb_get_obj(struct drm_framebuffer *fb,
> +                                         unsigned int plane)
> +{
> +       if (plane >= 4)
> +               return NULL;
> +
> +       return fb->obj[plane];
> +}
> +EXPORT_SYMBOL_GPL(drm_gem_fb_get_obj);
> +
> +/**
> + * drm_gem_fb_alloc - Allocate GEM backed framebuffer
> + * @dev: DRM device
> + * @mode_cmd: metadata from the userspace fb creation request
> + * @obj: GEM object(s) backing the framebuffer
> + * @num_planes: Number of planes
> + * @funcs: vtable to be used for the new framebuffer object
> + *
> + * Returns:
> + * Allocated struct drm_framebuffer * or error encoded pointer.
> + */
> +struct drm_framebuffer *
> +drm_gem_fb_alloc(struct drm_device *dev,
> +                const struct drm_mode_fb_cmd2 *mode_cmd,
> +                struct drm_gem_object **obj, unsigned int num_planes,
> +                const struct drm_framebuffer_funcs *funcs)
> +{
> +       struct drm_framebuffer *fb;
> +       int ret, i;
> +
> +       fb = kzalloc(sizeof(*fb), GFP_KERNEL);
> +       if (!fb)
> +               return ERR_PTR(-ENOMEM);
> +
> +       drm_helper_mode_fill_fb_struct(dev, fb, mode_cmd);
> +
> +       for (i = 0; i < num_planes; i++)
> +               fb->obj[i] = obj[i];
> +
> +       ret = drm_framebuffer_init(dev, fb, funcs);
> +       if (ret) {
> +               DRM_DEV_ERROR(dev->dev, "Failed to init framebuffer: %d\n",
> +                             ret);
> +               kfree(fb);
> +               return ERR_PTR(ret);
> +       }
> +
> +       return fb;
> +}
> +EXPORT_SYMBOL(drm_gem_fb_alloc);
> +
> +/**
> + * drm_gem_fb_destroy - Free GEM backed framebuffer
> + * @fb: DRM framebuffer
> + *
> + * Frees a GEM backed framebuffer with it's backing buffer(s) and the structure
> + * itself. Drivers can use this as their &drm_framebuffer_funcs->destroy
> + * callback.
> + */
> +void drm_gem_fb_destroy(struct drm_framebuffer *fb)
> +{
> +       int i;
> +
> +       for (i = 0; i < 4; i++) {
> +               if (fb->obj[i])
> +                       drm_gem_object_put_unlocked(fb->obj[i]);

 if(fb->obj[i]) is unnecessary here, drm_gem_object_put_unlocked
checks for NULL too.  If we do the check here, we should be consistent
and do it everywhere...

> +       }
> +
> +       drm_framebuffer_cleanup(fb);
> +       kfree(fb);
> +}
> +EXPORT_SYMBOL(drm_gem_fb_destroy);
> +
> +/**
> + * drm_gem_fb_create_handle - Create handle for GEM backed framebuffer
> + * @fb: DRM framebuffer
> + * @file: drm file
> + * @handle: handle created
> + *
> + * Drivers can use this as their &drm_framebuffer_funcs->create_handle
> + * callback.
> + *
> + * Returns:
> + * 0 on success or a negative error code on failure.
> + */
> +int drm_gem_fb_create_handle(struct drm_framebuffer *fb, struct drm_file *file,
> +                            unsigned int *handle)
> +{
> +       return drm_gem_handle_create(file, fb->obj[0], handle);
> +}
> +EXPORT_SYMBOL(drm_gem_fb_create_handle);
> +
> +/**
> + * drm_gem_fb_create_with_funcs() - helper function for the
> + *                                  &drm_mode_config_funcs.fb_create
> + *                                  callback
> + * @dev: DRM device
> + * @file: drm file for the ioctl call
> + * @mode_cmd: metadata from the userspace fb creation request
> + * @funcs: vtable to be used for the new framebuffer object
> + *
> + * This can be used to set &drm_framebuffer_funcs for drivers that need the
> + * &drm_framebuffer_funcs.dirty callback. Use drm_gem_fb_create() if you don't
> + * need to change &drm_framebuffer_funcs.
> + */
> +struct drm_framebuffer *
> +drm_gem_fb_create_with_funcs(struct drm_device *dev, struct drm_file *file,
> +                            const struct drm_mode_fb_cmd2 *mode_cmd,
> +                            const struct drm_framebuffer_funcs *funcs)
> +{
> +       const struct drm_format_info *info;
> +       struct drm_gem_object *objs[4];
> +       struct drm_framebuffer *fb;
> +       int ret, i;
> +
> +       info = drm_get_format_info(dev, mode_cmd);
> +       if (!info)
> +               return ERR_PTR(-EINVAL);
> +
> +       for (i = 0; i < info->num_planes; i++) {
> +               unsigned int width = mode_cmd->width / (i ? info->hsub : 1);
> +               unsigned int height = mode_cmd->height / (i ? info->vsub : 1);
> +               unsigned int min_size;
> +
> +               objs[i] = drm_gem_object_lookup(file, mode_cmd->handles[i]);
> +               if (!objs[i]) {
> +                       DRM_DEV_ERROR(dev->dev, "Failed to lookup GEM\n");
> +                       ret = -ENOENT;
> +                       goto err_gem_object_put;
> +               }
> +
> +               min_size = (height - 1) * mode_cmd->pitches[i]
> +                        + width * info->cpp[i]
> +                        + mode_cmd->offsets[i];
> +
> +               if (objs[i]->size < min_size) {
> +                       drm_gem_object_put_unlocked(objs[i]);
> +                       ret = -EINVAL;
> +                       goto err_gem_object_put;
> +               }
> +       }
> +
> +       fb = drm_gem_fb_alloc(dev, mode_cmd, objs, i, funcs);
> +       if (IS_ERR(fb)) {
> +               ret = PTR_ERR(fb);
> +               goto err_gem_object_put;
> +       }
> +
> +       return fb;
> +
> +err_gem_object_put:
> +       for (i--; i >= 0; i--)
> +               drm_gem_object_put_unlocked(objs[i]);
> +
> +       return ERR_PTR(ret);
> +}
> +EXPORT_SYMBOL_GPL(drm_gem_fb_create_with_funcs);
> +
> +static const struct drm_framebuffer_funcs drm_gem_fb_funcs = {
> +       .destroy        = drm_gem_fb_destroy,
> +       .create_handle  = drm_gem_fb_create_handle,
> +};
> +
> +/**
> + * drm_gem_fb_create() - &drm_mode_config_funcs.fb_create callback function
> + * @dev: DRM device
> + * @file: drm file for the ioctl call
> + * @mode_cmd: metadata from the userspace fb creation request
> + *
> + * If your hardware has special alignment or pitch requirements these should be
> + * checked before calling this function. Use drm_gem_fb_create_with_funcs() if
> + * you need to set &drm_framebuffer_funcs.dirty.
> + */
> +struct drm_framebuffer *
> +drm_gem_fb_create(struct drm_device *dev, struct drm_file *file,
> +                 const struct drm_mode_fb_cmd2 *mode_cmd)
> +{
> +       return drm_gem_fb_create_with_funcs(dev, file, mode_cmd,
> +                                           &drm_gem_fb_funcs);
> +}
> +EXPORT_SYMBOL_GPL(drm_gem_fb_create);
> +
> +/**
> + * drm_gem_fb_prepare_fb() - Prepare gem framebuffer
> + * @plane: Which plane
> + * @state: Plane state attach fence to
> + *
> + * This should be set as the &struct drm_plane_helper_funcs.prepare_fb hook.
> + *
> + * This function checks if the plane FB has an dma-buf attached, extracts
> + * the exclusive fence and attaches it to plane state for the atomic helper
> + * to wait on.
> + *
> + * There is no need for cleanup_fb for gem based framebuffer drivers.
> + */
> +int drm_gem_fb_prepare_fb(struct drm_plane *plane,
> +                         struct drm_plane_state *state)
> +{
> +       struct dma_buf *dma_buf;
> +       struct dma_fence *fence;
> +
> +       if ((plane->state->fb == state->fb) || !state->fb)
> +               return 0;
> +
> +       dma_buf = drm_gem_fb_get_obj(state->fb, 0)->dma_buf;
> +       if (dma_buf) {
> +               fence = reservation_object_get_excl_rcu(dma_buf->resv);
> +               drm_atomic_set_fence_for_plane(state, fence);
> +       }
> +
> +       return 0;
> +}
> +EXPORT_SYMBOL_GPL(drm_gem_fb_prepare_fb);
> diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h
> index 5244f05..50def22 100644
> --- a/include/drm/drm_framebuffer.h
> +++ b/include/drm/drm_framebuffer.h
> @@ -190,6 +190,10 @@ struct drm_framebuffer {
>          * @filp_head: Placed on &drm_file.fbs, protected by &drm_file.fbs_lock.
>          */
>         struct list_head filp_head;
> +       /**
> +        * @obj: GEM objects backing the framebuffer, one per plane (optional).
> +        */
> +       struct drm_gem_object *obj[4];
>  };

The other plane-based arrays are plural (pitches, offsets) prefer
objs[4], or better yet gem_objs[4] ;)

>
>  #define obj_to_fb(x) container_of(x, struct drm_framebuffer, base)
> diff --git a/include/drm/drm_gem_framebuffer_helper.h b/include/drm/drm_gem_framebuffer_helper.h
> new file mode 100644
> index 0000000..af3d1ee
> --- /dev/null
> +++ b/include/drm/drm_gem_framebuffer_helper.h
> @@ -0,0 +1,35 @@
> +#ifndef __DRM_GEM_FB_HELPER_H__
> +#define __DRM_GEM_FB_HELPER_H__
> +
> +struct drm_device;
> +struct drm_file;
> +struct drm_framebuffer;
> +struct drm_framebuffer_funcs;
> +struct drm_gem_object;
> +struct drm_mode_fb_cmd2;
> +struct drm_plane;
> +struct drm_plane_state;
> +
> +struct drm_gem_object *drm_gem_fb_get_obj(struct drm_framebuffer *fb,
> +                                         unsigned int plane);
> +struct drm_framebuffer *
> +drm_gem_fb_alloc(struct drm_device *dev,
> +                const struct drm_mode_fb_cmd2 *mode_cmd,
> +                struct drm_gem_object **obj, unsigned int num_planes,
> +                const struct drm_framebuffer_funcs *funcs);
> +void drm_gem_fb_destroy(struct drm_framebuffer *fb);
> +int drm_gem_fb_create_handle(struct drm_framebuffer *fb, struct drm_file *file,
> +                            unsigned int *handle);
> +
> +struct drm_framebuffer *
> +drm_gem_fb_create_with_funcs(struct drm_device *dev, struct drm_file *file,
> +                            const struct drm_mode_fb_cmd2 *mode_cmd,
> +                            const struct drm_framebuffer_funcs *funcs);
> +struct drm_framebuffer *
> +drm_gem_fb_create(struct drm_device *dev, struct drm_file *file,
> +                 const struct drm_mode_fb_cmd2 *mode_cmd);
> +
> +int drm_gem_fb_prepare_fb(struct drm_plane *plane,
> +                         struct drm_plane_state *state);
> +
> +#endif
> --
> 2.7.4
>
>
>
> ------------------------------
>
> Message: 3
> Date: Wed,  9 Aug 2017 12:11:07 +0200
> From: Noralf Trønnes <noralf at tronnes.org>
> To: dri-devel at lists.freedesktop.org
> Cc: narmstrong at baylibre.com, liviu.dudau at arm.com,
>         laurent.pinchart at ideasonboard.com, marex at denx.de,
>         boris.brezillon at free-electrons.com, abrodkin at synopsys.com,
>         z.liuxinliang at hisilicon.com, kong.kongxinwei at hisilicon.com,
>         tomi.valkeinen at ti.com, puck.chen at hisilicon.com, jsarha at ti.com,
>         vincent.abriou at st.com, alison.wang at freescale.com,
>         philippe.cornu at st.com, yannick.fertre at st.com, zourongrong at gmail.com,
>         maxime.ripard at free-electrons.com, shawnguo at kernel.org
> Subject: [PATCH v2 04/22] drm/arc: Use drm_gem_fb_create()
> Message-ID: <1502273485-62636-5-git-send-email-noralf at tronnes.org>
> Content-Type: text/plain; charset=UTF-8
>
> drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
> so use the function directly.
>
> Cc: Alexey Brodkin <abrodkin at synopsys.com>
> Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
> ---
>  drivers/gpu/drm/arc/arcpgu_drv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
> index 415b7da..088fd51 100644
> --- a/drivers/gpu/drm/arc/arcpgu_drv.c
> +++ b/drivers/gpu/drm/arc/arcpgu_drv.c
> @@ -18,6 +18,7 @@
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_fb_cma_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
> +#include <drm/drm_gem_framebuffer_helper.h>
>  #include <drm/drm_atomic_helper.h>
>  #include <linux/of_reserved_mem.h>
>
> @@ -32,7 +33,7 @@ static void arcpgu_fb_output_poll_changed(struct drm_device *dev)
>  }
>
>  static struct drm_mode_config_funcs arcpgu_drm_modecfg_funcs = {
> -       .fb_create  = drm_fb_cma_create,
> +       .fb_create  = drm_gem_fb_create,
>         .output_poll_changed = arcpgu_fb_output_poll_changed,
>         .atomic_check = drm_atomic_helper_check,
>         .atomic_commit = drm_atomic_helper_commit,
> --
> 2.7.4
>
>
>
> ------------------------------
>
> Message: 4
> Date: Wed,  9 Aug 2017 12:11:12 +0200
> From: Noralf Trønnes <noralf at tronnes.org>
> To: dri-devel at lists.freedesktop.org
> Cc: narmstrong at baylibre.com, liviu.dudau at arm.com,
>         laurent.pinchart at ideasonboard.com, marex at denx.de,
>         boris.brezillon at free-electrons.com, abrodkin at synopsys.com,
>         z.liuxinliang at hisilicon.com, kong.kongxinwei at hisilicon.com,
>         tomi.valkeinen at ti.com, puck.chen at hisilicon.com, jsarha at ti.com,
>         vincent.abriou at st.com, alison.wang at freescale.com,
>         philippe.cornu at st.com, yannick.fertre at st.com, zourongrong at gmail.com,
>         maxime.ripard at free-electrons.com, shawnguo at kernel.org
> Subject: [PATCH v2 09/22] drm/hisilicon/kirin: Use drm_gem_fb_create()
> Message-ID: <1502273485-62636-10-git-send-email-noralf at tronnes.org>
> Content-Type: text/plain; charset=UTF-8
>
> drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
> so use the function directly.
>
> Cc: Xinliang Liu <z.liuxinliang at hisilicon.com>
> Cc: Rongrong Zou <zourongrong at gmail.com>
> Cc: Xinwei Kong <kong.kongxinwei at hisilicon.com>
> Cc: Chen Feng <puck.chen at hisilicon.com>
> Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index 79fcce7..7a06d3b 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -22,6 +22,7 @@
>  #include <drm/drmP.h>
>  #include <drm/drm_gem_cma_helper.h>
>  #include <drm/drm_fb_cma_helper.h>
> +#include <drm/drm_gem_framebuffer_helper.h>
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_of.h>
> @@ -56,7 +57,7 @@ static void kirin_fbdev_output_poll_changed(struct drm_device *dev)
>  }
>
>  static const struct drm_mode_config_funcs kirin_drm_mode_config_funcs = {
> -       .fb_create = drm_fb_cma_create,
> +       .fb_create = drm_gem_fb_create,
>         .output_poll_changed = kirin_fbdev_output_poll_changed,
>         .atomic_check = drm_atomic_helper_check,
>         .atomic_commit = drm_atomic_helper_commit,
> --
> 2.7.4
>
>
>
> ------------------------------
>
> Message: 5
> Date: Wed,  9 Aug 2017 12:11:06 +0200
> From: Noralf Trønnes <noralf at tronnes.org>
> To: dri-devel at lists.freedesktop.org
> Cc: narmstrong at baylibre.com, liviu.dudau at arm.com,
>         laurent.pinchart at ideasonboard.com, marex at denx.de,
>         boris.brezillon at free-electrons.com, abrodkin at synopsys.com,
>         z.liuxinliang at hisilicon.com, kong.kongxinwei at hisilicon.com,
>         tomi.valkeinen at ti.com, puck.chen at hisilicon.com, jsarha at ti.com,
>         vincent.abriou at st.com, alison.wang at freescale.com,
>         philippe.cornu at st.com, yannick.fertre at st.com, zourongrong at gmail.com,
>         maxime.ripard at free-electrons.com, shawnguo at kernel.org
> Subject: [PATCH v2 03/22] drm/tinydrm: Use drm_gem_framebuffer_helper
> Message-ID: <1502273485-62636-4-git-send-email-noralf at tronnes.org>
> Content-Type: text/plain; charset=UTF-8
>
> Use drm_gem_framebuffer_helper directly instead of the cma
> library wrappers.
>
> Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
> ---
>  drivers/gpu/drm/tinydrm/core/tinydrm-core.c | 3 ++-
>  drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c | 5 +++--
>  drivers/gpu/drm/tinydrm/mipi-dbi.c          | 5 +++--
>  drivers/gpu/drm/tinydrm/repaper.c           | 5 +++--
>  4 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-core.c b/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
> index 551709e..1a8a57c 100644
> --- a/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
> +++ b/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
> @@ -10,6 +10,7 @@
>  #include <drm/drm_atomic.h>
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_crtc_helper.h>
> +#include <drm/drm_gem_framebuffer_helper.h>
>  #include <drm/tinydrm/tinydrm.h>
>  #include <linux/device.h>
>  #include <linux/dma-buf.h>
> @@ -128,7 +129,7 @@ tinydrm_fb_create(struct drm_device *drm, struct drm_file *file_priv,
>  {
>         struct tinydrm_device *tdev = drm->dev_private;
>
> -       return drm_fb_cma_create_with_funcs(drm, file_priv, mode_cmd,
> +       return drm_gem_fb_create_with_funcs(drm, file_priv, mode_cmd,
>                                             tdev->fb_funcs);
>  }
>
> diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
> index ec43fb7..f4fddec 100644
> --- a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
> +++ b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
> @@ -9,6 +9,7 @@
>
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_crtc_helper.h>
> +#include <drm/drm_gem_framebuffer_helper.h>
>  #include <drm/drm_modes.h>
>  #include <drm/tinydrm/tinydrm.h>
>
> @@ -145,7 +146,7 @@ EXPORT_SYMBOL(tinydrm_display_pipe_update);
>   * @pipe: Simple display pipe
>   * @plane_state: Plane state
>   *
> - * This function uses drm_fb_cma_prepare_fb() to check if the plane FB has an
> + * This function uses drm_gem_fb_prepare_fb() to check if the plane FB has an
>   * dma-buf attached, extracts the exclusive fence and attaches it to plane
>   * state for the atomic helper to wait on. Drivers can use this as their
>   * &drm_simple_display_pipe_funcs->prepare_fb callback.
> @@ -153,7 +154,7 @@ EXPORT_SYMBOL(tinydrm_display_pipe_update);
>  int tinydrm_display_pipe_prepare_fb(struct drm_simple_display_pipe *pipe,
>                                     struct drm_plane_state *plane_state)
>  {
> -       return drm_fb_cma_prepare_fb(&pipe->plane, plane_state);
> +       return drm_gem_fb_prepare_fb(&pipe->plane, plane_state);
>  }
>  EXPORT_SYMBOL(tinydrm_display_pipe_prepare_fb);
>
> diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c
> index c83eeb7..466fab7 100644
> --- a/drivers/gpu/drm/tinydrm/mipi-dbi.c
> +++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c
> @@ -9,6 +9,7 @@
>   * (at your option) any later version.
>   */
>
> +#include <drm/drm_gem_framebuffer_helper.h>
>  #include <drm/tinydrm/mipi-dbi.h>
>  #include <drm/tinydrm/tinydrm-helpers.h>
>  #include <linux/debugfs.h>
> @@ -253,8 +254,8 @@ static int mipi_dbi_fb_dirty(struct drm_framebuffer *fb,
>  }
>
>  static const struct drm_framebuffer_funcs mipi_dbi_fb_funcs = {
> -       .destroy        = drm_fb_cma_destroy,
> -       .create_handle  = drm_fb_cma_create_handle,
> +       .destroy        = drm_gem_fb_destroy,
> +       .create_handle  = drm_gem_fb_create_handle,
>         .dirty          = mipi_dbi_fb_dirty,
>  };
>
> diff --git a/drivers/gpu/drm/tinydrm/repaper.c b/drivers/gpu/drm/tinydrm/repaper.c
> index 3343d3f..bdbc1c7 100644
> --- a/drivers/gpu/drm/tinydrm/repaper.c
> +++ b/drivers/gpu/drm/tinydrm/repaper.c
> @@ -25,6 +25,7 @@
>  #include <linux/spi/spi.h>
>  #include <linux/thermal.h>
>
> +#include <drm/drm_gem_framebuffer_helper.h>
>  #include <drm/tinydrm/tinydrm.h>
>  #include <drm/tinydrm/tinydrm-helpers.h>
>
> @@ -614,8 +615,8 @@ static int repaper_fb_dirty(struct drm_framebuffer *fb,
>  }
>
>  static const struct drm_framebuffer_funcs repaper_fb_funcs = {
> -       .destroy        = drm_fb_cma_destroy,
> -       .create_handle  = drm_fb_cma_create_handle,
> +       .destroy        = drm_gem_fb_destroy,
> +       .create_handle  = drm_gem_fb_create_handle,
>         .dirty          = repaper_fb_dirty,
>  };
>
> --
> 2.7.4
>
>
>
> ------------------------------
>
> Message: 6
> Date: Wed,  9 Aug 2017 12:11:08 +0200
> From: Noralf Trønnes <noralf at tronnes.org>
> To: dri-devel at lists.freedesktop.org
> Cc: narmstrong at baylibre.com, liviu.dudau at arm.com,
>         laurent.pinchart at ideasonboard.com, marex at denx.de,
>         boris.brezillon at free-electrons.com, abrodkin at synopsys.com,
>         z.liuxinliang at hisilicon.com, kong.kongxinwei at hisilicon.com,
>         tomi.valkeinen at ti.com, puck.chen at hisilicon.com, jsarha at ti.com,
>         vincent.abriou at st.com, alison.wang at freescale.com,
>         philippe.cornu at st.com, yannick.fertre at st.com, zourongrong at gmail.com,
>         maxime.ripard at free-electrons.com, shawnguo at kernel.org
> Subject: [PATCH v2 05/22] drm/arm/hdlcd: Use drm_gem_fb_create()
> Message-ID: <1502273485-62636-6-git-send-email-noralf at tronnes.org>
> Content-Type: text/plain; charset=UTF-8
>
> drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
> so use the function directly.
>
> Cc: Liviu Dudau <liviu.dudau at arm.com>
> Cc: Brian Starkey <brian.starkey at arm.com>
> Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
> ---
>  drivers/gpu/drm/arm/hdlcd_drv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
> index f9bda7b..764d0c8 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> @@ -25,6 +25,7 @@
>  #include <drm/drm_fb_helper.h>
>  #include <drm/drm_fb_cma_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
> +#include <drm/drm_gem_framebuffer_helper.h>
>  #include <drm/drm_of.h>
>
>  #include "hdlcd_drv.h"
> @@ -106,7 +107,7 @@ static void hdlcd_fb_output_poll_changed(struct drm_device *drm)
>  }
>
>  static const struct drm_mode_config_funcs hdlcd_mode_config_funcs = {
> -       .fb_create = drm_fb_cma_create,
> +       .fb_create = drm_gem_fb_create,
>         .output_poll_changed = hdlcd_fb_output_poll_changed,
>         .atomic_check = drm_atomic_helper_check,
>         .atomic_commit = drm_atomic_helper_commit,
> --
> 2.7.4
>
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
> ------------------------------
>
> End of dri-devel Digest, Vol 89, Issue 180
> ******************************************


More information about the dri-devel mailing list