2014-11-09 02:21:06 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Red Hat
|
|
|
|
* Author: Rob Clark <robdclark@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 as published by
|
|
|
|
* the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "msm_drv.h"
|
2018-04-03 22:42:23 +08:00
|
|
|
#include "msm_gem.h"
|
2014-11-09 02:21:06 +08:00
|
|
|
#include "msm_kms.h"
|
|
|
|
|
2015-04-29 07:35:37 +08:00
|
|
|
static void msm_atomic_wait_for_commit_done(struct drm_device *dev,
|
|
|
|
struct drm_atomic_state *old_state)
|
|
|
|
{
|
|
|
|
struct drm_crtc *crtc;
|
2017-07-19 22:39:18 +08:00
|
|
|
struct drm_crtc_state *new_crtc_state;
|
2015-04-29 07:35:37 +08:00
|
|
|
struct msm_drm_private *priv = old_state->dev->dev_private;
|
|
|
|
struct msm_kms *kms = priv->kms;
|
|
|
|
int i;
|
|
|
|
|
2017-07-19 22:39:18 +08:00
|
|
|
for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) {
|
|
|
|
if (!new_crtc_state->active)
|
2015-04-29 07:35:37 +08:00
|
|
|
continue;
|
|
|
|
|
|
|
|
kms->funcs->wait_for_crtc_commit_done(kms, crtc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-03 22:42:23 +08:00
|
|
|
int msm_atomic_prepare_fb(struct drm_plane *plane,
|
|
|
|
struct drm_plane_state *new_state)
|
|
|
|
{
|
|
|
|
struct msm_drm_private *priv = plane->dev->dev_private;
|
|
|
|
struct msm_kms *kms = priv->kms;
|
|
|
|
struct drm_gem_object *obj;
|
|
|
|
struct msm_gem_object *msm_obj;
|
|
|
|
struct dma_fence *fence;
|
|
|
|
|
|
|
|
if (!new_state->fb)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
obj = msm_framebuffer_bo(new_state->fb, 0);
|
|
|
|
msm_obj = to_msm_bo(obj);
|
|
|
|
fence = reservation_object_get_excl_rcu(msm_obj->resv);
|
|
|
|
|
|
|
|
drm_atomic_set_fence_for_plane(new_state, fence);
|
|
|
|
|
|
|
|
return msm_framebuffer_prepare(new_state->fb, kms->aspace);
|
|
|
|
}
|
|
|
|
|
2018-03-01 03:19:05 +08:00
|
|
|
void msm_atomic_commit_tail(struct drm_atomic_state *state)
|
2014-11-09 02:21:06 +08:00
|
|
|
{
|
|
|
|
struct drm_device *dev = state->dev;
|
2015-01-31 06:04:45 +08:00
|
|
|
struct msm_drm_private *priv = dev->dev_private;
|
|
|
|
struct msm_kms *kms = priv->kms;
|
|
|
|
|
|
|
|
kms->funcs->prepare_commit(kms, state);
|
2014-11-09 02:21:06 +08:00
|
|
|
|
2015-02-22 19:24:19 +08:00
|
|
|
drm_atomic_helper_commit_modeset_disables(dev, state);
|
2014-11-09 02:21:06 +08:00
|
|
|
|
2016-08-29 17:12:03 +08:00
|
|
|
drm_atomic_helper_commit_planes(dev, state, 0);
|
2014-11-09 02:21:06 +08:00
|
|
|
|
2015-02-22 19:24:19 +08:00
|
|
|
drm_atomic_helper_commit_modeset_enables(dev, state);
|
2014-11-09 02:21:06 +08:00
|
|
|
|
2015-04-29 07:35:37 +08:00
|
|
|
msm_atomic_wait_for_commit_done(dev, state);
|
2014-11-09 02:21:06 +08:00
|
|
|
|
2015-01-31 06:04:45 +08:00
|
|
|
kms->funcs->complete_commit(kms, state);
|
2018-03-01 03:19:01 +08:00
|
|
|
|
|
|
|
drm_atomic_helper_commit_hw_done(state);
|
|
|
|
|
|
|
|
drm_atomic_helper_cleanup_planes(dev, state);
|
2018-03-01 03:18:58 +08:00
|
|
|
}
|