Skip to contentSkip to conversation

drm/sti: atomic bug fixes

PATCH In review Fabien Dessenne 2 participants 17 messages Sep 15, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover drm/sti: atomic bug fixes

This serie provides with bug fixes found while testing drm/sti with an atomic version of weston

[PATCH 1/8] drm/sti: fix debug logs
[PATCH 2/8] drm/sti: run hqvdp init sequence only once [PATCH 3/8] drm/sti: run gdp init sequence only once [PATCH 4/8] drm/sti: fix atomic_disable check
[PATCH 5/8] drm/sti: use different notifier_block for each pipe [PATCH 6/8] drm/sti: use vtg array instead of vtg_main/aux [PATCH 7/8] drm/sti: in crtc_atomic_flush, enable only planes of this [PATCH 8/8] drm/sti: use valid video mode
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw

PATCH 1/8 drm/sti: fix debug logs

Add some missing \n in logs.

---
 drivers/gpu/drm/sti/sti_gdp.c  | 2 +-
 drivers/gpu/drm/sti/sti_hda.c  | 4 ++--
 drivers/gpu/drm/sti/sti_hdmi.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/sti/sti_gdp.c +1 -1
index f7cd671..3d48e5e 100644
@@ -819,7 +819,7 @@ static void sti_gdp_atomic_update(struct drm_plane *drm_plane,
 	if (!curr_list) {
 		/* First update or invalid node should directly write in the
 		 * hw register */
-		DRM_DEBUG_DRIVER("%s first update (or invalid node)",
+		DRM_DEBUG_DRIVER("%s first update (or invalid node)\n",
 				 sti_plane_to_str(plane));
 
 		writel(gdp->is_curr_top ?
drivers/gpu/drm/sti/sti_hda.c +2 -2
index 8505569..a225c4d 100644
@@ -313,7 +313,7 @@ static void hda_enable_hd_dacs(struct sti_hda *hda, bool enable)
 			mask = DAC_CFG_HD_HZUVW_OFF_MASK;
 			break;
 		default:
-			DRM_INFO("Video DACS control register not supported!");
+			DRM_INFO("Video DACS control register not supported\n");
 			return;
 		}
 
@@ -362,7 +362,7 @@ static void hda_dbg_video_dacs_ctrl(struct seq_file *s, void __iomem *reg)
 		mask = DAC_CFG_HD_HZUVW_OFF_MASK;
 		break;
 	default:
-		DRM_DEBUG_DRIVER("Warning: DACS ctrl register not supported!");
+		DRM_DEBUG_DRIVER("Warning: DACS ctrl register not supported\n");
 		return;
 	}
 
drivers/gpu/drm/sti/sti_hdmi.c +1 -1
index d850dda..1f9e7b4 100644
@@ -203,7 +203,7 @@ static irqreturn_t hdmi_irq_thread(int irq, void *arg)
 
 	/* Audio FIFO underrun IRQ */
 	if (hdmi->irq_status & HDMI_INT_AUDIO_FIFO_XRUN)
-		DRM_INFO("Warning: audio FIFO underrun occurs!");
+		DRM_INFO("Warning: audio FIFO underrun occurs!\n");
 
 	return IRQ_HANDLED;
 }
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 1/8
#2 lore raw

Re: [PATCH 1/8] drm/sti: fix debug logs

Quoted 50 lines · Fabien Dessenne

Add some missing \n in logs.

---
 drivers/gpu/drm/sti/sti_gdp.c  | 2 +-
 drivers/gpu/drm/sti/sti_hda.c  | 4 ++--
 drivers/gpu/drm/sti/sti_hdmi.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/sti/sti_gdp.c +1 -1
index f7cd671..3d48e5e 100644
@@ -819,7 +819,7 @@ static void sti_gdp_atomic_update(struct drm_plane *drm_plane,
 	if (!curr_list) {
 		/* First update or invalid node should directly write in the
 		 * hw register */
-		DRM_DEBUG_DRIVER("%s first update (or invalid node)",
+		DRM_DEBUG_DRIVER("%s first update (or invalid node)\n",
 				 sti_plane_to_str(plane));
 
 		writel(gdp->is_curr_top ?
drivers/gpu/drm/sti/sti_hda.c +2 -2
index 8505569..a225c4d 100644
@@ -313,7 +313,7 @@ static void hda_enable_hd_dacs(struct sti_hda *hda, bool enable)
 			mask = DAC_CFG_HD_HZUVW_OFF_MASK;
 			break;
 		default:
-			DRM_INFO("Video DACS control register not supported!");
+			DRM_INFO("Video DACS control register not supported\n");
 			return;
 		}
 
@@ -362,7 +362,7 @@ static void hda_dbg_video_dacs_ctrl(struct seq_file *s, void __iomem *reg)
 		mask = DAC_CFG_HD_HZUVW_OFF_MASK;
 		break;
 	default:
-		DRM_DEBUG_DRIVER("Warning: DACS ctrl register not supported!");
+		DRM_DEBUG_DRIVER("Warning: DACS ctrl register not supported\n");
 		return;
 	}
 
drivers/gpu/drm/sti/sti_hdmi.c +0 -0
index d850dda..1f9e7b4 100644

drivers/gpu/drm/sti/sti_hdmi.c static irqreturn_t hdmi_irq_thread(int irq, void *arg) · line 209

Quoted 8 lines
drivers/gpu/drm/sti/sti_hdmi.c +1 -1
@@ -203,7 +203,7 @@ static irqreturn_t hdmi_irq_thread(int irq, void *arg)
 
 	/* Audio FIFO underrun IRQ */
 	if (hdmi->irq_status & HDMI_INT_AUDIO_FIFO_XRUN)
-		DRM_INFO("Warning: audio FIFO underrun occurs!");
+		DRM_INFO("Warning: audio FIFO underrun occurs!\n");
 
 	return IRQ_HANDLED;
 }

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

#3 lore raw

PATCH 2/8 drm/sti: run hqvdp init sequence only once

In reply to Fabien Dessenne

Do not rely on plane->status to define whether this is the first update but rather check for hqvdp->xp70_initialized bit status. This avoids multiple and unwanted calls to sti_vtg_register_client() which breaks the kernel scheduler.

---
 drivers/gpu/drm/sti/sti_hqvdp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/sti/sti_hqvdp.c +2 -2
index b5ee783..a222b2e 100644
@@ -770,6 +770,7 @@ static void sti_hqvdp_disable(struct sti_hqvdp *hqvdp)
 		DRM_ERROR("XP70 could not revert to idle\n");
 
 	hqvdp->plane.status = STI_PLANE_DISABLED;
+	hqvdp->xp70_initialized = false;
 }
 
 /**
@@ -1012,7 +1013,6 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
 	struct sti_hqvdp *hqvdp = to_sti_hqvdp(plane);
 	struct drm_crtc *crtc = state->crtc;
 	struct drm_framebuffer *fb = state->fb;
-	bool first_prepare = plane->status == STI_PLANE_DISABLED ? true : false;
 	struct drm_crtc_state *crtc_state;
 	struct drm_display_mode *mode;
 	int dst_x, dst_y, dst_w, dst_h;
@@ -1063,7 +1063,7 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
 		return -EINVAL;
 	}
 
-	if (first_prepare) {
+	if (!hqvdp->xp70_initialized) {
 		/* Start HQVDP XP70 coprocessor */
 		sti_hqvdp_start_xp70(hqvdp);
 
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 2/8
#4 lore raw

Re: [PATCH 2/8] drm/sti: run hqvdp init sequence only once

Quoted 32 lines · Fabien Dessenne

Do not rely on plane->status to define whether this is the first update but rather check for hqvdp->xp70_initialized bit status. This avoids multiple and unwanted calls to sti_vtg_register_client() which breaks the kernel scheduler.

---
 drivers/gpu/drm/sti/sti_hqvdp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/sti/sti_hqvdp.c +1 -1
index b5ee783..a222b2e 100644
@@ -770,6 +770,7 @@ static void sti_hqvdp_disable(struct sti_hqvdp *hqvdp)
 		DRM_ERROR("XP70 could not revert to idle\n");
 
 	hqvdp->plane.status = STI_PLANE_DISABLED;
+	hqvdp->xp70_initialized = false;
 }
 
 /**
@@ -1012,7 +1013,6 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
 	struct sti_hqvdp *hqvdp = to_sti_hqvdp(plane);
 	struct drm_crtc *crtc = state->crtc;
 	struct drm_framebuffer *fb = state->fb;
-	bool first_prepare = plane->status == STI_PLANE_DISABLED ? true : false;
 	struct drm_crtc_state *crtc_state;
 	struct drm_display_mode *mode;
 	int dst_x, dst_y, dst_w, dst_h;

drivers/gpu/drm/sti/sti_hqvdp.c static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane, · line 1069

Quoted 8 lines
drivers/gpu/drm/sti/sti_hqvdp.c +1 -1
@@ -1063,7 +1063,7 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
 		return -EINVAL;
 	}
 
-	if (first_prepare) {
+	if (!hqvdp->xp70_initialized) {
 		/* Start HQVDP XP70 coprocessor */
 		sti_hqvdp_start_xp70(hqvdp);
 

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

#5 lore raw

PATCH 3/8 drm/sti: run gdp init sequence only once

In reply to Fabien Dessenne

Do not rely on plane->status to define whether this is the first update but rather check for gdp->vtg.
This avoids multiple and unwanted calls to sti_vtg_register_client() which breaks the kernel scheduler.

---
 drivers/gpu/drm/sti/sti_gdp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/sti/sti_gdp.c +2 -2
index 3d48e5e..19052c4 100644
@@ -463,6 +463,7 @@ static void sti_gdp_disable(struct sti_gdp *gdp)
 		clk_disable_unprepare(gdp->clk_pix);
 
 	gdp->plane.status = STI_PLANE_DISABLED;
+	gdp->vtg = NULL;
 }
 
 /**
@@ -614,7 +615,6 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane,
 	struct drm_crtc *crtc = state->crtc;
 	struct sti_compositor *compo = dev_get_drvdata(gdp->dev);
 	struct drm_framebuffer *fb =  state->fb;
-	bool first_prepare = plane->status == STI_PLANE_DISABLED ? true : false;
 	struct drm_crtc_state *crtc_state;
 	struct sti_mixer *mixer;
 	struct drm_display_mode *mode;
@@ -651,7 +651,7 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane,
 		return -EINVAL;
 	}
 
-	if (first_prepare) {
+	if (!gdp->vtg) {
 		/* Register gdp callback */
 		gdp->vtg = mixer->id == STI_MIXER_MAIN ?
 					compo->vtg_main : compo->vtg_aux;
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 3/8
#6 lore raw

Re: [PATCH 3/8] drm/sti: run gdp init sequence only once

Quoted 32 lines · Fabien Dessenne

Do not rely on plane->status to define whether this is the first update but rather check for gdp->vtg.
This avoids multiple and unwanted calls to sti_vtg_register_client() which breaks the kernel scheduler.

---
 drivers/gpu/drm/sti/sti_gdp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/sti/sti_gdp.c +1 -1
index 3d48e5e..19052c4 100644
@@ -463,6 +463,7 @@ static void sti_gdp_disable(struct sti_gdp *gdp)
 		clk_disable_unprepare(gdp->clk_pix);
 
 	gdp->plane.status = STI_PLANE_DISABLED;
+	gdp->vtg = NULL;
 }
 
 /**
@@ -614,7 +615,6 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane,
 	struct drm_crtc *crtc = state->crtc;
 	struct sti_compositor *compo = dev_get_drvdata(gdp->dev);
 	struct drm_framebuffer *fb =  state->fb;
-	bool first_prepare = plane->status == STI_PLANE_DISABLED ? true : false;
 	struct drm_crtc_state *crtc_state;
 	struct sti_mixer *mixer;
 	struct drm_display_mode *mode;

drivers/gpu/drm/sti/sti_gdp.c static int sti_gdp_atomic_check(struct drm_plane *drm_plane, · line 657

Quoted 8 lines
drivers/gpu/drm/sti/sti_gdp.c +1 -1
@@ -651,7 +651,7 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane,
 		return -EINVAL;
 	}
 
-	if (first_prepare) {
+	if (!gdp->vtg) {
 		/* Register gdp callback */
 		gdp->vtg = mixer->id == STI_MIXER_MAIN ?
 					compo->vtg_main : compo->vtg_aux;

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

#7 lore raw

PATCH 4/8 drm/sti: fix atomic_disable check

In reply to Fabien Dessenne

When a drm_plane is being disabled, its ->crtc member is set to NULL before the .atomic_disable() func is called.
To get the crtc of the plane, read old_state->crtc instead of drm_plane->crtc

---
 drivers/gpu/drm/sti/sti_cursor.c | 6 +++---
 drivers/gpu/drm/sti/sti_gdp.c    | 6 +++---
 drivers/gpu/drm/sti/sti_hqvdp.c  | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/sti/sti_cursor.c +3 -3
index 3b53f7f..3a8b656 100644
@@ -309,15 +309,15 @@ static void sti_cursor_atomic_disable(struct drm_plane *drm_plane,
 {
 	struct sti_plane *plane = to_sti_plane(drm_plane);
 
-	if (!drm_plane->crtc) {
+	if (!oldstate->crtc) {
 		DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
 				 drm_plane->base.id);
 		return;
 	}
 
 	DRM_DEBUG_DRIVER("CRTC:%d (%s) drm plane:%d (%s)\n",
-			 drm_plane->crtc->base.id,
-			 sti_mixer_to_str(to_sti_mixer(drm_plane->crtc)),
+			 oldstate->crtc->base.id,
+			 sti_mixer_to_str(to_sti_mixer(oldstate->crtc)),
 			 drm_plane->base.id, sti_plane_to_str(plane));
 
 	plane->status = STI_PLANE_DISABLING;
drivers/gpu/drm/sti/sti_gdp.c +3 -3
index 19052c4..d5f7b18 100644
@@ -858,15 +858,15 @@ static void sti_gdp_atomic_disable(struct drm_plane *drm_plane,
 	/* restore possible crtcs value with the initial value */
 	drm_plane->possible_crtcs = plane->init_possible_crtcs;
 
-	if (!drm_plane->crtc) {
+	if (!oldstate->crtc) {
 		DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
 				 drm_plane->base.id);
 		return;
 	}
 
 	DRM_DEBUG_DRIVER("CRTC:%d (%s) drm plane:%d (%s)\n",
-			 drm_plane->crtc->base.id,
-			 sti_mixer_to_str(to_sti_mixer(drm_plane->crtc)),
+			 oldstate->crtc->base.id,
+			 sti_mixer_to_str(to_sti_mixer(oldstate->crtc)),
 			 drm_plane->base.id, sti_plane_to_str(plane));
 
 	plane->status = STI_PLANE_DISABLING;
drivers/gpu/drm/sti/sti_hqvdp.c +3 -3
index a222b2e..9dd13fd 100644
@@ -1214,15 +1214,15 @@ static void sti_hqvdp_atomic_disable(struct drm_plane *drm_plane,
 {
 	struct sti_plane *plane = to_sti_plane(drm_plane);
 
-	if (!drm_plane->crtc) {
+	if (!oldstate->crtc) {
 		DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
 				 drm_plane->base.id);
 		return;
 	}
 
 	DRM_DEBUG_DRIVER("CRTC:%d (%s) drm plane:%d (%s)\n",
-			 drm_plane->crtc->base.id,
-			 sti_mixer_to_str(to_sti_mixer(drm_plane->crtc)),
+			 oldstate->crtc->base.id,
+			 sti_mixer_to_str(to_sti_mixer(oldstate->crtc)),
 			 drm_plane->base.id, sti_plane_to_str(plane));
 
 	plane->status = STI_PLANE_DISABLING;
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 4/8
#8 lore raw

Re: [PATCH 4/8] drm/sti: fix atomic_disable check

Quoted 72 lines · Fabien Dessenne

When a drm_plane is being disabled, its ->crtc member is set to NULL before the .atomic_disable() func is called.
To get the crtc of the plane, read old_state->crtc instead of drm_plane->crtc

---
 drivers/gpu/drm/sti/sti_cursor.c | 6 +++---
 drivers/gpu/drm/sti/sti_gdp.c    | 6 +++---
 drivers/gpu/drm/sti/sti_hqvdp.c  | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/sti/sti_cursor.c +3 -3
index 3b53f7f..3a8b656 100644
@@ -309,15 +309,15 @@ static void sti_cursor_atomic_disable(struct drm_plane *drm_plane,
 {
 	struct sti_plane *plane = to_sti_plane(drm_plane);
 
-	if (!drm_plane->crtc) {
+	if (!oldstate->crtc) {
 		DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
 				 drm_plane->base.id);
 		return;
 	}
 
 	DRM_DEBUG_DRIVER("CRTC:%d (%s) drm plane:%d (%s)\n",
-			 drm_plane->crtc->base.id,
-			 sti_mixer_to_str(to_sti_mixer(drm_plane->crtc)),
+			 oldstate->crtc->base.id,
+			 sti_mixer_to_str(to_sti_mixer(oldstate->crtc)),
 			 drm_plane->base.id, sti_plane_to_str(plane));
 
 	plane->status = STI_PLANE_DISABLING;
drivers/gpu/drm/sti/sti_gdp.c +3 -3
index 19052c4..d5f7b18 100644
@@ -858,15 +858,15 @@ static void sti_gdp_atomic_disable(struct drm_plane *drm_plane,
 	/* restore possible crtcs value with the initial value */
 	drm_plane->possible_crtcs = plane->init_possible_crtcs;
 
-	if (!drm_plane->crtc) {
+	if (!oldstate->crtc) {
 		DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
 				 drm_plane->base.id);
 		return;
 	}
 
 	DRM_DEBUG_DRIVER("CRTC:%d (%s) drm plane:%d (%s)\n",
-			 drm_plane->crtc->base.id,
-			 sti_mixer_to_str(to_sti_mixer(drm_plane->crtc)),
+			 oldstate->crtc->base.id,
+			 sti_mixer_to_str(to_sti_mixer(oldstate->crtc)),
 			 drm_plane->base.id, sti_plane_to_str(plane));
 
 	plane->status = STI_PLANE_DISABLING;
drivers/gpu/drm/sti/sti_hqvdp.c +1 -1
index a222b2e..9dd13fd 100644
@@ -1214,15 +1214,15 @@ static void sti_hqvdp_atomic_disable(struct drm_plane *drm_plane,
 {
 	struct sti_plane *plane = to_sti_plane(drm_plane);
 
-	if (!drm_plane->crtc) {
+	if (!oldstate->crtc) {
 		DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
 				 drm_plane->base.id);
 		return;

drivers/gpu/drm/sti/sti_hqvdp.c static void sti_hqvdp_atomic_disable(struct drm_plane *drm_plane, · line 1228

Quoted 10 lines
drivers/gpu/drm/sti/sti_hqvdp.c +2 -2
 	}
 
 	DRM_DEBUG_DRIVER("CRTC:%d (%s) drm plane:%d (%s)\n",
-			 drm_plane->crtc->base.id,
-			 sti_mixer_to_str(to_sti_mixer(drm_plane->crtc)),
+			 oldstate->crtc->base.id,
+			 sti_mixer_to_str(to_sti_mixer(oldstate->crtc)),
 			 drm_plane->base.id, sti_plane_to_str(plane));
 
 	plane->status = STI_PLANE_DISABLING;

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

#9 lore raw

PATCH 5/8 drm/sti: use different notifier_block for each pipe

In reply to Fabien Dessenne

Each pipe shall have its own notifier block to manage the vblank event. This fixes issues where a client registered on given pipe is later abusively notified of events on the other pipe.

---
 drivers/gpu/drm/sti/sti_compositor.c | 4 +++-
 drivers/gpu/drm/sti/sti_compositor.h | 4 ++--
 drivers/gpu/drm/sti/sti_crtc.c       | 8 ++++----
 3 files changed, 9 insertions(+), 7 deletions(-)
drivers/gpu/drm/sti/sti_compositor.c +3 -1
index 134201e..f61c16d 100644
@@ -201,6 +201,7 @@ static int sti_compositor_probe(struct platform_device *pdev)
 	struct device_node *vtg_np;
 	struct sti_compositor *compo;
 	struct resource *res;
+	unsigned int i;
 
 	compo = devm_kzalloc(dev, sizeof(*compo), GFP_KERNEL);
 	if (!compo) {
@@ -208,7 +209,8 @@ static int sti_compositor_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 	compo->dev = dev;
-	compo->vtg_vblank_nb.notifier_call = sti_crtc_vblank_cb;
+	for (i = 0; i < STI_MAX_MIXER; i++)
+		compo->vtg_vblank_nb[i].notifier_call = sti_crtc_vblank_cb;
 
 	/* populate data structure depending on compatibility */
 	BUG_ON(!of_match_node(compositor_of_match, np)->data);
drivers/gpu/drm/sti/sti_compositor.h +2 -2
index 24444ef..177c57b 100644
@@ -62,7 +62,7 @@ struct sti_compositor_data {
  * @vid: array of vids
  * @vtg_main: vtg for main data path
  * @vtg_aux: vtg for auxillary data path
- * @vtg_vblank_nb: callback for VTG VSYNC notification
+ * @vtg_vblank_nb: array of callbacks for VTG VSYNC notification
  */
 struct sti_compositor {
 	struct device *dev;
@@ -78,7 +78,7 @@ struct sti_compositor {
 	struct sti_vid *vid[STI_MAX_VID];
 	struct sti_vtg *vtg_main;
 	struct sti_vtg *vtg_aux;
-	struct notifier_block vtg_vblank_nb;
+	struct notifier_block vtg_vblank_nb[STI_MAX_MIXER];
 };
 
 int sti_compositor_debufs_init(struct sti_compositor *compo,
drivers/gpu/drm/sti/sti_crtc.c +4 -4
index c7d734d..2f41cbe 100644
@@ -244,8 +244,7 @@ static int sti_crtc_set_property(struct drm_crtc *crtc,
 int sti_crtc_vblank_cb(struct notifier_block *nb,
 		       unsigned long event, void *data)
 {
-	struct sti_compositor *compo =
-		container_of(nb, struct sti_compositor, vtg_vblank_nb);
+	struct sti_compositor *compo;
 	struct drm_crtc *crtc = data;
 	struct sti_mixer *mixer;
 	unsigned long flags;
@@ -254,6 +253,7 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
 
 	priv = crtc->dev->dev_private;
 	pipe = drm_crtc_index(crtc);
+	compo = container_of(nb, struct sti_compositor, vtg_vblank_nb[pipe]);
 	mixer = compo->mixer[pipe];
 
 	if ((event != VTG_TOP_FIELD_EVENT) &&
@@ -295,7 +295,7 @@ int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
 {
 	struct sti_private *dev_priv = dev->dev_private;
 	struct sti_compositor *compo = dev_priv->compo;
-	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb;
+	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
 	struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
 
 	DRM_DEBUG_DRIVER("\n");
@@ -314,7 +314,7 @@ void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
 {
 	struct sti_private *priv = drm_dev->dev_private;
 	struct sti_compositor *compo = priv->compo;
-	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb;
+	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
 	struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
 
 	DRM_DEBUG_DRIVER("\n");
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 5/8
#10 lore raw

Re: [PATCH 5/8] drm/sti: use different notifier_block for each pipe

Quoted 88 lines · Fabien Dessenne

Each pipe shall have its own notifier block to manage the vblank event. This fixes issues where a client registered on given pipe is later abusively notified of events on the other pipe.

---
 drivers/gpu/drm/sti/sti_compositor.c | 4 +++-
 drivers/gpu/drm/sti/sti_compositor.h | 4 ++--
 drivers/gpu/drm/sti/sti_crtc.c       | 8 ++++----
 3 files changed, 9 insertions(+), 7 deletions(-)
drivers/gpu/drm/sti/sti_compositor.c +3 -1
index 134201e..f61c16d 100644
@@ -201,6 +201,7 @@ static int sti_compositor_probe(struct platform_device *pdev)
 	struct device_node *vtg_np;
 	struct sti_compositor *compo;
 	struct resource *res;
+	unsigned int i;
 
 	compo = devm_kzalloc(dev, sizeof(*compo), GFP_KERNEL);
 	if (!compo) {
@@ -208,7 +209,8 @@ static int sti_compositor_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 	compo->dev = dev;
-	compo->vtg_vblank_nb.notifier_call = sti_crtc_vblank_cb;
+	for (i = 0; i < STI_MAX_MIXER; i++)
+		compo->vtg_vblank_nb[i].notifier_call = sti_crtc_vblank_cb;
 
 	/* populate data structure depending on compatibility */
 	BUG_ON(!of_match_node(compositor_of_match, np)->data);
drivers/gpu/drm/sti/sti_compositor.h +2 -2
index 24444ef..177c57b 100644
@@ -62,7 +62,7 @@ struct sti_compositor_data {
  * @vid: array of vids
  * @vtg_main: vtg for main data path
  * @vtg_aux: vtg for auxillary data path
- * @vtg_vblank_nb: callback for VTG VSYNC notification
+ * @vtg_vblank_nb: array of callbacks for VTG VSYNC notification
  */
 struct sti_compositor {
 	struct device *dev;
@@ -78,7 +78,7 @@ struct sti_compositor {
 	struct sti_vid *vid[STI_MAX_VID];
 	struct sti_vtg *vtg_main;
 	struct sti_vtg *vtg_aux;
-	struct notifier_block vtg_vblank_nb;
+	struct notifier_block vtg_vblank_nb[STI_MAX_MIXER];
 };
 
 int sti_compositor_debufs_init(struct sti_compositor *compo,
drivers/gpu/drm/sti/sti_crtc.c +3 -3
index c7d734d..2f41cbe 100644
@@ -244,8 +244,7 @@ static int sti_crtc_set_property(struct drm_crtc *crtc,
 int sti_crtc_vblank_cb(struct notifier_block *nb,
 		       unsigned long event, void *data)
 {
-	struct sti_compositor *compo =
-		container_of(nb, struct sti_compositor, vtg_vblank_nb);
+	struct sti_compositor *compo;
 	struct drm_crtc *crtc = data;
 	struct sti_mixer *mixer;
 	unsigned long flags;
@@ -254,6 +253,7 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
 
 	priv = crtc->dev->dev_private;
 	pipe = drm_crtc_index(crtc);
+	compo = container_of(nb, struct sti_compositor, vtg_vblank_nb[pipe]);
 	mixer = compo->mixer[pipe];
 
 	if ((event != VTG_TOP_FIELD_EVENT) &&
@@ -295,7 +295,7 @@ int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
 {
 	struct sti_private *dev_priv = dev->dev_private;
 	struct sti_compositor *compo = dev_priv->compo;
-	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb;
+	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
 	struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
 
 	DRM_DEBUG_DRIVER("\n");

drivers/gpu/drm/sti/sti_crtc.c void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe) · line 320

Quoted 8 lines
drivers/gpu/drm/sti/sti_crtc.c +1 -1
@@ -314,7 +314,7 @@ void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
 {
 	struct sti_private *priv = drm_dev->dev_private;
 	struct sti_compositor *compo = priv->compo;
-	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb;
+	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
 	struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
 
 	DRM_DEBUG_DRIVER("\n");

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

#11 lore raw

PATCH 6/8 drm/sti: use vtg array instead of vtg_main/aux

In reply to Fabien Dessenne

This is more generic and more consistent with the other members of the sti_compositor struct.

---
 drivers/gpu/drm/sti/sti_compositor.c |  4 ++--
 drivers/gpu/drm/sti/sti_compositor.h |  6 ++----
 drivers/gpu/drm/sti/sti_crtc.c       | 12 +++++-------
 drivers/gpu/drm/sti/sti_gdp.c        |  3 +--
 4 files changed, 10 insertions(+), 15 deletions(-)
drivers/gpu/drm/sti/sti_compositor.c +2 -2
index f61c16d..f0c6f0a 100644
@@ -268,12 +268,12 @@ static int sti_compositor_probe(struct platform_device *pdev)
 
 	vtg_np = of_parse_phandle(pdev->dev.of_node, "st,vtg", 0);
 	if (vtg_np)
-		compo->vtg_main = of_vtg_find(vtg_np);
+		compo->vtg[STI_MIXER_MAIN] = of_vtg_find(vtg_np);
 	of_node_put(vtg_np);
 
 	vtg_np = of_parse_phandle(pdev->dev.of_node, "st,vtg", 1);
 	if (vtg_np)
-		compo->vtg_aux = of_vtg_find(vtg_np);
+		compo->vtg[STI_MIXER_AUX] = of_vtg_find(vtg_np);
 	of_node_put(vtg_np);
 
 	platform_set_drvdata(pdev, compo);
drivers/gpu/drm/sti/sti_compositor.h +2 -4
index 177c57b..c9e7e3b 100644
@@ -60,8 +60,7 @@ struct sti_compositor_data {
  * @rst_aux: reset control of the aux path
  * @mixer: array of mixers
  * @vid: array of vids
- * @vtg_main: vtg for main data path
- * @vtg_aux: vtg for auxillary data path
+ * @vtg: array of vtgs
  * @vtg_vblank_nb: array of callbacks for VTG VSYNC notification
  */
 struct sti_compositor {
@@ -76,8 +75,7 @@ struct sti_compositor {
 	struct reset_control *rst_aux;
 	struct sti_mixer *mixer[STI_MAX_MIXER];
 	struct sti_vid *vid[STI_MAX_VID];
-	struct sti_vtg *vtg_main;
-	struct sti_vtg *vtg_aux;
+	struct sti_vtg *vtg[STI_MAX_MIXER];
 	struct notifier_block vtg_vblank_nb[STI_MAX_MIXER];
 };
 
drivers/gpu/drm/sti/sti_crtc.c +5 -7
index 2f41cbe..96afe68 100644
@@ -86,8 +86,7 @@ sti_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode)
 		goto pix_error;
 	}
 
-	sti_vtg_set_config(mixer->id == STI_MIXER_MAIN ?
-			compo->vtg_main : compo->vtg_aux, &crtc->mode);
+	sti_vtg_set_config(compo->vtg[mixer->id], &crtc->mode);
 
 	if (sti_mixer_active_video_area(mixer, &crtc->mode)) {
 		DRM_ERROR("Can't set active video area\n");
@@ -297,12 +296,11 @@ int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	struct sti_compositor *compo = dev_priv->compo;
 	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
 	struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
+	struct sti_vtg *vtg = compo->vtg[pipe];
 
 	DRM_DEBUG_DRIVER("\n");
 
-	if (sti_vtg_register_client(pipe == STI_MIXER_MAIN ?
-			compo->vtg_main : compo->vtg_aux,
-			vtg_vblank_nb, crtc)) {
+	if (sti_vtg_register_client(vtg, vtg_vblank_nb, crtc)) {
 		DRM_ERROR("Cannot register VTG notifier\n");
 		return -EINVAL;
 	}
@@ -316,11 +314,11 @@ void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
 	struct sti_compositor *compo = priv->compo;
 	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
 	struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
+	struct sti_vtg *vtg = compo->vtg[pipe];
 
 	DRM_DEBUG_DRIVER("\n");
 
-	if (sti_vtg_unregister_client(pipe == STI_MIXER_MAIN ?
-			compo->vtg_main : compo->vtg_aux, vtg_vblank_nb))
+	if (sti_vtg_unregister_client(vtg, vtg_vblank_nb))
 		DRM_DEBUG_DRIVER("Warning: cannot unregister VTG notifier\n");
 
 	/* free the resources of the pending requests */
drivers/gpu/drm/sti/sti_gdp.c +1 -2
index d5f7b18..824020f 100644
@@ -653,8 +653,7 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane,
 
 	if (!gdp->vtg) {
 		/* Register gdp callback */
-		gdp->vtg = mixer->id == STI_MIXER_MAIN ?
-					compo->vtg_main : compo->vtg_aux;
+		gdp->vtg = compo->vtg[mixer->id];
 		if (sti_vtg_register_client(gdp->vtg,
 					    &gdp->vtg_field_nb, crtc)) {
 			DRM_ERROR("Cannot register VTG notifier\n");
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 6/8
#12 lore raw

Re: [PATCH 6/8] drm/sti: use vtg array instead of vtg_main/aux

Quoted 103 lines · Fabien Dessenne

This is more generic and more consistent with the other members of the sti_compositor struct.

---
 drivers/gpu/drm/sti/sti_compositor.c |  4 ++--
 drivers/gpu/drm/sti/sti_compositor.h |  6 ++----
 drivers/gpu/drm/sti/sti_crtc.c       | 12 +++++-------
 drivers/gpu/drm/sti/sti_gdp.c        |  3 +--
 4 files changed, 10 insertions(+), 15 deletions(-)
drivers/gpu/drm/sti/sti_compositor.c +2 -2
index f61c16d..f0c6f0a 100644
@@ -268,12 +268,12 @@ static int sti_compositor_probe(struct platform_device *pdev)
 
 	vtg_np = of_parse_phandle(pdev->dev.of_node, "st,vtg", 0);
 	if (vtg_np)
-		compo->vtg_main = of_vtg_find(vtg_np);
+		compo->vtg[STI_MIXER_MAIN] = of_vtg_find(vtg_np);
 	of_node_put(vtg_np);
 
 	vtg_np = of_parse_phandle(pdev->dev.of_node, "st,vtg", 1);
 	if (vtg_np)
-		compo->vtg_aux = of_vtg_find(vtg_np);
+		compo->vtg[STI_MIXER_AUX] = of_vtg_find(vtg_np);
 	of_node_put(vtg_np);
 
 	platform_set_drvdata(pdev, compo);
drivers/gpu/drm/sti/sti_compositor.h +2 -4
index 177c57b..c9e7e3b 100644
@@ -60,8 +60,7 @@ struct sti_compositor_data {
  * @rst_aux: reset control of the aux path
  * @mixer: array of mixers
  * @vid: array of vids
- * @vtg_main: vtg for main data path
- * @vtg_aux: vtg for auxillary data path
+ * @vtg: array of vtgs
  * @vtg_vblank_nb: array of callbacks for VTG VSYNC notification
  */
 struct sti_compositor {
@@ -76,8 +75,7 @@ struct sti_compositor {
 	struct reset_control *rst_aux;
 	struct sti_mixer *mixer[STI_MAX_MIXER];
 	struct sti_vid *vid[STI_MAX_VID];
-	struct sti_vtg *vtg_main;
-	struct sti_vtg *vtg_aux;
+	struct sti_vtg *vtg[STI_MAX_MIXER];
 	struct notifier_block vtg_vblank_nb[STI_MAX_MIXER];
 };
 
drivers/gpu/drm/sti/sti_crtc.c +5 -7
index 2f41cbe..96afe68 100644
@@ -86,8 +86,7 @@ sti_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode)
 		goto pix_error;
 	}
 
-	sti_vtg_set_config(mixer->id == STI_MIXER_MAIN ?
-			compo->vtg_main : compo->vtg_aux, &crtc->mode);
+	sti_vtg_set_config(compo->vtg[mixer->id], &crtc->mode);
 
 	if (sti_mixer_active_video_area(mixer, &crtc->mode)) {
 		DRM_ERROR("Can't set active video area\n");
@@ -297,12 +296,11 @@ int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
 	struct sti_compositor *compo = dev_priv->compo;
 	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
 	struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
+	struct sti_vtg *vtg = compo->vtg[pipe];
 
 	DRM_DEBUG_DRIVER("\n");
 
-	if (sti_vtg_register_client(pipe == STI_MIXER_MAIN ?
-			compo->vtg_main : compo->vtg_aux,
-			vtg_vblank_nb, crtc)) {
+	if (sti_vtg_register_client(vtg, vtg_vblank_nb, crtc)) {
 		DRM_ERROR("Cannot register VTG notifier\n");
 		return -EINVAL;
 	}
@@ -316,11 +314,11 @@ void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
 	struct sti_compositor *compo = priv->compo;
 	struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
 	struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
+	struct sti_vtg *vtg = compo->vtg[pipe];
 
 	DRM_DEBUG_DRIVER("\n");
 
-	if (sti_vtg_unregister_client(pipe == STI_MIXER_MAIN ?
-			compo->vtg_main : compo->vtg_aux, vtg_vblank_nb))
+	if (sti_vtg_unregister_client(vtg, vtg_vblank_nb))
 		DRM_DEBUG_DRIVER("Warning: cannot unregister VTG notifier\n");
 
 	/* free the resources of the pending requests */
drivers/gpu/drm/sti/sti_gdp.c +0 -0
index d5f7b18..824020f 100644

drivers/gpu/drm/sti/sti_gdp.c static int sti_gdp_atomic_check(struct drm_plane *drm_plane, · line 659

Quoted 9 lines
drivers/gpu/drm/sti/sti_gdp.c +1 -2
@@ -653,8 +653,7 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane,
 
 	if (!gdp->vtg) {
 		/* Register gdp callback */
-		gdp->vtg = mixer->id == STI_MIXER_MAIN ?
-					compo->vtg_main : compo->vtg_aux;
+		gdp->vtg = compo->vtg[mixer->id];
 		if (sti_vtg_register_client(gdp->vtg,
 					    &gdp->vtg_field_nb, crtc)) {
 			DRM_ERROR("Cannot register VTG notifier\n");

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

#13 lore raw

PATCH 7/8 drm/sti: in crtc_atomic_flush, enable only planes of this crtc

In reply to Fabien Dessenne

crtc_atomic_flush performs some additional processing, like plane enable at mixer level.
Enable only the planes attached to the CRTC.

---
 drivers/gpu/drm/sti/sti_crtc.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/sti/sti_crtc.c +4 -0
index 96afe68..bc1b186 100644
@@ -165,6 +165,10 @@ static void sti_crtc_atomic_flush(struct drm_crtc *crtc,
 
 		switch (plane->status) {
 		case STI_PLANE_UPDATED:
+			/* ignore update for other CRTC */
+			if (p->state->crtc != crtc)
+				continue;
+
 			/* update planes tag as updated */
 			DRM_DEBUG_DRIVER("update plane %s\n",
 					 sti_plane_to_str(plane));
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 7/8
#14 lore raw

Re: [PATCH 7/8] drm/sti: in crtc_atomic_flush, enable only planes of this crtc

Quoted 15 lines · Fabien Dessenne

crtc_atomic_flush performs some additional processing, like plane enable at mixer level.
Enable only the planes attached to the CRTC.

---
 drivers/gpu/drm/sti/sti_crtc.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/sti/sti_crtc.c +0 -0
index 96afe68..bc1b186 100644

drivers/gpu/drm/sti/sti_crtc.c static void sti_crtc_atomic_flush(struct drm_crtc *crtc, · line 174

Quoted 10 lines
drivers/gpu/drm/sti/sti_crtc.c +4 -0
@@ -165,6 +165,10 @@ static void sti_crtc_atomic_flush(struct drm_crtc *crtc,
 
 		switch (plane->status) {
 		case STI_PLANE_UPDATED:
+			/* ignore update for other CRTC */
+			if (p->state->crtc != crtc)
+				continue;
+
 			/* update planes tag as updated */
 			DRM_DEBUG_DRIVER("update plane %s\n",
 					 sti_plane_to_str(plane));

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

#15 lore raw

PATCH 8/8 drm/sti: use valid video mode

In reply to Fabien Dessenne

In atomic mode the crtc_xxx (eg crtc_hdisplay) members of the mode structure may be unset before calling atomic_check/commit for planes. Instead of, use xxx members which are actually set.

---
 drivers/gpu/drm/sti/sti_gdp.c   | 8 ++++----
 drivers/gpu/drm/sti/sti_hqvdp.c | 8 ++++----
 drivers/gpu/drm/sti/sti_vid.c   | 4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/sti/sti_gdp.c +4 -4
index 824020f..3297f3b 100644
@@ -631,8 +631,8 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane,
 	mode = &crtc_state->mode;
 	dst_x = state->crtc_x;
 	dst_y = state->crtc_y;
-	dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
-	dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
+	dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
+	dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
 	/* src_x are in 16.16 format */
 	src_x = state->src_x >> 16;
 	src_y = state->src_y >> 16;
@@ -736,8 +736,8 @@ static void sti_gdp_atomic_update(struct drm_plane *drm_plane,
 	mode = &crtc->mode;
 	dst_x = state->crtc_x;
 	dst_y = state->crtc_y;
-	dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
-	dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
+	dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
+	dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
 	/* src_x are in 16.16 format */
 	src_x = state->src_x >> 16;
 	src_y = state->src_y >> 16;
drivers/gpu/drm/sti/sti_hqvdp.c +4 -4
index 9dd13fd..31fa7ae 100644
@@ -1026,8 +1026,8 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
 	mode = &crtc_state->mode;
 	dst_x = state->crtc_x;
 	dst_y = state->crtc_y;
-	dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
-	dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
+	dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
+	dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
 	/* src_x are in 16.16 format */
 	src_x = state->src_x >> 16;
 	src_y = state->src_y >> 16;
@@ -1115,8 +1115,8 @@ static void sti_hqvdp_atomic_update(struct drm_plane *drm_plane,
 	mode = &crtc->mode;
 	dst_x = state->crtc_x;
 	dst_y = state->crtc_y;
-	dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
-	dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
+	dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
+	dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
 	/* src_x are in 16.16 format */
 	src_x = state->src_x >> 16;
 	src_y = state->src_y >> 16;
drivers/gpu/drm/sti/sti_vid.c +2 -2
index 47634a0..2ad5989 100644
@@ -142,8 +142,8 @@ void sti_vid_commit(struct sti_vid *vid,
 	struct drm_display_mode *mode = &crtc->mode;
 	int dst_x = state->crtc_x;
 	int dst_y = state->crtc_y;
-	int dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
-	int dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
+	int dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
+	int dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
 	int src_h = state->src_h >> 16;
 	u32 val, ydo, xdo, yds, xds;
 
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 8/8
#16 lore raw

Re: [PATCH 8/8] drm/sti: use valid video mode

Quoted 69 lines · Fabien Dessenne

In atomic mode the crtc_xxx (eg crtc_hdisplay) members of the mode structure may be unset before calling atomic_check/commit for planes. Instead of, use xxx members which are actually set.

---
 drivers/gpu/drm/sti/sti_gdp.c   | 8 ++++----
 drivers/gpu/drm/sti/sti_hqvdp.c | 8 ++++----
 drivers/gpu/drm/sti/sti_vid.c   | 4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/sti/sti_gdp.c +4 -4
index 824020f..3297f3b 100644
@@ -631,8 +631,8 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane,
 	mode = &crtc_state->mode;
 	dst_x = state->crtc_x;
 	dst_y = state->crtc_y;
-	dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
-	dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
+	dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
+	dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
 	/* src_x are in 16.16 format */
 	src_x = state->src_x >> 16;
 	src_y = state->src_y >> 16;
@@ -736,8 +736,8 @@ static void sti_gdp_atomic_update(struct drm_plane *drm_plane,
 	mode = &crtc->mode;
 	dst_x = state->crtc_x;
 	dst_y = state->crtc_y;
-	dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
-	dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
+	dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
+	dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
 	/* src_x are in 16.16 format */
 	src_x = state->src_x >> 16;
 	src_y = state->src_y >> 16;
drivers/gpu/drm/sti/sti_hqvdp.c +4 -4
index 9dd13fd..31fa7ae 100644
@@ -1026,8 +1026,8 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
 	mode = &crtc_state->mode;
 	dst_x = state->crtc_x;
 	dst_y = state->crtc_y;
-	dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
-	dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
+	dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
+	dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
 	/* src_x are in 16.16 format */
 	src_x = state->src_x >> 16;
 	src_y = state->src_y >> 16;
@@ -1115,8 +1115,8 @@ static void sti_hqvdp_atomic_update(struct drm_plane *drm_plane,
 	mode = &crtc->mode;
 	dst_x = state->crtc_x;
 	dst_y = state->crtc_y;
-	dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
-	dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
+	dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
+	dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
 	/* src_x are in 16.16 format */
 	src_x = state->src_x >> 16;
 	src_y = state->src_y >> 16;
drivers/gpu/drm/sti/sti_vid.c +0 -0
index 47634a0..2ad5989 100644

drivers/gpu/drm/sti/sti_vid.c void sti_vid_commit(struct sti_vid *vid, · line 149

Quoted 10 lines
drivers/gpu/drm/sti/sti_vid.c +2 -2
@@ -142,8 +142,8 @@ void sti_vid_commit(struct sti_vid *vid,
 	struct drm_display_mode *mode = &crtc->mode;
 	int dst_x = state->crtc_x;
 	int dst_y = state->crtc_y;
-	int dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
-	int dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
+	int dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
+	int dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
 	int src_h = state->src_h >> 16;
 	u32 val, ydo, xdo, yds, xds;
 

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