Skip to contentSkip to conversation

drm/msm: A handful of dpu fixes

PATCH RESEND In review Sean Paul 5 participants 28 messages Feb 21, 2018 – Mar 15, 2018 14 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Sean Paul

author
#0 lore raw

cover drm/msm: A handful of dpu fixes

Apologies for the spam, I'm resending again because git send-email keeps adding the commit hash as a cc, and then failing since it's not a valid email. If anyone knows how to suppress git send-email from adding the "From <sha1> Mon Sep 17 00:00:00 2001" line as a cc, hit me up. For now, I've just done the dumb thing and marked --suppress-cc=all.

[original msg]
We've finally got the mtp development kit booting the DPU driver that was sent upstream last week. Here are some of the patches that were necessary to do that. There are a bunch more, but they touch downstream code that is not going upstream (namely dsi-staging and smmu). The booting kernel can be found at [1].

Once the patches in this series receive some light review, I'll drop them on for-next at [2].

Thanks,

Sean

[1]- https://cgit.freedesktop.org/~seanpaul/dpu-staging/log/?h=mtp-testing
[2]- https://cgit.freedesktop.org/~seanpaul/dpu-staging/log/?h=for-next

Jeykumar Sankaran (1):
drm/msm/dpu: Fix writeback compile macros

Sean Paul (9):
drm/msm: Add displayport files to Makefile drm/msm: Include the dpu_dbg header in msm_drv.c drm/msm: Change driver name back to msm drm/msm: Remove smmu driver init/cleanup from msm_drv drm/msm: Defer probe if display component not found drm/msm: Fix deadlock calling msm_gem_new() drm/msm: Populate kms->irq for dpu
drm/msm: Sprinkle pm_runtime calls around drm/msm: Restore msm_atomic_check hook

 drivers/gpu/drm/msm/Makefile                  | 14 ++++++++++++++
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c      |  3 +++
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c   |  7 ++-----
 .../gpu/drm/msm/disp/dpu1/dpu_hw_reg_dma_v1.c |  2 --
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c       | 19 ++++++++++++++++++-
 drivers/gpu/drm/msm/msm_drv.c                 | 17 +++++++++--------
 6 files changed, 46 insertions(+), 16 deletions(-)
Signature · 6 lines
2.16.1.291.g4437f3f132-goog

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20180221151838.224718-1-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

author
#2 lore raw

PATCH RESEND 1/10 drm/msm: Add displayport files to Makefile

Still behind a config flag, and ymmv when trying to build them, but they're present at least.

---
 drivers/gpu/drm/msm/Makefile | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/gpu/drm/msm/Makefile +14 -0
index d9014441d022..fcd85ae28d66 100644
@@ -108,6 +108,20 @@ msm-y := \
 	msm_ringbuffer.o \
 	msm_submitqueue.o
 
+msm-$(CONFIG_DRM_MSM_DP)+= dp/dp_usbpd.o \
+	dp/dp_parser.o \
+	dp/dp_power.o \
+	dp/dp_catalog.o \
+	dp/dp_aux.o \
+	dp/dp_panel.o \
+	dp/dp_link.o \
+	dp/dp_ctrl.o \
+	dp/dp_audio.o \
+	dp/dp_debug.o \
+	dp/dp_display.o \
+	dp/dp_drm.o \
+	dp/dp_hdcp2p2.o
+
 msm_wb-$(CONFIG_DRM_MSM_WRITEBACK) += disp/dpu1/dpu_wb.o \
 				      disp/dpu1/dpu_encoder_phys_wb.o
 
Signature · 6 lines
2.16.1.291.g4437f3f132-goog

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20180221151838.224718-2-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

Reviewed-by
#4 lore raw

Re: [PATCH RESEND 01/10] drm/msm: Add displayport files to Makefile

Quoted 4 lines · Sean Paul

Still behind a config flag, and ymmv when trying to build them, but they're present at least.

Quoted 28 lines
---
 drivers/gpu/drm/msm/Makefile | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/gpu/drm/msm/Makefile +14 -0
index d9014441d022..fcd85ae28d66 100644
@@ -108,6 +108,20 @@ msm-y := \
 	msm_ringbuffer.o \
 	msm_submitqueue.o
 
+msm-$(CONFIG_DRM_MSM_DP)+= dp/dp_usbpd.o \
+	dp/dp_parser.o \
+	dp/dp_power.o \
+	dp/dp_catalog.o \
+	dp/dp_aux.o \
+	dp/dp_panel.o \
+	dp/dp_link.o \
+	dp/dp_ctrl.o \
+	dp/dp_audio.o \
+	dp/dp_debug.o \
+	dp/dp_display.o \
+	dp/dp_drm.o \
+	dp/dp_hdcp2p2.o
+
 msm_wb-$(CONFIG_DRM_MSM_WRITEBACK) += disp/dpu1/dpu_wb.o \
 				      disp/dpu1/dpu_encoder_phys_wb.o
Signature · 5 lines
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
author
#5 lore raw

PATCH RESEND 2/10 drm/msm: Include the dpu_dbg header in msm_drv.c

In reply to a message not in the archive

We'll need to clean up these conditionals further, but at least fix the compilation error.

---
 drivers/gpu/drm/msm/msm_drv.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/msm/msm_drv.c +3 -0
index e1b7e468c3dc..6f2affe5ccff 100644
@@ -53,6 +53,9 @@
 #ifdef CONFIG_DRM_MSM_DSI_STAGING
 #include "dsi_display.h"
 #endif
+#ifdef CONFIG_DRM_MSM_DPU
+#include "dpu_dbg.h"
+#endif
 
 /*
  * MSM driver version:
Signature · 6 lines
2.16.1.291.g4437f3f132-goog

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20180221151838.224718-3-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

#7 lore raw

Re: [PATCH RESEND 02/10] drm/msm: Include the dpu_dbg header in msm_drv.c

Quoted 4 lines · Sean Paul

We'll need to clean up these conditionals further, but at least fix the compilation error.

Reviewed by Jeykumar Sankaran

Quoted 18 lines
---
 drivers/gpu/drm/msm/msm_drv.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/msm/msm_drv.c +3 -0
index e1b7e468c3dc..6f2affe5ccff 100644
@@ -53,6 +53,9 @@
 #ifdef CONFIG_DRM_MSM_DSI_STAGING
 #include "dsi_display.h"
 #endif
+#ifdef CONFIG_DRM_MSM_DPU
+#include "dpu_dbg.h"
+#endif
 
 /*
  * MSM driver version:
Signature · 5 lines
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
Reviewed-by
#8 lore raw

Re: [PATCH RESEND 02/10] drm/msm: Include the dpu_dbg header in msm_drv.c

In reply to a message not in the archive
Quoted 4 lines · Sean Paul

We'll need to clean up these conditionals further, but at least fix the compilation error.

Quoted 18 lines
---
 drivers/gpu/drm/msm/msm_drv.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/msm/msm_drv.c +3 -0
index e1b7e468c3dc..6f2affe5ccff 100644
@@ -53,6 +53,9 @@
 #ifdef CONFIG_DRM_MSM_DSI_STAGING
 #include "dsi_display.h"
 #endif
+#ifdef CONFIG_DRM_MSM_DPU
+#include "dpu_dbg.h"
+#endif
 
 /*
  * MSM driver version:
Signature · 5 lines
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
author
#9 lore raw

PATCH RESEND 3/10 drm/msm: Change driver name back to msm

In reply to a message not in the archive

So userspace can find it again.

---
 drivers/gpu/drm/msm/msm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_drv.c +1 -1
index 6f2affe5ccff..106678a164c2 100644
@@ -1943,7 +1943,7 @@ static struct platform_driver msm_platform_driver = {
 	.probe      = msm_pdev_probe,
 	.remove     = msm_pdev_remove,
 	.driver     = {
-		.name   = "msm_drm",
+		.name   = "msm",
 		.of_match_table = dt_match,
 		.pm     = &msm_pm_ops,
 	},
Signature · 6 lines
2.16.1.291.g4437f3f132-goog

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20180221151838.224718-4-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

Reviewed-by
#11 lore raw

Re: [PATCH RESEND 03/10] drm/msm: Change driver name back to msm

Quoted 3 lines · Sean Paul

So userspace can find it again.

Quoted 18 lines
---
 drivers/gpu/drm/msm/msm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_drv.c +1 -1
index 6f2affe5ccff..106678a164c2 100644
@@ -1943,7 +1943,7 @@ static struct platform_driver msm_platform_driver 
 = {
 	.probe      = msm_pdev_probe,
 	.remove     = msm_pdev_remove,
 	.driver     = {
-		.name   = "msm_drm",
+		.name   = "msm",
 		.of_match_table = dt_match,
 		.pm     = &msm_pm_ops,

},

Signature · 5 lines
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
author
#12 lore raw

PATCH RESEND 4/10 drm/msm: Remove smmu driver init/cleanup from msm_drv

In reply to a message not in the archive

Leftover bits from the initial removal of smmu.

---
 drivers/gpu/drm/msm/msm_drv.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +0 -6
index 106678a164c2..9532321a0e4f 100644
@@ -1966,9 +1966,6 @@ static int __init msm_drm_register(void)
 
 	DBG("init");
 	msm_mdp_register();
-#ifdef CONFIG_DRM_MSM_DPU
-	msm_smmu_driver_init();
-#endif
 	msm_dsi_register();
 	msm_edp_register();
 	msm_hdmi_register();
@@ -1985,9 +1982,6 @@ static void __exit msm_drm_unregister(void)
 	msm_edp_unregister();
 	msm_dsi_unregister();
 	msm_mdp_unregister();
-#ifdef CONFIG_DRM_MSM_DPU
-	msm_smmu_driver_cleanup();
-#endif
 }
 
 module_init(msm_drm_register);
Signature · 6 lines
2.16.1.291.g4437f3f132-goog

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20180221151838.224718-5-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

#14 lore raw

Re: [PATCH RESEND 04/10] drm/msm: Remove smmu driver init/cleanup from msm_drv

Quoted 3 lines · Sean Paul

Leftover bits from the initial removal of smmu.

Reviewed by Jeykumar Sankaran

Quoted 28 lines
---
 drivers/gpu/drm/msm/msm_drv.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +0 -6
index 106678a164c2..9532321a0e4f 100644
@@ -1966,9 +1966,6 @@ static int __init msm_drm_register(void)
 
 	DBG("init");
 	msm_mdp_register();
-#ifdef CONFIG_DRM_MSM_DPU
-	msm_smmu_driver_init();
-#endif
 	msm_dsi_register();
 	msm_edp_register();
 	msm_hdmi_register();
@@ -1985,9 +1982,6 @@ static void __exit msm_drm_unregister(void)
 	msm_edp_unregister();
 	msm_dsi_unregister();
 	msm_mdp_unregister();
-#ifdef CONFIG_DRM_MSM_DPU
-	msm_smmu_driver_cleanup();
-#endif
 }
 
 module_init(msm_drm_register);
Signature · 5 lines
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
Reviewed-by
#15 lore raw

Re: [PATCH RESEND 04/10] drm/msm: Remove smmu driver init/cleanup from msm_drv

In reply to a message not in the archive
Quoted 3 lines · Sean Paul

Leftover bits from the initial removal of smmu.

Quoted 28 lines
---
 drivers/gpu/drm/msm/msm_drv.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +0 -6
index 106678a164c2..9532321a0e4f 100644
@@ -1966,9 +1966,6 @@ static int __init msm_drm_register(void)
 
 	DBG("init");
 	msm_mdp_register();
-#ifdef CONFIG_DRM_MSM_DPU
-	msm_smmu_driver_init();
-#endif
 	msm_dsi_register();
 	msm_edp_register();
 	msm_hdmi_register();
@@ -1985,9 +1982,6 @@ static void __exit msm_drm_unregister(void)
 	msm_edp_unregister();
 	msm_dsi_unregister();
 	msm_mdp_unregister();
-#ifdef CONFIG_DRM_MSM_DPU
-	msm_smmu_driver_cleanup();
-#endif
 }
 
 module_init(msm_drm_register);
Signature · 5 lines
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
author
#16 lore raw

PATCH RESEND 5/10 drm/msm: Defer probe if display component not found

In reply to a message not in the archive

The downstream driver relies on Makefile ordering of files to ensure components probe in the right order. This took me entirely too long to sort out, so don't rely on that any longer.

---
 drivers/gpu/drm/msm/msm_drv.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/msm/msm_drv.c +4 -0
index 9532321a0e4f..30c56b873fbe 100644
@@ -1784,6 +1784,7 @@ static int add_display_components(struct device *dev,
 	if (of_device_is_compatible(dev->of_node, "qcom,dpu-kms")) {
 		struct device_node *np = dev->of_node;
 		unsigned int i;
+		bool found = false;
 
 #ifdef CONFIG_DRM_MSM_DSI_STAGING
 		for (i = 0; i < MAX_DSI_ACTIVE_DISPLAY; i++) {
@@ -1794,8 +1795,11 @@ static int add_display_components(struct device *dev,
 				component_match_add(dev, matchptr, compare_of,
 						node);
 				pr_debug("Added component = %s\n", name);
+				found = true;
 			}
 		}
+		if (!found)
+			return -EPROBE_DEFER;
 #endif
 
 		for (i = 0; ; i++) {
Signature · 6 lines
2.16.1.291.g4437f3f132-goog

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20180221151838.224718-6-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

Reviewed-by
#18 lore raw

Re: [PATCH RESEND 05/10] drm/msm: Defer probe if display component not found

Quoted 5 lines · Sean Paul

The downstream driver relies on Makefile ordering of files to ensure components probe in the right order. This took me entirely too long to sort out, so don't rely on that any longer.

Quoted 30 lines
---
 drivers/gpu/drm/msm/msm_drv.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/msm/msm_drv.c +1 -0
index 9532321a0e4f..30c56b873fbe 100644
@@ -1784,6 +1784,7 @@ static int add_display_components(struct device 
 *dev,
 	if (of_device_is_compatible(dev->of_node, "qcom,dpu-kms")) {
 		struct device_node *np = dev->of_node;
 		unsigned int i;
+		bool found = false;
 
 #ifdef CONFIG_DRM_MSM_DSI_STAGING
drivers/gpu/drm/msm/msm_drv.c +3 -0
 		for (i = 0; i < MAX_DSI_ACTIVE_DISPLAY; i++) {
@@ -1794,8 +1795,11 @@ static int add_display_components(struct device 
 *dev,
 				component_match_add(dev, matchptr, compare_of,
 						node);
 				pr_debug("Added component = %s\n", name);
+				found = true;
 			}
 		}
+		if (!found)
+			return -EPROBE_DEFER;
 #endif
 

for (i = 0; ; i++) {

Signature · 5 lines
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
author
#19 lore raw

PATCH RESEND 6/10 drm/msm: Fix deadlock calling msm_gem_new()

In reply to a message not in the archive

msm_gem_new() acquires the struct_mutex, so surrounding this call with locks causes deadlocks all day long.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_reg_dma_v1.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_reg_dma_v1.c +0 -2
index fc2efec6360b..bb4547748ce9 100644
@@ -601,10 +601,8 @@ static struct dpu_reg_dma_buffer *alloc_reg_dma_buf_v1(u32 size)
 	if (!dma_buf)
 		return ERR_PTR(-ENOMEM);
 
-	mutex_lock(&reg_dma->drm_dev->struct_mutex);
 	dma_buf->buf = msm_gem_new(reg_dma->drm_dev,
 				    rsize, MSM_BO_UNCACHED);
-	mutex_unlock(&reg_dma->drm_dev->struct_mutex);
 	if (IS_ERR_OR_NULL(dma_buf->buf)) {
 		rc = -EINVAL;
 		goto fail;
Signature · 6 lines
2.16.1.291.g4437f3f132-goog

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20180221151838.224718-7-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

Reviewed-by
#21 lore raw

Re: [PATCH RESEND 06/10] drm/msm: Fix deadlock calling msm_gem_new()

Quoted 4 lines · Sean Paul

msm_gem_new() acquires the struct_mutex, so surrounding this call with locks causes deadlocks all day long.

Quoted 21 lines
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_reg_dma_v1.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_reg_dma_v1.c +0 -2
index fc2efec6360b..bb4547748ce9 100644
@@ -601,10 +601,8 @@ static struct dpu_reg_dma_buffer
 *alloc_reg_dma_buf_v1(u32 size)
 	if (!dma_buf)
 		return ERR_PTR(-ENOMEM);
 
-	mutex_lock(&reg_dma->drm_dev->struct_mutex);
 	dma_buf->buf = msm_gem_new(reg_dma->drm_dev,
 				    rsize, MSM_BO_UNCACHED);
-	mutex_unlock(&reg_dma->drm_dev->struct_mutex);
 	if (IS_ERR_OR_NULL(dma_buf->buf)) {
 		rc = -EINVAL;

goto fail;

Signature · 5 lines
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
author
#22 lore raw

PATCH RESEND 7/10 drm/msm: Populate kms->irq for dpu

In reply to a message not in the archive

The irq wasn't actually getting installed b/c kms->irq was vacant. Fill it in.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +9 -0
index 24eb4683ae62..fb4de59d8ed1 100644
@@ -2047,14 +2047,22 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 
 struct msm_kms *dpu_kms_init(struct drm_device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev->dev);
 	struct msm_drm_private *priv;
 	struct dpu_kms *dpu_kms;
+	int irq;
 
 	if (!dev || !dev->dev_private) {
 		DPU_ERROR("drm device node invalid\n");
 		return ERR_PTR(-EINVAL);
 	}
 
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0) {
+		DPU_ERROR("failed to get irq: %d\n", irq);
+		return irq;
+	}
+
 	priv = dev->dev_private;
 
 	dpu_kms = kzalloc(sizeof(*dpu_kms), GFP_KERNEL);
@@ -2065,6 +2073,7 @@ struct msm_kms *dpu_kms_init(struct drm_device *dev)
 
 	msm_kms_init(&dpu_kms->base, &kms_funcs);
 	dpu_kms->dev = dev;
+	dpu_kms->base.irq = irq;
 
 	return &dpu_kms->base;
 }
Signature · 6 lines
2.16.1.291.g4437f3f132-goog

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20180221151838.224718-8-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

Reviewed-by
#24 lore raw

Re: [PATCH RESEND 07/10] drm/msm: Populate kms->irq for dpu

Quoted 4 lines · Sean Paul

The irq wasn't actually getting installed b/c kms->irq was vacant. Fill it in.

Quoted 33 lines
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +8 -0
index 24eb4683ae62..fb4de59d8ed1 100644
@@ -2047,14 +2047,22 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 
 struct msm_kms *dpu_kms_init(struct drm_device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev->dev);
 	struct msm_drm_private *priv;
 	struct dpu_kms *dpu_kms;
+	int irq;
 
 	if (!dev || !dev->dev_private) {
 		DPU_ERROR("drm device node invalid\n");
 		return ERR_PTR(-EINVAL);
 	}
 
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0) {
+		DPU_ERROR("failed to get irq: %d\n", irq);
+		return irq;
+	}
+
 	priv = dev->dev_private;
 
 	dpu_kms = kzalloc(sizeof(*dpu_kms), GFP_KERNEL);

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c struct msm_kms *dpu_kms_init(struct drm_device · line 2077

Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1 -0
@@ -2065,6 +2073,7 @@ struct msm_kms *dpu_kms_init(struct drm_device 
 *dev)
 
 	msm_kms_init(&dpu_kms->base, &kms_funcs);
 	dpu_kms->dev = dev;
+	dpu_kms->base.irq = irq;

msm_drv.c uses

Quoted 3 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +0 -0
 	return &dpu_kms->base;
 }
Signature · 5 lines
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
author
#25 lore raw

PATCH RESEND 8/10 drm/msm: Sprinkle pm_runtime calls around

In reply to a message not in the archive

Adding missing pm_runtime references where appropriate.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c |  3 +++
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c  | 10 +++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +3 -0
index f1642d72469e..df6cbeb15cf5 100644
@@ -3497,6 +3497,7 @@ static void dpu_crtc_disable(struct drm_crtc *crtc)
 	/* disable clk & bw control until clk & bw properties are set */
 	cstate->bw_control = false;
 	cstate->bw_split_vote = false;
+	pm_runtime_put_sync(crtc->dev->dev);
 
 	mutex_unlock(&dpu_crtc->crtc_lock);
 }
@@ -3523,6 +3524,8 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
 	DPU_EVT32_VERBOSE(DRMID(crtc));
 	dpu_crtc = to_dpu_crtc(crtc);
 
+	pm_runtime_get_sync(crtc->dev->dev);
+
 	drm_for_each_encoder(encoder, crtc->dev) {
 		if (encoder->crtc != crtc)
 			continue;
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +9 -1
index fb4de59d8ed1..b919c9a6a463 100644
@@ -114,6 +114,7 @@ static int _dpu_danger_signal_status(struct seq_file *s,
 	priv = kms->dev->dev_private;
 	memset(&status, 0, sizeof(struct dpu_danger_safe_status));
 
+	pm_runtime_get_sync(kms->dev->dev);
 	dpu_power_resource_enable(&priv->phandle, kms->core_client, true);
 	if (danger_status) {
 		seq_puts(s, "\nDanger signal status:\n");
@@ -127,6 +128,7 @@ static int _dpu_danger_signal_status(struct seq_file *s,
 					&status);
 	}
 	dpu_power_resource_enable(&priv->phandle, kms->core_client, false);
+	pm_runtime_put_sync(kms->dev->dev);
 
 	seq_printf(s, "MDP     :  0x%x\n", status.mdp);
 
@@ -346,12 +348,14 @@ static void _dpu_debugfs_destroy(struct dpu_kms *dpu_kms)
 
 static int dpu_kms_enable_vblank(struct msm_kms *kms, struct drm_crtc *crtc)
 {
+	pm_runtime_get_sync(crtc->dev->dev);
 	return dpu_crtc_vblank(crtc, true);
 }
 
 static void dpu_kms_disable_vblank(struct msm_kms *kms, struct drm_crtc *crtc)
 {
 	dpu_crtc_vblank(crtc, false);
+	pm_runtime_put_sync(crtc->dev->dev);
 }
 
 static void dpu_kms_wait_for_frame_transfer_complete(struct msm_kms *kms,
@@ -413,6 +417,7 @@ static void dpu_kms_prepare_commit(struct msm_kms *kms,
 	if (!dev || !dev->dev_private)
 		return;
 	priv = dev->dev_private;
+	pm_runtime_get_sync(dev->dev);
 	dpu_power_resource_enable(&priv->phandle, dpu_kms->core_client, true);
 
 	list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
@@ -471,6 +476,7 @@ static void dpu_kms_complete_commit(struct msm_kms *kms,
 	}
 
 	dpu_power_resource_enable(&priv->phandle, dpu_kms->core_client, false);
+	pm_runtime_put_sync(dpu_kms->dev->dev);
 
 	DPU_EVT32_VERBOSE(DPU_EVTLOG_FUNC_EXIT);
 }
@@ -1896,7 +1902,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 		dpu_kms->core_client = NULL;
 		goto error;
 	}
-
+	pm_runtime_get_sync(dev->dev);
 	rc = dpu_power_resource_enable(&priv->phandle, dpu_kms->core_client,
 		true);
 	if (rc) {
@@ -2030,6 +2036,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 			dpu_kms_handle_power_event, dpu_kms, "kms");
 
 	dpu_power_resource_enable(&priv->phandle, dpu_kms->core_client, false);
+	pm_runtime_put_sync(dev->dev);
 
 	return 0;
 
@@ -2039,6 +2046,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 perf_err:
 power_error:
 	dpu_power_resource_enable(&priv->phandle, dpu_kms->core_client, false);
+	pm_runtime_put_sync(dev->dev);
 error:
 	_dpu_kms_hw_destroy(dpu_kms, platformdev);
 end:
Signature · 6 lines
2.16.1.291.g4437f3f132-goog

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20180221151838.224718-9-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

#27 lore raw

Re: [PATCH RESEND 08/10] drm/msm: Sprinkle pm_runtime calls around

Quoted 75 lines · Sean Paul

Adding missing pm_runtime references where appropriate.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c |  3 +++
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c  | 10 +++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +1 -0
index f1642d72469e..df6cbeb15cf5 100644
@@ -3497,6 +3497,7 @@ static void dpu_crtc_disable(struct drm_crtc 
 *crtc)
 	/* disable clk & bw control until clk & bw properties are set */
 	cstate->bw_control = false;
 	cstate->bw_split_vote = false;
+	pm_runtime_put_sync(crtc->dev->dev);
 
 	mutex_unlock(&dpu_crtc->crtc_lock);

}

drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +2 -0
@@ -3523,6 +3524,8 @@ static void dpu_crtc_enable(struct drm_crtc 
 *crtc,
 	DPU_EVT32_VERBOSE(DRMID(crtc));
 	dpu_crtc = to_dpu_crtc(crtc);
 
+	pm_runtime_get_sync(crtc->dev->dev);
+
 	drm_for_each_encoder(encoder, crtc->dev) {
 		if (encoder->crtc != crtc)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +0 -0
 			continue;
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1 -0
index fb4de59d8ed1..b919c9a6a463 100644
@@ -114,6 +114,7 @@ static int _dpu_danger_signal_status(struct 
 seq_file *s,
 	priv = kms->dev->dev_private;
 	memset(&status, 0, sizeof(struct dpu_danger_safe_status));
 
+	pm_runtime_get_sync(kms->dev->dev);
 	dpu_power_resource_enable(&priv->phandle, kms->core_client, true);
 	if (danger_status) {
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +3 -0
 		seq_puts(s, "\nDanger signal status:\n");
@@ -127,6 +128,7 @@ static int _dpu_danger_signal_status(struct 
 seq_file *s,
 					&status);
 	}
 	dpu_power_resource_enable(&priv->phandle, kms->core_client, false);
+	pm_runtime_put_sync(kms->dev->dev);
 
 	seq_printf(s, "MDP     :  0x%x\n", status.mdp);
@@ -346,12 +348,14 @@ static void _dpu_debugfs_destroy(struct dpu_kms 
 *dpu_kms)
 
 static int dpu_kms_enable_vblank(struct msm_kms *kms, struct drm_crtc 
 *crtc)
 {
+	pm_runtime_get_sync(crtc->dev->dev);
 	return dpu_crtc_vblank(crtc, true);
 }
 
 static void dpu_kms_disable_vblank(struct msm_kms *kms, struct 
 drm_crtc *crtc)
 {
 	dpu_crtc_vblank(crtc, false);
+	pm_runtime_put_sync(crtc->dev->dev);

}

static void dpu_kms_wait_for_frame_transfer_complete(struct msm_kms
*kms,

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c static void dpu_kms_prepare_commit(struct msm_kms · line 421

Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1 -0
@@ -413,6 +417,7 @@ static void dpu_kms_prepare_commit(struct msm_kms 
 *kms,
 	if (!dev || !dev->dev_private)
 		return;
 	priv = dev->dev_private;
+	pm_runtime_get_sync(dev->dev);

CONFIG_DEBUG_FS is not enabled yet. Do we need this change here? If yes, we need to add pm_runtime calls in other files as well e.g: sde_plane_danger_read/write in dpu_plane.c.

Quoted 41 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +0 -0
 	dpu_power_resource_enable(&priv->phandle, dpu_kms->core_client, 
 true);
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1 -0
 	list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
@@ -471,6 +476,7 @@ static void dpu_kms_complete_commit(struct msm_kms 
 *kms,
 	}
 
 	dpu_power_resource_enable(&priv->phandle, dpu_kms->core_client, 
 false);
+	pm_runtime_put_sync(dpu_kms->dev->dev);
 
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +3 -1
 	DPU_EVT32_VERBOSE(DPU_EVTLOG_FUNC_EXIT);
 }
@@ -1896,7 +1902,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 		dpu_kms->core_client = NULL;
 		goto error;
 	}
-
+	pm_runtime_get_sync(dev->dev);
 	rc = dpu_power_resource_enable(&priv->phandle, dpu_kms->core_client,
 		true);
 	if (rc) {
@@ -2030,6 +2036,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 			dpu_kms_handle_power_event, dpu_kms, "kms");
 
 	dpu_power_resource_enable(&priv->phandle, dpu_kms->core_client, 
 false);
+	pm_runtime_put_sync(dev->dev);
 
 	return 0;
@@ -2039,6 +2046,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 perf_err:
 power_error:
 	dpu_power_resource_enable(&priv->phandle, dpu_kms->core_client, 
 false);
+	pm_runtime_put_sync(dev->dev);
 error:
 	_dpu_kms_hw_destroy(dpu_kms, platformdev);

end:

Signature · 5 lines
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): e953b0d8daa63e5cd2f65259b1c80a27-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org

author
#29 lore raw

Re: [PATCH RESEND 08/10] drm/msm: Sprinkle pm_runtime calls around

Quoted 72 lines · Jeykumar Sankaran
Quoted 71 lines · Sean Paul

Adding missing pm_runtime references where appropriate.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c |  3 +++
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c  | 10 +++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +1 -0
index f1642d72469e..df6cbeb15cf5 100644
@@ -3497,6 +3497,7 @@ static void dpu_crtc_disable(struct drm_crtc
 *crtc)
 	/* disable clk & bw control until clk & bw properties are set */
 	cstate->bw_control = false;
 	cstate->bw_split_vote = false;
+	pm_runtime_put_sync(crtc->dev->dev);
 
 	mutex_unlock(&dpu_crtc->crtc_lock);

}

drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +2 -0
@@ -3523,6 +3524,8 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
 	DPU_EVT32_VERBOSE(DRMID(crtc));
 	dpu_crtc = to_dpu_crtc(crtc);
 
+	pm_runtime_get_sync(crtc->dev->dev);
+
 	drm_for_each_encoder(encoder, crtc->dev) {
 		if (encoder->crtc != crtc)
 			continue;
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1 -0
index fb4de59d8ed1..b919c9a6a463 100644
@@ -114,6 +114,7 @@ static int _dpu_danger_signal_status(struct seq_file
 *s,
 	priv = kms->dev->dev_private;
 	memset(&status, 0, sizeof(struct dpu_danger_safe_status));
 
+	pm_runtime_get_sync(kms->dev->dev);
 	dpu_power_resource_enable(&priv->phandle, kms->core_client, true);
 	if (danger_status) {
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +3 -0
 		seq_puts(s, "\nDanger signal status:\n");
@@ -127,6 +128,7 @@ static int _dpu_danger_signal_status(struct seq_file
 *s,
 					&status);
 	}
 	dpu_power_resource_enable(&priv->phandle, kms->core_client, false);
+	pm_runtime_put_sync(kms->dev->dev);
 
 	seq_printf(s, "MDP     :  0x%x\n", status.mdp);
@@ -346,12 +348,14 @@ static void _dpu_debugfs_destroy(struct dpu_kms
 *dpu_kms)
 
 static int dpu_kms_enable_vblank(struct msm_kms *kms, struct drm_crtc
 *crtc)
 {
+	pm_runtime_get_sync(crtc->dev->dev);
 	return dpu_crtc_vblank(crtc, true);
 }
 
 static void dpu_kms_disable_vblank(struct msm_kms *kms, struct drm_crtc
 *crtc)
 {
 	dpu_crtc_vblank(crtc, false);
+	pm_runtime_put_sync(crtc->dev->dev);

}

Quoted 13 lines

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c static void dpu_kms_prepare_commit(struct msm_kms · line 421

Quoted 8 lines

static void dpu_kms_wait_for_frame_transfer_complete(struct msm_kms
*kms,

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1 -0
@@ -413,6 +417,7 @@ static void dpu_kms_prepare_commit(struct msm_kms
 *kms,
 	if (!dev || !dev->dev_private)
 		return;
 	priv = dev->dev_private;
+	pm_runtime_get_sync(dev->dev);

CONFIG_DEBUG_FS is not enabled yet. Do we need this change here? If yes, we need
to add pm_runtime calls in other files as well e.g:
sde_plane_danger_read/write in dpu_plane.c.

Hmm, yeah good catch. Aside from the question of debugfs (which I think we should probably do a deep review of what's being exposed), perhaps we should move the pm_runtime_(get|put)_sync calls in dpu_power_resource_enable, then we don't need to worry about adding the calls everywhere.

Thoughts?

Sean

Quoted 44 lines
Quoted 41 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +0 -0
 	dpu_power_resource_enable(&priv->phandle, dpu_kms->core_client, true);
 
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1 -0
 	list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
@@ -471,6 +476,7 @@ static void dpu_kms_complete_commit(struct msm_kms
 *kms,
 	}
 
 	dpu_power_resource_enable(&priv->phandle, dpu_kms->core_client,
 false);
+	pm_runtime_put_sync(dpu_kms->dev->dev);
 
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +3 -1
 	DPU_EVT32_VERBOSE(DPU_EVTLOG_FUNC_EXIT);
 }
@@ -1896,7 +1902,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 		dpu_kms->core_client = NULL;
 		goto error;
 	}
-
+	pm_runtime_get_sync(dev->dev);
 	rc = dpu_power_resource_enable(&priv->phandle, dpu_kms->core_client,
 		true);
 	if (rc) {
@@ -2030,6 +2036,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 			dpu_kms_handle_power_event, dpu_kms, "kms");
 
 	dpu_power_resource_enable(&priv->phandle, dpu_kms->core_client,
 false);
+	pm_runtime_put_sync(dev->dev);
 
 	return 0;
@@ -2039,6 +2046,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 perf_err:
 power_error:
 	dpu_power_resource_enable(&priv->phandle, dpu_kms->core_client,
 false);
+	pm_runtime_put_sync(dev->dev);
 error:
 	_dpu_kms_hw_destroy(dpu_kms, platformdev);

end:

Signature · 1 line
Jeykumar S
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
#30 lore raw

PATCH 1/1 drm/msm: Add pm_runtime_get/put calls to dpu

Ensure that pm_runtime is properly referenced/unreferenced when we need it.

---

Didn't get a response to my suggestion, so wrote the patch anyways. Thoughts?

 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c |  3 +++
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c  |  2 ++
 drivers/gpu/drm/msm/dpu_power_handle.c   | 12 ++++++++----
 3 files changed, 13 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +3 -0
index f1642d72469e..df6cbeb15cf5 100644
@@ -3497,6 +3497,7 @@ static void dpu_crtc_disable(struct drm_crtc *crtc)
 	/* disable clk & bw control until clk & bw properties are set */
 	cstate->bw_control = false;
 	cstate->bw_split_vote = false;
+	pm_runtime_put_sync(crtc->dev->dev);
 
 	mutex_unlock(&dpu_crtc->crtc_lock);
 }
@@ -3523,6 +3524,8 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
 	DPU_EVT32_VERBOSE(DRMID(crtc));
 	dpu_crtc = to_dpu_crtc(crtc);
 
+	pm_runtime_get_sync(crtc->dev->dev);
+
 	drm_for_each_encoder(encoder, crtc->dev) {
 		if (encoder->crtc != crtc)
 			continue;
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +2 -0
index fb4de59d8ed1..90608a303aec 100644
@@ -346,12 +346,14 @@ static void _dpu_debugfs_destroy(struct dpu_kms *dpu_kms)
 
 static int dpu_kms_enable_vblank(struct msm_kms *kms, struct drm_crtc *crtc)
 {
+	pm_runtime_get_sync(crtc->dev->dev);
 	return dpu_crtc_vblank(crtc, true);
 }
 
 static void dpu_kms_disable_vblank(struct msm_kms *kms, struct drm_crtc *crtc)
 {
 	dpu_crtc_vblank(crtc, false);
+	pm_runtime_put_sync(crtc->dev->dev);
 }
 
 static void dpu_kms_wait_for_frame_transfer_complete(struct msm_kms *kms,
drivers/gpu/drm/msm/dpu_power_handle.c +8 -4
index 477ea9f2778c..a52be861117f 100644
@@ -18,6 +18,7 @@
 #include <linux/of.h>
 #include <linux/string.h>
 #include <linux/of_address.h>
+#include <linux/pm_runtime.h>
 #include <linux/slab.h>
 #include <linux/mutex.h>
 #include <linux/of_platform.h>
@@ -857,6 +858,9 @@ int dpu_power_resource_enable(struct dpu_power_handle *phandle,
 		return -EINVAL;
 	}
 
+	if (enable)
+		pm_runtime_get_sync(phandle->dev);
+
 	mp = &phandle->mp;
 
 	mutex_lock(&phandle->phandle_lock);
@@ -963,10 +967,6 @@ int dpu_power_resource_enable(struct dpu_power_handle *phandle,
 				DPU_POWER_EVENT_POST_DISABLE);
 	}
 
-end:
-	mutex_unlock(&phandle->phandle_lock);
-	return rc;
-
 clk_err:
 	dpu_power_rsc_update(phandle, false);
 rsc_err:
@@ -979,7 +979,11 @@ int dpu_power_resource_enable(struct dpu_power_handle *phandle,
 		dpu_power_data_bus_update(&phandle->data_bus_handle[i], 0);
 data_bus_hdl_err:
 	phandle->current_usecase_ndx = prev_usecase_ndx;
+
+end:
 	mutex_unlock(&phandle->phandle_lock);
+	if (!enable)
+		pm_runtime_put_sync(phandle->dev);
 	return rc;
 }
 
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 20180314150718.254814-1-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

#32 lore raw

Re: [DPU PATCH] drm/msm: Add pm_runtime_get/put calls to dpu

Quoted 9 lines · Sean Paul

Ensure that pm_runtime is properly referenced/unreferenced when we need it.

---

Didn't get a response to my suggestion, so wrote the patch anyways. Thoughts?

This patch looks fine for now.
The plan is to deprecate the downstream power_handler APIs going forward and rely entirely on runtime pm APIs.

Currently, the pm_runtime_get/put API is used to control the MDSS main power supply (which is defined as a generic power domain). The idea is to extend the runtime_pm suspend/resume handlers to manage clock and bus resources so that the power_handler code can be trimmed off.

Thanks,
Sravanthi

Quoted 92 lines
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c |  3 +++
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c  |  2 ++
 drivers/gpu/drm/msm/dpu_power_handle.c   | 12 ++++++++----
 3 files changed, 13 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +1 -0
index f1642d72469e..df6cbeb15cf5 100644
@@ -3497,6 +3497,7 @@ static void dpu_crtc_disable(struct drm_crtc 
 *crtc)
 	/* disable clk & bw control until clk & bw properties are set */
 	cstate->bw_control = false;
 	cstate->bw_split_vote = false;
+	pm_runtime_put_sync(crtc->dev->dev);
 
 	mutex_unlock(&dpu_crtc->crtc_lock);

}

drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +2 -0
@@ -3523,6 +3524,8 @@ static void dpu_crtc_enable(struct drm_crtc 
 *crtc,
 	DPU_EVT32_VERBOSE(DRMID(crtc));
 	dpu_crtc = to_dpu_crtc(crtc);
 
+	pm_runtime_get_sync(crtc->dev->dev);
+
 	drm_for_each_encoder(encoder, crtc->dev) {
 		if (encoder->crtc != crtc)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +0 -0
 			continue;
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +2 -0
index fb4de59d8ed1..90608a303aec 100644
@@ -346,12 +346,14 @@ static void _dpu_debugfs_destroy(struct dpu_kms 
 *dpu_kms)
 
 static int dpu_kms_enable_vblank(struct msm_kms *kms, struct drm_crtc 
 *crtc)
 {
+	pm_runtime_get_sync(crtc->dev->dev);
 	return dpu_crtc_vblank(crtc, true);
 }
 
 static void dpu_kms_disable_vblank(struct msm_kms *kms, struct 
 drm_crtc *crtc)
 {
 	dpu_crtc_vblank(crtc, false);
+	pm_runtime_put_sync(crtc->dev->dev);

}

static void dpu_kms_wait_for_frame_transfer_complete(struct msm_kms
*kms,

drivers/gpu/drm/msm/dpu_power_handle.c +4 -0
index 477ea9f2778c..a52be861117f 100644
@@ -18,6 +18,7 @@
 #include <linux/of.h>
 #include <linux/string.h>
 #include <linux/of_address.h>
+#include <linux/pm_runtime.h>
 #include <linux/slab.h>
 #include <linux/mutex.h>
 #include <linux/of_platform.h>
@@ -857,6 +858,9 @@ int dpu_power_resource_enable(struct
 dpu_power_handle *phandle,
 		return -EINVAL;
 	}
 
+	if (enable)
+		pm_runtime_get_sync(phandle->dev);
+
 	mp = &phandle->mp;
 
drivers/gpu/drm/msm/dpu_power_handle.c +0 -4
 	mutex_lock(&phandle->phandle_lock);
@@ -963,10 +967,6 @@ int dpu_power_resource_enable(struct
 dpu_power_handle *phandle,
 				DPU_POWER_EVENT_POST_DISABLE);
 	}
 
-end:
-	mutex_unlock(&phandle->phandle_lock);
-	return rc;
-
 clk_err:
 	dpu_power_rsc_update(phandle, false);

rsc_err:

drivers/gpu/drm/msm/dpu_power_handle.c +0 -0
@@ -979,7 +979,11 @@ int dpu_power_resource_enable(struct
 dpu_power_handle *phandle,

drivers/gpu/drm/msm/dpu_power_handle.c int dpu_power_resource_enable(struct · line 989

Quoted 10 lines
drivers/gpu/drm/msm/dpu_power_handle.c +4 -0
 		dpu_power_data_bus_update(&phandle->data_bus_handle[i], 0);
 data_bus_hdl_err:
 	phandle->current_usecase_ndx = prev_usecase_ndx;
+
+end:
 	mutex_unlock(&phandle->phandle_lock);
+	if (!enable)
+		pm_runtime_put_sync(phandle->dev);
 	return rc;
 }

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 94e53348399f60ace8da8281acdaaef0-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org

Reviewed-by Sravanthi Kollukuduru
#34 lore raw

Re: [DPU PATCH] drm/msm: Add pm_runtime_get/put calls to dpu

Quoted 5 lines · On 2018-03-15 20:12, [email protected] wrote:
Quoted 4 lines · Sean Paul

Ensure that pm_runtime is properly referenced/unreferenced when we need it.

Quoted 116 lines
Quoted 5 lines

---

Didn't get a response to my suggestion, so wrote the patch anyways. Thoughts?

This patch looks fine for now.
The plan is to deprecate the downstream power_handler APIs going forward and rely entirely on runtime pm APIs.

Currently, the pm_runtime_get/put API is used to control the MDSS main power supply (which is defined as a generic power domain). The idea is to extend the runtime_pm suspend/resume handlers to manage clock and bus resources so that the power_handler code can be trimmed off.

Thanks,
Sravanthi

Quoted 98 lines
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c |  3 +++
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c  |  2 ++
 drivers/gpu/drm/msm/dpu_power_handle.c   | 12 ++++++++----
 3 files changed, 13 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +1 -0
index f1642d72469e..df6cbeb15cf5 100644
@@ -3497,6 +3497,7 @@ static void dpu_crtc_disable(struct drm_crtc 
 *crtc)
 	/* disable clk & bw control until clk & bw properties are set */
 	cstate->bw_control = false;
 	cstate->bw_split_vote = false;
+	pm_runtime_put_sync(crtc->dev->dev);
 
 	mutex_unlock(&dpu_crtc->crtc_lock);

}

drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +2 -0
@@ -3523,6 +3524,8 @@ static void dpu_crtc_enable(struct drm_crtc 
 *crtc,
 	DPU_EVT32_VERBOSE(DRMID(crtc));
 	dpu_crtc = to_dpu_crtc(crtc);
 
+	pm_runtime_get_sync(crtc->dev->dev);
+
 	drm_for_each_encoder(encoder, crtc->dev) {
 		if (encoder->crtc != crtc)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +0 -0
 			continue;
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +2 -0
index fb4de59d8ed1..90608a303aec 100644
@@ -346,12 +346,14 @@ static void _dpu_debugfs_destroy(struct dpu_kms 
 *dpu_kms)
 
 static int dpu_kms_enable_vblank(struct msm_kms *kms, struct drm_crtc 
 *crtc)
 {
+	pm_runtime_get_sync(crtc->dev->dev);
 	return dpu_crtc_vblank(crtc, true);
 }
 
 static void dpu_kms_disable_vblank(struct msm_kms *kms, struct 
 drm_crtc *crtc)
 {
 	dpu_crtc_vblank(crtc, false);
+	pm_runtime_put_sync(crtc->dev->dev);

}

static void dpu_kms_wait_for_frame_transfer_complete(struct msm_kms
*kms,

drivers/gpu/drm/msm/dpu_power_handle.c +4 -0
index 477ea9f2778c..a52be861117f 100644
@@ -18,6 +18,7 @@
 #include <linux/of.h>
 #include <linux/string.h>
 #include <linux/of_address.h>
+#include <linux/pm_runtime.h>
 #include <linux/slab.h>
 #include <linux/mutex.h>
 #include <linux/of_platform.h>
@@ -857,6 +858,9 @@ int dpu_power_resource_enable(struct
 dpu_power_handle *phandle,
 		return -EINVAL;
 	}
 
+	if (enable)
+		pm_runtime_get_sync(phandle->dev);
+
 	mp = &phandle->mp;
 
drivers/gpu/drm/msm/dpu_power_handle.c +0 -4
 	mutex_lock(&phandle->phandle_lock);
@@ -963,10 +967,6 @@ int dpu_power_resource_enable(struct
 dpu_power_handle *phandle,
 				DPU_POWER_EVENT_POST_DISABLE);
 	}
 
-end:
-	mutex_unlock(&phandle->phandle_lock);
-	return rc;
-
 clk_err:
 	dpu_power_rsc_update(phandle, false);

rsc_err:

drivers/gpu/drm/msm/dpu_power_handle.c +2 -0
@@ -979,7 +979,11 @@ int dpu_power_resource_enable(struct
 dpu_power_handle *phandle,
 		dpu_power_data_bus_update(&phandle->data_bus_handle[i], 0);
 data_bus_hdl_err:
 	phandle->current_usecase_ndx = prev_usecase_ndx;
+
+end:
 	mutex_unlock(&phandle->phandle_lock);
Quoted 8 lines

drivers/gpu/drm/msm/dpu_power_handle.c int dpu_power_resource_enable(struct dpu_power_handle *phandle, · line 988

Quoted 4 lines
drivers/gpu/drm/msm/dpu_power_handle.c +2 -0
+	if (!enable)
+		pm_runtime_put_sync(phandle->dev);
 	return rc;
 }

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

author
#35 lore raw

PATCH RESEND 9/10 drm/msm/dpu: Fix writeback compile macros

In reply to a message not in the archive

From: Jeykumar Sankaran <[email protected]>

The writeback config gates were too aggressive and blocked out all encoder initialization. Reduce the scope of the gating to just exclude writeback initialization

[seanpaul fixed commit msg and reduced to one block inside the function]
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +2 -5
index 6f1688786838..3d168fa09f3f 100644
@@ -3441,7 +3441,6 @@ static void dpu_encoder_early_unregister(struct drm_encoder *encoder)
 	_dpu_encoder_destroy_debugfs(encoder);
 }
 
-#ifdef CONFIG_DRM_MSM_WRITEBACK
 static int dpu_encoder_virt_add_phys_encs(
 		u32 display_caps,
 		struct dpu_encoder_virt *dpu_enc,
@@ -3494,6 +3493,7 @@ static int dpu_encoder_virt_add_phys_encs(
 static int dpu_encoder_virt_add_phys_enc_wb(struct dpu_encoder_virt *dpu_enc,
 		struct dpu_enc_phys_init_params *params)
 {
+#ifdef CONFIG_DRM_MSM_WRITEBACK
 	struct dpu_encoder_phys *enc = NULL;
 
 	if (!dpu_enc) {
@@ -3519,10 +3519,9 @@ static int dpu_encoder_virt_add_phys_enc_wb(struct dpu_encoder_virt *dpu_enc,
 
 	dpu_enc->phys_encs[dpu_enc->num_phys_encs] = enc;
 	++dpu_enc->num_phys_encs;
-
+#endif
 	return 0;
 }
-#endif
 
 static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc,
 				 struct dpu_kms *dpu_kms,
@@ -3625,7 +3624,6 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc,
 			}
 		}
 
-#ifdef CONFIG_DRM_MSM_WRITEBACK
 		if (!ret) {
 			if (intf_type == INTF_WB)
 				ret = dpu_encoder_virt_add_phys_enc_wb(dpu_enc,
@@ -3639,7 +3637,6 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc,
 				DPU_ERROR_ENC(dpu_enc,
 						"failed to add phys encs\n");
 		}
-#endif
 	}
 
 	for (i = 0; i < dpu_enc->num_phys_encs; i++) {
Signature · 6 lines
2.16.1.291.g4437f3f132-goog

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
author
#36 lore raw

PATCH RESEND 10/10 drm/msm: Restore msm_atomic_check hook

In reply to a message not in the archive

Somehow this got lost, put it back. We might want to re-evaluate whether this is actually necessary, but for now let's actually use the thing.

---
 drivers/gpu/drm/msm/msm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_drv.c +1 -1
index 30c56b873fbe..eda4a2340f93 100644
@@ -119,7 +119,7 @@ int msm_atomic_check(struct drm_device *dev,
 static const struct drm_mode_config_funcs mode_config_funcs = {
 	.fb_create = msm_framebuffer_create,
 	.output_poll_changed = msm_fb_output_poll_changed,
-	.atomic_check = drm_atomic_helper_check,
+	.atomic_check = msm_atomic_check,
 	.atomic_commit = msm_atomic_commit,
 	.atomic_state_alloc = msm_atomic_state_alloc,
 	.atomic_state_clear = msm_atomic_state_clear,
Signature · 6 lines
2.16.1.291.g4437f3f132-goog

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20180221151838.224718-11-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org

#38 lore raw

Re: [PATCH RESEND 10/10] drm/msm: Restore msm_atomic_check hook

Quoted 4 lines · Sean Paul

Somehow this got lost, put it back. We might want to re-evaluate whether this is actually necessary, but for now let's actually use the thing.

we might need this atm, although I'd prefer trying to move back to original atomic check/commit/etc to start with. Personally I'd rather be moving in the direction of using the generic helpers (only reason it doesn't now is they didn't exist when I did initial atomic conversion, and no one has gotten around to this cleanup yet).

If the kthread-per-crtc scheme ends up being useful, it should probably be done in the atomic-helpers rather than in-driver, to ensure more consistent behavior (and bug-fixes) across drivers..

BR,
-R

Quoted 18 lines
---
 drivers/gpu/drm/msm/msm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_drv.c +1 -2
index 30c56b873fbe..eda4a2340f93 100644
@@ -119,7 +119,7 @@ int msm_atomic_check(struct drm_device *dev,
 static const struct drm_mode_config_funcs mode_config_funcs = {
        .fb_create = msm_framebuffer_create,
        .output_poll_changed = msm_fb_output_poll_changed,
-       .atomic_check = drm_atomic_helper_check,
+       .atomic_check = msm_atomic_check,
        .atomic_commit = msm_atomic_commit,
        .atomic_state_alloc = msm_atomic_state_alloc,
        .atomic_state_clear = msm_atomic_state_clear,
--
Quoted 2 lines

2.16.1.291.g4437f3f132-goog

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): CAF6AEGswWCtmdCi_Etg8V2Ty9pr1=veHnd8s7iuE4Ot8SB8Ppw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#40 lore raw

Re: [PATCH RESEND 10/10] drm/msm: Restore msm_atomic_check hook

Quoted 11 lines · Rob Clark
Quoted 4 lines · Sean Paul

Somehow this got lost, put it back. We might want to re-evaluate whether this is actually necessary, but for now let's actually use the thing.

we might need this atm, although I'd prefer trying to move back to original atomic check/commit/etc to start with. Personally I'd rather be moving in the direction of using the generic helpers (only reason it doesn't now is they didn't exist when I did initial atomic conversion, and no one has gotten around to this cleanup yet).

I suspect we can get rid of it. iirc, the dpu check didn't do anything interesting yet. I didn't want to rip it all out yet, but I'll add it to the trello and revisit once it bubbles up to the top of the stack (when I go through the msm core changes).

Sean

Quoted 33 lines

If the kthread-per-crtc scheme ends up being useful, it should probably be done in the atomic-helpers rather than in-driver, to ensure more consistent behavior (and bug-fixes) across drivers..

BR,
-R

Quoted 18 lines
---
 drivers/gpu/drm/msm/msm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_drv.c +1 -2
index 30c56b873fbe..eda4a2340f93 100644
@@ -119,7 +119,7 @@ int msm_atomic_check(struct drm_device *dev,
 static const struct drm_mode_config_funcs mode_config_funcs = {
        .fb_create = msm_framebuffer_create,
        .output_poll_changed = msm_fb_output_poll_changed,
-       .atomic_check = drm_atomic_helper_check,
+       .atomic_check = msm_atomic_check,
        .atomic_commit = msm_atomic_commit,
        .atomic_state_alloc = msm_atomic_state_alloc,
        .atomic_state_clear = msm_atomic_state_clear,
--
Quoted 2 lines

2.16.1.291.g4437f3f132-goog

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
Reviewed-by
#41 lore raw

Re: [PATCH RESEND 10/10] drm/msm: Restore msm_atomic_check hook

In reply to a message not in the archive
Quoted 4 lines · Sean Paul

Somehow this got lost, put it back. We might want to re-evaluate whether this is actually necessary, but for now let's actually use the thing.

Quoted 17 lines
---
 drivers/gpu/drm/msm/msm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_drv.c +1 -1
index 30c56b873fbe..eda4a2340f93 100644
@@ -119,7 +119,7 @@ int msm_atomic_check(struct drm_device *dev,
 static const struct drm_mode_config_funcs mode_config_funcs = {
 	.fb_create = msm_framebuffer_create,
 	.output_poll_changed = msm_fb_output_poll_changed,
-	.atomic_check = drm_atomic_helper_check,
+	.atomic_check = msm_atomic_check,
 	.atomic_commit = msm_atomic_commit,
 	.atomic_state_alloc = msm_atomic_state_alloc,
 	.atomic_state_clear = msm_atomic_state_clear,
Signature · 5 lines
Jeykumar S
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno