[Intel-gfx] [PATCH 1/2] drm: add flags argument to crtc page_flip callback

Mario Kleiner mario.kleiner at tuebingen.mpg.de
Fri Nov 2 05:29:10 CET 2012


On 30.10.12 19:33, Jesse Barnes wrote:
> This lets us pass down flags the drivers might be interested in, e.g. async.
>
> Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>

Hi Jesse

I like it :) -- Anything that helps to get rid of the troublesome 
'SwapBuffersWait' madness in the ddx at some point makes me happy.

> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index ef1b221..b4964ac 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -3627,7 +3627,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>   			(void (*) (struct drm_pending_event *)) kfree;
>   	}
>
> -	ret = crtc->funcs->page_flip(crtc, fb, e);
> +	ret = crtc->funcs->page_flip(crtc, fb, e, flags);

I think this should be page_flip->flags, ie.

+	ret = crtc->funcs->page_flip(crtc, fb, e, page_flip->flags);

because flags is used here:

>   	if (ret) {
>   		if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) {
>   			spin_lock_irqsave(&dev->event_lock, flags);

to spin_lock_irqsave.

As a tiny nit-pick, you sometimes name the variable 'flags', sometimes 
'flip_flags' in the different kms implementations below, which could be 
made consistent.

Reviewed-by: mario.kleiner at tuebingen.mpg.de


> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> index fce245f..90dc116 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> @@ -202,8 +202,9 @@ static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
>   };
>
>   static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
> -				      struct drm_framebuffer *fb,
> -				      struct drm_pending_vblank_event *event)
> +				     struct drm_framebuffer *fb,
> +				     struct drm_pending_vblank_event *event,
> +				     u32 flags)
>   {
>   	struct drm_device *dev = crtc->dev;
>   	struct exynos_drm_private *dev_priv = dev->dev_private;
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 31d9fb8..2c0c174 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -7109,7 +7109,8 @@ static int intel_default_queue_flip(struct drm_device *dev,
>
>   static int intel_crtc_page_flip(struct drm_crtc *crtc,
>   				struct drm_framebuffer *fb,
> -				struct drm_pending_vblank_event *event)
> +				struct drm_pending_vblank_event *event,
> +				u32 flip_flags)
>   {
>   	struct drm_device *dev = crtc->dev;
>   	struct drm_i915_private *dev_priv = dev->dev_private;
> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
> index 8f98e5a..dc89496 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
> @@ -610,7 +610,7 @@ fail:
>
>   int
>   nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
> -		       struct drm_pending_vblank_event *event)
> +		       struct drm_pending_vblank_event *event, u32 flip_flags)
>   {
>   	struct drm_device *dev = crtc->dev;
>   	struct nouveau_drm *drm = nouveau_drm(dev);
> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h
> index 722548b..bb2f63d 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_display.h
> +++ b/drivers/gpu/drm/nouveau/nouveau_display.h
> @@ -63,7 +63,7 @@ int  nouveau_vblank_enable(struct drm_device *dev, int crtc);
>   void nouveau_vblank_disable(struct drm_device *dev, int crtc);
>
>   int  nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
> -			    struct drm_pending_vblank_event *event);
> +			    struct drm_pending_vblank_event *event, u32 flags);
>   int  nouveau_finish_page_flip(struct nouveau_channel *,
>   			      struct nouveau_page_flip_state *);
>
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index bfa2a60..4c32552 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -346,7 +346,8 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)
>
>   static int radeon_crtc_page_flip(struct drm_crtc *crtc,
>   				 struct drm_framebuffer *fb,
> -				 struct drm_pending_vblank_event *event)
> +				 struct drm_pending_vblank_event *event,
> +				 u32 flip_flags)
>   {
>   	struct drm_device *dev = crtc->dev;
>   	struct radeon_device *rdev = dev->dev_private;
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> index 0e7a930..4878fa6 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> @@ -476,7 +476,8 @@ void shmob_drm_crtc_finish_page_flip(struct shmob_drm_crtc *scrtc)
>
>   static int shmob_drm_crtc_page_flip(struct drm_crtc *crtc,
>   				    struct drm_framebuffer *fb,
> -				    struct drm_pending_vblank_event *event)
> +				    struct drm_pending_vblank_event *event,
> +				    u32 flags)
>   {
>   	struct shmob_drm_crtc *scrtc = to_shmob_crtc(crtc);
>   	struct drm_device *dev = scrtc->crtc.dev;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index 5474394..3cb86fe 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -1682,7 +1682,8 @@ int vmw_du_update_layout(struct vmw_private *dev_priv, unsigned num,
>
>   int vmw_du_page_flip(struct drm_crtc *crtc,
>   		     struct drm_framebuffer *fb,
> -		     struct drm_pending_vblank_event *event)
> +		     struct drm_pending_vblank_event *event,
> +		     u32 flags)
>   {
>   	struct vmw_private *dev_priv = vmw_priv(crtc->dev);
>   	struct drm_framebuffer *old_fb = crtc->fb;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
> index 6fa89c9..088a8c9 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
> @@ -123,7 +123,8 @@ struct vmw_display_unit {
>   void vmw_display_unit_cleanup(struct vmw_display_unit *du);
>   int vmw_du_page_flip(struct drm_crtc *crtc,
>   		     struct drm_framebuffer *fb,
> -		     struct drm_pending_vblank_event *event);
> +		     struct drm_pending_vblank_event *event,
> +		     u32 flags);
>   void vmw_du_crtc_save(struct drm_crtc *crtc);
>   void vmw_du_crtc_restore(struct drm_crtc *crtc);
>   void vmw_du_crtc_gamma_set(struct drm_crtc *crtc,
> diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c
> index 78d3eda..8c93b57 100644
> --- a/drivers/staging/imx-drm/ipuv3-crtc.c
> +++ b/drivers/staging/imx-drm/ipuv3-crtc.c
> @@ -132,7 +132,8 @@ static void ipu_crtc_dpms(struct drm_crtc *crtc, int mode)
>
>   static int ipu_page_flip(struct drm_crtc *crtc,
>   		struct drm_framebuffer *fb,
> -		struct drm_pending_vblank_event *event)
> +		struct drm_pending_vblank_event *event,
> +		u32 flags)
>   {
>   	struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
>   	int ret;
> diff --git a/drivers/staging/omapdrm/omap_crtc.c b/drivers/staging/omapdrm/omap_crtc.c
> index 732f2ad..51daf5d 100644
> --- a/drivers/staging/omapdrm/omap_crtc.c
> +++ b/drivers/staging/omapdrm/omap_crtc.c
> @@ -173,7 +173,8 @@ static void page_flip_cb(void *arg)
>
>   static int omap_crtc_page_flip_locked(struct drm_crtc *crtc,
>   		 struct drm_framebuffer *fb,
> -		 struct drm_pending_vblank_event *event)
> +		 struct drm_pending_vblank_event *event,
> +		 u32 flags)
>   {
>   	struct drm_device *dev = crtc->dev;
>   	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 3fa18b7..79f1d9b 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -355,7 +355,8 @@ struct drm_crtc_funcs {
>   	 */
>   	int (*page_flip)(struct drm_crtc *crtc,
>   			 struct drm_framebuffer *fb,
> -			 struct drm_pending_vblank_event *event);
> +			 struct drm_pending_vblank_event *event,
> +			 u32 flags);
>
>   	int (*set_property)(struct drm_crtc *crtc,
>   			    struct drm_property *property, uint64_t val);
> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
> index 3d6301b..6e927bb 100644
> --- a/include/uapi/drm/drm_mode.h
> +++ b/include/uapi/drm/drm_mode.h
> @@ -399,7 +399,9 @@ struct drm_mode_crtc_lut {
>   };
>
>   #define DRM_MODE_PAGE_FLIP_EVENT 0x01
> -#define DRM_MODE_PAGE_FLIP_FLAGS DRM_MODE_PAGE_FLIP_EVENT
> +#define DRM_MODE_PAGE_FLIP_ASYNC 0x02
> +#define DRM_MODE_PAGE_FLIP_FLAGS (DRM_MODE_PAGE_FLIP_EVENT | \
> +				  DRM_MODE_PAGE_FLIP_ASYNC)
>
>   /*
>    * Request a page flip on the specified crtc.
>



More information about the Intel-gfx mailing list