#asahi-re · 2022-04-06 14:05
kameksone last thing, I saw documentation about the GPU shader assembly, but I didn't find much documentation about the driver itself (how packets are encoded, descriptors, texture tiling and so on). Maybe I could start reading the mesa driver and improve the documentation to familiarize myself if that's useful#asahi-re · 2022-04-06 13:52
kamekswell, thank you very much for your time and advices#asahi-re · 2022-04-06 13:51
kameksfair enough. I guess it also better belong to gpu channel too. Sorry I drifted the conversation a lot#asahi-re · 2022-04-06 13:51
kamekshmmm, what kind of areas are still foggy?#asahi-re · 2022-04-06 13:49
kameks(yup, this is what I read from Alyssa's blog posts)#asahi-re · 2022-04-06 13:48
kamekswhat about Vulkan, do you need help there?#asahi-re · 2022-04-06 13:48
kameksis there still stuff I can help with?#asahi-re · 2022-04-06 13:47
kamekshow much work is left to do on the linux driver?#asahi-re · 2022-04-06 13:47
kamekswell, you have a perfect point about it being impossible to do on macos#asahi-re · 2022-04-06 13:47
kameksthat makes sense#asahi-re · 2022-04-06 13:46
kameksso during boot, you upload the firmware? or somehow you have the guarantee that it will not be impacted by macos#asahi-re · 2022-04-06 13:46
kameksah, I see#asahi-re · 2022-04-06 13:45
kamekseg, you update macos, and now you can't dual boot linux anymore#asahi-re · 2022-04-06 13:45
kameksis that a problem for linux too?#asahi-re · 2022-04-06 13:45
kameksso a macos could also update the GPU side firmware and break the ABI ?#asahi-re · 2022-04-06 13:44
kameksby firmware, you mean the GPU ioctls ?#asahi-re · 2022-04-06 13:42
kameksI see. so the only way on mac is to completely replace the kernel driver and reimplement metal as well (assuming it is possible)#asahi-re · 2022-04-06 13:39
kamekshow did go solve it? did they just stopped using those syscalls?#asahi-re · 2022-04-06 13:37
kameksyou have a point#asahi-re · 2022-04-06 13:36
kameks;-(#asahi-re · 2022-04-06 13:35
kameksok, got it#asahi-re · 2022-04-06 13:34
kameksyes, that's the case#asahi-re · 2022-04-06 13:34
kamekswell I think the 360 was exploited because the GPU could write any address, including kernel#asahi-re · 2022-04-06 13:33
kameksright, but the mapping still go through the OS, you can't just randomly change permission for kernel owned pages#asahi-re · 2022-04-06 13:32
kamekson console as well, we ask the kernel for GPU map. some of them have unified memory space, some of them don't. but the kernel still keeps proper permission to avoid privilege escalation using the GPU#asahi-re · 2022-04-06 13:31
kameksyup, I mean, have it in a user accessible API, not driver internal#asahi-re · 2022-04-06 13:26
kameksabout RE, I've read it and I fully agree to follow the practices#asahi-re · 2022-04-06 13:25
kameksideally, my stuff would also run on a stock macos#asahi-re · 2022-04-06 13:24
kameksWhat'd like to have/do is a user-space driver, that ideally also run on mac. So I wouldn't be responsible for page allocation and protection or the ring buffer. But mostly raw command encoding, helpers to tile textures, find memory footprints (where to put mips) and so on. If that's more or less already what the kernel is doing, that's all the better#asahi-re · 2022-04-06 13:02
kamekson M1 GPU, the command buffer still reside in kernel space?#asahi-re · 2022-04-06 13:01
kameksbut even if the platform were to not support a high level API such as Vulkan, we could implement it ourselves if we had the time for it. we got all the tools#asahi-re · 2022-04-06 12:59
kameksthe only drawback is that it's not portable at all#asahi-re · 2022-04-06 12:58
kameksthe only things which are going into kernel is initializing the GPU, opening the video port, and command submission. The rest is just memory we allocate on our own heap, and we fill with the help of low level functions#asahi-re · 2022-04-06 12:55
kameksa texture descriptor is just a raw struct where we put pointers and properties, we don't have to register and destroy them with the driver#asahi-re · 2022-04-06 12:54
kameksthe recording of commands is fully user-space#asahi-re · 2022-04-06 12:54
kameksonly the submission is talking to the kernel#asahi-re · 2022-04-06 12:53
kamekson console API, a command buffer is a void*. we create a command encoder, give it a range of preallocated memory, and a callback for when it runs out of memory. The encode writes command to the memory we control as we go. We are then responsible to submit all the buffers at once.#asahi-re · 2022-04-06 12:51
kameksdo you have to talk to the kernel for every single command you record ?#asahi-re · 2022-04-06 12:49
kameksno black magic, that's very low level#asahi-re · 2022-04-06 12:49
kameksbut the driver is just going to format it into a command packet#asahi-re · 2022-04-06 12:49
kameksand give the pointer to the "driver"#asahi-re · 2022-04-06 12:48
kameksbasically, we allocate memory, map it for GPU access, and memcopy precompiled shader code#asahi-re · 2022-04-06 12:47
kameksOn these consoles, they also have a higher level API, built on top of the low level API. That higher level API is fully open source (to licensed developers), and it is a bliss to work with something with no hidden pieces#asahi-re · 2022-04-06 12:45
kameksI read Alyssa's blog posts about GPU RE, I'm not sure what's the exact status as of today. What I'd like to do is write a raw-level API for M1 GPU, similar to what we have on certain game consoles#asahi-re · 2022-04-06 12:40
kameks"unless youre outright copying code and implementations" -> that's copyright infringement, so yeah, definitely not okay#asahi-re · 2022-04-06 12:37
kameks"i mean idk why anyone would take apple to court over losing access to an apple id" -> Epic did, but that's a whole other story, and Apple will fight tooth and nails for iOS#asahi-re · 2022-04-06 12:36
kameksit's really about do you think apple cares or not so much as long as we don't do anything harmful to their IP#asahi-re · 2022-04-06 12:35
kameksto be clear, I don't want to get involved with a lawsuit with Apple. Even if I have a case, I don't have time, money and courage to fight one of the biggest corporate#asahi-re · 2022-04-06 12:12
kameksis there stance something like "we don't want to help linux run, we don't want to publish our internal documentations because it also contains trade secrets and we don't want to spend time for a shippable documentation. but if people are going to do the work for us for free, sure why not?" or do you think I really risk being kicked out of the access to iOS SDK and should refrain from participating?#asahi-re · 2022-04-06 12:09
kamekseven if they won't help, because they don't want to spend resources, and want macos to be the os of choice