drm/atomic-helper: Export framebuffer_changed()

The Rockchip driver cannot use drm_atomic_helper_wait_for_vblanks()
because it has hardware counters for neither vblanks nor scanlines.

In order to simplify re-implementing the functionality for this driver,
export the framebuffer_changed() helper so it can be reused.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
John Keeping 2016-01-19 10:46:58 +00:00 committed by Mark Yao
parent 484bb6c969
commit c240906d36
2 changed files with 24 additions and 4 deletions

View File

@ -946,9 +946,23 @@ static void wait_for_fences(struct drm_device *dev,
} }
} }
static bool framebuffer_changed(struct drm_device *dev, /**
struct drm_atomic_state *old_state, * drm_atomic_helper_framebuffer_changed - check if framebuffer has changed
struct drm_crtc *crtc) * @dev: DRM device
* @old_state: atomic state object with old state structures
* @crtc: DRM crtc
*
* Checks whether the framebuffer used for this CRTC changes as a result of
* the atomic update. This is useful for drivers which cannot use
* drm_atomic_helper_wait_for_vblanks() and need to reimplement its
* functionality.
*
* Returns:
* true if the framebuffer changed.
*/
bool drm_atomic_helper_framebuffer_changed(struct drm_device *dev,
struct drm_atomic_state *old_state,
struct drm_crtc *crtc)
{ {
struct drm_plane *plane; struct drm_plane *plane;
struct drm_plane_state *old_plane_state; struct drm_plane_state *old_plane_state;
@ -965,6 +979,7 @@ static bool framebuffer_changed(struct drm_device *dev,
return false; return false;
} }
EXPORT_SYMBOL(drm_atomic_helper_framebuffer_changed);
/** /**
* drm_atomic_helper_wait_for_vblanks - wait for vblank on crtcs * drm_atomic_helper_wait_for_vblanks - wait for vblank on crtcs
@ -999,7 +1014,8 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
if (old_state->legacy_cursor_update) if (old_state->legacy_cursor_update)
continue; continue;
if (!framebuffer_changed(dev, old_state, crtc)) if (!drm_atomic_helper_framebuffer_changed(dev,
old_state, crtc))
continue; continue;
ret = drm_crtc_vblank_get(crtc); ret = drm_crtc_vblank_get(crtc);

View File

@ -42,6 +42,10 @@ int drm_atomic_helper_commit(struct drm_device *dev,
struct drm_atomic_state *state, struct drm_atomic_state *state,
bool async); bool async);
bool drm_atomic_helper_framebuffer_changed(struct drm_device *dev,
struct drm_atomic_state *old_state,
struct drm_crtc *crtc);
void drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, void drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
struct drm_atomic_state *old_state); struct drm_atomic_state *old_state);