disp: msm: move vblank enable and disable to crtc hooks

Upstream now prefers to utilize vblank enable and disable
through crtc hooks rather than drm driver. Remove
calls from kms vblank enable/disbale.

Change-Id: Ic6911838f14f93a0d277b7bdc2c1968270ec25a2
Signed-off-by: Samantha Tran <samtran@codeaurora.org>
Signed-off-by: Nilaan Gunabalachandran <ngunabal@codeaurora.org>
This commit is contained in:
Samantha Tran
2020-10-20 11:38:57 -07:00
committed by Nilaan Gunabalachandran
parent c53a07ee48
commit ee58486c84
4 changed files with 75 additions and 95 deletions

View File

@@ -344,51 +344,6 @@ int msm_get_src_bpc(int chroma_format,
return src_bpp;
}
struct vblank_work {
struct kthread_work work;
int crtc_id;
bool enable;
struct msm_drm_private *priv;
};
static void vblank_ctrl_worker(struct kthread_work *work)
{
struct vblank_work *cur_work = container_of(work,
struct vblank_work, work);
struct msm_drm_private *priv = cur_work->priv;
struct msm_kms *kms = priv->kms;
if (cur_work->enable)
kms->funcs->enable_vblank(kms, priv->crtcs[cur_work->crtc_id]);
else
kms->funcs->disable_vblank(kms, priv->crtcs[cur_work->crtc_id]);
kfree(cur_work);
}
static int vblank_ctrl_queue_work(struct msm_drm_private *priv,
int crtc_id, bool enable)
{
struct vblank_work *cur_work;
struct kthread_worker *worker;
if (!priv || crtc_id >= priv->num_crtcs)
return -EINVAL;
cur_work = kzalloc(sizeof(*cur_work), GFP_ATOMIC);
if (!cur_work)
return -ENOMEM;
kthread_init_work(&cur_work->work, vblank_ctrl_worker);
cur_work->crtc_id = crtc_id;
cur_work->enable = enable;
cur_work->priv = priv;
worker = &priv->event_thread[crtc_id].worker;
kthread_queue_work(worker, &cur_work->work);
return 0;
}
static int msm_drm_uninit(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
@@ -1116,26 +1071,6 @@ static void msm_irq_uninstall(struct drm_device *dev)
kms->funcs->irq_uninstall(kms);
}
static int msm_enable_vblank(struct drm_device *dev, unsigned int pipe)
{
struct msm_drm_private *priv = dev->dev_private;
struct msm_kms *kms = priv->kms;
if (!kms)
return -ENXIO;
DBG("dev=%pK, crtc=%u", dev, pipe);
return vblank_ctrl_queue_work(priv, pipe, true);
}
static void msm_disable_vblank(struct drm_device *dev, unsigned int pipe)
{
struct msm_drm_private *priv = dev->dev_private;
struct msm_kms *kms = priv->kms;
if (!kms)
return;
DBG("dev=%pK, crtc=%u", dev, pipe);
vblank_ctrl_queue_work(priv, pipe, false);
}
/*
* DRM ioctls:
*/
@@ -1727,8 +1662,6 @@ static struct drm_driver msm_driver = {
.irq_preinstall = msm_irq_preinstall,
.irq_postinstall = msm_irq_postinstall,
.irq_uninstall = msm_irq_uninstall,
.enable_vblank = msm_enable_vblank,
.disable_vblank = msm_disable_vblank,
.gem_free_object_unlocked = msm_gem_free_object,
.gem_vm_ops = &vm_ops,
.dumb_create = msm_gem_dumb_create,

View File

@@ -57,8 +57,6 @@ struct msm_kms_funcs {
int (*irq_postinstall)(struct msm_kms *kms);
void (*irq_uninstall)(struct msm_kms *kms);
irqreturn_t (*irq)(struct msm_kms *kms);
int (*enable_vblank)(struct msm_kms *kms, struct drm_crtc *crtc);
void (*disable_vblank)(struct msm_kms *kms, struct drm_crtc *crtc);
/* modeset, bracketing atomic_commit(): */
void (*prepare_fence)(struct msm_kms *kms,
struct drm_atomic_state *state);

View File

@@ -50,6 +50,13 @@ struct sde_crtc_custom_events {
struct sde_irq_callback *irq);
};
struct vblank_work {
struct kthread_work work;
int crtc_id;
bool enable;
struct msm_drm_private *priv;
};
static int sde_crtc_power_interrupt_handler(struct drm_crtc *crtc_drm,
bool en, struct sde_irq_callback *ad_irq);
static int sde_crtc_idle_interrupt_handler(struct drm_crtc *crtc_drm,
@@ -6274,6 +6281,72 @@ static void _sde_crtc_destroy_debugfs(struct drm_crtc *crtc)
}
#endif /* CONFIG_DEBUG_FS */
static void vblank_ctrl_worker(struct kthread_work *work)
{
struct vblank_work *cur_work = container_of(work,
struct vblank_work, work);
struct msm_drm_private *priv = cur_work->priv;
struct msm_kms *kms = priv->kms;
sde_crtc_vblank(priv->crtcs[cur_work->crtc_id], cur_work->enable);
kfree(cur_work);
}
static int vblank_ctrl_queue_work(struct msm_drm_private *priv,
int crtc_id, bool enable)
{
struct vblank_work *cur_work;
struct drm_crtc *crtc;
struct kthread_worker *worker;
if (!priv || crtc_id >= priv->num_crtcs)
return -EINVAL;
cur_work = kzalloc(sizeof(*cur_work), GFP_ATOMIC);
if (!cur_work)
return -ENOMEM;
crtc = priv->crtcs[crtc_id];
kthread_init_work(&cur_work->work, vblank_ctrl_worker);
cur_work->crtc_id = crtc_id;
cur_work->enable = enable;
cur_work->priv = priv;
worker = &priv->event_thread[crtc_id].worker;
kthread_queue_work(worker, &cur_work->work);
return 0;
}
static int sde_crtc_enable_vblank(struct drm_crtc *crtc)
{
struct drm_device *dev = crtc->dev;
unsigned int pipe = crtc->index;
struct msm_drm_private *priv = dev->dev_private;
struct msm_kms *kms = priv->kms;
if (!kms)
return -ENXIO;
DBG("dev=%pK, crtc=%u", dev, pipe);
return vblank_ctrl_queue_work(priv, pipe, true);
}
static void sde_crtc_disable_vblank(struct drm_crtc *crtc)
{
struct drm_device *dev = crtc->dev;
unsigned int pipe = crtc->index;
struct msm_drm_private *priv = dev->dev_private;
struct msm_kms *kms = priv->kms;
if (!kms)
return;
DBG("dev=%pK, crtc=%u", dev, pipe);
vblank_ctrl_queue_work(priv, pipe, false);
}
static int sde_crtc_late_register(struct drm_crtc *crtc)
{
return _sde_crtc_init_debugfs(crtc);
@@ -6287,6 +6360,8 @@ static void sde_crtc_early_unregister(struct drm_crtc *crtc)
static const struct drm_crtc_funcs sde_crtc_funcs = {
.set_config = drm_atomic_helper_set_config,
.destroy = sde_crtc_destroy,
.enable_vblank = sde_crtc_enable_vblank,
.disable_vblank = sde_crtc_disable_vblank,
.page_flip = drm_atomic_helper_page_flip,
.atomic_set_property = sde_crtc_atomic_set_property,
.atomic_get_property = sde_crtc_atomic_get_property,

View File

@@ -205,30 +205,6 @@ static int _sde_kms_dump_clks_state(struct sde_kms *sde_kms)
}
#endif
static int sde_kms_enable_vblank(struct msm_kms *kms, struct drm_crtc *crtc)
{
int ret;
if (!kms || !crtc)
return -EINVAL;
SDE_ATRACE_BEGIN("sde_kms_enable_vblank");
ret = sde_crtc_vblank(crtc, true);
SDE_ATRACE_END("sde_kms_enable_vblank");
return ret;
}
static void sde_kms_disable_vblank(struct msm_kms *kms, struct drm_crtc *crtc)
{
if (!kms || !crtc)
return;
SDE_ATRACE_BEGIN("sde_kms_disable_vblank");
sde_crtc_vblank(crtc, false);
SDE_ATRACE_END("sde_kms_disable_vblank");
}
static void sde_kms_wait_for_frame_transfer_complete(struct msm_kms *kms,
struct drm_crtc *crtc)
{
@@ -3752,8 +3728,6 @@ static const struct msm_kms_funcs kms_funcs = {
.complete_commit = sde_kms_complete_commit,
.wait_for_crtc_commit_done = sde_kms_wait_for_commit_done,
.wait_for_tx_complete = sde_kms_wait_for_frame_transfer_complete,
.enable_vblank = sde_kms_enable_vblank,
.disable_vblank = sde_kms_disable_vblank,
.check_modified_format = sde_format_check_modified_format,
.atomic_check = sde_kms_atomic_check,
.get_format = sde_get_msm_format,