321 Commits

Author SHA1 Message Date
Dave Stevenson
50527c6f2e mmal: Only include Videocore components if not running on Videocore
Fixes build break from "2ac42ee mmal: Hack to make mmal core register
VideoCore components"
2023-03-22 14:33:23 +00:00
Dave Stevenson
8fa944c740 mmal: Add mapping for IL OMX_IndexParamBrcmEnableIJGTableScaling param
Adds MMAL_PARAMETER_JPEG_IJG_SCALING to map onto the IL parameter
OMX_IndexParamBrcmEnableIJGTableScaling.
2022-02-02 15:10:03 +00:00
Phil Elwell
3ff42d6972 vcos: Add vcos_safe_strncpy and VCOS_SAFE_STRNCPY
Add a src-length-limited version of VCOS_SAFE_STRCPY. For some
reason the vc4 linker complained about not being able to find strnlen,
hence the open-coded version.
2022-02-02 14:58:54 +00:00
Dave Stevenson
14b90ff9d9 mmal: Hack to make mmal core register VideoCore components
The default linker option with Bullseye appears to now set
as-needed, so as the core doesn't call into mmal_vc_client
it is viewed as unnecesary, missing that mmal_vc_client has
a constructor that registers functions with the core.

Move the registration of the component supplier to the core_init.
The linker is therefore satisfied that mmal_vc_client is used,
and actually links to it.

This allows Picamera to work again.

https://github.com/waveform80/picamera/issues/697

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2021-11-25 15:54:17 +00:00
Tim Gover
0093675e4a interface/vcos: Get rid of LLTHREAD cast warning
The cast is safe. Get rid of some compiler noise.
2021-10-25 15:36:16 +01:00
Dave Stevenson
6e8f786db2 video_decode: Option to stop decode on aspect ratio & colourspace changes
V4L2 needs to stop on any change that triggers a V4L2_EVENT_SOURCE_CHANGE,
and that includes aspect ratio and colourspace changes.

Add a new parameter to request that behaviour from the RIL component.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
2021-09-28 15:19:51 +01:00
Naushir Patuck
5aece5be06 isp: Add SW colour denoise configuration
This change adds a colour denoise config structure to allow us to set the
operating mode of the software colour denoise.  This essentially chooses
between the video and stills colour denoise variants.

The related kernel change is at:
https://github.com/raspberrypi/linux/pull/4069
2021-09-28 15:18:51 +01:00
Dave Stevenson
4a0a19b88b video_decode: Add parameter to disable timestamp validation
Video_decode was always ensuring that timestamps increased in value
during a stream.
V4L2 M2M API wants a direct mapping, so add an option to disable it.
2021-01-11 19:42:05 +00:00
Dave Stevenson
7deff646e8 MMAL/IL: Add support for the 16bpp Bayer/Grey raw 10/12/14 formats
Unicam can unpack to 16bpp, but only using the bottom N bits, and
V4L2 supports them all. It is also far easier for a CPU to process.

Adds support to the framework and to the ISP component (changes the
black level config).
2021-01-11 19:42:05 +00:00
popcornmix
9f3f9054a6 Remove vcfiled and vcfilesys 2020-10-27 11:56:13 +00:00
Dave Stevenson
e432bc3400 vec: Support PAL-N.
It's supported as a standard preset within the VEC, but there was
no way of selecting it.
The 2 bits for SDTV mode in enum SDTV_MODE_T were fully utilised,
so add it as a modifier in one of the higher bits if PAL is
selected.

https://github.com/raspberrypi/firmware/issues/811
2020-10-22 16:18:04 +01:00
popcornmix
f73fca015d vc_service: Fix enum types to string lookup
Success and error had same values but retry was different (1 vs -2)
Only affects logging string, so not critical but fixes a warning
2020-08-13 10:59:40 +01:00
Dave Stevenson
6d044bc2be MMAL/IL/ISP component: Add support for mono MIPI formats, and Bayer raw 14
MIPI raw 14 wasn't previously defined, so add it for completeness

To support monochrome image sensors, add formats to handle the relevant
packed data formats into the ISP, and disable demosaic.
The Bayer pipeline is still active in Bayer mode, so all 4 channels need
to be programmed with the same data for blocks such as black level and
lens shading.
2020-08-13 10:51:30 +01:00
Dave Stevenson
2534d69d0d interface/mmal: Reduce the header bytes alloc in the MMAL examples
The examples read the first 512 bytes of the stream and try stuffing
them into the codec as header bytes.
If running a debug build of MMAL this will fail as the extradata
field of the port format is bigger than MMAL_FORMAT_EXTRADATA_MAX_SIZE

Reduce the header bytes array down to 128bytes to match
MMAL_FORMAT_EXTRADATA_MAX_SIZE.
2020-07-28 11:04:12 +01:00
Dave Stevenson
fdc2102ccf Remove vcfiled and vcfilesys.
Both these libraries/apps were related to the VPU accessing the
host file system over VCHI. This has never been used on the Pi,
and is creating build warnings with the latest versions of gcc.
Remove them from the source tree.
2020-07-28 11:04:12 +01:00
John Cox
188d3bfe4a Fix cast warning on vcos_llthread_current
Current header generates warnings of the form "warning: cast from
function call of type ‘pthread_t’ {aka ‘long unsigned int’} to
non-matching type ‘VCOS_LLTHREAD_T *’ {aka ‘struct VCOS_LLTHREAD_T *’}
[-Wbad-function-cast]".  Fix that.
2020-06-26 14:24:31 +01:00
popcornmix
f97b1af1b3 Revert "Add MMAL and MMAL_APPS to 64bit builds"
This reverts commit 7d3c6b9f4c.
2020-05-28 15:02:54 +01:00
popcornmix
c069fd469d WF: Fix copyright headers 2020-05-27 15:07:47 +01:00
Phil Elwell
b58bb558f8 arm_loader: Add SET_LAUNCH_VPU1 mailbox message
SET_LAUNCH_VPU (0x30013) works like SET_EXECUTE_CODE except it
runs the code on VPU1 using the QPU rpc thread. The mailbox
returns immediately, and will only fail if out of memory.
2020-05-27 14:24:19 +01:00
Dave Stevenson
ef41631200 video_encode: Add option to include header bytes with frame
V4L2 wants H264 header bytes to be included alongside an encoded
frame, therefore add a new option that selects this behaviour.
2020-05-27 14:23:10 +01:00
Dave Stevenson
04c2643311 mmal/vc: Add mapping for OMX_IndexConfigBufferStall / MMAL_PARAMETER_VIDEO_STALL_THRESHOLD
Requested on the forum, and potentially useful
https://www.raspberrypi.org/forums/viewtopic.php?f=70&t=273123&p=1655481
2020-05-27 14:23:10 +01:00
David Plowman
b420015189 isp: allow more formats of lens shading tables, including corner-sampled and 16-bit
The old lens_shading parameter structures exist for backwards
compatability, but there's a new v2 version which includes a
corner_sampled flag (when the grid is sampled on cell corners rather
than centrally) and a gain_format, which allows different fractional
precision in the uint8_t values, and even a u4.10 16-bit format.

Calls through the V4L2 interface to the ISP should use the v2
style of structure.
2020-05-27 14:23:10 +01:00
David Plowman
106b9ee84d isp: add application control of the gamma block
Preserves the "gamma_shift" functionality that was previously available.
2020-05-27 14:23:10 +01:00
David Plowman
998f7ee3e5 isp: add application control of (automatic) Defective Pixel Correction (DPC) block 2020-05-27 14:23:10 +01:00
David Plowman
336ef2b1d2 isp: add application control of sharpen block 2020-05-27 14:23:10 +01:00
David Plowman
f2f1eb651c isp: add application control of Green Equalisation (GEQ) parameters 2020-05-27 14:23:10 +01:00
David Plowman
010ffa92e4 isp: add application control of spatial denoise parameters 2020-05-27 14:23:10 +01:00
David Plowman
b8fa9560f9 isp: Allow setting Black Level for all 3 channels (whilst still preserving the old single channel method).
The new 3-channel method wants 16-bit black levels whereas the single-channel method uses native sensor bit depth. This does lead to some slightly awkward code; please refer to the inline comments for the conventions used.
2020-05-27 14:23:10 +01:00
Dave Stevenson
b1dc4cb6a7 isp: Add stats port to enable userspace 3A algorithms
Still needs some tarting up with regard enabling ports
in random orders, but all seems to be working.
2020-05-27 14:23:10 +01:00
popcornmix
e31da99739 Revert "mmal: Support 64 bit clients"
This reverts commit c2cd8020ed571c2db13d2ba99695c654136fb440.
2020-05-27 14:23:10 +01:00
Dave Stevenson
4a57ea4107 vc_image: Add vpitch parameter to VC_IMAGE_T for Bayer images
This allows us to use buffers that don't have any alignment on the
height.
2020-05-27 13:41:19 +01:00
popcornmix
03795057f9 Revert "tvservice: Fix freeze on old firmware. (#617)"
This reverts commit 2aaabf31e6.
2020-05-27 12:49:53 +01:00
Dave Stevenson
291f9cb826 MMAL / video_render: Allow column stride to be set on column formats
MMAL and video_render used not to allow the client to set the column
stride or the chroma offset.
format->es->video.width wasn't actually being used for anything as
mmal_encoding_width_to_stride returns 0 meaning the component has to
compute it.

Add an extra flag for format->flags (MMAL_ES_FORMAT_FLAG_COL_FMTS_WIDTH_IS_COL_STRIDE)
that treats format->es->video.width as the column stride instead of
being ignored.

video_render also used to ignore nSliceHeight (format->es->video.width)
on the column formats.
Adding support in setting that (via vc_image vpitch) means that you can
crop down a larger image with the chroma in a different place.
eg width=(col stride), height=2160, crop.width=1920, crop.height=1080
flags = MMAL_ES_FORMAT_FLAG_COL_FMTS_WIDTH_IS_COL_STRIDE
will display the top left 1080p image out of a 4k source image.
2020-05-12 13:00:20 +01:00
Andrew Scheller
5b1ef8b158 Fix header enum typo 2020-05-04 12:46:31 +01:00
andry
2aaabf31e6 tvservice: Fix freeze on old firmware. (#617)
This fixes infinity loop at tvservice_wait_for_reply on initialize
with older firmare. [E] No multi display support in firmware!
Checked with `tvservice --list`
2020-05-04 09:18:45 +01:00
Dave Stevenson
6e6a2c859a vc_image/video_decode: Move +16 lines for di_adv from vc_image to decoder
The advanced deinterlaced algorithm wanted 16 extra lines of height on
SAND images as a scratchpad. vc_image had been hacked to add those lines
to each and every SAND image.

HEVC decode uses SAND but doesn't care about that context, and will never
support interlaced content.

Remove the +16 lines from vc_image, and add specify it as a vpitch when
creating the image from within the decoder.
2020-02-28 19:36:43 +00:00
popcornmix
06bc6daa02 CMakeLists: Remove unwanted quoting See: https://github.com/raspberrypi/userland/issues/603 2020-01-14 17:33:59 +00:00
Dave Stevenson
1117308aaa vc_image: Default YUVUV to non-tall mode, with flag if required.
The HEVC block and various others don't require tall mode, it's only
the H264 codec block that has to keep the column stride below
64kB.

Switch the default configuration to NOT require tall mode.
All the users of SAND with the H264 block are currently internal
to the VPU (video decode will vc_image_convert, or pass an opaque
VC_IMAGE_T. Camera to video_encode either goes via planar, or is
passing a VC_IMAGE_T).
Add a flag to these when creating the images to request tall mode.
2020-01-14 17:28:49 +00:00
Dagg Stompler
42ec119e03 vmcs_host/vcilcs: build only on 32 bit
vcilcs requries libbrcmEGL, libbrcmGLESv2 and libkhrn_client which have
only 32 bit versions currently, so disable it when building aarch64

Signed-off-by: Dagg Stompler <daggs@gmx.com>
2019-12-17 09:25:33 +00:00
Dave Stevenson
7d3c6b9f4c Add MMAL and MMAL_APPS to 64bit builds
Drops
host_applications/android/apps/vidtex
interface/mmal/openmaxil
interface/mmal/client(/brcmjpeg)
as they aren't directly supported and need further fixup for 64bit.
2019-12-11 14:04:13 +00:00
Dave Stevenson
76c0680083 MMAL and vcsm fixups for 64bit builds
Fixes various casts to/from integer of a different size, and printf
for size_t not using %zu.
2019-12-11 14:04:13 +00:00
Dave Stevenson
b20feb419e mmal: Support 64 bit clients
Where 32bit values are passed down to the VPU, these need to
be mapped into a lookup table within the client. Any pointers
that happen to be within structures such as MMAL_ES_FORMAT_T
are already recreated at each end, but the IPC structures must
always be of the same structure.

Where there are pointers to host side client contexts or component
handles, these are stored in lookup tables and a 32bit handle passed
to the VPU. On return these are looked back up again to convert
back to the handle.
2019-12-11 14:04:13 +00:00
Dave Stevenson
ceb18b1b04 mmal_vc_shm: Expand error message 2019-07-24 16:14:17 +01:00
Dave Stevenson
1eeb882dd6 mmal_vc_shm: Refcount init/exit, and call on component create/destroy
Calling mmal_vc_shm from the constructor means that vcsm_init
is initialised very early. Should another user come along and
want to use export then it can't.

Move mmal_vc_shm init and exit calls to mmal_vc_component_create /
destroy so that other things can be created first, and reference
count calls so that it can be called for every component.
2019-07-24 16:08:53 +01:00
James Hughes
917d4cecd2 Fix tvservice -d option
Wasn't handling the new bitmap based flag for ID correctly
in the send command function. Not picked up before as this
function is not used by many commands, and it was simply missed

Moved the command check to before the point where the ID bit is set.
2019-07-24 16:05:00 +01:00
James Hughes
ebb96ac7e7 Change to tvservice commands
Commands now use a bit set to specify that they include
a display_id parameter, rather than having two sets of
commands, one with and one without the display_id.

Makes things a lot easier.

Tested on Pi4 and Pi3 with older firmware to check backwards
compatibility. Seemed OK.
2019-07-24 16:04:46 +01:00
James Hughes
6df8668220 tvservice backwards compatibility
Previously, not able to run new tvservice app on firmware that
did not support the new commands. You could use old apps on new
firmware though!

This fixes this and forces use of old non-ID display commands
on older firmware.
2019-07-24 16:04:37 +01:00
Tim Gover
02d186a871 vcimage: Add basic support for VC_IMAGE_RGBA1010102
Add basic support for deep color RGBA. Images can be uploaded/copied and
displayed via dispmanx but there is no support for converting to other
formats.
2019-07-24 16:03:33 +01:00
Dave Stevenson
93af8ff10e Add support for Rec2020 colour space in vc_image, IL, and MMAL 2019-07-24 16:03:33 +01:00
Dave Stevenson
6d22c1ee19 Add full support for Argon10 as a new image format
Argon 10bit YUV had been temporarily hacked in as a modified
YUV_UV format. Actually add it as a new image format at Scalerlib,
vc_image, IL, and MMAL levels.
2019-07-24 16:03:33 +01:00