[PATCH 0/2] Fix omap VENC (PAL/NTSC TV out) operation with omapdrm driver

STALE3931d

10 messages, 3 authors, 2015-12-15 · open the first message on its own page

[PATCH 0/2] Fix omap VENC (PAL/NTSC TV out) operation with omapdrm driver

From: H. Nikolaus Schaller <hidden>
Date: 2015-11-13 10:30:21

This patch set fixes some issues with the OMAP VENC
when used with the omapdrm driver.

Tested on: BeagleBoard XM, GTA04 and OpenPandora


H. Nikolaus Schaller (2):
  video:omap2:dss: fix timings for VENC to match what omapdrm expects
  video:omapdrm: make omapdrm assume the tv-out cable is always
    connected

 drivers/gpu/drm/omapdrm/omap_connector.c |  1 +
 drivers/video/fbdev/omap2/dss/venc.c     | 12 ++++++++++++
 2 files changed, 13 insertions(+)

-- 
2.5.1

[PATCH 1/2] video:omap2:dss: fix timings for VENC to match what omapdrm expects

From: H. Nikolaus Schaller <hidden>
Date: 2015-11-13 10:29:25

Otherwise check_timings fails and we get a "has no modes" message
from xrandr.

This fix makes the venc assume PAL and NTSC timings that match the
timings synthetized by copy_timings_drm_to_omap() from omapdrm
mode settings so that check_timings() succeeds.

Tested on: BeagleBoard XM, GTA04 and OpenPandora

Signed-off-by: H. Nikolaus Schaller <redacted>
---
 drivers/video/fbdev/omap2/dss/venc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff --git a/drivers/video/fbdev/omap2/dss/venc.c b/drivers/video/fbdev/omap2/dss/venc.c
index 99ca268..d05a549 100644
--- a/drivers/video/fbdev/omap2/dss/venc.c
+++ b/drivers/video/fbdev/omap2/dss/venc.c
@@ -275,6 +275,12 @@ const struct omap_video_timings omap_dss_pal_timings = {
 	.vbp		= 41,
 
 	.interlace	= true,
+
+	.hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
+	.vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
+	.data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
+	.de_level = OMAPDSS_SIG_ACTIVE_HIGH,
+	.sync_pclk_edge = OMAPDSS_DRIVE_SIG_FALLING_EDGE,
 };
 EXPORT_SYMBOL(omap_dss_pal_timings);
 
@@ -290,6 +296,12 @@ const struct omap_video_timings omap_dss_ntsc_timings = {
 	.vbp		= 31,
 
 	.interlace	= true,
+
+	.hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
+	.vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
+	.data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
+	.de_level = OMAPDSS_SIG_ACTIVE_HIGH,
+	.sync_pclk_edge = OMAPDSS_DRIVE_SIG_FALLING_EDGE,
 };
 EXPORT_SYMBOL(omap_dss_ntsc_timings);
 
-- 
2.5.1

[PATCH 2/2] video:omapdrm: make omapdrm assume the tv-out cable is always connected

From: H. Nikolaus Schaller <hidden>
Date: 2015-11-13 10:30:19

Include VENC in the set of drivers where it is assimed that the cable
is always connected. Like DPI, DSI, DBI and SDI do.

Otherwise, the VENC will return cable status "unknown" and is not enabled
by the X-server. So there is no video output signal.

Tested on: BeagleBoard XM, GTA04 and OpenPandora

Signed-off-by: H. Nikolaus Schaller <redacted>
---
 drivers/gpu/drm/omapdrm/omap_connector.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
index 83f2a91..98ddb5d 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -120,6 +120,7 @@ static enum drm_connector_status omap_connector_detect(
 		else
 			ret = connector_status_disconnected;
 	} else if (dssdev->type = OMAP_DISPLAY_TYPE_DPI ||
+			dssdev->type = OMAP_DISPLAY_TYPE_VENC ||
 			dssdev->type = OMAP_DISPLAY_TYPE_DBI ||
 			dssdev->type = OMAP_DISPLAY_TYPE_SDI ||
 			dssdev->type = OMAP_DISPLAY_TYPE_DSI) {
-- 
2.5.1

Re: [PATCH 2/2] video:omapdrm: make omapdrm assume the tv-out cable is always connected

From: Tomi Valkeinen <hidden>
Date: 2015-11-13 11:46:29


On 13/11/15 12:29, H. Nikolaus Schaller wrote:
quoted hunk
Include VENC in the set of drivers where it is assimed that the cable
is always connected. Like DPI, DSI, DBI and SDI do.

Otherwise, the VENC will return cable status "unknown" and is not enabled
by the X-server. So there is no video output signal.

Tested on: BeagleBoard XM, GTA04 and OpenPandora

Signed-off-by: H. Nikolaus Schaller <redacted>
---
 drivers/gpu/drm/omapdrm/omap_connector.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
index 83f2a91..98ddb5d 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -120,6 +120,7 @@ static enum drm_connector_status omap_connector_detect(
 		else
 			ret = connector_status_disconnected;
 	} else if (dssdev->type == OMAP_DISPLAY_TYPE_DPI ||
+			dssdev->type == OMAP_DISPLAY_TYPE_VENC ||
 			dssdev->type == OMAP_DISPLAY_TYPE_DBI ||
 			dssdev->type == OMAP_DISPLAY_TYPE_SDI ||
 			dssdev->type == OMAP_DISPLAY_TYPE_DSI) {
I have no idea why VENC is not working for you when using
connector_status_unknown, but I just tested DPI with
connector_status_unknown (i.e. changed the above func to return unknown
for DPI), and it works fine with X and X omap driver. And xrandr
confirms that the connection status is unknown:

# xrandr
Screen 0: minimum 320 x 200, current 1920 x 1200, maximum 2048 x 2048
HDMI-1 disconnected (normal left inverted right x axis y axis)
None-1 unknown connection 1920x1200+0+0 (normal left inverted right x
axis y axis) 0mm x 0mm
   1920x1200     60.00*+  60.00 +

Grep also shows that there are many drivers using
connector_status_unknown, so I'm guessing it should work fine...

 Tomi

Re: [PATCH 2/2] video:omapdrm: make omapdrm assume the tv-out cable is always connected

From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Date: 2015-11-13 12:00:57

On Friday 13 November 2015 13:46:01 Tomi Valkeinen wrote:
On 13/11/15 12:29, H. Nikolaus Schaller wrote:
quoted
Include VENC in the set of drivers where it is assimed that the cable
is always connected. Like DPI, DSI, DBI and SDI do.

Otherwise, the VENC will return cable status "unknown" and is not enabled
by the X-server. So there is no video output signal.

Tested on: BeagleBoard XM, GTA04 and OpenPandora

Signed-off-by: H. Nikolaus Schaller <redacted>
---

 drivers/gpu/drm/omapdrm/omap_connector.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c
b/drivers/gpu/drm/omapdrm/omap_connector.c index 83f2a91..98ddb5d 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -120,6 +120,7 @@ static enum drm_connector_status
omap_connector_detect(
 		else
 			ret = connector_status_disconnected;
 	} else if (dssdev->type = OMAP_DISPLAY_TYPE_DPI ||
+			dssdev->type = OMAP_DISPLAY_TYPE_VENC ||
 			dssdev->type = OMAP_DISPLAY_TYPE_DBI ||
 			dssdev->type = OMAP_DISPLAY_TYPE_SDI ||
 			dssdev->type = OMAP_DISPLAY_TYPE_DSI) {
I have no idea why VENC is not working for you when using
connector_status_unknown, but I just tested DPI with
connector_status_unknown (i.e. changed the above func to return unknown
for DPI), and it works fine with X and X omap driver. And xrandr
confirms that the connection status is unknown:

# xrandr
Screen 0: minimum 320 x 200, current 1920 x 1200, maximum 2048 x 2048
HDMI-1 disconnected (normal left inverted right x axis y axis)
None-1 unknown connection 1920x1200+0+0 (normal left inverted right x
axis y axis) 0mm x 0mm
   1920x1200     60.00*+  60.00 +

Grep also shows that there are many drivers using
connector_status_unknown, so I'm guessing it should work fine...
And beside it's not right to consider VENC as always connected, as it isn't. 
The unknown status is there for a reason, to describe connectors for which we 
can't get any status information. The situation is different for DPI, DBI, SDI 
and DSI as those are on-board busses that connect to a non-removable panel, so 
we can say with a good confidence that the panel is connected (the situation 
could be changed with a hammer and a chisel, but that's unlikely to happen, 
hence the confidence).

-- 
Regards,

Laurent Pinchart

Re: [PATCH 2/2] video:omapdrm: make omapdrm assume the tv-out cable is always connected

From: H. Nikolaus Schaller <hidden>
Date: 2015-11-13 13:32:06

Hi Laurent and Tomi,

Am 13.11.2015 um 13:01 schrieb Laurent Pinchart [off-list ref]:
On Friday 13 November 2015 13:46:01 Tomi Valkeinen wrote:
quoted
On 13/11/15 12:29, H. Nikolaus Schaller wrote:
quoted
Include VENC in the set of drivers where it is assimed that the cable
is always connected. Like DPI, DSI, DBI and SDI do.

Otherwise, the VENC will return cable status "unknown" and is not enabled
by the X-server. So there is no video output signal.

Tested on: BeagleBoard XM, GTA04 and OpenPandora

Signed-off-by: H. Nikolaus Schaller <redacted>
---

drivers/gpu/drm/omapdrm/omap_connector.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c
b/drivers/gpu/drm/omapdrm/omap_connector.c index 83f2a91..98ddb5d 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -120,6 +120,7 @@ static enum drm_connector_status
omap_connector_detect(
		else
			ret = connector_status_disconnected;
	} else if (dssdev->type = OMAP_DISPLAY_TYPE_DPI ||
+			dssdev->type = OMAP_DISPLAY_TYPE_VENC ||
			dssdev->type = OMAP_DISPLAY_TYPE_DBI ||
			dssdev->type = OMAP_DISPLAY_TYPE_SDI ||
			dssdev->type = OMAP_DISPLAY_TYPE_DSI) {
I have no idea why VENC is not working for you when using
connector_status_unknown,
I agree that it should...
quoted
but I just tested DPI with
connector_status_unknown (i.e. changed the above func to return unknown
for DPI
Good hint. I can do the same check. Maybe it highlights the real issue.
quoted
), and it works fine with X and X omap driver. And xrandr
confirms that the connection status is unknown:

# xrandr
Screen 0: minimum 320 x 200, current 1920 x 1200, maximum 2048 x 2048
HDMI-1 disconnected (normal left inverted right x axis y axis)
None-1 unknown connection 1920x1200+0+0 (normal left inverted right x
axis y axis) 0mm x 0mm
  1920x1200     60.00*+  60.00 +
Which configs, drivers and system are you using for this results?
quoted
Grep also shows that there are many drivers using
connector_status_unknown, so I'm guessing it should work fine...
And beside it's not right to consider VENC as always connected, as it isn't. 
Hm. Well, the VENC (meaning the D/A converter inside the OMAP3 chip)
is always connected. But the monitor or cable isn't.
The unknown status is there for a reason, to describe connectors for which we 
can't get any status information. The situation is different for DPI, DBI, SDI 
and DSI as those are on-board busses that connect to a non-removable panel, so 
we can say with a good confidence that the panel is connected (the situation 
could be changed with a hammer and a chisel, but that's unlikely to happen, 
hence the confidence).
Well, it may be that the omapdrm and X11 combination (unfortuantely I don't
understand either and have not found a good description how they interwork),
 keeps the VENC disabled if the connector is unknown.

And since there is no code to detect that a cable has been connected, there
might be missing some trigger to enable the interface.

The symptom I see is that the status of this card is "disabled" while the LCD
panel is "enabled". After doing my proposed patch, both come up "enabled".

So my patch appears to be a work around some other still hidden problem.

Any hint from the experts how to debug / find the real issue & solution is welcome.

BR,
Nikolaus

Re: [PATCH 2/2] video:omapdrm: make omapdrm assume the tv-out cable is always connected

From: H. Nikolaus Schaller <hidden>
Date: 2015-11-13 16:45:40

Here the test results:

Am 13.11.2015 um 13:01 schrieb Laurent Pinchart [off-list ref]:
On Friday 13 November 2015 13:46:01 Tomi Valkeinen wrote:
quoted
On 13/11/15 12:29, H. Nikolaus Schaller wrote:
quoted
Include VENC in the set of drivers where it is assimed that the cable
is always connected. Like DPI, DSI, DBI and SDI do.

Otherwise, the VENC will return cable status "unknown" and is not enabled
by the X-server. So there is no video output signal.

Tested on: BeagleBoard XM, GTA04 and OpenPandora

Signed-off-by: H. Nikolaus Schaller <redacted>
---

drivers/gpu/drm/omapdrm/omap_connector.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c
b/drivers/gpu/drm/omapdrm/omap_connector.c index 83f2a91..98ddb5d 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -120,6 +120,7 @@ static enum drm_connector_status
omap_connector_detect(
		else
			ret = connector_status_disconnected;
	} else if (dssdev->type = OMAP_DISPLAY_TYPE_DPI ||
+			dssdev->type = OMAP_DISPLAY_TYPE_VENC ||
			dssdev->type = OMAP_DISPLAY_TYPE_DBI ||
			dssdev->type = OMAP_DISPLAY_TYPE_SDI ||
			dssdev->type = OMAP_DISPLAY_TYPE_DSI) {
I have no idea why VENC is not working for you when using
connector_status_unknown, but I just tested DPI with
connector_status_unknown (i.e. changed the above func to return unknown
for DPI), and it works fine with X and X omap driver. And xrandr
confirms that the connection status is unknown:

# xrandr
Screen 0: minimum 320 x 200, current 1920 x 1200, maximum 2048 x 2048
HDMI-1 disconnected (normal left inverted right x axis y axis)
None-1 unknown connection 1920x1200+0+0 (normal left inverted right x
axis y axis) 0mm x 0mm
  1920x1200     60.00*+  60.00 +
A) with this VENC patch:

root@letux:~# xrandr
Screen 0: minimum 320 x 200, current 720 x 640, maximum 2048 x 2048
None-1 connected 720x574+0+0 0mm x 0mm
   720x574i      50.00*+
None-2 connected 480x640+0+0 0mm x 0mm
   480x640       65.74*+
root@letux:~# cat /sys/class/drm/card0-Unknown-*/enabled
enabled
enabled
root@letux:~# cat /sys/class/drm/card0-Unknown-*/status 
connected
connected

B) w/o VENC patch (VENC returns returning connector_status_unknown):

root@letux:~# xrandr
Screen 0: minimum 320 x 200, current 480 x 640, maximum 2048 x 2048
None-1 connected 480x640+0+0 0mm x 0mm
   480x640       65.74*+
None-2 unknown connection
   720x574i      50.00 +
root@letux:~# cat /sys/class/drm/card0-Unknown-*/enabled
enabled
disabled
root@letux:~# cat /sys/class/drm/card0-Unknown-*/status
connected
unknown

C) with DPI (also) returning connector_status_unknown

root@letux:~# xrandr
Screen 0: minimum 320 x 200, current 720 x 640, maximum 2048 x 2048
None-1 unknown connection 720x574+0+0 0mm x 0mm
   720x574i      50.00*+
None-2 unknown connection 480x640+0+0 0mm x 0mm
   480x640       65.74*+
root@letux:~# cat /sys/class/drm/card0-Unknown-*/enabled
enabled
enabled
root@letux:~# cat /sys/class/drm/card0-Unknown-*/status
unknown
unknown
root@letux:~# 

D) VENC patch but DPI returning connector_status_unknown

rroot@letux:~# xrandr
Screen 0: minimum 320 x 200, current 720 x 574, maximum 2048 x 2048
None-1 unknown connection
   480x640       65.74 +
None-2 connected 720x574+0+0 0mm x 0mm
   720x574i      50.00*+oot@letux:~# cat /sys/class/drm/card0-Unknown-*/enabled
disabled
enabled
root@letux:~# cat /sys/class/drm/card0-Unknown-*/status
unknown
connected

In case B) I have no TV out and in case D) I have no LCD.

So it looks as if it works if my LCD and VENC report the same
connection status. And fails if they differ.

Anyone with an explanation or even vague idea where to search
for the real bug?

BR and thanks,
Nikolaus

Re: [PATCH 1/2] video:omap2:dss: fix timings for VENC to match what omapdrm expects

From: Tomi Valkeinen <hidden>
Date: 2015-12-09 08:18:51

On 13/11/15 12:29, H. Nikolaus Schaller wrote:
Otherwise check_timings fails and we get a "has no modes" message
from xrandr.

This fix makes the venc assume PAL and NTSC timings that match the
timings synthetized by copy_timings_drm_to_omap() from omapdrm
mode settings so that check_timings() succeeds.

Tested on: BeagleBoard XM, GTA04 and OpenPandora

Signed-off-by: H. Nikolaus Schaller <redacted>
---
 drivers/video/fbdev/omap2/dss/venc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
I've picked this up.

With this patch and the one below I can get tv-out working on my very old
beagleboard, and it seems to work with X also. It doesn't start automatically
as the connection state is unknown, but doing "xrandr --output None-1 --auto"
was all I needed to enable it.

 Tomi

From a4274600a5a67256b91266b0d2624b9c9028909b Mon Sep 17 00:00:00 2001
From: Tomi Valkeinen <redacted>
Date: Tue, 8 Dec 2015 18:32:14 +0200
Subject: [PATCH] drm/omap: fix fbdev pix format to support all platforms

omap_fbdev always creates a framebuffer with ARGB8888 pixel format. On
OMAP3 we have VIDEO1 overlay that does not support ARGB8888, and on
OMAP2 none of the overlays support ARGB888.

This patch changes the omap_fbdev's fb to XRGB8888, which is supported
by all platforms.

Signed-off-by: Tomi Valkeinen <redacted>
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index b8e4cdec28c3..24f92bea39c7 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -112,11 +112,8 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
 	dma_addr_t paddr;
 	int ret;
 
-	/* only doing ARGB32 since this is what is needed to alpha-blend
-	 * with video overlays:
-	 */
 	sizes->surface_bpp = 32;
-	sizes->surface_depth = 32;
+	sizes->surface_depth = 24;
 
 	DBG("create fbdev: %dx%d@%d (%dx%d)", sizes->surface_width,
 			sizes->surface_height, sizes->surface_bpp,

Re: [PATCH 1/2] video:omap2:dss: fix timings for VENC to match what omapdrm expects

From: H. Nikolaus Schaller <hidden>
Date: 2015-12-13 18:41:39

Hi Tomi,

Am 09.12.2015 um 09:18 schrieb Tomi Valkeinen [off-list ref]:
On 13/11/15 12:29, H. Nikolaus Schaller wrote:
quoted
Otherwise check_timings fails and we get a "has no modes" message
from xrandr.

This fix makes the venc assume PAL and NTSC timings that match the
timings synthetized by copy_timings_drm_to_omap() from omapdrm
mode settings so that check_timings() succeeds.

Tested on: BeagleBoard XM, GTA04 and OpenPandora

Signed-off-by: H. Nikolaus Schaller <redacted>
---
drivers/video/fbdev/omap2/dss/venc.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
I've picked this up.
Thanks!
With this patch and the one below I can get tv-out working on my very old
beagleboard, and it seems to work with X also. It doesn't start automatically
as the connection state is unknown, but doing "xrandr --output None-1 --auto"
was all I needed to enable it.
Great that you did find the real reason of the problem.

I have tested it on the GTA04 and it also works.

Will the patches arrive in 4.5?

So thanks a lot,
Nikolaus
quoted hunk
Tomi

From a4274600a5a67256b91266b0d2624b9c9028909b Mon Sep 17 00:00:00 2001
From: Tomi Valkeinen <redacted>
Date: Tue, 8 Dec 2015 18:32:14 +0200
Subject: [PATCH] drm/omap: fix fbdev pix format to support all platforms

omap_fbdev always creates a framebuffer with ARGB8888 pixel format. On
OMAP3 we have VIDEO1 overlay that does not support ARGB8888, and on
OMAP2 none of the overlays support ARGB888.

This patch changes the omap_fbdev's fb to XRGB8888, which is supported
by all platforms.

Signed-off-by: Tomi Valkeinen <redacted>
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index b8e4cdec28c3..24f92bea39c7 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -112,11 +112,8 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
	dma_addr_t paddr;
	int ret;

-	/* only doing ARGB32 since this is what is needed to alpha-blend
-	 * with video overlays:
-	 */
	sizes->surface_bpp = 32;
-	sizes->surface_depth = 32;
+	sizes->surface_depth = 24;

	DBG("create fbdev: %dx%d@%d (%dx%d)", sizes->surface_width,
			sizes->surface_height, sizes->surface_bpp,

Re: [PATCH 1/2] video:omap2:dss: fix timings for VENC to match what omapdrm expects

From: Tomi Valkeinen <hidden>
Date: 2015-12-15 12:53:47

On 13/12/15 20:41, H. Nikolaus Schaller wrote:
Great that you did find the real reason of the problem.

I have tested it on the GTA04 and it also works.

Will the patches arrive in 4.5?
4.4, I hope.

 Tomi
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help