[PATCH V4 2/2] drm/imx: Switch to drm_fb_cma_prepare_fb() helper

Lucas Stach l.stach at pengutronix.de
Mon Nov 14 10:32:47 UTC 2016


Am Montag, den 14.11.2016, 11:07 +0100 schrieb Marek Vasut:
> Remove the common code from the driver and use the
> drm_fb_cma_prepare_fb() helper instead.
> Moveover, call the helper from prepare_fb() plane hook .
> 
> Signed-off-by: Marek Vasut <marex at denx.de>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> Cc: Lucas Stach <l.stach at pengutronix.de>

Reviewed-by: Lucas Stach <l.stach at pengutronix.de>

> ---
> V2: - Rename the function to drm_fb_cma_extract_and_attach_fence()
>     - Add missing newline
> V3: - Call drm_fb_cma_prepare_fb directly
> V4: - Update to latest next/master (b60de3e)
> ---
>  drivers/gpu/drm/imx/imx-drm-core.c | 32 +-------------------------------
>  drivers/gpu/drm/imx/ipuv3-plane.c  |  1 +
>  2 files changed, 2 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
> index a16e8b7..3340429 100644
> --- a/drivers/gpu/drm/imx/imx-drm-core.c
> +++ b/drivers/gpu/drm/imx/imx-drm-core.c
> @@ -18,7 +18,6 @@
>  #include <linux/dma-buf.h>
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
> -#include <linux/reservation.h>
>  #include <drm/drmP.h>
>  #include <drm/drm_atomic.h>
>  #include <drm/drm_atomic_helper.h>
> @@ -151,40 +150,11 @@ static int imx_drm_atomic_check(struct drm_device *dev,
>  	return ret;
>  }
>  
> -static int imx_drm_atomic_commit(struct drm_device *dev,
> -				 struct drm_atomic_state *state,
> -				 bool nonblock)
> -{
> -	struct drm_plane_state *plane_state;
> -	struct drm_plane *plane;
> -	struct dma_buf *dma_buf;
> -	struct dma_fence *fence;
> -	int i;
> -
> -	/*
> -	 * If the plane fb has an dma-buf attached, fish out the exclusive
> -	 * fence for the atomic helper to wait on.
> -	 */
> -	for_each_plane_in_state(state, plane, plane_state, i) {
> -		if ((plane->state->fb != plane_state->fb) && plane_state->fb) {
> -			dma_buf = drm_fb_cma_get_gem_obj(plane_state->fb,
> -							 0)->base.dma_buf;
> -			if (!dma_buf)
> -				continue;
> -			fence = reservation_object_get_excl_rcu(dma_buf->resv);
> -
> -			drm_atomic_set_fence_for_plane(plane_state, fence);
> -		}
> -	}
> -
> -	return drm_atomic_helper_commit(dev, state, nonblock);
> -}
> -
>  static const struct drm_mode_config_funcs imx_drm_mode_config_funcs = {
>  	.fb_create = drm_fb_cma_create,
>  	.output_poll_changed = imx_drm_output_poll_changed,
>  	.atomic_check = imx_drm_atomic_check,
> -	.atomic_commit = imx_drm_atomic_commit,
> +	.atomic_commit = drm_atomic_helper_commit,
>  };
>  
>  static void imx_drm_atomic_commit_tail(struct drm_atomic_state *state)
> diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
> index 6a97e396..e74a0ad 100644
> --- a/drivers/gpu/drm/imx/ipuv3-plane.c
> +++ b/drivers/gpu/drm/imx/ipuv3-plane.c
> @@ -468,6 +468,7 @@ static void ipu_plane_atomic_update(struct drm_plane *plane,
>  }
>  
>  static const struct drm_plane_helper_funcs ipu_plane_helper_funcs = {
> +	.prepare_fb = drm_fb_cma_prepare_fb,
>  	.atomic_check = ipu_plane_atomic_check,
>  	.atomic_disable = ipu_plane_atomic_disable,
>  	.atomic_update = ipu_plane_atomic_update,




More information about the dri-devel mailing list