NetBSD Problem Report #52984
From www@NetBSD.org Wed Feb 7 11:45:59 2018
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id B671F7A187
for <gnats-bugs@gnats.NetBSD.org>; Wed, 7 Feb 2018 11:45:59 +0000 (UTC)
Message-Id: <20180207114558.88EAA7A261@mollari.NetBSD.org>
Date: Wed, 7 Feb 2018 11:45:58 +0000 (UTC)
From: jun@soum.co.jp
Reply-To: jun@soum.co.jp
To: gnats-bugs@NetBSD.org
Subject: RPI/earmv6hf and earmv7hf: omxplayer abort trap
X-Send-Pr-Version: www-1.0
>Number: 52984
>Category: port-evbarm
>Synopsis: RPI/earmv6hf and earmv7hf: omxplayer abort trap
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-evbarm-maintainer
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Feb 07 11:50:00 +0000 2018
>Closed-Date: Wed Aug 22 13:29:49 +0000 2018
>Last-Modified: Wed Aug 22 13:29:49 +0000 2018
>Originator: Jun Ebihara
>Release: NetBSD 8.99.12
>Organization:
SOUM Corporation
>Environment:
NetBSD rpi 8.99.12 NetBSD 8.99.12 (RPI2) #0: Fri Feb 2 10:49:01 UTC 2018 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/RPI2 evbarm
>Description:
omxplayer Abort trap and core dumped.
rpi# omxplayer a.mpv
Video codec omx-h264 width 1920 height 1080 profile 100 fps 23.976025
Audio codec opus channels 2 samplerate 48000 bitspersample 16
Subtitle count: 0, state: off, index: 1, delay: 0
terminate called after throwing an instance of 'Enforce_error'
what(): Enforcement failed in SubtitleRenderer.cpp(299)
V:PortSettingsChanged: 1920x1080@23.98 interlace:0 deinterlace:0 anaglyph:0 par:1.00 display:0 layer:0 alpha:255 aspectMode:0
/usr/pkg/bin/omxplayer: line 67: 22807 Abort trap (core dumped) LD_LIBRARY_PATH="$OMXPLAYER_LIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" $OMXPLAYER_BIN "$@"
>How-To-Repeat:
1. download raspberrypi image
http://cdn.netbsd.org/pub/NetBSD/misc/jun/raspberry-pi/2018-02-11-earmv6hf/2018-02-11-netbsd-raspi-earmv6hf.img.gz
http://mail-index.netbsd.org/port-arm/2018/02/06/msg004579.html
2. copy to microsd
gunzip < 2018-02-11-netbsd-raspi-earmv6hf.img.gz |dd of=/dev/rsd0d bs=4m
3. setup Raspberry PI 0/1/2/3
- microsd card
- connect HDMI
- USB keyboard
4. install omxplayer
login: root (with no password)
# pkg_add omxplayer
# pkg_add youtube-dl
# youtube-dl https://www.youtube.com/watch?v=wG8ZCC8IwvM
5. omxplayer start and abort trap
# omxplayer *.mkv
Video codec omx-h264 width 1280 height 720 profile 77 fps 29.970030
terminate called after throwing an instance of 'Enforce_error'
what(): Enforcement failed in SubtitleRenderer.cpp(299)
Audio codec opus channels 2 samplerate 48000 bitspersample 16
Subtitle count: 0, state: off, index: 1, delay: 0
V:PortSettingsChanged: 1280x720@29.97 interlace:0 deinterlace:0 anaglyph:0 par:1.00 display:0 layer:0 alpha:255 aspectMode:0
/usr/pkg/bin/omxplayer: line 67: 11452 Abort trap (core dumped) LD_LIBRARY_PATH="$OMXPLAYER_LIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" $OMXPLAYER_BIN "$@"
>Fix:
not known
>Release-Note:
>Audit-Trail:
From: Rin Okuyama <rokuyama@rk.phys.keio.ac.jp>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: port-evbarm/52984 RPI/earmv6hf and earmv7hf: omxplayer abort trap
Date: Sun, 19 Aug 2018 21:10:32 +0900
I did bisect kernel for earmv6hf on Raspberry Pi 3B.
Userland and omxplayer are taken from Jun's image of NetBSD 8.0:
http://cdn.netbsd.org/pub/NetBSD/misc/jun/raspberry-pi/NetBSD-8.0/
(a) Kernel as of 2017-12-10 00:00:00 UTC (just BEFORE FDTization)
---> OK
(b) Kernel as of 2017-12-11 00:00:00 UTC (just AFTER FDTization)
---> NG
The problem turned out to be due to FDTization, as Jun expected.
However, our code itself does not matter, perhaps; I tried to convert
kernel (a) into netbsd.img (format for FDTizaed kernel), and copy it to
/boot/kernel7.img. Then, kernel boots normally, and dmesg is not changed
from original netbsd.bin of (a). But, only omxplayer aborts!
I expect that firmware initializes vchiq in different manners depending
on whether kernel supports FDT or not. As a result, omxplayer does not
work on kernel after FDTization.
P.S.
I changed category of PR from pkg to port-evbarm. But, edit-pr did not
ask me why...
Responsible-Changed-From-To: pkg-manager->port-evbarm-maintainer
Responsible-Changed-By: rin@NetBSD.org
Responsible-Changed-When: Mon, 20 Aug 2018 23:08:23 +0000
Responsible-Changed-Why:
Over to correct maintainer.
From: Rin Okuyama <rokuyama@rk.phys.keio.ac.jp>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: port-evbarm/52984 (RPI/earmv6hf and earmv7hf: omxplayer abort
trap)
Date: Tue, 21 Aug 2018 08:12:53 +0900
By using a dirty hack, omxplayer works fine on kernel from -current!
The point is to stop GPU loading FDT blob, as I suggested in the
previous message. The procedure is as follows:
(1) Boot kernel normally. Then, dump fdt_data:
https://nxr.netbsd.org/xref/src/sys/arch/evbarm/fdt/fdt_machdep.c#106
fdt_data is a copy of FDT blob which GPU makes from /boot/*.dtb.
(2) Embed dumped FDT blob into data section of kernel.
(3) Copy kernel (netbsd.bin) into /boot/kernel7.img (i.e., GPU does
not load *.dtb files).
Then, omxplayer works fine.
This indicates that (A) GPU is not initialized if *.dtb is provided,
or (B) GPU is initialized but its state is broken by loading *.dtb.
I will take a look what Linux and FreeBSD deal with this problem.
From: Nick Hudson <nick.hudson@gmx.co.uk>
To: gnats-bugs@NetBSD.org, port-evbarm-maintainer@netbsd.org,
gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, jun@soum.co.jp,
Rin Okuyama <rokuyama@rk.phys.keio.ac.jp>
Cc:
Subject: Re: port-evbarm/52984 (RPI/earmv6hf and earmv7hf: omxplayer abort
trap)
Date: Tue, 21 Aug 2018 08:16:31 +0100
On 21/08/2018 00:15, Rin Okuyama wrote:
> The following reply was made to PR port-evbarm/52984; it has been noted by GNATS.
>
> From: Rin Okuyama <rokuyama@rk.phys.keio.ac.jp>
> To: gnats-bugs@NetBSD.org
> Cc:
> Subject: Re: port-evbarm/52984 (RPI/earmv6hf and earmv7hf: omxplayer abort
> trap)
> Date: Tue, 21 Aug 2018 08:12:53 +0900
>
> By using a dirty hack, omxplayer works fine on kernel from -current!
> The point is to stop GPU loading FDT blob, as I suggested in the
> previous message. The procedure is as follows:
>
> (1) Boot kernel normally. Then, dump fdt_data:
>
> https://nxr.netbsd.org/xref/src/sys/arch/evbarm/fdt/fdt_machdep.c#106
>
> fdt_data is a copy of FDT blob which GPU makes from /boot/*.dtb.
>
> (2) Embed dumped FDT blob into data section of kernel.
>
> (3) Copy kernel (netbsd.bin) into /boot/kernel7.img (i.e., GPU does
> not load *.dtb files).
>
> Then, omxplayer works fine.
>
> This indicates that (A) GPU is not initialized if *.dtb is provided,
> or (B) GPU is initialized but its state is broken by loading *.dtb.
>
> I will take a look what Linux and FreeBSD deal with this problem.
>
>
Is it because the memory ranges passed from the firmware are incorrect
or incorrectly handled some way so that bcm283[56]_dma_ranges doesn't
cover the memory then used by vchiq?
https://nxr.netbsd.org/xref/src/sys/arch/arm/broadcom/bcm283x_platform.c#645
Just guessing
Nick
From: Rin Okuyama <rokuyama@rk.phys.keio.ac.jp>
To: Nick Hudson <nick.hudson@gmx.co.uk>, gnats-bugs@NetBSD.org,
port-evbarm-maintainer@netbsd.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org, jun@soum.co.jp
Cc:
Subject: Re: port-evbarm/52984 (RPI/earmv6hf and earmv7hf: omxplayer abort
trap)
Date: Tue, 21 Aug 2018 17:59:13 +0900
On 2018/08/21 16:16, Nick Hudson wrote:
> Is it because the memory ranges passed from the firmware are incorrect or incorrectly handled some way so that bcm283[56]_dma_ranges doesn't cover the memory then used by vchiq?
>
> https://nxr.netbsd.org/xref/src/sys/arch/arm/broadcom/bcm283x_platform.c#645
>
> Just guessing
Thanks, but bcm283x_memorysize is same regardless of whether GPU
loads FDT blob or not.
rin
From: Rin Okuyama <rokuyama@rk.phys.keio.ac.jp>
To: Nick Hudson <nick.hudson@gmx.co.uk>, gnats-bugs@NetBSD.org,
port-evbarm-maintainer@netbsd.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org, jun@soum.co.jp
Cc:
Subject: Re: port-evbarm/52984 (RPI/earmv6hf and earmv7hf: omxplayer abort
trap)
Date: Wed, 22 Aug 2018 12:00:02 +0900
Finally, omxplayer works fine on -current kernel without any tricks!!
According to this thread in official RPI repository in github,
https://github.com/raspberrypi/firmware/issues/763
when v3d, hdmi, pixelvalve, or hvs are enabled in FDT blog, firmware
turns off GPU functionality of VideoCore, expecting OS drivers control
it appropriately.
Therefore, these features are explicitly disabled in *.dtb, till we
add drivers for them (hdmi is already turned off in our DTS):
http://www.netbsd.org/~rin/rpi_dts_20180822.patch
With this patch, omxplayer works fine on Raspberry Pi 3B. And
everything including genfb and X also works fine as before.
OK to commit this fix?
rin
From: Nick Hudson <nick.hudson@gmx.co.uk>
To: Rin Okuyama <rokuyama@rk.phys.keio.ac.jp>, gnats-bugs@NetBSD.org,
port-evbarm-maintainer@netbsd.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org, jun@soum.co.jp,
"Jared D. McNeill" <jmcneill@invisible.ca>
Cc:
Subject: Re: port-evbarm/52984 (RPI/earmv6hf and earmv7hf: omxplayer abort
trap)
Date: Wed, 22 Aug 2018 09:05:55 +0100
On 22/08/2018 04:00, Rin Okuyama wrote:
> Finally, omxplayer works fine on -current kernel without any tricks!!
>
> According to this thread in official RPI repository in github,
>
> https://github.com/raspberrypi/firmware/issues/763
>
> when v3d, hdmi, pixelvalve, or hvs are enabled in FDT blog, firmware
> turns off GPU functionality of VideoCore, expecting OS drivers control
> it appropriately.
>
> Therefore, these features are explicitly disabled in *.dtb, till we
> add drivers for them (hdmi is already turned off in our DTS):
>
> http://www.netbsd.org/~rin/rpi_dts_20180822.patch
>
> With this patch, omxplayer works fine on Raspberry Pi 3B. And
> everything including genfb and X also works fine as before.
>
> OK to commit this fix?
I think so, but Jared was keen to not touch the files directly and might
have an alternative method here
>
> rin
Nick
From: Jared McNeill <jmcneill@invisible.ca>
To: Nick Hudson <nick.hudson@gmx.co.uk>
Cc: Rin Okuyama <rokuyama@rk.phys.keio.ac.jp>,
gnats-bugs@NetBSD.org,
port-evbarm-maintainer@netbsd.org,
gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org,
jun@soum.co.jp
Subject: Re: port-evbarm/52984 (RPI/earmv6hf and earmv7hf: omxplayer abort
trap)
Date: Wed, 22 Aug 2018 06:57:38 -0300
--Apple-Mail=_DA38DBE9-CF96-4064-B164-E46B10431980
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
On Aug 22, 2018, at 5:05 AM, Nick Hudson <nick.hudson@gmx.co.uk> wrote:
>=20
> I think so, but Jared was keen to not touch the files directly and =
might have an alternative method here
This is an exceptional case so I think patching the dts is fine as a =
stopgap until someone ports vc4 drm.=
--Apple-Mail=_DA38DBE9-CF96-4064-B164-E46B10431980
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
charset=us-ascii
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" class=3D"">On =
Aug 22, 2018, at 5:05 AM, Nick Hudson <<a =
href=3D"mailto:nick.hudson@gmx.co.uk" =
class=3D"">nick.hudson@gmx.co.uk</a>> wrote:<br =
class=3D""><div><blockquote type=3D"cite" class=3D""><br =
class=3D"Apple-interchange-newline"><div class=3D""><span =
style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
12px; font-style: normal; font-variant-caps: normal; font-weight: =
normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
display: inline !important;" class=3D"">I think so, but Jared was keen =
to not touch the files directly and might have an alternative method =
here</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
normal; font-weight: normal; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;" class=3D""></div></blockquote></div><br class=3D""><div =
class=3D"">This is an exceptional case so I think patching the dts is =
fine as a stopgap until someone ports vc4 drm.</div></body></html>=
--Apple-Mail=_DA38DBE9-CF96-4064-B164-E46B10431980--
From: Jun Ebihara <jun@soum.co.jp>
To: gnats-bugs@NetBSD.org, rokuyama@rk.phys.keio.ac.jp
Cc: port-evbarm-maintainer@netbsd.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Subject: Re: port-evbarm/52984 (RPI/earmv6hf and earmv7hf: omxplayer abort
trap)
Date: Wed, 22 Aug 2018 19:38:19 +0900 (JST)
From: Rin Okuyama <rokuyama@rk.phys.keio.ac.jp>
Subject: Re: port-evbarm/52984 (RPI/earmv6hf and earmv7hf: omxplayer abort trap)
Date: Wed, 22 Aug 2018 03:00:02 +0000 (UTC)
> Therefore, these features are explicitly disabled in *.dtb, till we
> add drivers for them (hdmi is already turned off in our DTS):
> http://www.netbsd.org/~rin/rpi_dts_20180822.patch
> With this patch, omxplayer works fine on Raspberry Pi 3B. And
> everything including genfb and X also works fine as before.
after apply this patch,omxplayer works well again!
https://twitter.com/ebijun/status/1032213271409881089
many thanx!
--
Jun Ebihara
From: "Rin Okuyama" <rin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/52984 CVS commit: src/sys/external/gpl2/dts/dist/arch/arm/boot/dts
Date: Wed, 22 Aug 2018 13:16:41 +0000
Module Name: src
Committed By: rin
Date: Wed Aug 22 13:16:41 UTC 2018
Modified Files:
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts: bcm283x.dtsi
Log Message:
Explicitly disable v3d, pixelvalve, and hvs for bcm283x at the moment.
When these devices or hdmi are enabled, firmware turns off GPU functionality of
VideoCore, expecting OS drivers handle it appropriately:
https://github.com/raspberrypi/firmware/issues/763
This breaks userland applications using /dev/vchiq, such as omxplayer.
XXX We need enable them back when we import vc4 drm driver.
Fix PR port-evbarm/52984 and
PR port-arm/53042.
OK jmcneill, skrll
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/bcm283x.dtsi
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: rin@NetBSD.org
State-Changed-When: Wed, 22 Aug 2018 13:29:49 +0000
State-Changed-Why:
Fix committed.
Nick, Jared, thank you for your review. I also thank Jun for rapid confirmation.
No need to pullup since RPI* kernels in any release branch is not FDTized yet.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.