Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FORTIFY_SOURCE fix and pin package versions #80

Merged

Conversation

danielksato
Copy link
Contributor

As described in #77 and #79, FORTIFY_SOURCE is needed for Cmake to work
on icamerasrc and intel-ipu36-camera-hal. Additionally, recent upstream
releases have broken several dependencies. While I'm hoping the recent
flurry of activity upstream means support for kernel 6.7+ is on the way,
these workarounds should keep us running for now.

As described in stefanpartheym#77 and stefanpartheym#79, FORTIFY_SOURCE is needed for Cmake to work
on icamerasrc and intel-ipu36-camera-hal. Additionally, recent upstream
releases have broken several dependencies. While I'm hoping the recent
flurry of activity upstream means support for kernel 6.7+ is on the way,
these workarounds should keep us running for now.
@danielksato danielksato marked this pull request as draft April 14, 2024 20:01
@danielksato
Copy link
Contributor Author

Marking this as a draft until someone confirms that my updated PKGBUILD for intel-ipu6-dkms-git properly identifies the conflict with the AUR version.

license=('unknown')
depends=('dkms' 'intel-ivsc-firmware')
provides=('intel-ivsc-driver-dkms-git', 'intel-ipu6-dkms-git')
conflicts=('intel-ivsc-driver-dkms-git', 'intel-ipu6-dkms-git')
Copy link

@petobens petobens Apr 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT these , (commas in provides and conflicts) are invalid characters

@petobens
Copy link

petobens commented Apr 15, 2024

I tried this branch (removing the commas I mentioned) and I'm getting:

==> Making package: intel-ipu6-dkms-git r165.cfb7af1e5-1 (Mon 15 Apr 2024 12:07:53 AM -03)
==> Checking runtime dependencies...
==> Installing missing dependencies...
error: target not found: intel-ivsc-firmware
==> ERROR: 'pacman' failed to install missing dependencies.
==> Missing dependencies:
  -> intel-ivsc-firmware
==> Checking buildtime dependencies...
==> ERROR: Could not resolve all dependencies.
ERROR: Failed to build/install: intel-ipu6-dkms-git

Any pointers?

@danielksato
Copy link
Contributor Author

@petobens intel-ivsc-firmware is an AUR package; you should be able to just install it using your AUR helper of choice. I guess it worked on my system since I was installing over an older version; I'll add it to the install.sh explicitly.

@petobens
Copy link

Everything working now. Great work! Thanks!

@danielksato
Copy link
Contributor Author

danielksato commented Apr 15, 2024 via email

@elhossary
Copy link

@danielksato I confirm that it works with me.
Many thanks for this PR.

@stefanpartheym May be it is feasible to make a new branch out of this PR, because the updates of the upstream dependencies are breaking the setup. So, having a branch that pinpoint the commits known to work is IMO a good idea.

@danielksato
Copy link
Contributor Author

@elhossary did this work for you on a fresh install, or were you installing over an existing one?

@elhossary
Copy link

fresh install

@danielksato
Copy link
Contributor Author

Cool, I'll mark it ready for review.

@danielksato danielksato marked this pull request as ready for review April 16, 2024 13:27
@lukemarsden
Copy link

lukemarsden commented Apr 16, 2024

Not wanting to delay the merging of this PR, since it makes everything build again for me (latest manjaro, kernel 6.6.27-1-MANJARO), but I'm seeing no video, v4l2-relayd giving me:

[...]
Apr 16 15:15:15 hope sh[4651]: [04-16 15:15:15.902] CamHAL[ERR] Failed to find DevName for cameraId: 0, get video node: ov13b10 , devname: /dev/v4l-subdev1
Apr 16 15:15:15 hope sh[4651]: [04-16 15:15:15.908] CamHAL[ERR] Get entity fail for calling getEntityById
Apr 16 15:15:15 hope sh[4651]: [04-16 15:15:15.908] CamHAL[ERR] Get entity fail for calling getEntityById
Apr 16 15:15:15 hope sh[4651]: [04-16 15:15:15.908] CamHAL[ERR] setup Link ov13b10  [-1:0] ==> Intel IPU6 CSI-2  [-1x0] enable 1 failed.
Apr 16 15:15:15 hope sh[4651]: [04-16 15:15:15.908] CamHAL[ERR] set MediaCtlConf McLink failed: ret = -1
Apr 16 15:15:20 hope sh[4651]: [04-16 15:15:15.908] CamHAL[ERR] set up mediaCtl failed
Apr 16 15:15:20 hope sh[4651]: [04-16 15:15:15.908] CamHAL[ERR] @configure Device Configure failed
Apr 16 15:15:20 hope sh[4651]: [04-16 15:15:15.908] CamHAL[ERR] failed to config streams.

and sudo gst-launch-1.0 icamerasrc ! autovideosink giving:

[04-16 15:19:42.125] CamHAL[INF] (null), media format in tuning: 0, media format for aic 0.
[04-16 15:19:42.125] CamHAL[ERR] Failed to find DevName for cameraId: 0, get video node: ov13b10 , devname: /dev/v4l-subdev1
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
[04-16 15:19:42.133] CamHAL[ERR] Get entity fail for calling getEntityById
[04-16 15:19:42.133] CamHAL[ERR] Get entity fail for calling getEntityById
[04-16 15:19:42.133] CamHAL[ERR] setup Link ov13b10  [-1:0] ==> Intel IPU6 CSI-2  [-1x0] enable 1 failed.
[04-16 15:19:42.133] CamHAL[ERR] set MediaCtlConf McLink failed: ret = -1
[04-16 15:19:42.133] CamHAL[ERR] set up mediaCtl failed
[04-16 15:19:42.133] CamHAL[ERR] @configure Device Configure failed
[04-16 15:19:42.133] CamHAL[ERR] failed to config streams.
ERROR: from element /GstPipeline:pipeline0/Gstcamerasrc:camerasrc0: src pad: Internal data flow error.
Additional debug info:
gstcambasesrc.cpp(3143): gst_cam_base_src_loop (): /GstPipeline:pipeline0/Gstcamerasrc:camerasrc0:
streaming task paused, reason not-negotiated (-4)
Execution ended after 0:00:00.004819429
Setting pipeline to NULL ...
Freeing pipeline ...

on X1 Carbon Gen 11 21HMCTO1WW with an ov2740 sensor. Any clues on what might be wrong? I tried wiping out my archlinux-ipu6-webcam folder, clean checkout of this branch, running ./uninstall.sh, ./install.sh, reboot.

@danielksato
Copy link
Contributor Author

danielksato commented Apr 16, 2024 via email

@lukemarsden
Copy link

lukemarsden commented Apr 16, 2024

Still not working I'm afraid, in fact when I did that I went back to getting this in the dmesg -w output:

[   17.257478] intel-ipu6-isys intel-ipu6-isys0: isys port open ready failed -16
[   17.257488] intel-ipu6-isys intel-ipu6-isys0: Device close failure: -16

which I had previously seen prior to a reboot before I had tried install.sh -as

@elhossary
Copy link

Could be Manjaro specific issue

@danielksato
Copy link
Contributor Author

@lukemarsden I got your exact same error while I was in the process of troubleshooting, but before I realized I should document my work for others and I don't remember what fixed it. So I don't think it's a Manjaro issue, like @elhossary suggested.

Are you doing a fresh install or trying to upgrade?

@lukemarsden
Copy link

lukemarsden commented Apr 18, 2024 via email

@stefanpartheym
Copy link
Owner

stefanpartheym commented Apr 18, 2024

Hey guys,

thanks for the effort (for the PR and testing).
I just tested the PR and can also confirm, it works for me. Though, I must admit, it didn't work on the first try.

Tested on kernel 6.6.28-1-lts

Running the ./test.sh script gave me the old WARNING: erroneous pipeline: no element "icamerasrc" error.
So I uninstalled the icamerasrc pacakges:

yay -Rsn icamerasrc-git-fix icamerasrc-git-fix-debug

After that, I reinstalled the package via:

cd icamerasrc-git-fix.old
makepkg -sif --noconfirm --needed

Now, running ./test.sh again, gave me proper camera output.

Tested on kernel 6.8.7-arch1-1

Same error as above with the LTS kernel. So, I repeated the same procedure.

Running ./test.sh gives me the following error though:

Setting pipeline to PAUSED ...
[04-18 11:51:56.1] CamHAL[INF] aiqb file name ov13b10.aiqb
[04-18 11:51:56.2] CamHAL[INF] aiqb file name ov13b10.aiqb
[04-18 11:51:56.2] CamHAL[INF] (null), media format in tuning: 0, media format for aic 0.
[04-18 11:51:56.2] CamHAL[INF] aiqb file name ov13b10.aiqb
[04-18 11:51:56.2] CamHAL[INF] aiqb file name ov13b10.aiqb
[04-18 11:51:56.3] CamHAL[INF] (null), media format in tuning: 0, media format for aic 0.
[04-18 11:51:56.3] CamHAL[INF] aiqb file name ov8856.aiqb
[04-18 11:51:56.3] CamHAL[INF] aiqb file name ov8856.aiqb
[04-18 11:51:56.3] CamHAL[INF] (null), media format in tuning: 0, media format for aic 0.
[04-18 11:51:56.3] CamHAL[INF] aiqb file name ov8856.aiqb
[04-18 11:51:56.3] CamHAL[INF] aiqb file name ov8856.aiqb
[04-18 11:51:56.3] CamHAL[INF] (null), media format in tuning: 0, media format for aic 0.
[04-18 11:51:56.3] CamHAL[INF] aiqb file name ov01a10.aiqb
[04-18 11:51:56.4] CamHAL[INF] aiqb file name ov01a10.aiqb
[04-18 11:51:56.4] CamHAL[INF] (null), media format in tuning: 0, media format for aic 0.
[04-18 11:51:56.4] CamHAL[INF] aiqb file name ov01a10.aiqb
[04-18 11:51:56.4] CamHAL[INF] aiqb file name ov01a10.aiqb
[04-18 11:51:56.5] CamHAL[INF] (null), media format in tuning: 0, media format for aic 0.
[04-18 11:51:56.5] CamHAL[INF] aiqb file name OV02C10_1BG203N3_ADL.aiqb
[04-18 11:51:56.5] CamHAL[INF] aiqb file name OV02C10_1BG203N3_ADL.aiqb
[04-18 11:51:56.5] CamHAL[INF] (null), media format in tuning: 0, media format for aic 0.
[04-18 11:51:56.5] CamHAL[INF] aiqb file name OV02C10_1SG204N3_ADL.aiqb
[04-18 11:51:56.6] CamHAL[INF] aiqb file name OV02C10_1SG204N3_ADL.aiqb
[04-18 11:51:56.6] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.6] CamHAL[INF] aiqb file name OV02C10_CIFME14_ADL.aiqb
[04-18 11:51:56.6] CamHAL[INF] aiqb file name OV02C10_CIFME14_ADL.aiqb
[04-18 11:51:56.6] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.6] CamHAL[INF] aiqb file name OV02C10_1BG203N3_ADL.aiqb
[04-18 11:51:56.6] CamHAL[INF] aiqb file name OV02C10_1BG203N3_ADL.aiqb
[04-18 11:51:56.7] CamHAL[INF] (null), media format in tuning: 0, media format for aic 0.
[04-18 11:51:56.7] CamHAL[INF] aiqb file name OV02C10_1SG204N3_ADL.aiqb
[04-18 11:51:56.7] CamHAL[INF] aiqb file name OV02C10_1SG204N3_ADL.aiqb
[04-18 11:51:56.7] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.7] CamHAL[INF] aiqb file name OV02C10_CIFME14_ADL.aiqb
[04-18 11:51:56.7] CamHAL[INF] aiqb file name OV02C10_CIFME14_ADL.aiqb
[04-18 11:51:56.7] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.7] CamHAL[INF] aiqb file name OV2740_CJFLE23_ADL.aiqb
[04-18 11:51:56.8] CamHAL[INF] aiqb file name OV2740_CJFLE23_ADL.aiqb
[04-18 11:51:56.8] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.8] CamHAL[INF] aiqb file name HM2170_1SG205N3_ADL.aiqb
[04-18 11:51:56.8] CamHAL[INF] aiqb file name HM2170_1SG205N3_ADL.aiqb
[04-18 11:51:56.8] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.8] CamHAL[INF] aiqb file name HM2170_CJFME18_ADL.aiqb
[04-18 11:51:56.9] CamHAL[INF] aiqb file name HM2170_CJFME18_ADL.aiqb
[04-18 11:51:56.9] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.9] CamHAL[INF] aiqb file name HM2170_1SG205N3_ADL.aiqb
[04-18 11:51:56.9] CamHAL[INF] aiqb file name HM2170_1SG205N3_ADL.aiqb
[04-18 11:51:56.9] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.9] CamHAL[INF] aiqb file name HM2170_CJFME18_ADL.aiqb
[04-18 11:51:56.9] CamHAL[INF] aiqb file name HM2170_CJFME18_ADL.aiqb
[04-18 11:51:56.9] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.9] CamHAL[INF] aiqb file name HI556_1BG502T3_ADL.aiqb
[04-18 11:51:56.10] CamHAL[INF] aiqb file name HI556_1BG502T3_ADL.aiqb
[04-18 11:51:56.10] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.10] CamHAL[INF] aiqb file name HI556_CJFLE25_ADL.aiqb
[04-18 11:51:56.10] CamHAL[INF] aiqb file name HI556_CJFLE25_ADL.aiqb
[04-18 11:51:56.10] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.10] CamHAL[INF] aiqb file name ov01a1s.aiqb
[04-18 11:51:56.11] CamHAL[INF] aiqb file name ov01a1s.aiqb
[04-18 11:51:56.11] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.11] CamHAL[INF] aiqb file name OV08A10_YHUT_ADL.aiqb
[04-18 11:51:56.12] CamHAL[INF] aiqb file name OV08A10_YHUT_ADL.aiqb
[04-18 11:51:56.12] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.12] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.12] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.12] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.12] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.12] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.12] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.12] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.12] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.12] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.12] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.12] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.12] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.12] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.12] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.13] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.13] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.13] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.13] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.13] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.13] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.13] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.13] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.13] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.13] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.13] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.13] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.13] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.13] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.13] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.13] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.13] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.13] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.14] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.14] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.14] CamHAL[INF] aiqb file name IMX390_HDR_TGL.aiqb
[04-18 11:51:56.14] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.14] CamHAL[INF] aiqb file name AR0234_TGL_10bits.aiqb
[04-18 11:51:56.14] CamHAL[INF] aiqb file name AR0234_TGL_10bits.aiqb
[04-18 11:51:56.14] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.14] CamHAL[INF] aiqb file name AR0234_TGL_10bits.aiqb
[04-18 11:51:56.14] CamHAL[INF] aiqb file name AR0234_TGL_10bits.aiqb
[04-18 11:51:56.14] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.14] CamHAL[INF] aiqb file name AR0234_TGL_10bits.aiqb
[04-18 11:51:56.14] CamHAL[INF] aiqb file name AR0234_TGL_10bits.aiqb
[04-18 11:51:56.14] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.14] CamHAL[INF] aiqb file name AR0234_TGL_10bits.aiqb
[04-18 11:51:56.14] CamHAL[INF] aiqb file name AR0234_TGL_10bits.aiqb
[04-18 11:51:56.15] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.15] CamHAL[INF] aiqb file name AR0234_TGL_10bits.aiqb
[04-18 11:51:56.15] CamHAL[INF] aiqb file name AR0234_TGL_10bits.aiqb
[04-18 11:51:56.15] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.15] CamHAL[INF] aiqb file name AR0234_TGL_10bits.aiqb
[04-18 11:51:56.15] CamHAL[INF] aiqb file name AR0234_TGL_10bits.aiqb
[04-18 11:51:56.15] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.15] CamHAL[INF] aiqb file name AR0234_TGL_10bits.aiqb
[04-18 11:51:56.15] CamHAL[INF] aiqb file name AR0234_TGL_10bits.aiqb
[04-18 11:51:56.15] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.15] CamHAL[INF] aiqb file name AR0234_TGL_10bits.aiqb
[04-18 11:51:56.15] CamHAL[INF] aiqb file name AR0234_TGL_10bits.aiqb
[04-18 11:51:56.15] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.15] CamHAL[INF] aiqb file name AR0234_TGL_10bits.aiqb
[04-18 11:51:56.15] CamHAL[INF] aiqb file name AR0234_TGL_10bits.aiqb
[04-18 11:51:56.15] CamHAL[ERR] invalid media format, default value used.
[04-18 11:51:56.15] CamHAL[INF] (null), media format in tuning: 0, media format for aic 0.
[04-18 11:51:56.15] CamHAL[INF] (null), media format in tuning: 0, media format for aic 0.
[04-18 11:51:56.15] CamHAL[INF] (null), media format in tuning: 0, media format for aic 0.
[04-18 11:51:56.15] CamHAL[INF] (null), media format in tuning: 0, media format for aic 0.
[04-18 11:51:56.16] CamHAL[ERR] Failed to find DevName for cameraId: 0, get video node: ov13b10 , devname: /dev/v4l-subdev1
[04-18 11:51:56.18] CamHAL[ERR] MediaControl init failed
Failed to set pipeline to PAUSED.
Setting pipeline to NULL ...
Freeing pipeline ...
[04-18 11:51:56.215] CamHAL[WAR] Seems camera device 0 is not closed properly (pid 11262).

@kotturi-mahipal
Copy link

Trying to install on XPS-13 9315 Linux 6.6.27-1-lts.

error_icamera

@elhossary
Copy link

elhossary commented Apr 18, 2024

reboot is needed after running uninstall.sh, then run install.sh on LTS kernel

git clone https://github.com/stefanpartheym/archlinux-ipu6-webcam.git
cd archlinux-ipu6-webcam/
./uninstall.sh
# Reboot
git pull origin pull/80/head
./install.sh
# Reboot again

@kotturi-mahipal
Copy link

reboot is needed after running uninstall.sh, then run install.sh on LTS kernel

Getting the same error.

@mar565
Copy link

mar565 commented Apr 22, 2024

Can confirm it not working with 6.8.7-arch1-1 on XPS 9320. (fresh install)

@danielksato
Copy link
Contributor Author

@mar565 I wouldn't expect it to; I'm sorry if the notes were unclear.

The upstream Intel repos have added commits that are intended to support 6.7 and 6.8 kernels; however they break compatibility with the 6.6 LTS kernels that were working before (see the main branch readme).

If you're interested in trying to build these packages for the 6.8 kernel, you'll need to un-pin intel-ipu6-dkms-git and intel-ipu6ep-camera-hal-git at the very least. I don't have time this week to dig in on building on non-LTS kernels, but obviously it would be awesome if we could get that working (and it would make most of the work in this branch obsolete).

@elhossary
Copy link

elhossary commented Apr 22, 2024

I tested the main branch and this PR on the latest kernel (fresh install), and it did not work.
The main branch fails during installation, the PR passes the installation, but the camera does not capture.
Conclusion, it works only on the LTS with this PR.
X1 Carbon 10th

@danielksato
Copy link
Contributor Author

@elhossary to be clear, it's expected that this branch will only work on the LTS kernel; it explicitly pulls commits that exclude the work that's been done upstream to support 6.7+. That work seemed to break support on the LTS kernel.

The main branch fails during installation

Is this the i915_drm.h issue from last week, when building intel-ipu6ep-camera-hal-git, or something different?

@elhossary
Copy link

as I remember, yes

@danielksato
Copy link
Contributor Author

I was able to make a more current version of intel-ipu6ep-camera-hal-git compile by changing that include from drm/i915_drm.h to libdrm/i915_drm.h, but the camera didn't work with the LTS kernel. I didn't get the chance to try it with a current kernel version.

If you want to try it, you could unpin those commits and modify the source. If you build modified source with makepkg your changes will be overwritten; I'd throw something like sed -Ei 's/(#include\s)(drm)/\1lib\2/' src/core/CameraBuffer.cpp into the prepare section of the PKGBUILD (working from memory here; I'm not in front of my laptop so you may need to adjust the path).

@mar565
Copy link

mar565 commented Apr 22, 2024

I changed to the LTS kernel and re-installed it with in between reboots. Now it seems that I messed something up. On boot it tells me it cant find the files for the device:
mei_vsc spi-INTC1094:00: file not found vs/soc_a1_prod.bin

dmesg:

[    1.848590] intel-ipu6 0000:00:05.0: enabling device (0000 -> 0002)
[    1.848762] intel-ipu6 0000:00:05.0: Device 0x465d (rev: 0x2)
[    1.848779] intel-ipu6 0000:00:05.0: physical base address 0x603c000000
[    1.848781] intel-ipu6 0000:00:05.0: mapped as: 0x00000000eb51a52a
[    1.848851] intel-ipu6 0000:00:05.0: Unable to set secure mode
[    1.848854] intel-ipu6 0000:00:05.0: IPU in non-secure mode
[    1.848855] intel-ipu6 0000:00:05.0: IPU secure touch = 0x0
[    1.848857] intel-ipu6 0000:00:05.0: IPU camera mask = 0xff
[    1.848876] intel-ipu6 0000:00:05.0: Skip ipc reset for non-secure mode
[    1.848877] intel-ipu6 0000:00:05.0: IPC reset done
[    1.848878] intel-ipu6 0000:00:05.0: cpd file name: intel/ipu6ep_fw.bin
[    1.848909] intel-ipu6 0000:00:05.0: Direct firmware load for intel/ipu6ep_fw.bin failed with error -2
[    1.848911] intel-ipu6 0000:00:05.0: Requesting signed firmware failed
[    1.848947] intel-ipu6: probe of 0000:00:05.0 failed with error -2
[    1.852846] mc: Linux media interface: v0.10

...

mei_vsc spi-INTC1094:00: Direct firmware load for vsc/soc_a1_prod/ivsc_fw_a1_prod.bin failed with error -2
[    2.646168] mei_vsc spi-INTC1094:00: file not found vsc/soc_a1_prod/ivsc_fw_a1_prod.bin
[    2.646195] mei_vsc spi-INTC1094:00: hw_reset failed ret = -19
[    2.646212] mei_vsc spi-INTC1094:00: reset failed ret = -19
[    2.646226] mei_vsc spi-INTC1094:00: link layer initialization failed.
[    2.646245] mei_vsc spi-INTC1094:00: init hw failure.

@danielksato
Copy link
Contributor Author

@mar565 that's a new one for me. Maybe try rebuilding and reinstalling intel-ipu6ep-camera-bin?

@mar565
Copy link

mar565 commented Apr 22, 2024

Got it working. Thank you!
I did it by cleaning the cache of pacman and yay.
When changing kernels I actually had to uninstall the non-LTS one, since the script still wanted to use that one, despite running the LTS kernel at that moment. I suspect that's where my problems started. Was this behavior foreseeable?

@danielksato
Copy link
Contributor Author

I'm not sure honestly; I haven't tried a mainline kernel. Thinking about digging in though; it seems like somebody should. Won't have time this week though.

@Milihhard
Copy link

Milihhard commented Apr 23, 2024

It work on the 6.6.28-1-lts kernel with an existing config. I had to use the uninstall script, reboot, then using the install script. I am on wayland so I did this fix #71 .

The uninstall script has some missing package for information

@Kajot-dev
Copy link

Can confirm that this is working on 6.6 kernel, Manjaro with #71 Thanks!

@twouters
Copy link

twouters commented Apr 28, 2024

I've been running this for a few days and noticed that /usr/lib/tracker-extract-3 was segfaulting when running GNOME and it ended up restarting itself and crashing again.

I've added intel/ipu6-camera-hal#96 as a patch to fix this.

@danielksato
Copy link
Contributor Author

@twouters can you share an updated PKGBUILD that includes that patch?

@twouters
Copy link

@twouters can you share an updated PKGBUILD that includes that patch?

diff --git a/intel-ipu6ep-camera-hal-git/PKGBUILD b/intel-ipu6ep-camera-hal-git/PKGBUILD
index 43d2594..89bff3d 100644
--- a/intel-ipu6ep-camera-hal-git/PKGBUILD
+++ b/intel-ipu6ep-camera-hal-git/PKGBUILD
@@ -5,7 +5,7 @@ _ipu_ver=ipu6ep
 pkgname=intel-ipu6ep-camera-hal-git-fix
 _pkgname=ipu6-camera-hal
 pkgver=r95.da2e282
-pkgrel=1
+pkgrel=2
 pkgdesc="Intel IPU6 camera HAL (Alder Lake)"
 arch=('x86_64')
 url="https://github.com/intel/ipu6-camera-hal"
@@ -14,12 +14,13 @@ depends=('intel-ipu6-dkms-git' 'intel-ipu6ep-camera-bin')
 makedepends=('git' 'cmake')
 provides=(ipu6-camera-hal)
 conflicts=('intel-ipu6-camera-hal-git' 'intel-ipu6ep-camera-hal-git')
-source=("git+${url}.git#commit=da2e2821244f21b95bcb37a1271bf73360c4669e")
-sha256sums=('SKIP')
+source=("git+${url}.git#commit=da2e2821244f21b95bcb37a1271bf73360c4669e" "camerashm-fix-semaphore-permission-issue.patch")
+sha256sums=('SKIP' 'ff706d487b9762503036e0bbec44cc873183fa4a55be1a212bec2a8da5772aff')
 
 prepare() {
     cd $_pkgname
     sed -i "s|-D_FORTIFY_SOURCE=2| |" CMakeLists.txt
+    patch -p1 -i ../camerashm-fix-semaphore-permission-issue.patch
 }
 
 pkgver() {
diff --git a/intel-ipu6ep-camera-hal-git/camerashm-fix-semaphore-permission-issue.patch b/intel-ipu6ep-camera-hal-git/camerashm-fix-semaphore-permission-issue.patch
new file mode 100644
index 0000000..eb2043e
--- /dev/null
+++ b/intel-ipu6ep-camera-hal-git/camerashm-fix-semaphore-permission-issue.patch
@@ -0,0 +1,71 @@
+From 0cc4d6781960e36a7aa13930c4de6cbf68fad7a4 Mon Sep 17 00:00:00 2001
+From: Hao Yao <hao.yao@intel.com>
+Date: Wed, 28 Feb 2024 11:04:26 +0800
+Subject: [PATCH] CameraShm: Fix semaphore permission issue
+
+When user created semaphore with mode 777, the actual mode of it may
+not be expected because of umask. In this case, another non-root user
+calling sem_open will get error EACCES then mSemLock is 0, which can
+cause later segment fault. To avoid this, we directly change the
+semaphore file mode to 0666 by chmod and add null check in lock().
+
+Signed-off-by: Hao Yao <hao.yao@intel.com>
+---
+ src/iutils/CameraShm.cpp | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/src/iutils/CameraShm.cpp b/src/iutils/CameraShm.cpp
+index 403402a8..b49cd20f 100644
+--- a/src/iutils/CameraShm.cpp
++++ b/src/iutils/CameraShm.cpp
+@@ -31,6 +31,7 @@ static const int CAMERA_IPCKEY = 0x43414D;
+ static const int CAMERA_SHM_LOCK_TIME = 2;
+ 
+ #define SEM_NAME "/camlock"
++#define SEM_FD_NAME "/dev/shm/sem.camlock"
+ 
+ CameraSharedMemory::CameraSharedMemory()
+         : mSemLock(nullptr),
+@@ -211,7 +212,7 @@ bool CameraSharedMemory::processExist(pid_t pid, const char* storedName) {
+ }
+ 
+ void CameraSharedMemory::openSemLock() {
+-    mSemLock = sem_open(SEM_NAME, O_CREAT | O_EXCL, 0777, 1);
++    mSemLock = sem_open(SEM_NAME, O_CREAT | O_EXCL, 0644, 1);
+     if (mSemLock == SEM_FAILED) {
+         mSemLock = sem_open(SEM_NAME, O_RDWR);
+         if (mSemLock == SEM_FAILED) {
+@@ -221,6 +222,7 @@ void CameraSharedMemory::openSemLock() {
+             LOG1("Open the sem lock");
+         }
+     } else {
++        chmod(SEM_FD_NAME, 0666);
+         LOG1("Create the sem lock");
+         return;
+     }
+@@ -244,7 +246,12 @@ void CameraSharedMemory::openSemLock() {
+         LOG1("Lock timed out, process holding it may have crashed. Re-create the semaphore.");
+         sem_close(mSemLock);
+         sem_unlink(SEM_NAME);
+-        mSemLock = sem_open(SEM_NAME, O_CREAT | O_EXCL, 0777, 1);
++        mSemLock = sem_open(SEM_NAME, O_CREAT | O_EXCL, 0644, 1);
++        if (mSemLock == SEM_FAILED) {
++            LOGE("failed to re-create sem lock, errno: %s\n", strerror(errno));
++        } else {
++            chmod(SEM_FD_NAME, 0666);
++        }
+     }
+ }
+ 
+@@ -255,9 +262,10 @@ void CameraSharedMemory::closeSemLock() {
+ int CameraSharedMemory::lock() {
+     int ret = OK;
+     struct timespec ts;
+-    CLEAR(ts);
++    CheckAndLogError(mSemLock == SEM_FAILED, BAD_VALUE, "invalid sem lock");
+ 
+     // Wait the semaphore lock for 2 seconds
++    CLEAR(ts);
+     clock_gettime(CLOCK_REALTIME, &ts);
+     ts.tv_sec += CAMERA_SHM_LOCK_TIME;
+     while (((ret = sem_timedwait(mSemLock, &ts)) == -1) && errno == EINTR) {

@danielksato
Copy link
Contributor Author

I'm new to working with PKGBUILDs, but is it a normal practice to copy the patch for the whole commit?

I feel like a git cherry-pick under the prepare() section would be cleaner, and would maintain the upstream repo as a single source of truth.

@Kajot-dev
Copy link

I'm new to working with PKGBUILDs, but is it a normal practice to copy the patch for the whole commit?

I feel like a git cherry-pick under the prepare() section would be cleaner, and would maintain the upstream repo as a single source of truth.

I've seen such approach with patches fairly often (nothing wrong with it, you just have the patch file alongside PKGBUILD). Sometimes you can't cherry pick because the commit does not exist ;)

@elhossary
Copy link

I believe we should focus on LTS kernels only for this PR or the main repo.
Because Kernel 6.10 is likely to upstream the drivers.
https://www.phoronix.com/news/Intel-IPU6-Media-In-Linux-6.10

@danielksato
Copy link
Contributor Author

I believe we should focus on LTS kernels only for this PR or the main repo. Because Kernel 6.10 is likely to upstream the drivers. https://www.phoronix.com/news/Intel-IPU6-Media-In-Linux-6.10

This is fantastic news @elhossary. Phoronix is such a lynchpin for the desktop Linux community.

@stefanpartheym
Copy link
Owner

@elhossary This is really great news. Thanks for the hint!

With this being said, I'll merge this PR now.
I know, some people still had issues on their hardware even with this PR. However, i'd merge it despite it, because as of right now, no one could build the repo on one of the current LTS kernels anyways. So, this PR is definitely an improvement to the status quo, at least for some people.

@stefanpartheym stefanpartheym merged commit dd8876b into stefanpartheym:main May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants