Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
From: CK Hu <ck.hu@mediatek.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>,
	linux-mediatek@lists.infradead.org,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Daniel Vetter <daniel.vetter@intel.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 44/59] drm/mediatek: Use drm_atomic_helper_wait_for_fences
Date: Mon, 17 Jun 2019 13:19:31 +0800
Message-ID: <1560748771.16762.0.camel@mtksdaap41> (raw)
In-Reply-To: <20190614203615.12639-45-daniel.vetter@ffwll.ch>

Hi, Daniel:

On Fri, 2019-06-14 at 22:36 +0200, Daniel Vetter wrote:
> If we use the gem fb helper as the prepare_fb hook, plus the
> drm_prime.c import helpers now automatically setting obj->resv, we can
> use the shared helpers to wait for fences instead of rolling our own.
> Note that this relies on mtk setting drm_fb->obj, which is already
> done in mtk_drm_framebuffer_init().

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> 
> Aside: Probably can use the default commit_tail with this again, but I
> didn't check for that.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: CK Hu <ck.hu@mediatek.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-mediatek@lists.infradead.org
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c   | 12 +---------
>  drivers/gpu/drm/mediatek/mtk_drm_fb.c    | 28 ------------------------
>  drivers/gpu/drm/mediatek/mtk_drm_fb.h    |  1 -
>  drivers/gpu/drm/mediatek/mtk_drm_plane.c |  2 ++
>  4 files changed, 3 insertions(+), 40 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index dd8dab562500..2d5caf532431 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -38,22 +38,12 @@ static void mtk_atomic_schedule(struct mtk_drm_private *private,
>  	schedule_work(&private->commit.work);
>  }
>  
> -static void mtk_atomic_wait_for_fences(struct drm_atomic_state *state)
> -{
> -	struct drm_plane *plane;
> -	struct drm_plane_state *new_plane_state;
> -	int i;
> -
> -	for_each_new_plane_in_state(state, plane, new_plane_state, i)
> -		mtk_fb_wait(new_plane_state->fb);
> -}
> -
>  static void mtk_atomic_complete(struct mtk_drm_private *private,
>  				struct drm_atomic_state *state)
>  {
>  	struct drm_device *drm = private->drm;
>  
> -	mtk_atomic_wait_for_fences(state);
> +	drm_atomic_helper_wait_for_fences(drm, state, false);
>  
>  	/*
>  	 * Mediatek drm supports runtime PM, so plane registers cannot be
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_fb.c b/drivers/gpu/drm/mediatek/mtk_drm_fb.c
> index 4c3ad7de2d3b..396ba497986d 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_fb.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_fb.c
> @@ -49,34 +49,6 @@ static struct drm_framebuffer *mtk_drm_framebuffer_init(struct drm_device *dev,
>  	return fb;
>  }
>  
> -/*
> - * Wait for any exclusive fence in fb's gem object's reservation object.
> - *
> - * Returns -ERESTARTSYS if interrupted, else 0.
> - */
> -int mtk_fb_wait(struct drm_framebuffer *fb)
> -{
> -	struct drm_gem_object *gem;
> -	struct reservation_object *resv;
> -	long ret;
> -
> -	if (!fb)
> -		return 0;
> -
> -	gem = fb->obj[0];
> -	if (!gem || !gem->dma_buf || !gem->dma_buf->resv)
> -		return 0;
> -
> -	resv = gem->dma_buf->resv;
> -	ret = reservation_object_wait_timeout_rcu(resv, false, true,
> -						  MAX_SCHEDULE_TIMEOUT);
> -	/* MAX_SCHEDULE_TIMEOUT on success, -ERESTARTSYS if interrupted */
> -	if (WARN_ON(ret < 0))
> -		return ret;
> -
> -	return 0;
> -}
> -
>  struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev,
>  					       struct drm_file *file,
>  					       const struct drm_mode_fb_cmd2 *cmd)
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_fb.h b/drivers/gpu/drm/mediatek/mtk_drm_fb.h
> index 6b80c28e33cf..eb64d26001c6 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_fb.h
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_fb.h
> @@ -6,7 +6,6 @@
>  #ifndef MTK_DRM_FB_H
>  #define MTK_DRM_FB_H
>  
> -int mtk_fb_wait(struct drm_framebuffer *fb);
>  struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev,
>  					       struct drm_file *file,
>  					       const struct drm_mode_fb_cmd2 *cmd);
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> index f2ef83aed6f9..42cc9823eaaa 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> @@ -8,6 +8,7 @@
>  #include <drm/drm_atomic.h>
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_plane_helper.h>
> +#include <drm/drm_gem_framebuffer_helper.h>
>  
>  #include "mtk_drm_crtc.h"
>  #include "mtk_drm_ddp_comp.h"
> @@ -146,6 +147,7 @@ static void mtk_plane_atomic_disable(struct drm_plane *plane,
>  }
>  
>  static const struct drm_plane_helper_funcs mtk_plane_helper_funcs = {
> +	.prepare_fb = drm_gem_fb_prepare_fb,
>  	.atomic_check = mtk_plane_atomic_check,
>  	.atomic_update = mtk_plane_atomic_update,
>  	.atomic_disable = mtk_plane_atomic_disable,



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply index

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190614203615.12639-1-daniel.vetter@ffwll.ch>
2019-06-14 20:35 ` [PATCH 06/59] drm/prime: Actually remove DRIVER_PRIME everywhere Daniel Vetter
2019-06-14 21:36   ` Sam Ravnborg
2019-06-17 15:39   ` [PATCH] " Daniel Vetter
2019-06-17 17:56   ` [PATCH 06/59] " Emil Velikov
2019-06-14 20:35 ` [PATCH 12/59] drm/atmel: Drop drm_gem_prime_export/import Daniel Vetter
2019-06-14 21:43   ` Sam Ravnborg
2019-06-14 20:35 ` [PATCH 14/59] drm/exynos: Drop drm_gem_prime_export Daniel Vetter
2019-06-14 20:35 ` [PATCH 17/59] drm/imx: Drop drm_gem_prime_export/import Daniel Vetter
2019-06-14 20:35 ` [PATCH 19/59] drm/mtk: " Daniel Vetter
2019-06-17  1:51   ` CK Hu
2019-06-14 20:35 ` [PATCH 20/59] drm/meson: " Daniel Vetter
2019-06-18  9:48   ` Neil Armstrong
2019-06-14 20:35 ` [PATCH 22/59] drm/mxsfb: " Daniel Vetter
2019-06-17 13:59   ` Stefan Agner
2019-06-14 20:35 ` [PATCH 27/59] drm/rockchip: " Daniel Vetter
2019-06-15 22:36   ` Heiko Stuebner
2019-06-14 20:35 ` [PATCH 30/59] drm/stm: " Daniel Vetter
2019-06-18  9:55   ` Philippe CORNU
2019-06-14 20:36 ` [PATCH 44/59] drm/mediatek: Use drm_atomic_helper_wait_for_fences Daniel Vetter
2019-06-17  5:19   ` CK Hu [this message]

Reply instructions:

You may reply publically 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=1560748771.16762.0.camel@mtksdaap41 \
    --to=ck.hu@mediatek.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=p.zabel@pengutronix.de \
    /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

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org infradead-linux-arm-kernel@archiver.kernel.org
	public-inbox-index linux-arm-kernel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox