Commit 6cbe5c46 authored by Andrey Grodzovsky's avatar Andrey Grodzovsky Committed by Alex Deucher

drm/atomic: Save flip flags in drm_crtc_state

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.

v5:
Fix type in header.
Rename the field to pageflip_flags.
Remove unrelated hunk.
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAndrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1486072591-3893-2-git-send-email-Andrey.Grodzovsky@amd.com
parent bb18dfcc
...@@ -2718,7 +2718,8 @@ static int page_flip_common( ...@@ -2718,7 +2718,8 @@ static int page_flip_common(
struct drm_atomic_state *state, struct drm_atomic_state *state,
struct drm_crtc *crtc, struct drm_crtc *crtc,
struct drm_framebuffer *fb, 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 *plane = crtc->primary;
struct drm_plane_state *plane_state; struct drm_plane_state *plane_state;
...@@ -2730,12 +2731,12 @@ static int page_flip_common( ...@@ -2730,12 +2731,12 @@ static int page_flip_common(
return PTR_ERR(crtc_state); return PTR_ERR(crtc_state);
crtc_state->event = event; crtc_state->event = event;
crtc_state->pageflip_flags = flags;
plane_state = drm_atomic_get_plane_state(state, plane); plane_state = drm_atomic_get_plane_state(state, plane);
if (IS_ERR(plane_state)) if (IS_ERR(plane_state))
return PTR_ERR(plane_state); return PTR_ERR(plane_state);
ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); ret = drm_atomic_set_crtc_for_plane(plane_state, crtc);
if (ret != 0) if (ret != 0)
return ret; return ret;
...@@ -2762,10 +2763,6 @@ static int page_flip_common( ...@@ -2762,10 +2763,6 @@ static int page_flip_common(
* Provides a default &drm_crtc_funcs.page_flip implementation * Provides a default &drm_crtc_funcs.page_flip implementation
* using the atomic driver interface. * 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:
* Returns 0 on success, negative errno numbers on failure. * Returns 0 on success, negative errno numbers on failure.
* *
...@@ -2781,9 +2778,6 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc, ...@@ -2781,9 +2778,6 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
struct drm_atomic_state *state; struct drm_atomic_state *state;
int ret = 0; int ret = 0;
if (flags & DRM_MODE_PAGE_FLIP_ASYNC)
return -EINVAL;
state = drm_atomic_state_alloc(plane->dev); state = drm_atomic_state_alloc(plane->dev);
if (!state) if (!state)
return -ENOMEM; return -ENOMEM;
...@@ -2791,7 +2785,7 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc, ...@@ -2791,7 +2785,7 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
retry: retry:
ret = page_flip_common(state, crtc, fb, event); ret = page_flip_common(state, crtc, fb, event, flags);
if (ret != 0) if (ret != 0)
goto fail; goto fail;
...@@ -2846,9 +2840,6 @@ int drm_atomic_helper_page_flip_target( ...@@ -2846,9 +2840,6 @@ int drm_atomic_helper_page_flip_target(
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
int ret = 0; int ret = 0;
if (flags & DRM_MODE_PAGE_FLIP_ASYNC)
return -EINVAL;
state = drm_atomic_state_alloc(plane->dev); state = drm_atomic_state_alloc(plane->dev);
if (!state) if (!state)
return -ENOMEM; return -ENOMEM;
...@@ -2856,7 +2847,7 @@ int drm_atomic_helper_page_flip_target( ...@@ -2856,7 +2847,7 @@ int drm_atomic_helper_page_flip_target(
state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
retry: retry:
ret = page_flip_common(state, crtc, fb, event); ret = page_flip_common(state, crtc, fb, event, flags);
if (ret != 0) if (ret != 0)
goto fail; goto fail;
...@@ -3056,6 +3047,7 @@ void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc, ...@@ -3056,6 +3047,7 @@ void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc,
state->color_mgmt_changed = false; state->color_mgmt_changed = false;
state->zpos_changed = false; state->zpos_changed = false;
state->event = NULL; state->event = NULL;
state->pageflip_flags = 0;
} }
EXPORT_SYMBOL(__drm_atomic_helper_crtc_duplicate_state); EXPORT_SYMBOL(__drm_atomic_helper_crtc_duplicate_state);
......
...@@ -155,9 +155,16 @@ struct drm_crtc_state { ...@@ -155,9 +155,16 @@ struct drm_crtc_state {
* Target vertical blank period when a page flip * Target vertical blank period when a page flip
* should take effect. * should take effect.
*/ */
u32 target_vblank; u32 target_vblank;
/**
* @pageflip_flags:
*
* DRM_MODE_PAGE_FLIP_* flags, as passed to the page flip ioctl.
* Zero in any other case.
*/
u32 pageflip_flags;
/** /**
* @event: * @event:
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment