Skip to contentSkip to conversation

drm/exynos/mixer: fixes for interlaced mode

PATCH In review Andrzej Hajda 2 participants 7 messages Feb 2, 2018 – Apr 22, 2018 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20180202151126eucas1p2142bfb4a4376aea7763f40ce2630e349@eucas1p2.samsung.com

#1 lore raw

cover drm/exynos/mixer: fixes for interlaced mode

Hi Inki, Tobias,

This is reviewed/updated/tested Tobias's patch addressing page-faults in Video Processor in interlaced mode. Plus preliminary patch fixing Mixer interlaced mode.

Regards
Andrzej

Andrzej Hajda (1):
drm/exynos/mixer: fix synchronization check in interlaced mode

Tobias Jakobi (1):
drm/exynos: mixer: avoid Oops in vp_video_buffer()

 drivers/gpu/drm/exynos/exynos_mixer.c | 22 +++++++++++++++++-----
 drivers/gpu/drm/exynos/regs-mixer.h   |  1 +
 2 files changed, 18 insertions(+), 5 deletions(-)
Signature · 1 line
2.16.1
#2 lore raw

PATCH 1/2 drm/exynos/mixer: fix synchronization check in interlaced mode

In case of interlace mode video processor registers and mixer config register must be check to ensure internal state is in sync with shadow registers.
This patch fixes page-faults in interlaced mode.

---
 drivers/gpu/drm/exynos/exynos_mixer.c | 10 ++++++++++
 drivers/gpu/drm/exynos/regs-mixer.h   |  1 +
 2 files changed, 11 insertions(+)
drivers/gpu/drm/exynos/exynos_mixer.c +10 -0
index dc5d79465f9b..ff7d088c922a 100644
@@ -494,6 +494,7 @@ static void vp_video_buffer(struct mixer_context *ctx,
 
 	spin_lock_irqsave(&ctx->reg_slock, flags);
 
+	vp_reg_write(ctx, VP_SHADOW_UPDATE, 1);
 	/* interlace or progressive scan mode */
 	val = (test_bit(MXR_BIT_INTERLACE, &ctx->flags) ? ~0 : 0);
 	vp_reg_writemask(ctx, VP_MODE, val, VP_MODE_LINE_SKIP);
@@ -711,6 +712,15 @@ static irqreturn_t mixer_irq_handler(int irq, void *arg)
 
 		/* interlace scan need to check shadow register */
 		if (test_bit(MXR_BIT_INTERLACE, &ctx->flags)) {
+			if (test_bit(MXR_BIT_VP_ENABLED, &ctx->flags) &&
+			    vp_reg_read(ctx, VP_SHADOW_UPDATE))
+				goto out;
+
+			base = mixer_reg_read(ctx, MXR_CFG);
+			shadow = mixer_reg_read(ctx, MXR_CFG_S);
+			if (base != shadow)
+				goto out;
+
 			base = mixer_reg_read(ctx, MXR_GRAPHIC_BASE(0));
 			shadow = mixer_reg_read(ctx, MXR_GRAPHIC_BASE_S(0));
 			if (base != shadow)
drivers/gpu/drm/exynos/regs-mixer.h +1 -0
index c311f571bdf9..189cfa2470a8 100644
@@ -47,6 +47,7 @@
 #define MXR_MO				0x0304
 #define MXR_RESOLUTION			0x0310
 
+#define MXR_CFG_S			0x2004
 #define MXR_GRAPHIC0_BASE_S		0x2024
 #define MXR_GRAPHIC1_BASE_S		0x2044
 
Signature · 6 lines
2.16.1

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

PATCH 2/2 drm/exynos: mixer: avoid Oops in vp_video_buffer()

In reply to Andrzej Hajda

From: Tobias Jakobi <[email protected]>

If an interlaced video mode is selected, a IOMMU pagefault is triggered by vp_video_buffer().

Fix the most apparent bugs:
- pitch value for chroma plane
- divide by two of height and vpos of source and destination

[ a.hajda: Halved also destination height and vpos, updated commit message ]
---
 drivers/gpu/drm/exynos/exynos_mixer.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/exynos/exynos_mixer.c +7 -5
index ff7d088c922a..66b7cc2128e7 100644
@@ -485,7 +485,7 @@ static void vp_video_buffer(struct mixer_context *ctx,
 			chroma_addr[1] = chroma_addr[0] + 0x40;
 		} else {
 			luma_addr[1] = luma_addr[0] + fb->pitches[0];
-			chroma_addr[1] = chroma_addr[0] + fb->pitches[0];
+			chroma_addr[1] = chroma_addr[0] + fb->pitches[1];
 		}
 	} else {
 		luma_addr[1] = 0;
@@ -508,21 +508,23 @@ static void vp_video_buffer(struct mixer_context *ctx,
 	vp_reg_write(ctx, VP_IMG_SIZE_Y, VP_IMG_HSIZE(fb->pitches[0]) |
 		VP_IMG_VSIZE(fb->height));
 	/* chroma plane for NV12/NV21 is half the height of the luma plane */
-	vp_reg_write(ctx, VP_IMG_SIZE_C, VP_IMG_HSIZE(fb->pitches[0]) |
+	vp_reg_write(ctx, VP_IMG_SIZE_C, VP_IMG_HSIZE(fb->pitches[1]) |
 		VP_IMG_VSIZE(fb->height / 2));
 
 	vp_reg_write(ctx, VP_SRC_WIDTH, state->src.w);
-	vp_reg_write(ctx, VP_SRC_HEIGHT, state->src.h);
 	vp_reg_write(ctx, VP_SRC_H_POSITION,
 			VP_SRC_H_POSITION_VAL(state->src.x));
-	vp_reg_write(ctx, VP_SRC_V_POSITION, state->src.y);
-
 	vp_reg_write(ctx, VP_DST_WIDTH, state->crtc.w);
 	vp_reg_write(ctx, VP_DST_H_POSITION, state->crtc.x);
+
 	if (test_bit(MXR_BIT_INTERLACE, &ctx->flags)) {
+		vp_reg_write(ctx, VP_SRC_HEIGHT, state->src.h / 2);
+		vp_reg_write(ctx, VP_SRC_V_POSITION, state->src.y / 2);
 		vp_reg_write(ctx, VP_DST_HEIGHT, state->crtc.h / 2);
 		vp_reg_write(ctx, VP_DST_V_POSITION, state->crtc.y / 2);
 	} else {
+		vp_reg_write(ctx, VP_SRC_HEIGHT, state->src.h);
+		vp_reg_write(ctx, VP_SRC_V_POSITION, state->src.y);
 		vp_reg_write(ctx, VP_DST_HEIGHT, state->crtc.h);
 		vp_reg_write(ctx, VP_DST_V_POSITION, state->crtc.y);
 	}
Signature · 6 lines
2.16.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw
In reply to Andrzej Hajda

Hi Inki,

Quoted 8 lines · Andrzej Hajda

Hi Inki, Tobias,

This is reviewed/updated/tested Tobias's patch addressing page-faults in Video Processor in interlaced mode. Plus preliminary patch fixing Mixer interlaced mode.

Regards
Andrzej

Gentle ping.

Regards
Andrzej

Quoted 11 lines

Andrzej Hajda (1):
drm/exynos/mixer: fix synchronization check in interlaced mode

Tobias Jakobi (1):
drm/exynos: mixer: avoid Oops in vp_video_buffer()

 drivers/gpu/drm/exynos/exynos_mixer.c | 22 +++++++++++++++++-----
 drivers/gpu/drm/exynos/regs-mixer.h   |  1 +
 2 files changed, 18 insertions(+), 5 deletions(-)

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

#5 lore raw
Quoted 5 lines · Andrzej Hajda

Hi Inki,

Quoted 2 lines · Andrzej Hajda

Hi Inki, Tobias,

Quoted 7 lines
Quoted 6 lines

This is reviewed/updated/tested Tobias's patch addressing page-faults in Video Processor in interlaced mode. Plus preliminary patch fixing Mixer interlaced mode.

Regards
Andrzej

Gentle ping.

Ping.

--
Regards
Andrzej

Quoted 10 lines

Regards
Andrzej

Quoted 6 lines

Andrzej Hajda (1):
drm/exynos/mixer: fix synchronization check in interlaced mode

Tobias Jakobi (1):
drm/exynos: mixer: avoid Oops in vp_video_buffer()

Quoted 8 lines
Quoted 4 lines
 drivers/gpu/drm/exynos/exynos_mixer.c | 22 +++++++++++++++++-----
 drivers/gpu/drm/exynos/regs-mixer.h   |  1 +
 2 files changed, 18 insertions(+), 5 deletions(-)

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

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

#6 lore raw
Quoted 6 lines · Andrzej Hajda
Quoted 5 lines · Andrzej Hajda

Hi Inki,

Quoted 2 lines · Andrzej Hajda

Hi Inki, Tobias,

Quoted 8 lines
Quoted 7 lines
Quoted 6 lines

This is reviewed/updated/tested Tobias's patch addressing page-faults in Video Processor in interlaced mode. Plus preliminary patch fixing Mixer interlaced mode.

Regards
Andrzej

Gentle ping.

Ping.

Ping, almost three months passed.

Regards
Andrzej

Quoted 23 lines

--
Regards
Andrzej

Quoted 9 lines

Regards
Andrzej

Quoted 6 lines

Andrzej Hajda (1):
drm/exynos/mixer: fix synchronization check in interlaced mode

Tobias Jakobi (1):
drm/exynos: mixer: avoid Oops in vp_video_buffer()

Quoted 8 lines
Quoted 4 lines
 drivers/gpu/drm/exynos/exynos_mixer.c | 22 +++++++++++++++++-----
 drivers/gpu/drm/exynos/regs-mixer.h   |  1 +
 2 files changed, 18 insertions(+), 5 deletions(-)

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

Quoted 4 lines

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

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

maintainer
#7 lore raw

2018년 04월 20일 21:44에 Andrzej Hajda 이(가) 쓴 글:

Quoted 11 lines · Andrzej Hajda
Quoted 10 lines · Andrzej Hajda
Quoted 9 lines

Hi Inki,

Quoted 6 lines · Andrzej Hajda

Hi Inki, Tobias,

This is reviewed/updated/tested Tobias's patch addressing page-faults in Video Processor in interlaced mode. Plus preliminary patch fixing Mixer interlaced mode.

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines

Regards
Andrzej

Gentle ping.

Ping.

Ping, almost three months passed.

Oops, really sorry. I forgot this. Merged.

Thanks,
Inki Dae

Quoted 32 lines

Regards
Andrzej

Quoted 23 lines

--
Regards
Andrzej

Quoted 9 lines

Regards
Andrzej

Quoted 6 lines

Andrzej Hajda (1):
drm/exynos/mixer: fix synchronization check in interlaced mode

Tobias Jakobi (1):
drm/exynos: mixer: avoid Oops in vp_video_buffer()

Quoted 8 lines
Quoted 4 lines
 drivers/gpu/drm/exynos/exynos_mixer.c | 22 +++++++++++++++++-----
 drivers/gpu/drm/exynos/regs-mixer.h   |  1 +
 2 files changed, 18 insertions(+), 5 deletions(-)

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

Quoted 4 lines

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

Quoted 7 lines

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

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