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
Add some missing \n in logs.
Signed-off-by: Fabien Dessenne fabien.dessenne@st.com --- 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(-)
diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c index f7cd671..3d48e5e 100644 --- a/drivers/gpu/drm/sti/sti_gdp.c +++ b/drivers/gpu/drm/sti/sti_gdp.c @@ -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 ? diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c index 8505569..a225c4d 100644 --- a/drivers/gpu/drm/sti/sti_hda.c +++ b/drivers/gpu/drm/sti/sti_hda.c @@ -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; }
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index d850dda..1f9e7b4 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -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; }
Acked-by: Vincent Abriou vincent.abriou@st.com
On 09/15/2016 03:41 PM, Fabien Dessenne wrote:
Add some missing \n in logs.
Signed-off-by: Fabien Dessenne fabien.dessenne@st.com
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(-)
diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c index f7cd671..3d48e5e 100644 --- a/drivers/gpu/drm/sti/sti_gdp.c +++ b/drivers/gpu/drm/sti/sti_gdp.c @@ -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 ?
diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c index 8505569..a225c4d 100644 --- a/drivers/gpu/drm/sti/sti_hda.c +++ b/drivers/gpu/drm/sti/sti_hda.c @@ -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!");
return; }DRM_DEBUG_DRIVER("Warning: DACS ctrl register not supported\n");
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index d850dda..1f9e7b4 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -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;
}
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.
Signed-off-by: Fabien Dessenne fabien.dessenne@st.com --- drivers/gpu/drm/sti/sti_hqvdp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c index b5ee783..a222b2e 100644 --- a/drivers/gpu/drm/sti/sti_hqvdp.c +++ b/drivers/gpu/drm/sti/sti_hqvdp.c @@ -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);
Acked-by: Vincent Abriou vincent.abriou@st.com
On 09/15/2016 03:41 PM, Fabien Dessenne wrote:
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.
Signed-off-by: Fabien Dessenne fabien.dessenne@st.com
drivers/gpu/drm/sti/sti_hqvdp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c index b5ee783..a222b2e 100644 --- a/drivers/gpu/drm/sti/sti_hqvdp.c +++ b/drivers/gpu/drm/sti/sti_hqvdp.c @@ -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);
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.
Signed-off-by: Fabien Dessenne fabien.dessenne@st.com --- drivers/gpu/drm/sti/sti_gdp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c index 3d48e5e..19052c4 100644 --- a/drivers/gpu/drm/sti/sti_gdp.c +++ b/drivers/gpu/drm/sti/sti_gdp.c @@ -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;
Acked-by: Vincent Abriou vincent.abriou@st.com
On 09/15/2016 03:41 PM, Fabien Dessenne wrote:
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.
Signed-off-by: Fabien Dessenne fabien.dessenne@st.com
drivers/gpu/drm/sti/sti_gdp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c index 3d48e5e..19052c4 100644 --- a/drivers/gpu/drm/sti/sti_gdp.c +++ b/drivers/gpu/drm/sti/sti_gdp.c @@ -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;
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
Signed-off-by: Fabien Dessenne fabien.dessenne@st.com --- 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(-)
diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c index 3b53f7f..3a8b656 100644 --- a/drivers/gpu/drm/sti/sti_cursor.c +++ b/drivers/gpu/drm/sti/sti_cursor.c @@ -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; diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c index 19052c4..d5f7b18 100644 --- a/drivers/gpu/drm/sti/sti_gdp.c +++ b/drivers/gpu/drm/sti/sti_gdp.c @@ -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; diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c index a222b2e..9dd13fd 100644 --- a/drivers/gpu/drm/sti/sti_hqvdp.c +++ b/drivers/gpu/drm/sti/sti_hqvdp.c @@ -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;
Acked-by: Vincent Abriou vincent.abriou@st.com
On 09/15/2016 03:41 PM, Fabien Dessenne wrote:
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
Signed-off-by: Fabien Dessenne fabien.dessenne@st.com
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(-)
diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c index 3b53f7f..3a8b656 100644 --- a/drivers/gpu/drm/sti/sti_cursor.c +++ b/drivers/gpu/drm/sti/sti_cursor.c @@ -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;
diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c index 19052c4..d5f7b18 100644 --- a/drivers/gpu/drm/sti/sti_gdp.c +++ b/drivers/gpu/drm/sti/sti_gdp.c @@ -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;
diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c index a222b2e..9dd13fd 100644 --- a/drivers/gpu/drm/sti/sti_hqvdp.c +++ b/drivers/gpu/drm/sti/sti_hqvdp.c @@ -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;
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.
Signed-off-by: Fabien Dessenne fabien.dessenne@st.com --- 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(-)
diff --git a/drivers/gpu/drm/sti/sti_compositor.c b/drivers/gpu/drm/sti/sti_compositor.c index 134201e..f61c16d 100644 --- a/drivers/gpu/drm/sti/sti_compositor.c +++ b/drivers/gpu/drm/sti/sti_compositor.c @@ -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); diff --git a/drivers/gpu/drm/sti/sti_compositor.h b/drivers/gpu/drm/sti/sti_compositor.h index 24444ef..177c57b 100644 --- a/drivers/gpu/drm/sti/sti_compositor.h +++ b/drivers/gpu/drm/sti/sti_compositor.h @@ -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, diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c index c7d734d..2f41cbe 100644 --- a/drivers/gpu/drm/sti/sti_crtc.c +++ b/drivers/gpu/drm/sti/sti_crtc.c @@ -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");
Acked-by: Vincent Abriou vincent.abriou@st.com
On 09/15/2016 03:41 PM, Fabien Dessenne wrote:
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.
Signed-off-by: Fabien Dessenne fabien.dessenne@st.com
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(-)
diff --git a/drivers/gpu/drm/sti/sti_compositor.c b/drivers/gpu/drm/sti/sti_compositor.c index 134201e..f61c16d 100644 --- a/drivers/gpu/drm/sti/sti_compositor.c +++ b/drivers/gpu/drm/sti/sti_compositor.c @@ -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);
diff --git a/drivers/gpu/drm/sti/sti_compositor.h b/drivers/gpu/drm/sti/sti_compositor.h index 24444ef..177c57b 100644 --- a/drivers/gpu/drm/sti/sti_compositor.h +++ b/drivers/gpu/drm/sti/sti_compositor.h @@ -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, diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c index c7d734d..2f41cbe 100644 --- a/drivers/gpu/drm/sti/sti_crtc.c +++ b/drivers/gpu/drm/sti/sti_crtc.c @@ -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");
This is more generic and more consistent with the other members of the sti_compositor struct.
Signed-off-by: Fabien Dessenne fabien.dessenne@st.com --- 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(-)
diff --git a/drivers/gpu/drm/sti/sti_compositor.c b/drivers/gpu/drm/sti/sti_compositor.c index f61c16d..f0c6f0a 100644 --- a/drivers/gpu/drm/sti/sti_compositor.c +++ b/drivers/gpu/drm/sti/sti_compositor.c @@ -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); diff --git a/drivers/gpu/drm/sti/sti_compositor.h b/drivers/gpu/drm/sti/sti_compositor.h index 177c57b..c9e7e3b 100644 --- a/drivers/gpu/drm/sti/sti_compositor.h +++ b/drivers/gpu/drm/sti/sti_compositor.h @@ -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]; };
diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c index 2f41cbe..96afe68 100644 --- a/drivers/gpu/drm/sti/sti_crtc.c +++ b/drivers/gpu/drm/sti/sti_crtc.c @@ -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 */ diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c index d5f7b18..824020f 100644 --- a/drivers/gpu/drm/sti/sti_gdp.c +++ b/drivers/gpu/drm/sti/sti_gdp.c @@ -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");
Acked-by: Vincent Abriou vincent.abriou@st.com
On 09/15/2016 03:41 PM, Fabien Dessenne wrote:
This is more generic and more consistent with the other members of the sti_compositor struct.
Signed-off-by: Fabien Dessenne fabien.dessenne@st.com
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(-)
diff --git a/drivers/gpu/drm/sti/sti_compositor.c b/drivers/gpu/drm/sti/sti_compositor.c index f61c16d..f0c6f0a 100644 --- a/drivers/gpu/drm/sti/sti_compositor.c +++ b/drivers/gpu/drm/sti/sti_compositor.c @@ -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);
diff --git a/drivers/gpu/drm/sti/sti_compositor.h b/drivers/gpu/drm/sti/sti_compositor.h index 177c57b..c9e7e3b 100644 --- a/drivers/gpu/drm/sti/sti_compositor.h +++ b/drivers/gpu/drm/sti/sti_compositor.h @@ -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];
};
diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c index 2f41cbe..96afe68 100644 --- a/drivers/gpu/drm/sti/sti_crtc.c +++ b/drivers/gpu/drm/sti/sti_crtc.c @@ -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 */
diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c index d5f7b18..824020f 100644 --- a/drivers/gpu/drm/sti/sti_gdp.c +++ b/drivers/gpu/drm/sti/sti_gdp.c @@ -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;
if (sti_vtg_register_client(gdp->vtg, &gdp->vtg_field_nb, crtc)) { DRM_ERROR("Cannot register VTG notifier\n");gdp->vtg = compo->vtg[mixer->id];
crtc_atomic_flush performs some additional processing, like plane enable at mixer level. Enable only the planes attached to the CRTC.
Signed-off-by: Fabien Dessenne fabien.dessenne@st.com --- drivers/gpu/drm/sti/sti_crtc.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c index 96afe68..bc1b186 100644 --- a/drivers/gpu/drm/sti/sti_crtc.c +++ b/drivers/gpu/drm/sti/sti_crtc.c @@ -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));
Acked-by: Vincent Abriou vincent.abriou@st.com
On 09/15/2016 03:41 PM, Fabien Dessenne wrote:
crtc_atomic_flush performs some additional processing, like plane enable at mixer level. Enable only the planes attached to the CRTC.
Signed-off-by: Fabien Dessenne fabien.dessenne@st.com
drivers/gpu/drm/sti/sti_crtc.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c index 96afe68..bc1b186 100644 --- a/drivers/gpu/drm/sti/sti_crtc.c +++ b/drivers/gpu/drm/sti/sti_crtc.c @@ -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));
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.
Signed-off-by: Fabien Dessenne fabien.dessenne@st.com --- 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(-)
diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c index 824020f..3297f3b 100644 --- a/drivers/gpu/drm/sti/sti_gdp.c +++ b/drivers/gpu/drm/sti/sti_gdp.c @@ -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; diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c index 9dd13fd..31fa7ae 100644 --- a/drivers/gpu/drm/sti/sti_hqvdp.c +++ b/drivers/gpu/drm/sti/sti_hqvdp.c @@ -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; diff --git a/drivers/gpu/drm/sti/sti_vid.c b/drivers/gpu/drm/sti/sti_vid.c index 47634a0..2ad5989 100644 --- a/drivers/gpu/drm/sti/sti_vid.c +++ b/drivers/gpu/drm/sti/sti_vid.c @@ -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;
Acked-by: Vincent Abriou vincent.abriou@st.com
On 09/15/2016 03:41 PM, Fabien Dessenne wrote:
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.
Signed-off-by: Fabien Dessenne fabien.dessenne@st.com
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(-)
diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c index 824020f..3297f3b 100644 --- a/drivers/gpu/drm/sti/sti_gdp.c +++ b/drivers/gpu/drm/sti/sti_gdp.c @@ -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;
diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c index 9dd13fd..31fa7ae 100644 --- a/drivers/gpu/drm/sti/sti_hqvdp.c +++ b/drivers/gpu/drm/sti/sti_hqvdp.c @@ -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;
diff --git a/drivers/gpu/drm/sti/sti_vid.c b/drivers/gpu/drm/sti/sti_vid.c index 47634a0..2ad5989 100644 --- a/drivers/gpu/drm/sti/sti_vid.c +++ b/drivers/gpu/drm/sti/sti_vid.c @@ -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@lists.freedesktop.org