diff mbox series

drm/mediatek: Use CPU when fail to get cmdq event

Message ID 20200902220542.60-1-chunkuang.hu@kernel.org (mailing list archive)
State New, archived
Headers show
Series drm/mediatek: Use CPU when fail to get cmdq event | expand

Commit Message

Chun-Kuang Hu Sept. 2, 2020, 10:05 p.m. UTC
Even though cmdq client is created successfully, without the cmdq event,
cmdq could not work correctly, so use CPU when fail to get cmdq event.

Fixes: 60fa8c13ab1a ("drm/mediatek: Move gce event property to mutex device node")
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

Comments

Chun-Kuang Hu Sept. 8, 2020, 11 p.m. UTC | #1
Chun-Kuang Hu <chunkuang.hu@kernel.org> 於 2020年9月3日 週四 上午6:06寫道:
>
> Even though cmdq client is created successfully, without the cmdq event,
> cmdq could not work correctly, so use CPU when fail to get cmdq event.

Applied to mediatek-drm-fixes [1].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-fixes

Regards,
Chun-Kuang.

>
> Fixes: 60fa8c13ab1a ("drm/mediatek: Move gce event property to mutex device node")
> Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index 3fc5511330b9..4d29568be3f5 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -831,13 +831,19 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
>                         drm_crtc_index(&mtk_crtc->base));
>                 mtk_crtc->cmdq_client = NULL;
>         }
> -       ret = of_property_read_u32_index(priv->mutex_node,
> -                                        "mediatek,gce-events",
> -                                        drm_crtc_index(&mtk_crtc->base),
> -                                        &mtk_crtc->cmdq_event);
> -       if (ret)
> -               dev_dbg(dev, "mtk_crtc %d failed to get mediatek,gce-events property\n",
> -                       drm_crtc_index(&mtk_crtc->base));
> +
> +       if (mtk_crtc->cmdq_client) {
> +               ret = of_property_read_u32_index(priv->mutex_node,
> +                                                "mediatek,gce-events",
> +                                                drm_crtc_index(&mtk_crtc->base),
> +                                                &mtk_crtc->cmdq_event);
> +               if (ret) {
> +                       dev_dbg(dev, "mtk_crtc %d failed to get mediatek,gce-events property\n",
> +                               drm_crtc_index(&mtk_crtc->base));
> +                       cmdq_mbox_destroy(mtk_crtc->cmdq_client);
> +                       mtk_crtc->cmdq_client = NULL;
> +               }
> +       }
>  #endif
>         return 0;
>  }
> --
> 2.17.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index 3fc5511330b9..4d29568be3f5 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -831,13 +831,19 @@  int mtk_drm_crtc_create(struct drm_device *drm_dev,
 			drm_crtc_index(&mtk_crtc->base));
 		mtk_crtc->cmdq_client = NULL;
 	}
-	ret = of_property_read_u32_index(priv->mutex_node,
-					 "mediatek,gce-events",
-					 drm_crtc_index(&mtk_crtc->base),
-					 &mtk_crtc->cmdq_event);
-	if (ret)
-		dev_dbg(dev, "mtk_crtc %d failed to get mediatek,gce-events property\n",
-			drm_crtc_index(&mtk_crtc->base));
+
+	if (mtk_crtc->cmdq_client) {
+		ret = of_property_read_u32_index(priv->mutex_node,
+						 "mediatek,gce-events",
+						 drm_crtc_index(&mtk_crtc->base),
+						 &mtk_crtc->cmdq_event);
+		if (ret) {
+			dev_dbg(dev, "mtk_crtc %d failed to get mediatek,gce-events property\n",
+				drm_crtc_index(&mtk_crtc->base));
+			cmdq_mbox_destroy(mtk_crtc->cmdq_client);
+			mtk_crtc->cmdq_client = NULL;
+		}
+	}
 #endif
 	return 0;
 }