#
#asahi-re · 2022-10-05 00:14
rqou_the RTKit AVE firmware contains over a dozen Cortex-M3 sub-firmwares
#asahi-re · 2022-10-05 00:13
rqou_unrelated to AVD, but i just found that the AVE unit also has a co-coprocessor
#asahi-re · 2022-10-04 15:23
_jannau_mmal, their v4l2 decoder is only frontend for that but at least the h264 v4l2 decoder works using a recent (anything from this year should be fine) BSP kernel
#asahi-re · 2022-10-04 15:19
chadmed[m]the rpi4 uses some stupid proprietary thing that doesnt even work when youve got the APs in aarch64 mode
#asahi-re · 2022-10-04 15:18
_jannau_rcombs: ffmpeg has no support yet? the hevc decoder on the rpi4 uses the stateless api as well but I guess there are alternative API for that
#asahi-re · 2022-10-04 15:11
rcombsjudging by that codebase, the API seems fairly analogous to vaapi's, which ffmpeg is able to handle just fine
#asahi-re · 2022-10-04 15:11
rcombsif you do end up using the request API, we'll need to add support in ffmpeg, but it looks like that should be entirely doable (and https://github.com/bootlin/libva-v4l2-request might be useful for initial experimenting)
#asahi-re · 2022-10-04 13:57
_jannau_it would be a bad match for the v4l2 m2m api if we have to provide slice header params but have to decode the whole frame at once. I can only think of buffering the encoded slice data inside the kernel atm
#asahi-re · 2022-10-04 13:39
Jamie[m]and the result is one big framebuffer containing the entire pieced-together frame
#asahi-re · 2022-10-04 13:39
Jamie[m]yes. the submission from kernel->firmware (one mailbox message pointing to one small SRAM buffer pointing to one 0xB7504 DMA buffer) is a request to decode one frame. There are two arrays inside the 0xB7504 which grow with the number of slices in the frame, and there are numbers in the buffer which equal the number of slices in the frame
#asahi-re · 2022-10-04 13:28
_jannau_if per slice parameters have to be submitted the decoder probably supports slice based decoding and macos just delivers all slices at ones. Have you tested with a video stream with more than 1 slice?
#asahi-re · 2022-10-04 13:24
nicolas17oof matrix bridge fell over
#asahi-re · 2022-10-04 13:21
Jamie[m]maybe the actual decoding hardware is operating at a per-slice level and the per-frame stuff is just the firmware interface, that'd be nice i guess
#asahi-re · 2022-10-04 13:17
Jamie[m](idk enough about h.264 to know if that's an easy/efficient/possible transformation)
#asahi-re · 2022-10-04 13:16
Jamie[m]whereas this api involves userspace separately requesting decoding of each slice
#asahi-re · 2022-10-04 13:15
Jamie[m]idk if the api maps correctly? in h.264, macos submits one frame at a time, referencing all the slices of the frame
#asahi-re · 2022-10-04 13:14
Jamie[m]hmm
#asahi-re · 2022-10-04 13:09
_jannau_it will essentially provide the same information as macos in that 0xB7504 byte large structure
#asahi-re · 2022-10-04 13:08
nicolas17why can't apple use a sandboxed userspace daemon for this? :/
#asahi-re · 2022-10-04 13:08
_jannau_no, we should be using the stateless v4l2 m2m decoder api which requires parsing in userspace
#asahi-re · 2022-10-04 13:07
Jamie[m]so yeah uh if we wanna use v4l m2m it'd better be written in rust
#asahi-re · 2022-10-04 13:07
_jannau_yes, someone from ProjectZero complained that Apple moved the parsing into the kernel. which is a bad idea. I suspect apple might be planning to move the parsing to a co-processor/firmware
#asahi-re · 2022-10-04 13:06
Jamie[m]an 0day no less :/ https://googleprojectzero.github.io/0days-in-the-wild/0day-RCAs/2022/CVE-2022-22675.html
#asahi-re · 2022-10-04 13:05
nicolas17seems not
#asahi-re · 2022-10-04 13:05
Jamie[m]oh is chadmed not in this channel?
#asahi-re · 2022-10-04 13:04
Jamie[m]yeah exactly I was just finding details of that
#asahi-re · 2022-10-04 13:03
nicolas17IIRC there was a recent vulnerability in macOS's kernel-mode parsing of h264 x_x
#asahi-re · 2022-10-04 13:02
Jamie[m]the macos driver *does* do complex parsing of video formats to produce this spaghetti
#asahi-re · 2022-10-04 12:59
Jamie[m]chadmed, rcombs: r.e. ping a few days ago in #-dev, I didn't get a frame just by poking from M1 exactly: I was replaying all the massive complex buffers from a trace of the mac driver
#asahi-re · 2022-10-04 12:54
Jamie[m]compared to the spaghetti of hardcoded offsets
#asahi-re · 2022-10-04 12:53
Jamie[m]diy firmware and/or direct register access both jumped out as potentially sane options to me too
#asahi-re · 2022-10-04 12:52
Jamie[m]I believe in the H264 case it contains a couple of arrays with one element for each slice used in the frame
#asahi-re · 2022-10-04 12:52
Jamie[m]I remember the 0xB7504 thing being a rounder number though, unless you're talking about size rather than alignment
#asahi-re · 2022-10-04 12:51
Jamie[m]and yeah input frame data is in stream 0, as is decoded framebuffer oufput
#asahi-re · 2022-10-04 12:50
Jamie[m]I agree with all that assessment of avd rqou_
#asahi-re · 2022-10-04 11:14
svenI usually clean them up because apple likes to use very long registers names
#asahi-re · 2022-10-04 11:14
svenI think there’s even an example for register names in the re policy
#asahi-re · 2022-10-04 10:03
Lenaregister names should be fine afaik
#asahi-re · 2022-10-04 09:04
hmon[m]question, i should rename register names if i want to publish as documentation? or not publish at all? they're really domain specific so its hard to come up with synonyms
#asahi-re · 2022-10-04 08:53
hmon[m]oh also i've got most of the ANE power/performance registers down :P
#asahi-re · 2022-10-04 08:44
hmon[m]<rqou_> "for extra funsies, this base..." <- ane situation not much different
#asahi-re · 2022-10-03 20:35
rqou_although irq mapping is unclear
#asahi-re · 2022-10-03 20:35
rqou_afaict it doesn't have access to any hardware the AP doesn't also have access to
#asahi-re · 2022-10-03 20:34
rqou_we _might_ also be able to just ignore the firmware
#asahi-re · 2022-10-03 20:34
rqou_it's not signed or anything, and i've already confirmed running custom arbitrary code
#asahi-re · 2022-10-03 20:33
rqou_depending on how thorough we go with the RE effort we might just be able to write our own firmware
#asahi-re · 2022-10-03 20:31
rqou_the firmware is somehow written so that most of it takes pointers to the sram base address (or the base address of something else important in the sram) such that ghidra can't follow any xrefs
#asahi-re · 2022-10-03 20:31
rqou_unclear
#asahi-re · 2022-10-03 20:30
jannauso it could be a giant struct covering all codecs on driver side and it points the appropiate substructs per codec (or the irmware knows where to look at, sigh)
#asahi-re · 2022-10-03 20:29
rqou_in general there's a _ton_ of magic offsets that different classes in the driver and the firmware just have to somehow keep in sync

plus ›