agnos-builder icon indicating copy to clipboard operation
agnos-builder copied to clipboard

Update Weston

Open andiradulescu opened this issue 1 year ago • 9 comments

@adeebshihadeh this is my proposal for https://github.com/commaai/agnos-builder/issues/16

This will update weston to the Linaro latest downstream (based on weston 8.0.0) for Ubuntu 20.04, used in Qualcomm Robotics RB5 Dev Kit / QRB5165. The manifest (and tag) used is LU.UM.3.3.1.r1-25900-QRB5165.0.

My proposal comes for a couple of reasons:

  • using upstream weston (as it is) forces to use mesa/freedreno which has sketchy support for OpenCL
  • using upstream weston with the adreno drivers would mean to put (the linaro) patches on top of the upstream weston - which is the same thing as pulling the linaro downstream - if we want this, we could probably reduce the number of changes Linaro did (e.g. only import the sdm_backend), but there will be a lot of trial and error
  • using weston 8 since Ubuntu 20.04 uses weston 8

Please let me know what you think.

andiradulescu avatar Jan 30 '24 21:01 andiradulescu

Bounty is locked! I'll have to take some time to review the approach and make sure it hits all the things we want to do.

adeebshihadeh avatar Jan 30 '24 21:01 adeebshihadeh

Thanks! Sure, take your time. I will putting this on hold for at least a couple of days.

Current progress is that all compile-*.sh steps compile fine, except weston which has some linking errors that need to be fixed next:

12.11 /usr/bin/ld: warning: liblog.so.0, needed by compositor/libexec_weston.so.0.0.0, not found (try using -rpath or -rpath-link)
12.11 /usr/bin/ld: compositor/libexec_weston.so.0.0.0: undefined reference to `__android_log_print'
12.11 /usr/bin/ld: libweston/libweston-8.so.0.0.0: undefined reference to `gbm_perform'

After weston compiles fine, I need to push the new version(s) of weston to my C3 and fix every problem one by one.

At the end, any private changes you have on the current weston, need to be copied over (as patches) to this PR.

andiradulescu avatar Jan 30 '24 21:01 andiradulescu

If you need it, the entire LU.UM.3.3.1.r1-25900-QRB5165.0 Linaro release can be pulled with:

repo init --depth=1 --current-branch -u https://git.codelinaro.org/clo/le/le/manifest.git -b release -m LU.UM.3.3.1.r1-25900-QRB5165.0.xml --repo-url=https://git.codelinaro.org/clo/tools/repo.git --repo-branch=qc-stable
repo sync -j8 -c

And to build:

MACHINE=qrb5165-rb5 DISTRO=qti-distro-ubuntu-fullstack-perf source poky/qti-conf/set_bb_env.sh
bitbake -p qti-ubuntu-robotics-image

This is from where I extracted manually all the compile phases. By hand.

andiradulescu avatar Jan 30 '24 22:01 andiradulescu

Last commits pack weston (and deps) in deb files, with applied patches.

Weston now loads fine, UI works except there is a lot of tearing because backend-sdm expects the kernel to support atomic_modeset for drm/msm/adreno drivers. From what I researched, it seems the support needed is from 4.19. Our kernel is based on 4.9.

What I'm currently trying to do, is finding/making a "fix" so that backend-sdm works without atomic_modeset. Since in weston 1.9.0 compositor-sdm.c doesn't need this.

Keep in mind that if you build from this branch, weston debs are not installed automatically (they are placed in /tmp, right now). I'm leaving this for the end.

andiradulescu avatar Feb 05 '24 22:02 andiradulescu

  • using weston 8 since Ubuntu 20.04 uses weston 8

Which version does 24.04 use? Should we just go straight to that version?

adeebshihadeh avatar Feb 07 '24 22:02 adeebshihadeh

Ubuntu 24.04 uses the latest Weston 13.0.0. We can probably go straight to the latest.

The only issue right now is with the kernel drm to support atomic modesetting:

  • either patch the current kernel (putting a newer drm on top)
  • either update the kernel (to a version where it's easy/fast to apply all changes as patches - e.g. msm-4.19 or msm-5.4 from Linaro)
  • find a fix (e.g. downgrade the backend-sdm to a version without atomic modesetting)

The next thing I'm trying is to patch the current kernel.

Mainlining the kernel will probably take more time than using a Linaro "downstream" msm kernel. But, there is some effort here https://github.com/robin-reckmann/linux / https://github.com/commaai/agnos-builder/issues/16#issuecomment-1569446897 that needs to be tested/compared, since I have no idea if the "msm" specific stuff we need is already in mainline (and what isn't). My effort is towards using the sdm/drm adreno drivers (not freedreno).

andiradulescu avatar Feb 07 '24 23:02 andiradulescu

I'm hesitant to put more effort into the current kernel, since we'd like to go to mainline soon-ish. For mainline, the very latest or the 24.04 kernel are probably what we'd want to go with.

adeebshihadeh avatar Feb 08 '24 00:02 adeebshihadeh

Current tentative target kernel for 24.04 is 6.8.

andiradulescu avatar Feb 08 '24 07:02 andiradulescu

I'm hesitant to put more effort into the current kernel, since we'd like to go to mainline soon-ish. For mainline, the very latest or the 24.04 kernel are probably what we'd want to go with.

Just so you know, I am/was very hesitant in doing any work to make things work on anything except Ubuntu 24.04 / latest.

Indeed, I tried some easy fixes to see weston work 100% but spent little time actually doing this.

As for this branch, it has very little backward compatibility fixes (just some missing include files in kernel 4.9). They can be easily deleted. You can check the diff.

Next, I would see the following get done:

  • clean/update old dependencies (including removal of armhf deps)
  • mainline the kernel
  • update weston 8 to weston 13

And this should be done, or close to done, in the Ubuntu 24.04 release window aka until April 25, 2024.

andiradulescu avatar Feb 08 '24 13:02 andiradulescu

The last conclusion of this PR on “old” 4.9 kernel is that it works but with lots of tearing, since there is no atomic modesetting which this version of weston with backend-sdm needs.

andiradulescu avatar Aug 13 '24 07:08 andiradulescu

Closing this PR, since changes in this PR, as they are, should not be needed anymore in mainline. More will be seen when weston is getting some work in mainline.

andiradulescu avatar Aug 13 '24 07:08 andiradulescu