Cheese can't playback the preview on Intel IPU6 camera platform

Bug #1978757 reported by Kai-Chuan Hsieh
62
This bug affects 10 people
Affects Status Importance Assigned to Milestone
OEM Priority Project
Confirmed
Critical
Andy Chi
cheese (Ubuntu)
Confirmed
Undecided
Unassigned
pipewire (Ubuntu)
Confirmed
Undecided
Unassigned
v4l2loopback (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Cheese can't playback preview on Intel IPU6 camera platform.

(cheese:6772): cheese-WARNING **: 10:26:06.389: Internal data stream error.: ../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstCameraBin:camerabin/GstWrapperCameraBinSrc:camera_source/GstBin:bin18/GstPipeWireSrc:pipewiresrc1:
streaming stopped, reason not-negotiated (-4)

Unsupported modifier, resource creation failed.
XXX: resource creation failed
Unsupported modifier, resource creation failed.
XXX: resource creation failed
Unsupported modifier, resource creation failed.
XXX: resource creation failed

On focal the gst-launch line is v4l2src, but it is changed to pipewiresrc on jammy.
I tried command $ gst-launch-1.0 v4l2src ! glimagesink
It can have camera image in the opened window.
And https://webcamtests.com/ can work successfully.
---
ProblemType: Bug
ApportVersion: 2.20.11-0ubuntu82.1
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: ubuntu:GNOME
DistributionChannelDescriptor:
 # This is the distribution channel descriptor for the OEM CDs
 # For more information see http://wiki.ubuntu.com/DistributionChannelDescriptor
 canonical-oem-somerville-jammy-amd64-20220425-25+jellyfish-tentacool+X18
DistroRelease: Ubuntu 22.04
InstallationDate: Installed on 2022-06-14 (0 days ago)
InstallationMedia: Ubuntu 22.04 LTS "Jammy Jellyfish" - somerville-jammy-amd64-20220425-25
MachineType: Dell Inc. XPS 9320
Package: cheese 41.1-1build1 [origin: unknown]
PackageArchitecture: amd64
ProcVersionSignature: Ubuntu 5.15.0-36.37-generic 5.15.35
RelatedPackageVersions:
 cheese 41.1-1build1
 cheese-common 41.1-1build1
Tags: jammy third-party-packages wayland-session gstreamer-error
Uname: Linux 5.15.0-36-generic x86_64
UnreportableReason: This does not seem to be an official Ubuntu package. Please retry after updating the indexes of available packages, if that does not work then remove related third party packages and try again.
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo
_MarkForUpload: True
dmi.bios.date: 06/06/2022
dmi.bios.release: 89.4
dmi.bios.vendor: Dell Inc.
dmi.bios.version: 89.4.1
dmi.board.vendor: Dell Inc.
dmi.chassis.type: 10
dmi.chassis.vendor: Dell Inc.
dmi.modalias: dmi:bvnDellInc.:bvr89.4.1:bd06/06/2022:br89.4:svnDellInc.:pnXPS9320:pvr:rvnDellInc.:rn:rvr:cvnDellInc.:ct10:cvr:sku0AF3:
dmi.product.family: XPS
dmi.product.name: XPS 9320
dmi.product.sku: 0AF3
dmi.sys.vendor: Dell Inc.

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : CheeseDebug.txt.gz

apport information

tags: added: oem-priority
tags: added: apport-collected gstreamer-error jammy third-party-packages wayland-session
description: updated
Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : Dependencies.txt

apport information

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : ProcCpuinfo.txt

apport information

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : ProcCpuinfoMinimal.txt

apport information

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : ProcEnviron.txt

apport information

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : lspci.txt

apport information

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote : lsusb.txt

apport information

description: updated
tags: added: originate-from-1973667 somerville
Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote (last edit ): Re: Can't playback preview on Intel IPU6 camera platform

I try to disable gstreamer1.0-pipewire device provider cap, then the Cheese can work correctly.

The package with device provider cap disabled can be installed by:

1. $ sudo add-apt-repository ppa:kchsieh/verification
2. $ sudo apt install gstreamer1.0-pipewire libpipewire-0.3-0 libpipewire-0.3-common libpipewire-0.3-modules libspa-0.2-modules pipewire-bin pipewire
3. $ sudo reboot

Revision history for this message
Sebastien Bacher (seb128) wrote :

shouldn't pipewire use libcamera that should be able to handle the camera?

Revision history for this message
Shih-Yuan Lee (fourdollars) wrote :

libcamera is a long term solution that Intel is still working on.
Currently it still needs to use a mid term solution that is to use libcamhal in https://launchpad.net/~oem-solutions-group/+archive/ubuntu/intel-ipu6 with v4l2-relayd in jammy/universe to bind the MIPI camera to a v4l2video device made by v4l2loopback kernel module.
We are still working on making the MIPI camera userspace stack to jammy/restricted.

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote :

@seb128

Hello,

Do you think to make gstreamer1.0-pipewire not register device provider by not set HAS_GSTREAMER_DEVICE_PROVIDER can be a temporary fix to maximize the compatibility?

Thanks,

Revision history for this message
Sebastien Bacher (seb128) wrote :

I'm unsure to understand the details of that proposal enough to have an opinion. How is HAS_GSTREAMER_DEVICE_PROVIDER set? Wouldn't it be easier for you to just not install gstreamer1.0-pipewire on those oem images?

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote (last edit ):

I create a build with the patch to make HAS_GSTREAMER_DEVICE_PROVIDER not set. I've tried to $ sudo apt purge gstremaer1.0-pipewire, then my platform can't boot into Desktop.

Therefore, I think wayland session has some package rely on gstreamer1.0-pipewire.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Don-t-register-device-provider.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
You-Sheng Yang (vicamo) wrote :

It seems to me there is a problem in the pipewiresrc that it closes/reopens the device every 3 seconds, while the gstreamer v4l2src works just fine.

1. add `debug=3` to /etc/modprobe.d/v4l2-relayd.conf, reboot to take effect

2. list supported media device:

  $ gst-device-monitor-1.0 Video/Source
  Probing devices...
  Device found:

  name : Intel MIPI Camera
  ...
  properties:
          object.path = v4l2:/dev/video0
          ...
  gst-launch-1.0 pipewiresrc path=34 ! ...

2. for pipewiresrc, run:

  $ GST_DEBUG=2,pipewiresrc:5 gst-launch-1.0 pipewiresrc path=34 ! videoconvert ! xvimagesink

   for v4l2src, run:

  $ GST_DEBUG=2,v4l2src:5 gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! xvimagesink

3. The v4l2src behaves well while pipewiresrc gives a blank screen.

Revision history for this message
Sebastien Bacher (seb128) wrote :

> It seems to me there is a problem in the pipewiresrc that it closes/reopens the device every 3 seconds,

could you report that upstream?

tags: added: originate-from-1971676
Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote (last edit ):

I try to compare the working and non-working system. The log's different when allocate buffer.

Good:
pipewire[1889]: pw.link: 0x5595fb3a6de0: allocating 16 buffers 0x5595fb3b4590
pipewire[1889]: pw.port: 0x5595fb361960: 1:0.0: 16 buffers flags:1 state:2 n_mix:1
pipewire[1889]: pw.port: 0x5595fb361960: 1.0 use 16 buffers on node: 0x5595fb35f2d0
pipewire[1889]: spa.v4l2: got 16 buffers

Bad:
pipewire[1118]: pw.link: 0x5620ee222d50: allocating 16 buffers 0x5620ee222600
pipewire[1118]: pw.port: 0x5620ee23d570: 1:0.0: 16 buffers flags:1 state:2 n_mix:1
pipewire[1118]: pw.port: 0x5620ee23d570: 1.0 use 16 buffers on node: 0x5620ee243c50
pipewire[1118]: spa.v4l2: got 2 buffers
pipewire[1118]: spa.v4l2: buffer 0 was already queued
pipewire[1118]: spa.v4l2: have 0 buffers using MMAP

From the source it utilize the ioctl to query the driver:
https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/spa/plugins/v4l2/v4l2-utils.c#L1439

More, the driver report the buffer flag V4L2_BUF_FLAG_QUEUED on IPU6 platform.
Might need to check driver what makes it different. It keeps reporting no buffers for doing streaming on IPU6 platform.

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote :

The log of #17.

Revision history for this message
You-Sheng Yang (vicamo) wrote :

It appears to me now there is a bug in the v4l2loopback that its timer calculation may corrupt under a certain scenario that `v4l2-compliance` gives:

  $ v4l2-compliance -d /dev/video1
  ...
  Buffer ioctls (Output 0):
                  fail: v4l2-test-buffers.cpp(369): timestamp != V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC && timestamp != V4L2_BUF_FLAG_TIMESTAMP_COPY
                  fail: v4l2-test-buffers.cpp(486): buf.check(Unqueued, i)
                  fail: v4l2-test-buffers.cpp(615): testQueryBuf(node, i, q.g_buffers())
          test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
          test VIDIOC_EXPBUF: OK (Not Supported)
                  fail: v4l2-test-buffers.cpp(1803): media_fd < 0
          test Requests: FAIL

Then a simple v4l2sink test will fail with log:

  $ GST_DEBUG=v4l2sink:7 gst-launch-1.0 -v videotestsrc ! v4l2sink device=/dev/video1
  ...
  0:00:00.025135153 2684382 0x55949d5f01e0 DEBUG v4l2sink
  gstv4l2sink.c:592:gst_v4l2sink_show_frame:<v4l2sink0> render buffer: 0x55949d6067e0
  Pipeline is PREROLLED ...
  Setting pipeline to PLAYING ...
  0:00:00.025482054 2684382 0x55949d5f8240 DEBUG v4l2sink
  gstv4l2sink.c:444:gst_v4l2sink_change_state:<v4l2sink0> 3 -> 4
  Redistribute latency...
  New clock: GstSystemClock
  0:00:00.025629911 2684382 0x55949d5f01e0 DEBUG v4l2sink
  gstv4l2sink.c:592:gst_v4l2sink_show_frame:<v4l2sink0> render buffer: 0x55949d6067e0
  Caught SIGSEGV
  Spinning. Please run 'gdb gst-launch-1.0 2684382' to continue debugging, Ctrl-C to quit, or
  Ctrl-\ to dump core.
  ^C

This can be easily reproduced with multiple `v4l2-compliance -d /dev/video1` executions until that timestamp test failure appears, then the following gst-launch-1.0 attempts will all fail.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in cheese (Ubuntu):
status: New → Confirmed
Changed in pipewire (Ubuntu):
status: New → Confirmed
Changed in oem-priority:
importance: Undecided → Critical
Changed in oem-priority:
assignee: nobody → Andy Chi (andch)
Andy Chi (andch)
Changed in oem-priority:
status: New → Confirmed
Changed in v4l2loopback (Ubuntu):
status: New → Confirmed
Revision history for this message
Nicolas DERIVE (kalon33) wrote :

Hello @fourdollars @andch,

Any news on this topic? We just replaced our laptops at work and we now have a batch of some Dell XPS 13 experiencing this bug under 22.04LTS.

Webcams are working properly in Chromium, not in Firefox and Cheese. Is there any workaround or fix available that could be deployed without messing another thing on the machines?

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote (last edit ):

Here is the issue that address the Firefox issue [1].
Here is the workaround for cheese [2] that makes mipi camera work.

[1] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2532#note_1892434
[2] https://wiki.ubuntu.com/Dell, known issue > LP:#1978757 Cheese can't playback preview not working on 22.04

Revision history for this message
You-Sheng Yang (vicamo) wrote :

For firefox, I got it running with linux/jammy version 5.15.0-77, as well as all other available jammy kernels in ubuntu archive: oem-5.17, hwe-5.19, oem-6.0, oem-6.1, hwe-6.2. All probed virtual camera and streaming well on https://webcamtests.com/.

Revision history for this message
You-Sheng Yang (vicamo) wrote :

The fix for firefox pointed out in comment #24 was planned as bug 2025204, but as my comment #25, I can no longer reproduce it with current released kernels.

Cheese is still broken.

Revision history for this message
Kai-Chuan Hsieh (kchsieh) wrote :

I tested 6.0-oem 6.0.0-1017-oem with the latest firefox snap 115.0-2 on jammy. The camera works in webcamtests.com.

summary: - Can't playback preview on Intel IPU6 camera platform
+ Cheese can't playback the preview on Intel IPU6 camera platform
Revision history for this message
Nacho Mg (nacho-mg) wrote :

After a bit of a fight, I've managed to get the MIPI camera working on my Lenovo ThinkPad X1 Carbon Gen 10. Here's what I've got:

- I'm using Ubuntu 22.04.3 LTS.
- I'm using Kernel 6.2.0-34-generic (with 6.2.0-35-generic for example it doesn't work for me)

With the above, I followed these steps: https://wiki.ubuntu.com/Lenovo

And I have added these configurations (replacing what is there, if any):

- In the file /etc/modprobe.d/v4l2loopback.conf:

options v4l2loopback card_label="Intel MIPI Camera" exclusive_caps=1 video_nr=0

- In the /etc/modprobe.d/v4l2-relayd.conf file:

options v4l2loopback exclusive_caps=1 card_label="Intel MIPI Camera"

- In the /etc/default/v4l2-relayd file:

# GStreamer source element name:
VIDEOSRC="icamerasrc"
#SPLASHSRC="filesrc location=/.../splash.png ! pngdec ! imagefreeze num-buffers=4 ! videoscale ! videoconvert"
# Output format, width, height, and frame rate:
FORMAT=NV12
WIDTH=1280
HEIGHT=720
FRAMERATE=30/1
# Virtual video device name:
CARD_LABEL="Intel MIPI Camera"
# Extra options to pass to v4l2-relayd:
#EXTRA_OPTS=-d

With this, after rebooting the system, the camera usually works in both chrome and firefox (meet, zoom, webcam test, etc...).

- In Cheese, I can also get it to work by launching it this way:

sudo cheese -d "Intel MIPI Camera".

- Sometimes when a black screen appears, just restart the v4l2-relayd service:

sudo systemctl restart v4l2-relayd.service

I hope this helps someone

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.