#1051998 chromium: please to add support for riscv64

#1051998#5
Date:
2023-09-15 14:44:44 UTC
From:
To:
Dear Maintainer,

Now the chromium can be built[0] on Debian riscv64 with the attached patch.
And it seems it works to visit youtube or bilibili on my Unmatched
board with below arguments:

chromium --no-sandbox --use-gl=egl

But the patch can not be accepted by now because:

The patch will conflict with ppc's patch and it can not be maintained by
rebasing code on ppc patch. In fact, the patch of riscv64 looks like
small and maintenance easily independent. I would like to follow your
advice that how to deal with the situation.

My initial thought is that applying the ppc/riscv64 patch based on
$(DEB_HOST_ARCH_CPU). Sure, this may require a tricky scripts to do so.
I will try my best not to break workflow for all maintainers of
chromium and I will maintain these patch until Chromium upstream support
the riscv64 totally.

Once ready, I will remove the moreinfo tag.

Thanks for all the help porting/backport the chromium riscv64 patch from
distro like[1]&[2] and developers.

[0]: https://drive.google.com/drive/folders/1n-XakYgPZiuI5hGQa0CGit-8e-74zfMa?usp=drive_link
[1]: https://build.opensuse.org/package/show/openSUSE:Factory:RISCV/chromium
[2]: https://github.com/felixonmars/archriscv-packages/tree/master/chromium

#1051998#10
Date:
2023-09-15 14:51:45 UTC
From:
To:
Sorry to forget to attach the patch in previous email.
#1051998#15
Date:
2023-09-15 18:09:02 UTC
From:
To:
Hi,

Have these patches been submitted upstream? If so, what's the status?
If not, why not?

BTW, quickly looking at those patches - when sending it upstream, I
suspect that the #ifdef around the stddef.h should either be removed
(stddef.h is available everywhere and if size_t requires it, size_t
requires it), or that whole #include removed (there's no usage of
size_t anywhere in the header).

#1051998#20
Date:
2023-09-18 09:37:12 UTC
From:
To:
Hi!

Sorry for the late reply!
I think the patchset should come from openSUSE folks first and then
other distros backport
the patchset to themself.

I checked the status of upstream:
1.  riscv64 for crashpad
https://chromium.googlesource.com/crashpad/crashpad/+/refs/heads/main/minidump/minidump_context.h#661
I think the crashpad has supported the riscv64 but Chromium has not
synced from upstream yet.

2. dav1d should be upstreamed to Chromium
https://chromium.googlesource.com/chromium/src.git/+/refs/tags/116.0.5845.217/third_party/dav1d/config/

3. ffmpeg
I am not sure how to evaluate the module to Chromium on riscv64. This
is the point in the patchset but I did not
find the ffmpeg in Chromium upstream.

4. sandbox should be upstream to Chromium
https://chromium.googlesource.com/chromium/src.git/+/refs/tags/116.0.5845.217/sandbox/

So we have lots work to upstream it looks like. But in fact, I heard
somebody has pushed these changes to upstream
given RISC-V ecosystem become getting better and better. Anyway, I
will submit/forward these changes to upstream and to see
upstream's response if there are possible. At the same time, I will
rebase the code on Debian's newest upload also.

Okay, many thanks again for pointing out here. maybe I have more
questions when sending it upstream.:)

BR,
Bo

#1051998#25
Date:
2023-09-23 14:17:47 UTC
From:
To:
Dear maintainers,

I have been tracking for Chromium riscv64 support for a while (actually
I am one of the maintainer at Arch Linux RISC-V and their Chromium
patches). I have compiled Chromium 117 with the attached patchset and
everything works fine including sandbox, except probably GPU
acceleration though, since I don't have access to any capable device.

Regarding patch content, `ffmpeg-scripts.patch` contains changes to
Chromium's own scripts for FFmpeg to generate headers and config files,
which is inside `ffmpeg-config.patch`. Here I manually turned off RVB
and RVV feature detection, since they are broken right now and there
isn't really RISC-V hardware that implements standard RVB and RVV. I
also reverted one commit in `ffmpeg-revert-442313ad.patch` which makes
the FFmpeg scripts rely on Linux x86-64 host. `v8.patch` is a backport
of [1], since V8 shipped with Chromium 117 is broken for riscv64. This
should be able to be simply removed in the next major version.

The patch size is reasonably small apart from `sandbox.patch`. With
crashpad's RISC-V support upstreamed and released in 117, once sandbox
patch is upstreamed too, we can modify our small patches after ppc64el
ones. But for now, we need to figure out a way for both platform's patch
to exist with significant macro condition overlap, if you are willing to
integrate riscv64 support.

Cheers,
Eric

#1051998#30
Date:
2023-09-23 14:23:13 UTC
From:
To:
On Sat, 23 Sep 2023 22:17:47 +0800 Eric Long <i@hack3r.moe> wrote:
 > `v8.patch` is a backport of [1], since V8 shipped with Chromium 117
is broken for riscv64. This
 > should be able to be simply removed in the next major version.

Sorry, forgot that link:

[1]: https://chromium-review.googlesource.com/c/v8/v8/+/4757761

#1051998#35
Date:
2023-10-09 15:19:51 UTC
From:
To:
Source: chromium
Followup-For: Bug #1051998
Version: 117.0.5938.149-1

Dear Maintainer,

Many thanks to Eric Long and his patchset. I decided to apply the
patchset to here because it seems more robust than my originly patchset.

Regrad as upstreaming progress of Chromium for riscv64, I think there is
some update between 116 and 117 as Eric said that show that there is
some effort to keep pushing this thing. The biggest patch to support
riscv64 here should be ffmpeg and sandbox. In fact, I am not very clear
how about, like ffmpeg how to be integrated into Chromium project. This
will cost my some energy to do that. In addition to as a riscv64 porter,
I feel some pressure from other package[0] which depended on Chromium
also. But definitely, upstreaming must come true.

The debdiff is the first to offer a workaround that fix conflcit issue
between ppc64el and riscv64. I have confirmed the workflow that does not
break other architecture's patch applying. The small flaw is that I
should delete the temp file like rv.series and keep detecting
automaticlly from riscv64 patchset. I would like to hear some
suggestions from you and other maintainers about this.:)

For anyone who want to download/use Debian riscv64 binary, please try it
here[1]. Once installed, without any arguments to use it normal.

Thanks.

[0]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1030895#59
[1]: http://www.riscv-dev.tech:63015/chromium/117/debs/

#1051998#40
Date:
2023-10-18 02:21:05 UTC
From:
To:
Dear Maintainer,

I rebased the supportting riscv64 patchset on 118, there are mainly
change from v8. see d/patches/riscv64/v8.patch.

Now I have some trouble to delete temp file as asid in previous mail. in
fact, on order to not break other archs workflow, so have to as a
workaround. Defineitely I will clear these files.

Binary package: http://www.riscv-dev.tech:63015/chromium/118/debs/

BR,
Bo

#1051998#45
Date:
2023-10-19 15:22:23 UTC
From:
To:
Dear Maintainer,

In fact,The patch in -1#40 is the same with this one. Bucause I forget
to delete these temp files when applying previous version debdiff before
building.

The workaround is introduced by convert_patch.sh and adding a judge
condition if the building on riscv64 machines otherwise it does not
effect building on others archs.

Could you evaluate the method is okay?

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1051998#40

#1051998#50
Date:
2023-10-30 08:17:14 UTC
From:
To:
Dear Maintainer,

I have rebased the patchset which to support riscv64 based on
118.0.5993.117-1. As expected, there are no code changes here.

BR,
Bo

#1051998#57
Date:
2023-11-05 05:56:20 UTC
From:
To:
Dear Maintainer,

I have rebased the patchset for riscv64 base on 119. No code change for
upstream for supporting riscv64 also.

Not sure it is suitable to upload experimental or not but I think can
gave it a try.

BR,
Bo

#1051998#62
Date:
2023-11-19 15:01:02 UTC
From:
To:
Dear Maintainer,

I have rebased the patchset base on 119.0.6045.159-1, there is no code
changed but maybe small change will be happened on next version from
upstream's supporting for riscv64.

In order to make it easier for you to review the code, I try to submit
MR but it seems there is not enable MR feature from chromium on salsa.

https://salsa.debian.org/vimerbf-guest/chromium/-/tree/support_riscv64?ref_type=heads

Please let me know if there is any issue, thanks.

BR,
Bo

#1051998#67
Date:
2023-11-22 04:50:55 UTC
From:
To:
Hello Bo YU,

Do you have links/references for the upstreaming of riscv64 support?
I am interested to see the status of that in Chromium development.

(Did Google accept all of the patches needed, or only a small
part of them?)

#1051998#72
Date:
2023-11-24 03:44:36 UTC
From:
To:
Hi!
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1051998#20

Sorry I promised that I will submit these patches to upstream but this
has not happened due to  being  busy with other works. Another reason
is that I known the support from upstream is alway in process and then
the original patchset come from opensuse then other distros picked
this as we did here so I am hesitant here it is suitable to submit
these valuable patchset from us.

But likely the Chromium developer has picked this now:
1. angle:
https://chromium-review.googlesource.com/c/angle/angle/+/5057086
2. base:
https://chromium-review.googlesource.com/c/chromium/src/+/5054184
3. sandbox:
https://chromium-review.googlesource.com/c/chromium/src/+/5056263
4. ffmpeg:
https://chromium-review.googlesource.com/c/chromium/third_party/ffmpeg/+/5054185

we have one dav1d to be left, but the developer told me he has did it.

I am not sure here so let's to see next step what happened.

BR,
Bo

#1051998#77
Date:
2023-11-25 04:52:01 UTC
From:
To:
Thanks Bo. It is good that the upstream is willing to accept patches for
riscv64. I was worried that Google would not support the platform, in
the same way that they do not support ppc64el.

I had considered adjusting the patches here so that they can be applied
after the ppc64el patches. (There is no way that a conditional patch set
would be accepted by Debian---all the patches have to apply together.)
But if the patches are accepted by the upstream, then there is no need
to adjust the patches for Debian.

#1051998#82
Date:
2023-12-19 14:03:18 UTC
From:
To:
Hi,

The good news is that angle and base support riscv64 both was merged by
chromium upstream.

sandbox and ffmpeg support riscv64 was become more complicated: first
get approval from Chromium ATLs, see:
https://chromium-review.googlesource.com/c/chromium/third_party/ffmpeg/+/5054185/comments/72ecb31a_56bf277d

https://chromium-review.googlesource.com/c/chromium/src/+/4935120

Thanks. CCing Yahan here also.:)

hmm, this time I have dropped 2 patches which upstream has updated based
on 120. Later version we will remove more riscv64 patch here. But we all
know, the most two biggest blockers are sandbox and ffmpeg.

Thanks your suggestions here.

I can cost some time to try apply these patches together and feedback to
here also.

#1051998#87
Date:
2024-01-17 02:40:52 UTC
From:
To:
Version: 120.0.6099.216-1
Tags: patch

The good news is that I have adjusted these patches which can be applied
after ppc64el.

These patches did not change since previous update and I have descripted
their status with upstream support. It seems very pretty that looks like
got upstream support whole.

BR,
Bo

#1051998#92
Date:
2024-02-02 10:05:10 UTC
From:
To:
Version: 121.0.6167.85-1
Tags: patch

I have rebased these patches based on 121.0.6167.85-1.

Add newly patch to fix rustc/ffmpeg build issue.

But the most important thing is that I have to catch up the newest
version of Debian chromium now:
https://tracker.debian.org/news/1499493/accepted-chromium-12106167139-1-source-into-unstable/

BR,
Bo

#1051998#97
Date:
2024-02-02 10:07:20 UTC
From:
To:
Sorry for the wrong version in the previous email.

Bo

#1051998#102
Date:
2024-02-09 15:50:14 UTC
From:
To:
I have rebased these patches based on 121.0.6167.139-1 and the most
notable changes are update ffmpeg config options also.


BR,
Bo

#1051998#107
Date:
2024-06-13 15:06:38 UTC
From:
To:
Hi,

Sorry if I am disorder to reply the thread.

Based on 125, now chromium is worked on riscv64 real hardware again, in
other words, it works on Unmatched board with amd graphic card.

For upstream, there are two mainly part was left still: ffmpeg and
sandbox. I am impressed by their response for this: they have to get
approval from chromium project leaders. I am optimistic that they will
eventually support riscv64 given the involve of riscv's software and
hardware ecosystem.

On debian side, we have testing suite for riscv64 now so we can review it
as a decent port status. As a riscv porter, I can maintain the patchset
to support riscv64 for a long time. In the past few months, I have been
providing deb package[0] for some users.

So could we evaluate this patch again? please let me know if any issues.


[0]: http://vimer.7766.org:63015/chromium/

#1051998#112
Date:
2024-06-13 16:20:07 UTC
From:
To:
Is there an upstream bug report for this? For sandbox in particular,
that patch is a lot and needs to go upstream. I would like to be
building against the ffmpeg debian package, which would make the ffmpeg
patch go away.

There's some random unnecessary stuff in this patchset, like ppc64le
patches. Also, 0008-HACK-devtools-remove-terser.patch removes terser but
doesn't explain _why_, and that patch affects all architectures. The
rest of the patches (other than sandbox and ffmpeg) look reasonable.

#1051998#117
Date:
2024-06-14 04:02:44 UTC
From:
To:
Hi,

Thanks for your quick reply.
...
ffmpeg bundled. This will reduce maintenance burden on ppc64 or rv64
also. anyway, the upstream bug was opened already:
https://chromium-review.googlesource.com/c/chromium/third_party/ffmpeg/+/5054185

In fact, I noticed we have tested dav1d[0] package in the past to rebase
the riscv64 patchset.

For sandbox, we do not have other choice than upstream support it:
https://chromium-review.googlesource.com/c/chromium/src/+/4935120

Many distributions on riscv64 use this patch.

ah, sorry, it seems I forget to clear these unused patches. My attention
is focused on to update ffmpeg. see series[1]

```
--- chromium-125.0.6422.141/debian/patches/series	2024-05-31 10:11:26.000000000 +0800
+++ chromium-125.0.6422.141/debian/patches/series	2024-05-21 18:21:02.000000000 +0800
@@ -141,3 +141,10 @@
  # These patches enable full POWER ISA 3.0 (POWER9) acceleration when applied
  # They will not work on POWER8 (ISA 2.07) or below
  #ppc64le/core/baseline-isa-3-0.patch
+riscv64/0001-cpuinfo.patch
+riscv64/0003-cpuinfo-drop-hwprobe.patch
+riscv64/0004-ffmpeg-generated-config.patch
+riscv64/0005-add-riscv64-support-ffmpeg.patch
+riscv64/0006-fix-rustc-build.patch
+riscv64/0007-fix-rust-ld.patch
+riscv64/0010-sandbox.patch
```

Okay, let me refresh these patches again.

[0]: https://salsa.debian.org/chromium-team/chromium/-/commit/0ef9a36c98ec9b5470c281fff7a63dfc713a875e
[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=1051998;filename=chromium_support_riscv64.debdiff;msg=107

#1051998#122
Date:
2024-06-17 16:08:34 UTC
From:
To:
Hi,
...
...

I have rebased the riscv64 patchset based on 126.0.6478.56 and doing
some clean for it.

So the size of patch is reduced again.

BR,
Bo

#1051998#127
Date:
2024-06-22 16:03:00 UTC
From:
To:
Version: 126.0.6478.114-1
Tags: patch

I have updated the patches based on 126.0.6478.114-1.
Please let me know if we can to try it on riscv64.

BR,
Bo

#1051998#132
Date:
2024-07-01 09:46:09 UTC
From:
To:
I have updated the patch based on 126.0.6478.126-1.

I never thought the patch will be displayed on mail thread and this is
hard to follow the thread. Next time maybe I can try it clone it with bts.


Please let me if any issues.