ChanServ changed the topic of #asahi-re to: Asahi Linux: porting Linux to Apple Silicon macs | Hardware / boot process / firmware interface reverse engineering | WARNING: this channel (only) may contain binary reverse engineering discussion | RE policy: https://alx.sh/re (MANDATORY READ) | GitHub: https://alx.sh/g | Wiki: https://alx.sh/w | Logs: https://alx.sh/l/asahi-re
phire has quit [Server closed connection]
phire has joined #asahi-re
amw has quit [Server closed connection]
amw has joined #asahi-re
_whitelogger has joined #asahi-re
rikkaa has joined #asahi-re
arekm has quit [Remote host closed the connection]
arekm has joined #asahi-re
chadmed has joined #asahi-re
MikaB[m] has joined #asahi-re
m6wiq has quit []
robinp_ has joined #asahi-re
robinp_ is now known as robinp
riker77_ has joined #asahi-re
riker77 has quit [Ping timeout: 480 seconds]
riker77_ is now known as riker77
PhilippvK has joined #asahi-re
phiologe has quit [Ping timeout: 480 seconds]
nicolas17 has quit [Ping timeout: 480 seconds]
<rqou_> hmm, trying to create a DARTTracer for the jpeg dart crashes m1n1
kylealanhale has joined #asahi-re
<rqou_> tracing with trace_device works, but i'm trying to understand how to create a more complicated tracing tool
<rqou_> i guess i'm clearly struggling trying to figure out how the m1n1 tooling works, since addresses that i can trace the macos kernel accessing crash whenever i try to read32 them
kylealanhale has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<rqou_> ah, figured it out. need to turn on the dart with pmgr_adt_clocks_enable first
<rqou_> finally figured out how to use the mmio tracing framework. is there an example of how to use _reloadcls? i can't seem to figure out how that's intended to be used
kameks has joined #asahi-re
r0ni has quit [Quit: Textual IRC Client: www.textualapp.com]
kameks has quit [Ping timeout: 480 seconds]
doggkruse has quit [Quit: Konversation terminated!]
doggkruse has joined #asahi-re
the_lanetly_052 has joined #asahi-re
doggkruse has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
aycippo[m] has joined #asahi-re
the_lanetly_052 has quit [Ping timeout: 480 seconds]
swampertx[m] has joined #asahi-re
kylealanhale has joined #asahi-re
riker77 has quit [Quit: Quitting IRC - gone for good...]
MajorBiscuit has joined #asahi-re
<rqou_> hmm, the dart iomap function seems to be crashing m1n1 when i try to run it in the shell?
riker77 has joined #asahi-re
<jannau> rqou_: are you using DART.from_adt()? if not it might be simply the wrong dart type
<rqou_> oops no, that fixes it
<rqou_> i tried copying the function from audio_capture.py which... doesn't do that
rikkaa has quit [Quit: Connection closed for inactivity]
<jannau> that's from simpler times when there was only m1 or it was only ever used on m1 and not m1 pro/max
<rqou_> success! (note contains reverse engineered macos driver code) https://gist.github.com/rqou/2dafd40cfe0362cc84c3ee26c68b2b36
<Jamie[m]1> haha nice
<rqou_> works only with a 4:2:0 jpeg that is 120x80 in size
<rqou_> aka exactly what alyssa's iosurface poc was hardcoded for
<j`ey> dumb q, what does it give you back? just some raw rgb values in some format?
<rqou_> it currently gives back raw rgb, but there should be other options as well
<rqou_> i _barely_ understand how to drive this hardware and basically just duplicated exactly what happens when you run alyssa's poc
<rqou_> which is itself hardcoded to these parameters
the_lanetly_052 has joined #asahi-re
kameks has joined #asahi-re
<rqou_> btw if anybody is deeply familiar with jpeg and can tell me why there's a 11-entry matrix involved in the process, that would be appreciated
<henje[m]> JPEG encodes blocks of 8x8 pixels using a discrete cosine transformation. The cosine coefficients form a matrix and are multiplied with a quantization matrix, which effectively eliminates unneeded coefficients. But both matrices should be 8x8.
<rqou_> yeah, that's in a separate block of registers
<rqou_> this is a matrix for... something else
<abrasive> an 11×11 matrix, or a matrix with 11 nonzero entries?
<Jamie[m]1> the latter, it looks like
<rqou_> a matrix with 11 entries of 4 bytes each
<rqou_> possibly not even a matrix
<rqou_> but the driver refers to it as a matrix multiplication... thingy
<Jamie[m]1> it certainly looks like 32-bit signed values
<Jamie[m]1> given the leading ffffff in some of them
<Jamie[m]1> vary them and see what happens to the image? :D
<henje[m]> So if it’s a quantization matrix in some form, later entries should effect higher frequency contents, i.e. sharp edges
<henje[m]> rqou_: if you mind, could you dump the values and share them?
<Jamie[m]1> they're in the gist henje
<henje[m]> Ah thx
<abrasive> oh, um
<abrasive> is JPEG in YCbCr?
<henje[m]> Yes
<abrasive> because YCbCr -> RGB is about that
<henje[m]> But 11 values? Shouldn’t that be 9?
<Jamie[m]1> ahhh, 3x3 matrix plus a separate numerator/denominator for the whole thing?
<abrasive> inverting that matrix gives me ['0x100', '0x0', '0x166', '0x100', '-0x58', '-0xb6', '0xff', '0x1c5', '0x0']
<abrasive> (with truncation rather than rounding, so)
<Jamie[m]1> nice :D
<rqou_> awesome, thanks
<rqou_> uh, i wonder what the last two entries do?
<abrasive> 1.0 = 0x100 in the matrix btw
<Jamie[m]1> -128 potentially makes sense for the subtraction
<abrasive> very probably constants added before/after the multiply
<abrasive> presumably only for Cb/Cr which is why there's only two?
<Jamie[m]1> who needs ANE, we can do matmul in the jpeg block :D
<rqou_> lmao
<rqou_> ok, i'm going to see if i can figure out how to give it an image of different sizes
<rqou_> also probably do a sleep
<henje[m]> Is the QTBL register the quantization matrix? In the gist it does not seem to be set
<rqou_> yes
<rqou_> i assume it isn't used for decoding, only encoding
<henje[m]> Right
rikkaa has joined #asahi-re
<rqou_> not sure if diving back into the driver re for a bit is useful or simply frustrating
<henje[m]> So MATRIX_MULT has to be set differently for decoding and encoding, right?
<rqou_> iosurface is incredibly confusing
<rqou_> idk, haven't looked at encoding whatsoever
<henje[m]> It should be if it’s just a matrix, because one does RGB -> YCbCr, and the other does YCbCr -> RGB, which need another matrix
<henje[m]> You could also go to HSL or whatever uses the same matrix format for conversion
m6wiq has joined #asahi-re
<Jamie[m]1> yeah the forwards matrix is in the (12.3) AppleJPEGDriver binary at 0x50cc
<Jamie[m]1> (i.e. 256 times the screenshot abrasive posted)
ExeciN[m] has joined #asahi-re
<rqou_> i found the register that controls the output alpha value (0x158) and the register that makes the output ARGB instead of BGRA (0x154)
<rqou_> sleep time
Axe has joined #asahi-re
kloenk has quit [Remote host closed the connection]
Axe has quit [Remote host closed the connection]
kameks has quit [Ping timeout: 480 seconds]
kylealanhale has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chadmed has quit [Ping timeout: 480 seconds]
qiuren[m] has joined #asahi-re
the_lanetly_052 has quit [Ping timeout: 480 seconds]
JasonAntwi-Appah[m] has joined #asahi-re
m6wiq1 has joined #asahi-re
m6wiq has quit [Read error: Connection reset by peer]
m6wiq1 has quit [Remote host closed the connection]
justeinkemp[m] has joined #asahi-re
skipwich has quit [Quit: DISCONNECT]
skipwich has joined #asahi-re
MajorBiscuit has quit [Ping timeout: 480 seconds]
rikkaa has quit [Quit: Connection closed for inactivity]
kloenk has joined #asahi-re
brstream[m] has joined #asahi-re
cadawerum1[m] has joined #asahi-re
AdwyzzOLEDEdition[m] is now known as AdryzzOLEDEdition[m]
kylealanhale has joined #asahi-re
doggkruse has joined #asahi-re
nicolas17 has joined #asahi-re
meenmachine has joined #asahi-re
meenmachine has quit [Read error: Connection reset by peer]
m6wiq has joined #asahi-re
meenmachine has joined #asahi-re
yuyichao_ has joined #asahi-re
meenmachine has quit [Quit: Textual IRC Client: www.textualapp.com]
yuyichao has quit [Read error: Connection reset by peer]
meenmachine has joined #asahi-re
meenmachine has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
doggkruse has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
doggkruse has joined #asahi-re
m6wiq has quit []
doggkruse has quit [Ping timeout: 480 seconds]
m6wiq has joined #asahi-re
kylealanhale has quit [Quit: Textual IRC Client: www.textualapp.com]
chengsun has quit [Quit: Quit]
chengsun has joined #asahi-re
m6wiq has quit []
meenmachine has joined #asahi-re
<M1bn3mar[m]> hey, i found a way to adjust the brightness in asahi i thought that it might be useful in development :)
<j`ey> what did you find?
m6wiq has joined #asahi-re
meenmachine has quit [Read error: Connection reset by peer]
m6wiq has quit []
sirn has quit [Server closed connection]
sirn has joined #asahi-re
abrasive has quit [Server closed connection]
abrasive has joined #asahi-re
phire has quit [Server closed connection]
phire has joined #asahi-re
robinp has quit [Server closed connection]
robinp has joined #asahi-re
chengsun has quit [Quit: Quit]
chengsun has joined #asahi-re
yrlf has quit [Quit: The Lounge - https://thelounge.chat]
yrlf has joined #asahi-re
<nicolas17> is there any public 'trace file' from m1n1, for example from the DCP tracer? (I don't have M1 hardware myself >.>)
<nicolas17> IIUC trace_dcp.py dumps raw binary data sent to the DCP mailbox and shared memory, and then a different script parses it into something readable
<nicolas17> I wanted to play with something related to that but I can't do my own trace...
pphilipss has joined #asahi-re