[libcamera-devel] How to displace viewfinder using DRM/KMS

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Oct 21 14:40:46 CEST 2021


Hi Kieran,

On Thu, Oct 21, 2021 at 10:53:28AM +0100, Kieran Bingham wrote:
> Quoting Laurent Pinchart (2021-10-20 21:03:55)
> > On Wed, Oct 20, 2021 at 05:05:56PM +0100, Eric Curtin wrote:
> > > Hi Guys,
> > > 
> > > To start thanks so much for your work on libcamera.
> > > 
> > > I am interested in running the cam app via DRM/KMS on my laptop and
> > > afterwards on my raspberry pi. I have figured out how to select the
> > > correct camera and select the correct display to output to. But how
> > > can I get them to play nicely together without "No mode matching
> > > 1280x720", "Failed to configure frame sink", "Failed to start camera
> > > session", "Unable to find display pipeline for format MJPEG", etc.
> > > 
> > > I'm a bit of a newbie to graphics and cameras, so any help to get this
> > > running would be greatly appreciated!
> > > 
> > > $ sudo LD_LIBRARY_PATH="/usr/local/lib:/usr/local/lib64" cam -c 1 -C4 -DeDP-1
> > > [7:12:21.427200555] [75751]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3119-2f75a7e5
> > > Using camera \_SB_.PCI0.XHC_.RHUB.HS08-8:1.0-13d3:5405 as cam0
> > > [7:12:21.534685678] [75751]  INFO Camera camera.cpp:937 configuring streams: (0) 1280x720-MJPEG
> > > No mode matching 1280x720
> > 
> > The DRM/KMS support in the cam application can't handle the KMS scaling
> > API at this point, so it requires configuring the camera to output a
> > resolution that matches the mode exactly. You can check the resolutions
> > supported by the KMS connector (using xrandr if you're running X for
> > instance), and then use the -s argument to cam to select the stream
> > resolution, assuming the camera is able to produce a matchin resolution.
> > 
> > It would be nice to lift this limitation, it will require a bit of work
> > in the cam application.
> 
> Can we extend cam to read the supported modes and formats from KMS, and
> filter the supported formats from the camera based on that?
> 
> Or are you talking about implementing scaling? (or both?)

I'm talking about both, and actually not just about scaling, but also
about supporting planes that do not span the whole screen. It shouldn't
be very difficult to do.

> > > Failed to configure frame sink
> > > Failed to start camera session
> > > curtine at curt 17:00:12 1
> > > $ sudo LD_LIBRARY_PATH="/usr/local/lib:/usr/local/lib64" cam -c 1 -C4 -DDP-1
> > > [7:12:25.392692897] [75760]  INFO Camera camera_manager.cpp:293
> > > libcamera v0.0.0+3119-2f75a7e5
> > > Using camera \_SB_.PCI0.XHC_.RHUB.HS08-8:1.0-13d3:5405 as cam0
> > > [7:12:25.497724802] [75760]  INFO Camera camera.cpp:937 configuring
> > > streams: (0) 1280x720-MJPEG
> > > Unable to find display pipeline for format MJPEG
> > 
> > That's the next issue, you also need a format that your display device
> > can handle natively. MJPEG won't be one of them. I assume you're using a
> > USB camera, so you could try passing `-s pixelformat=YUYV` to cam. With
> > a bit of luck, your display controller will support that format.
> > Otherwise, you won't be able to use cam and the KMS sink with that
> > camera and display controller.
> > 
> > > Failed to configure frame sink
> > > Failed to start camera session

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list