mirror of https://gitee.com/openkylin/linux.git
drm/msm: add kms->wait_flush()
First step in re-working the atomic related internal API to prepare for async updates pending.. ->wait_flush() is intended to block until there is no in-progress flush. A crtc_mask is used, rather than an atomic state object, as this will later be used for async flush after the atomic state is destroyed. This replaces ->wait_for_crtc_commit_done() v2: update for review comments Signed-off-by: Rob Clark <robdclark@chromium.org>
This commit is contained in:
parent
41a52059ee
commit
d4d2c60497
|
@ -390,6 +390,15 @@ static void dpu_kms_wait_for_commit_done(struct msm_kms *kms,
|
|||
}
|
||||
}
|
||||
|
||||
static void dpu_kms_wait_flush(struct msm_kms *kms, unsigned crtc_mask)
|
||||
{
|
||||
struct dpu_kms *dpu_kms = to_dpu_kms(kms);
|
||||
struct drm_crtc *crtc;
|
||||
|
||||
for_each_crtc_mask(dpu_kms->dev, crtc, crtc_mask)
|
||||
dpu_kms_wait_for_commit_done(kms, crtc);
|
||||
}
|
||||
|
||||
static int _dpu_kms_initialize_dsi(struct drm_device *dev,
|
||||
struct msm_drm_private *priv,
|
||||
struct dpu_kms *dpu_kms)
|
||||
|
@ -684,8 +693,8 @@ static const struct msm_kms_funcs kms_funcs = {
|
|||
.irq = dpu_irq,
|
||||
.prepare_commit = dpu_kms_prepare_commit,
|
||||
.commit = dpu_kms_commit,
|
||||
.wait_flush = dpu_kms_wait_flush,
|
||||
.complete_commit = dpu_kms_complete_commit,
|
||||
.wait_for_crtc_commit_done = dpu_kms_wait_for_commit_done,
|
||||
.enable_vblank = dpu_kms_enable_vblank,
|
||||
.disable_vblank = dpu_kms_disable_vblank,
|
||||
.check_modified_format = dpu_format_check_modified_format,
|
||||
|
|
|
@ -110,6 +110,15 @@ static void mdp4_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *st
|
|||
drm_crtc_vblank_get(crtc);
|
||||
}
|
||||
|
||||
static void mdp4_wait_flush(struct msm_kms *kms, unsigned crtc_mask)
|
||||
{
|
||||
struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms));
|
||||
struct drm_crtc *crtc;
|
||||
|
||||
for_each_crtc_mask(mdp4_kms->dev, crtc, crtc_mask)
|
||||
mdp4_crtc_wait_for_commit_done(crtc);
|
||||
}
|
||||
|
||||
static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *state)
|
||||
{
|
||||
struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms));
|
||||
|
@ -126,12 +135,6 @@ static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *s
|
|||
mdp4_disable(mdp4_kms);
|
||||
}
|
||||
|
||||
static void mdp4_wait_for_crtc_commit_done(struct msm_kms *kms,
|
||||
struct drm_crtc *crtc)
|
||||
{
|
||||
mdp4_crtc_wait_for_commit_done(crtc);
|
||||
}
|
||||
|
||||
static long mdp4_round_pixclk(struct msm_kms *kms, unsigned long rate,
|
||||
struct drm_encoder *encoder)
|
||||
{
|
||||
|
@ -182,8 +185,8 @@ static const struct mdp_kms_funcs kms_funcs = {
|
|||
.enable_vblank = mdp4_enable_vblank,
|
||||
.disable_vblank = mdp4_disable_vblank,
|
||||
.prepare_commit = mdp4_prepare_commit,
|
||||
.wait_flush = mdp4_wait_flush,
|
||||
.complete_commit = mdp4_complete_commit,
|
||||
.wait_for_crtc_commit_done = mdp4_wait_for_crtc_commit_done,
|
||||
.get_format = mdp_get_format,
|
||||
.round_pixclk = mdp4_round_pixclk,
|
||||
.destroy = mdp4_destroy,
|
||||
|
|
|
@ -160,6 +160,15 @@ static void mdp5_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *st
|
|||
mdp5_smp_prepare_commit(mdp5_kms->smp, &global_state->smp);
|
||||
}
|
||||
|
||||
static void mdp5_wait_flush(struct msm_kms *kms, unsigned crtc_mask)
|
||||
{
|
||||
struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms));
|
||||
struct drm_crtc *crtc;
|
||||
|
||||
for_each_crtc_mask(mdp5_kms->dev, crtc, crtc_mask)
|
||||
mdp5_crtc_wait_for_commit_done(crtc);
|
||||
}
|
||||
|
||||
static void mdp5_complete_commit(struct msm_kms *kms, struct drm_atomic_state *state)
|
||||
{
|
||||
struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms));
|
||||
|
@ -176,12 +185,6 @@ static void mdp5_complete_commit(struct msm_kms *kms, struct drm_atomic_state *s
|
|||
pm_runtime_put_sync(dev);
|
||||
}
|
||||
|
||||
static void mdp5_wait_for_crtc_commit_done(struct msm_kms *kms,
|
||||
struct drm_crtc *crtc)
|
||||
{
|
||||
mdp5_crtc_wait_for_commit_done(crtc);
|
||||
}
|
||||
|
||||
static long mdp5_round_pixclk(struct msm_kms *kms, unsigned long rate,
|
||||
struct drm_encoder *encoder)
|
||||
{
|
||||
|
@ -278,8 +281,8 @@ static const struct mdp_kms_funcs kms_funcs = {
|
|||
.enable_vblank = mdp5_enable_vblank,
|
||||
.disable_vblank = mdp5_disable_vblank,
|
||||
.prepare_commit = mdp5_prepare_commit,
|
||||
.wait_flush = mdp5_wait_flush,
|
||||
.complete_commit = mdp5_complete_commit,
|
||||
.wait_for_crtc_commit_done = mdp5_wait_for_crtc_commit_done,
|
||||
.get_format = mdp_get_format,
|
||||
.round_pixclk = mdp5_round_pixclk,
|
||||
.set_split_display = mdp5_set_split_display,
|
||||
|
|
|
@ -12,28 +12,6 @@
|
|||
#include "msm_gem.h"
|
||||
#include "msm_kms.h"
|
||||
|
||||
static void msm_atomic_wait_for_commit_done(struct drm_device *dev,
|
||||
struct drm_atomic_state *old_state)
|
||||
{
|
||||
struct drm_crtc *crtc;
|
||||
struct drm_crtc_state *new_crtc_state;
|
||||
struct msm_drm_private *priv = old_state->dev->dev_private;
|
||||
struct msm_kms *kms = priv->kms;
|
||||
int i;
|
||||
|
||||
for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) {
|
||||
if (!new_crtc_state->active)
|
||||
continue;
|
||||
|
||||
if (drm_crtc_vblank_get(crtc))
|
||||
continue;
|
||||
|
||||
kms->funcs->wait_for_crtc_commit_done(kms, crtc);
|
||||
|
||||
drm_crtc_vblank_put(crtc);
|
||||
}
|
||||
}
|
||||
|
||||
int msm_atomic_prepare_fb(struct drm_plane *plane,
|
||||
struct drm_plane_state *new_state)
|
||||
{
|
||||
|
@ -48,11 +26,28 @@ int msm_atomic_prepare_fb(struct drm_plane *plane,
|
|||
return msm_framebuffer_prepare(new_state->fb, kms->aspace);
|
||||
}
|
||||
|
||||
/* Get bitmask of crtcs that will need to be flushed. The bitmask
|
||||
* can be used with for_each_crtc_mask() iterator, to iterate
|
||||
* effected crtcs without needing to preserve the atomic state.
|
||||
*/
|
||||
static unsigned get_crtc_mask(struct drm_atomic_state *state)
|
||||
{
|
||||
struct drm_crtc_state *crtc_state;
|
||||
struct drm_crtc *crtc;
|
||||
unsigned i, mask = 0;
|
||||
|
||||
for_each_new_crtc_in_state(state, crtc, crtc_state, i)
|
||||
mask |= drm_crtc_mask(crtc);
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
void msm_atomic_commit_tail(struct drm_atomic_state *state)
|
||||
{
|
||||
struct drm_device *dev = state->dev;
|
||||
struct msm_drm_private *priv = dev->dev_private;
|
||||
struct msm_kms *kms = priv->kms;
|
||||
unsigned crtc_mask = get_crtc_mask(state);
|
||||
|
||||
kms->funcs->prepare_commit(kms, state);
|
||||
|
||||
|
@ -67,8 +62,7 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state)
|
|||
kms->funcs->commit(kms, state);
|
||||
}
|
||||
|
||||
msm_atomic_wait_for_commit_done(dev, state);
|
||||
|
||||
kms->funcs->wait_flush(kms, crtc_mask);
|
||||
kms->funcs->complete_commit(kms, state);
|
||||
|
||||
drm_atomic_helper_commit_hw_done(state);
|
||||
|
|
|
@ -34,9 +34,8 @@ struct msm_kms_funcs {
|
|||
void (*prepare_commit)(struct msm_kms *kms, struct drm_atomic_state *state);
|
||||
void (*commit)(struct msm_kms *kms, struct drm_atomic_state *state);
|
||||
void (*complete_commit)(struct msm_kms *kms, struct drm_atomic_state *state);
|
||||
/* functions to wait for atomic commit completed on each CRTC */
|
||||
void (*wait_for_crtc_commit_done)(struct msm_kms *kms,
|
||||
struct drm_crtc *crtc);
|
||||
void (*wait_flush)(struct msm_kms *kms, unsigned crtc_mask);
|
||||
|
||||
/* get msm_format w/ optional format modifiers from drm_mode_fb_cmd2 */
|
||||
const struct msm_format *(*get_format)(struct msm_kms *kms,
|
||||
const uint32_t format,
|
||||
|
@ -98,4 +97,8 @@ struct msm_mdss {
|
|||
int mdp5_mdss_init(struct drm_device *dev);
|
||||
int dpu_mdss_init(struct drm_device *dev);
|
||||
|
||||
#define for_each_crtc_mask(dev, crtc, crtc_mask) \
|
||||
drm_for_each_crtc(crtc, dev) \
|
||||
for_each_if (drm_crtc_mask(crtc) & (crtc_mask))
|
||||
|
||||
#endif /* __MSM_KMS_H__ */
|
||||
|
|
Loading…
Reference in New Issue