#
…

2021-09-25

00:02alyssaoh boy. the act of calling trace_device("/arm-io/jpeg0") causes a kernel panic. uh
00:04alyssawhat on earth
00:04alyssai do hope this is a PLBKAC
00:13alyssaokay I see some writes in boot, so the kernel driver is at least alive.
00:13alyssahilarious
00:15alyssathat said, I'm not seeing any writes now that it's actually, you know, booted.
00:15alyssaso I dunno if this thing is wired up to userspace.
00:16alyssa(opening jpegs in preview doesn't do it :-p)
00:18alyssaioreg says a few things; it requires MCU alignment, does not support DCT scaling, and does not support RST logging
00:22alyssathe whole iOS JPEG stack is here, though
00:24alyssa...i need to switch to !hypervisor to build a test app don't I. ugh.
00:26alyssawell, not a total loss. that gave me the boot procedure.
00:28alyssathis stuff was r/e'd on iOS, I wonder if the ABI is the same
00:37alyssa...just typed printk in userspace code
00:37alyssathe linux docs say I'm a real kernel hacker now.
00:48yuyichao has joined #asahi
00:48artemist0 has quit [Quit: artemist0]
00:50artemist has joined #asahi
00:56alyssaABI seems ot have changed. can I do this blindly? well...
00:59alyssa---it won't be blind 😉
00:59alyssathe kext is loaded with asserts
01:00DragoonAethis has quit [Quit: hej-hej!]
01:00alyssaso I can just trial and error and it'll tell me what I did wrong
01:00DragoonAethis has joined #asahi
01:01fdsdcv has quit []
01:13alyssaokay why is it complaining
01:19___nick___ has joined #asahi
01:20Emantor has quit [Quit: ZNC - http://znc.in]
01:20Emantor has joined #asahi
01:21alyssa"input/output size too small" but... that's regardless of the sizes.......
01:25alyssaoh er uh ok
01:38alyssagetting a lot closer now
01:44alyssanow it's stumbling on an unknown pixel format
01:44alyssaI am.. unsure what pixel format it wants.
01:54alyssaBGRA, apparently
01:54alyssanow it says bitstream corruption was detected. that sure sounds like it's actually getting at the hardware
01:57alyssaok. copied an actual JPEG there, that goes away.
01:57alyssaNow it's just complaining "Failed to egt user client, or client already gone"
01:57robinp has quit [Remote host closed the connection]
01:57alyssasolved by inserting a sleep.
01:57robinp has joined #asahi
01:57alyssaputting it together, I /think/ that gives a hardware JPEG decode under macOS
01:59chadmedwow theres a jpeg dsp in the soc?
01:59chadmedit really is just a big A14X isnt it lmao
02:02alyssaok, I see contents. they're wrong but. let's see now.
02:02alyssaactually not that wrong tbh
02:02alyssastride is just totally botched
02:05alyssaand that was purely a case of me having specifying the stride wrong, lol
02:06alyssabut now I see some... sort of tiling.
02:06alyssa---and stopped setting all the random bits.
02:07alyssaand now have a JPEG decoded successfully from my iokit bitbanging
02:10alyssa^ the code
02:11alyssaalthough I independently confirmed a bunch of things there
02:12alyssaso the moment of truth... is booting the other partition in the hypervisor and seeing if we get jpeg mmio like we expect
02:14quarkyalice has joined #asahi
02:16quarkyalice_ has quit [Ping timeout: 480 seconds]
02:21alyssaI do see jpeg mmio, running my demo app
02:21alyssathough... not what I would expect.
02:21alyssafor starters it talks to both jpeg0 and jpeg1..
02:34alyssai should strongly consider sleeping instead of trying to r/e this
02:43PhilippvK has joined #asahi
02:46phiologe has quit [Ping timeout: 480 seconds]
03:12marvin24_ has joined #asahi
03:15marvin24 has quit [Ping timeout: 480 seconds]
03:17yuyichao has quit [Ping timeout: 480 seconds]
04:03yuyichao has joined #asahi
04:12VinDuv_ has joined #asahi
04:12VinDuv has quit [Read error: Connection reset by peer]
04:12VinDuv_ is now known as VinDuv
05:00quarkyalice_ has joined #asahi
05:01quarkyalice_ has quit [Remote host closed the connection]
05:03quarkyalice_ has joined #asahi
05:04quarkyalice has quit [Remote host closed the connection]
06:04everslick has quit [Remote host closed the connection]
06:05everslick has joined #asahi
07:56ketteniswhat would linux do with a jpeg engine like that?
08:17VinDuvMJPEG encoder/decoder ?
08:18X-Scale` has joined #asahi
08:20aleasto has joined #asahi
08:24X-Scale has quit [Ping timeout: 480 seconds]
08:35zopieux has quit [Ping timeout: 480 seconds]
08:37zopieux has joined #asahi
08:39nctcf^ has quit [Remote host closed the connection]
09:26chadmedgimp image export 0.0000000001% faster :D
09:27chadmedit would be cool if the hardware was able to be generalised for other tasks involving similar math to jpeg compression
09:29svenwould be fun to benchmark and see if software running on the M1 or the HW would be faster :D
09:30chadmedyeah its possible that its not even faster than the main application cores
09:31chadmedit might exist just to offload jpeg processing such that the main cores dont need to be woken up to process a jpeg (common task on a phone) and thus can either stay asleep and save power or do other things and speed up the overall UX
09:31sveni guess it was useful on the first iphones
09:33j_eywhen im browsing memes, i need them to load *as quickly as possible*
09:34chadmedprobably saves a ton of processor time when generating thumbnails for Photos.app even on newer iphones
09:34j_eyyou dont think theyre cached?
09:35chadmedyeah they are but theyve got to be generated in the first place
09:35chadmedcaches can be cleared too
09:35sorearon average over the life of your phone, how many still images per second have you taken?
09:36sorearI can't see how this makes any sense except for video as VinDuv first suggested
09:37chadmedwell idk why dont cameras just have an AArch64 core to do image DSP then, why bother with fixed function hardware?
09:37sorearbecause cameras are expected to do video?
09:38chadmedits more energy efficient per operation is the answer. and given that the M1 is at the end of the day essentially just a big A14X then it will have the DNA of Apple's mobile devices in it
09:38chadmedyeah and phones are expected to compress JPEGs on the fly from raw image data too
09:38chadmeda hw block that can do this without waking up a bigger application core is more desirable in terms of energy use, which is important for mobile devices
09:38svenfwiw, i wouldn't be surprised at all if the JPEG hardware used to be faster/more efficient years ago but is easily beat by software running on the main core these days
09:38svenpossibly even software running on the efficiency core
09:39chadmedyeah it will be an interesting comparison to do regardless
09:39svennot very useful, but interesting :D
09:39chadmeddunno why theyd keep it in the soc if it wasnt helpful though. its not like they need to maintain backwards compatibility with ancient versions of ios and their corresponding apps
09:40chadmedits just wasted xsistors if it doesnt actually do anything useful
09:41sorearby the time you've done a UI interaction to wake up the phone, open the camera, taken a few dozen preview frames, autofocused, run the neural network noise reducer, etc, etc, etc, the final JPEG encode before storing the image is lost in the noise
09:44sorearalso, the latency doesn't matter because you can do this asynchronously?
09:49dottedmagchadmed: Might as well be // TODO: remove later, if it does not take much space on the chip
10:23svenhttps://github.com/AsahiLinux/linux/commits/i2c/v1 i'll probably submit that tomorrow after all the built bots have picked it up. happy about anyone who already wants to catch my dumb mistakes (typos, etc.) in there
10:34j_eysven: there's no issue including i2c-pasemi-core.o twice?, if both CONFIG_I2C_PASEMI and CONFIG_I2C_APPLE are set
10:35svendo you have a CPU that is both PowerPC and ARM64?
10:35j_eysven: maybe the wii2 will have that
10:36svenon the same cpu? :-P
10:36svenother drivers do that same thing fwiw
10:36svene.g. i2c-octeon-core.o
10:36j_eyPowerARMPC64
10:37sven(there's also this entire algos/ subfolder which i first thought would be the right place. but that one appears to be abandoned and newer drivers which also require the pci/platform split do it similar to what i've done there)
10:39j_eysven: youre using platform_get_resource + devm_ioremap_resource instead of devm_platform_ioremap_resource
10:40svengood point. let me fix that
10:42j_eysven: I hope pinctrl never fails to initialise in this driver, otherwise there's probably a null pointer deref :P
10:43svenhuh, where?
10:43j_eyif (IS_ERR(data->pctrl)) { goto out_clk_disable;
10:43j_eybut clkref isnt initiliased yet
10:43svenuh. are you looking at an old version?
10:44j_eyapparently
10:45j_eybtw, do you even need that? I think it should just do that already
10:46svenoh, does the core do that automatically?
10:46j_eyI believe so
10:47j_eythrough pinctrl_bind_pins
10:47svenah, nice
10:47svenlet me drop that then
10:57j_eysven: and what about reordering the last 2 commits? it's very minor, but the 2nd to last commit wont work without it, right?
11:01sventhough i guess now that commit is no-op for the pci variant :D
11:03j_eythat's fine I think
11:04mazI really like that there is still a trace of PASEMI in this machine. these guys were good.
11:08kettenisbtw, is patchwork supposed to pick up patches automatically? or does this involve a manual step from the relevant maintainers?
11:09kettenis(my pcie DT v5 series doesn't seem to show up yet in the devicetree patchwork)
11:09mazkettenis: depends on the maintainer's flow. some use PW, some don't, and it depends whether PW is fed from a bot or manually.
11:39chadmed has quit [Remote host closed the connection]
11:39chadmed has joined #asahi
12:24Glanzmann has joined #asahi
12:24Glanzmannalyssa: Do you have a kernel tree and branch that I can use to run a Debian Desktop on a mac mini?
12:26Glanzmannmarcan: I wonder what kind of Internet connection you have in Tokyo? Do they already have fibre to the flat there?
12:30nico_32_Glanzmann: try a recent branch https://github.com/mu-one/linux/ - it's her playground
12:32Glanzmannnico_32_: Thanks.
12:48alyssanico_32_: "her playground" ha indeed it is 😁
12:49alyssaGlanzmann: https://github.com/mu-one/linux/tree/many-hacks is what I last ran on my mini
12:49alyssaas the branch name suggests this is a branch of many hacks..
12:50alyssayou'll need to apply https://rosenzweig.io/0001-HACK-enable-ANS-clocks.patch to m1n1 or that kernel will die early in boot (fixing this is on my todo)
12:50alyssahttps://rosenzweig.io/.config is my current config, YMMV
12:50alyssa(It's minimalish for useful desktop so I'd just use it tbh)
12:50svenwe should just make m1n1 turn on everything until the pmgr stuff is upstream imho :D
12:51alyssasven: 🔥
12:51alyssasven: I /have/ the pmgr stuff in my tree it's just not wired up to ANS2 properly
12:51alyssaand then I boot as
12:51alyssaM1N1DEVICE=/dev/ttyACM0 python3 proxyclient/tools/linux.py --bootargs="net.ifnames=0 rw root=/dev/nvme0n1p4 rootwait rootfstype=ext4" ~/drm-misc/arch/arm64/boot/Image.gz ~/drm-misc/arch/arm64/boot/dts/apple/t8103-j274.dtb
12:51svennvme... right. i should try to get that in a shape that actually allows it to be reviewed as well
12:52alyssa(That's... err... completely untested but err.... should work ™)
12:52alyssafor initial boot I guess install that to a USB drive and then set the cmdline option "root=/dev/sda1" instead of nvme
12:53alyssasmashing the above together with https://github.com/AsahiLinux/docs/wiki/Developer-Quickstart should let you replicate my setup
12:54alyssa("How did you actually install to NVMe?" "I installed to USB, booted the USB, and rsync'ed / to /mnt")
12:55alyssasven: 😅
12:59nico_32_ is now known as nico_32
13:10Glanzmannalyssa: Thank you for the detailed instructions. I'll try to repdoduce it tomorrow and let you know how it went.
13:10alyssaGood luck 😅
13:10GlanzmannThank you.
13:11alyssaI am eager to know if the DCP driver works for you
13:25gabuscus_ has quit [Ping timeout: 480 seconds]
13:27Glanzmannalyssa: I see. Previously I hooked up the mac mini with a usb-c cable to my eizo monitor, should that work?
13:30gabuscus has joined #asahi
13:44alyssaHDMI should work
13:45alyssadoing video over the type-c ports requires a whole bunch of non-DCP work as well because USB is a nightmare
13:45alyssasven: I should... probably look into that now shouldn't I :v
13:46svenprobably
13:47svenmy best guess is that the tipd chip will be able to detect you want to switch to DP-only for the usb-c port and tell the typec_mux to set everything up correctly
13:47svendunno yet if the typec_mux is part of ATC PHY or just calls phy_set_mode or maybe does something else completely
13:56kettenisiBoot doesn't set this up if it detects DP on the type-c port?
13:59svenalyssa: yeah, it's gonna be complicated and probably requires us to understand how the entire typec mode switching (i.e. usb3, thunderbolt, etc.) is going to work before we can add this in a sane way :(
14:04Glanzmannalyssa: i see. will try hdmi then.
14:18alyssakettenis: oh, that's possible. still need it for hotplug.
14:21marcanGlanzmann: yes, it was already wired for symmetric gigabit FTTH, I just had to sign up for the line and ISP
14:21marcanthey just shipped me the ONU
14:26HAL_6900 has joined #asahi
14:26HAL_6900 has left #asahi [#asahi]
14:39X-Scale has joined #asahi
14:43X-Scale` has quit [Ping timeout: 480 seconds]
16:45aleasto has quit [Ping timeout: 480 seconds]
16:52aleasto has joined #asahi
17:11aleasto has quit [Quit: Konversation terminated!]
17:12aleasto has joined #asahi
17:16aleasto has quit []
17:16aleasto has joined #asahi
17:30kettenissven: the i2c binding looks good to me
17:33quarkyalice has joined #asahi
17:34quarkyalice__ has joined #asahi
17:36aleasto has quit [Quit: Konversation terminated!]
17:37quarkyalice_ has quit [Ping timeout: 480 seconds]
17:41quarkyalice has quit [Ping timeout: 480 seconds]
19:22j_eysven: maybe worth sending out that quirk earlier than other patches?
19:29suricato_ has joined #asahi
19:31suricato has quit [Ping timeout: 480 seconds]
19:53svenahh.. the T2 has ANS2 as well
19:53svenyeah, i can reply tomorrow why that happens and that the only reasonable fix is to just not to the genctr stuff on these apple ssds
19:53sven*just not do
19:55sveni'll have to figure out how to get those message into my mail client. i do9n't think i've subscribed to linux-kernel or linux-nvme
19:56j_eyYou can download a mbox.gz
19:57j_eyif your client supports that, in mutt it's `mutt -f t.mbox.gz`
19:57svenor if anyone else wants to reply: ANS2 is a arm64 coprocessor that emulates the NVMe MMIO and is likely used on the T2 as well. It uses the tag as index to an internal data structure and that index has only 8 bits. if you talk to ANS2 directly it'll just ignore the higher bits and only return the lower ones in the completion queue
19:58svenpresumably, whatever is running on T2 doesn't ignore them but panics if the tag is > 0x100
20:04svenah. that was actually painless to import
20:04svenguess i can already reply right now then :D
20:08roxfanomg patch collision
20:10svenyeah, i've replied to that patch
23:48quarkyalice__ has quit [Ping timeout: 480 seconds]
23:50quarkyalice has joined #asahi
…