diff mbox

[v4,1/3] drm/atomic: Save flip flags in drm_crtct_state

Message ID 1485968616-4296-2-git-send-email-Andrey.Grodzovsky@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrey Grodzovsky Feb. 1, 2017, 5:03 p.m. UTC
Allows using atomic flip helpers for drivers
using ASYNC flip.
Remove ASYNC_FLIP restriction in helpers and
caches the page flip flags in drm_crtc_state
to be used in the low level drivers.

v2:
Resending the patch since the original was broken.

v3:
Save flag in crtc_state instead of plane_state

v4:
Reset the flag before using again.

Change-Id: I0219c3ec3ecceb82143ee176d30cb50d9aa76bf0
Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
---
 drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++--------------
 include/drm/drm_crtc.h              |  9 ++++++++-
 include/drm/drm_plane.h             |  1 +
 3 files changed, 15 insertions(+), 15 deletions(-)

Comments

Ville Syrjala Feb. 1, 2017, 5:25 p.m. UTC | #1
On Wed, Feb 01, 2017 at 12:03:34PM -0500, Andrey Grodzovsky wrote:
> Allows using atomic flip helpers for drivers
> using ASYNC flip.
> Remove ASYNC_FLIP restriction in helpers and
> caches the page flip flags in drm_crtc_state
> to be used in the low level drivers.
> 
> v2:
> Resending the patch since the original was broken.
> 
> v3:
> Save flag in crtc_state instead of plane_state
> 
> v4:
> Reset the flag before using again.
> 
> Change-Id: I0219c3ec3ecceb82143ee176d30cb50d9aa76bf0
> Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++--------------
>  include/drm/drm_crtc.h              |  9 ++++++++-
>  include/drm/drm_plane.h             |  1 +
>  3 files changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index a4e5477..f84b5aa 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2737,7 +2737,8 @@ static int page_flip_common(
>  				struct drm_atomic_state *state,
>  				struct drm_crtc *crtc,
>  				struct drm_framebuffer *fb,
> -				struct drm_pending_vblank_event *event)
> +				struct drm_pending_vblank_event *event,
> +				uint32_t flags)
>  {
>  	struct drm_plane *plane = crtc->primary;
>  	struct drm_plane_state *plane_state;
> @@ -2749,12 +2750,12 @@ static int page_flip_common(
>  		return PTR_ERR(crtc_state);
>  
>  	crtc_state->event = event;
> +	crtc_state->pflip_flags = flags;

Still wondering why we can't afford to spell out "page_flip" completely?

>  
>  	plane_state = drm_atomic_get_plane_state(state, plane);
>  	if (IS_ERR(plane_state))
>  		return PTR_ERR(plane_state);
>  
> -
>  	ret = drm_atomic_set_crtc_for_plane(plane_state, crtc);
>  	if (ret != 0)
>  		return ret;
Alex Deucher Feb. 2, 2017, 4:57 p.m. UTC | #2
On Wed, Feb 1, 2017 at 12:03 PM, Andrey Grodzovsky
<Andrey.Grodzovsky@amd.com> wrote:
> Allows using atomic flip helpers for drivers
> using ASYNC flip.
> Remove ASYNC_FLIP restriction in helpers and
> caches the page flip flags in drm_crtc_state
> to be used in the low level drivers.
>
> v2:
> Resending the patch since the original was broken.
>
> v3:
> Save flag in crtc_state instead of plane_state
>
> v4:
> Reset the flag before using again.
>
> Change-Id: I0219c3ec3ecceb82143ee176d30cb50d9aa76bf0
> Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>

typo in the patch title:
drm_crtct_state



> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++--------------
>  include/drm/drm_crtc.h              |  9 ++++++++-
>  include/drm/drm_plane.h             |  1 +
>  3 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index a4e5477..f84b5aa 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2737,7 +2737,8 @@ static int page_flip_common(
>                                 struct drm_atomic_state *state,
>                                 struct drm_crtc *crtc,
>                                 struct drm_framebuffer *fb,
> -                               struct drm_pending_vblank_event *event)
> +                               struct drm_pending_vblank_event *event,
> +                               uint32_t flags)
>  {
>         struct drm_plane *plane = crtc->primary;
>         struct drm_plane_state *plane_state;
> @@ -2749,12 +2750,12 @@ static int page_flip_common(
>                 return PTR_ERR(crtc_state);
>
>         crtc_state->event = event;
> +       crtc_state->pflip_flags = flags;
>
>         plane_state = drm_atomic_get_plane_state(state, plane);
>         if (IS_ERR(plane_state))
>                 return PTR_ERR(plane_state);
>
> -
>         ret = drm_atomic_set_crtc_for_plane(plane_state, crtc);
>         if (ret != 0)
>                 return ret;
> @@ -2781,10 +2782,6 @@ static int page_flip_common(
>   * Provides a default &drm_crtc_funcs.page_flip implementation
>   * using the atomic driver interface.
>   *
> - * Note that for now so called async page flips (i.e. updates which are not
> - * synchronized to vblank) are not supported, since the atomic interfaces have
> - * no provisions for this yet.
> - *
>   * Returns:
>   * Returns 0 on success, negative errno numbers on failure.
>   *
> @@ -2800,9 +2797,6 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
>         struct drm_atomic_state *state;
>         int ret = 0;
>
> -       if (flags & DRM_MODE_PAGE_FLIP_ASYNC)
> -               return -EINVAL;
> -
>         state = drm_atomic_state_alloc(plane->dev);
>         if (!state)
>                 return -ENOMEM;
> @@ -2810,7 +2804,7 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
>         state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
>
>  retry:
> -       ret = page_flip_common(state, crtc, fb, event);
> +       ret = page_flip_common(state, crtc, fb, event, flags);
>         if (ret != 0)
>                 goto fail;
>
> @@ -2865,9 +2859,6 @@ int drm_atomic_helper_page_flip_target(
>         struct drm_crtc_state *crtc_state;
>         int ret = 0;
>
> -       if (flags & DRM_MODE_PAGE_FLIP_ASYNC)
> -               return -EINVAL;
> -
>         state = drm_atomic_state_alloc(plane->dev);
>         if (!state)
>                 return -ENOMEM;
> @@ -2875,7 +2866,7 @@ int drm_atomic_helper_page_flip_target(
>         state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
>
>  retry:
> -       ret = page_flip_common(state, crtc, fb, event);
> +       ret = page_flip_common(state, crtc, fb, event, flags);
>         if (ret != 0)
>                 goto fail;
>
> @@ -3072,6 +3063,7 @@ void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc,
>         state->color_mgmt_changed = false;
>         state->zpos_changed = false;
>         state->event = NULL;
> +       state->pflip_flags = 0;
>  }
>  EXPORT_SYMBOL(__drm_atomic_helper_crtc_duplicate_state);
>
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 5c77c3f..b74dbe1 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -162,10 +162,17 @@ struct drm_crtc_state {
>          * Target vertical blank period when a page flip
>          * should take effect.
>          */
> -
>         u32 target_vblank;
>
>         /**
> +        * @pflip_flags:
> +        *
> +        * DRM_MODE_PAGE_FLIP_* flags, as passed to the page flip ioctl.
> +        * Zero in any other case.
> +        */
> +       u32 pflip_flags;

I can go either way on whether we call this pflip or page_flip.  I
guess it's better to spell it out.

> +
> +       /**
>          * @event:
>          *
>          * Optional pointer to a DRM event to signal upon completion of the
> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index db3bbde..57414ae 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -122,6 +122,7 @@ struct drm_plane_state {
>          */
>         bool visible;
>
> +
>         struct drm_atomic_state *state;
>  };

Unrelated hunk.  Please drop this.

>
> --
> 1.9.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index a4e5477..f84b5aa 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2737,7 +2737,8 @@  static int page_flip_common(
 				struct drm_atomic_state *state,
 				struct drm_crtc *crtc,
 				struct drm_framebuffer *fb,
-				struct drm_pending_vblank_event *event)
+				struct drm_pending_vblank_event *event,
+				uint32_t flags)
 {
 	struct drm_plane *plane = crtc->primary;
 	struct drm_plane_state *plane_state;
@@ -2749,12 +2750,12 @@  static int page_flip_common(
 		return PTR_ERR(crtc_state);
 
 	crtc_state->event = event;
+	crtc_state->pflip_flags = flags;
 
 	plane_state = drm_atomic_get_plane_state(state, plane);
 	if (IS_ERR(plane_state))
 		return PTR_ERR(plane_state);
 
-
 	ret = drm_atomic_set_crtc_for_plane(plane_state, crtc);
 	if (ret != 0)
 		return ret;
@@ -2781,10 +2782,6 @@  static int page_flip_common(
  * Provides a default &drm_crtc_funcs.page_flip implementation
  * using the atomic driver interface.
  *
- * Note that for now so called async page flips (i.e. updates which are not
- * synchronized to vblank) are not supported, since the atomic interfaces have
- * no provisions for this yet.
- *
  * Returns:
  * Returns 0 on success, negative errno numbers on failure.
  *
@@ -2800,9 +2797,6 @@  int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
 	struct drm_atomic_state *state;
 	int ret = 0;
 
-	if (flags & DRM_MODE_PAGE_FLIP_ASYNC)
-		return -EINVAL;
-
 	state = drm_atomic_state_alloc(plane->dev);
 	if (!state)
 		return -ENOMEM;
@@ -2810,7 +2804,7 @@  int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
 	state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
 
 retry:
-	ret = page_flip_common(state, crtc, fb, event);
+	ret = page_flip_common(state, crtc, fb, event, flags);
 	if (ret != 0)
 		goto fail;
 
@@ -2865,9 +2859,6 @@  int drm_atomic_helper_page_flip_target(
 	struct drm_crtc_state *crtc_state;
 	int ret = 0;
 
-	if (flags & DRM_MODE_PAGE_FLIP_ASYNC)
-		return -EINVAL;
-
 	state = drm_atomic_state_alloc(plane->dev);
 	if (!state)
 		return -ENOMEM;
@@ -2875,7 +2866,7 @@  int drm_atomic_helper_page_flip_target(
 	state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
 
 retry:
-	ret = page_flip_common(state, crtc, fb, event);
+	ret = page_flip_common(state, crtc, fb, event, flags);
 	if (ret != 0)
 		goto fail;
 
@@ -3072,6 +3063,7 @@  void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc,
 	state->color_mgmt_changed = false;
 	state->zpos_changed = false;
 	state->event = NULL;
+	state->pflip_flags = 0;
 }
 EXPORT_SYMBOL(__drm_atomic_helper_crtc_duplicate_state);
 
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 5c77c3f..b74dbe1 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -162,10 +162,17 @@  struct drm_crtc_state {
 	 * Target vertical blank period when a page flip
 	 * should take effect.
 	 */
-
 	u32 target_vblank;
 
 	/**
+	 * @pflip_flags:
+	 *
+	 * DRM_MODE_PAGE_FLIP_* flags, as passed to the page flip ioctl.
+	 * Zero in any other case.
+	 */
+	u32 pflip_flags;
+
+	/**
 	 * @event:
 	 *
 	 * Optional pointer to a DRM event to signal upon completion of the
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index db3bbde..57414ae 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -122,6 +122,7 @@  struct drm_plane_state {
 	 */
 	bool visible;
 
+
 	struct drm_atomic_state *state;
 };