Skip to content

Commit

Permalink
Merge branch 'at91-4.19-trunk/drm-fixes' into linux-4.19-at91
Browse files Browse the repository at this point in the history
  • Loading branch information
cristibirsan committed Jun 24, 2019
2 parents a5703c7 + de7b172 commit e2083e4
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
38 changes: 38 additions & 0 deletions drivers/gpu/drm/drm_atomic_helper.c
Expand Up @@ -1330,6 +1330,41 @@ int drm_atomic_helper_wait_for_fences(struct drm_device *dev,
}
EXPORT_SYMBOL(drm_atomic_helper_wait_for_fences);

/**
* drm_atomic_helper_framebuffer_changed - check if framebuffer has changed
* @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_state *old_plane_state;
int i;

for_each_old_plane_in_state(old_state, plane, old_plane_state, i) {
if (plane->state->crtc != crtc &&
old_plane_state->crtc != crtc)
continue;

if (plane->state->fb != old_plane_state->fb)
return true;
}

return false;
}
EXPORT_SYMBOL(drm_atomic_helper_framebuffer_changed);

/**
* drm_atomic_helper_wait_for_vblanks - wait for vblank on crtcs
* @dev: DRM device
Expand Down Expand Up @@ -1365,6 +1400,9 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
if (!new_crtc_state->active)
continue;

if (!drm_atomic_helper_framebuffer_changed(dev,
old_state, crtc))
continue;
ret = drm_crtc_vblank_get(crtc);
if (ret != 0)
continue;
Expand Down
3 changes: 3 additions & 0 deletions include/drm/drm_atomic_helper.h
Expand Up @@ -61,6 +61,9 @@ void drm_atomic_helper_async_commit(struct drm_device *dev,
int drm_atomic_helper_wait_for_fences(struct drm_device *dev,
struct drm_atomic_state *state,
bool pre_swap);
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,
struct drm_atomic_state *old_state);
Expand Down

0 comments on commit e2083e4

Please sign in to comment.