#asahi-gpu · 2022-10-02 14:09
linaIn this case the kernel fills command buffers because Apple decided to architect their firmware such that those command buffers have to be trusted.#asahi-gpu · 2022-10-02 14:09
karolherbstand it's more like filling actual structs with data do describe jobs, is that correct?#asahi-gpu · 2022-10-02 14:08
linaIn this case we've been learning that some of those fields correspond directly to hardware registers (some of them fully or partially match PowerVR registers...), and since that ABI is dictated by hardware and therefore fixed, it's safe to expose to userspace directly.#asahi-gpu · 2022-10-02 14:08
karolherbstmhhh, normally I'd expect that userpace just fills command buffers, sends that to the kernel driver and that's it. But it kind of sounds like that doesn't really exists here?#asahi-gpu · 2022-10-02 14:08
linaIt's just that we're still figuring out what fields of the corresponding giant firmware render structures actually need to be exposed to userspace and which don't.#asahi-gpu · 2022-10-02 14:07
linaThey'd just be fields in the render struct. It's job data like everything else already there.#asahi-gpu · 2022-10-02 13:58
karolherbstwhat are those registers GL needs btw? Do you have some other ways of accessing that besides adding ioctls? Or is that mostly in the "context initialization" area?#asahi-gpu · 2022-10-02 13:41
alyssalina: also assuming the panfrost code is correct... brave#asahi-gpu · 2022-10-02 13:41
alyssagiggle#asahi-gpu · 2022-10-02 13:35
linaI don't know what I'm doing with mesa anyway, I just copied and pasted bits of Panfrost code so I'm not surprised it's broken... ^^;;;#asahi-gpu · 2022-10-02 12:59
svenCode review via irc? :D#asahi-gpu · 2022-10-02 12:48
alyssathe modifiers thing is the most fundamental breakage here but yeah#asahi-gpu · 2022-10-02 12:47
alyssa---#asahi-gpu · 2022-10-02 12:46
alyssathough I don't think that last part will actually matter because winsys will be NULL on linux#asahi-gpu · 2022-10-02 12:40
alyssathis should only be for DISPLAY_TARGET, it can and will break for SCANOUT and SHARED which can't go through the displaytarget path#asahi-gpu · 2022-10-02 12:40
alyssahttps://gitlab.freedesktop.org/asahilina/mesa/-/blob/omg-it-works/src/gallium/drivers/asahi/agx_pipe.c#L277#asahi-gpu · 2022-10-02 12:39
alyssa(DISPLAY_TARGET is mostly for software rasterizers but we can't delete it because reasons, SCANOUT is for buffers shared with the display/dcp, SHARED is for buffers shared across processes like window surfaces, LINEAR is an old hack that won't die)#asahi-gpu · 2022-10-02 12:38
alyssafor PIPE_BIND_SHARED, we can and should twiddle#asahi-gpu · 2022-10-02 12:38
alyssa!(pres->base.bind & (PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SCANOUT | PIPE_BIND_LINEAR))#asahi-gpu · 2022-10-02 12:37
alyssaagx_twiddled_allowed should then have#asahi-gpu · 2022-10-02 12:37
alyssathis if-stmt is way too late#asahi-gpu · 2022-10-02 12:37
alyssahttps://gitlab.freedesktop.org/asahilina/mesa/-/blob/omg-it-works/src/gallium/drivers/asahi/agx_pipe.c#L277#asahi-gpu · 2022-10-02 12:36
alyssathe second case is when the CLIENT selects the modifier, in which case we have to pick from that set conditional on those allowed checks#asahi-gpu · 2022-10-02 12:36
alyssaagx_twiddled_allowed || modifer != TWIDDLED#asahi-gpu · 2022-10-02 12:36
alyssaagx_linear_allowed || modifer != LINEAR#asahi-gpu · 2022-10-02 12:36
alyssaand at the end can assert#asahi-gpu · 2022-10-02 12:36
alyssathe first is when WE select the modifier, in which case it's just the logic without the for loop on top#asahi-gpu · 2022-10-02 12:35
alyssaand then there are two distinct cases#asahi-gpu · 2022-10-02 12:35
alyssaok i guess the second function isn't needed#asahi-gpu · 2022-10-02 12:35
alyssa}#asahi-gpu · 2022-10-02 12:35
alyssa return true;#asahi-gpu · 2022-10-02 12:35
alyssabool agx_twiddled_allowed(const struct agx_resource *pres) {#asahi-gpu · 2022-10-02 12:35
alyssa}#asahi-gpu · 2022-10-02 12:35
alyssa return pres->base.target == PIPE_BUFFER || agx_is_2d(pres->base.target);#asahi-gpu · 2022-10-02 12:34
alyssabool agx_linear_allowed(const struct agx_resource *pres) {#asahi-gpu · 2022-10-02 12:34
alyssaneed to split out 2 functions:#asahi-gpu · 2022-10-02 12:34
alyssathis loop is fundamentally bogus and will return modifiers that aren't actually valid#asahi-gpu · 2022-10-02 12:33
alyssahttps://gitlab.freedesktop.org/asahilina/mesa/-/blob/omg-it-works/src/gallium/drivers/asahi/agx_pipe.c#L277#asahi-gpu · 2022-10-02 12:32
alyssamissing assert(level == 0) here#asahi-gpu · 2022-10-02 12:32
alyssahttps://gitlab.freedesktop.org/asahilina/mesa/-/blob/omg-it-works/src/gallium/drivers/asahi/agx_pipe.c#L256#asahi-gpu · 2022-10-02 12:32
alyssaalso seemingly missing "handle->size = rsrc->layout.size_B;"#asahi-gpu · 2022-10-02 12:30
alyssa(I think no because you can't share depth/stencil targets across process boundaries so we should be ok)#asahi-gpu · 2022-10-02 12:30
alyssaor maybe "handle->format = rsrc->base.format;" ... would need to think for a bit to figure out whether the difference matters#asahi-gpu · 2022-10-02 12:30
alyssaalso seemingly missing "handle->format = rsrc->layout.format;" there#asahi-gpu · 2022-10-02 12:29
alyssathis depends on (handle->layer == 0)#asahi-gpu · 2022-10-02 12:28
alyssahttps://gitlab.freedesktop.org/asahilina/mesa/-/blob/omg-it-works/src/gallium/drivers/asahi/agx_pipe.c#L231#asahi-gpu · 2022-10-02 12:26
alyssaI don't think it's uncommon, I'd just like to know if that's causing people's problems ;)#asahi-gpu · 2022-10-02 12:26
danielsalyssa: it’s actually less uncommon than you might think - or was at least#asahi-gpu · 2022-10-02 12:24
alyssafor debug I would "assert(whandle->offset == 0);" there to see if that's causing any issue#asahi-gpu · 2022-10-02 12:24
alyssathis is wrong