#
…

2022-10-27

00:00jannaurandomly while experimenting with yuv overlays in dcp.py
00:03Dcow has quit [Remote host closed the connection]
00:04Dcow has joined #asahi-gpu
00:04alyssaAh lol nice
00:04Etrien has quit [Ping timeout: 480 seconds]
00:05alyssaIs there any Linux userspace that can use YUV overlays these days? :(
00:05jannausame flag needs to be set for yuv overlays
00:08jannauwayland compositor are supposed to use them for video playback via Linux DMA-Buf protocol
00:14danielsalyssa: yeah, weston
00:31amarioguy has joined #asahi-gpu
00:32Dcow has quit [Remote host closed the connection]
00:36Dcow has joined #asahi-gpu
00:44Dcow has quit [Ping timeout: 480 seconds]
00:47Dcow has joined #asahi-gpu
00:55chadmed has joined #asahi-gpu
00:55Dcow has quit [Ping timeout: 480 seconds]
01:01phirelina: so I got mesa running under osx on my M1 Max. Seems to work just fine without your patch that hacks in the acceleration buffers
01:02phireso that might be an Ultra "two dies" only change
01:03phireI should get this running under hypervisor. I suspect those other buffers will also be absent
01:03phireTheory: However apple are sharing 3d workloads across the two dies, it might only work for compressed framebuffers?
01:09Etrien has joined #asahi-gpu
01:10alyssas/framebuffer/depth stencil/, lina's patch doesn't touch the colour attachments
01:10alyssaand that's entirely possible, there are lots of funny limitations here
01:21phireyeah, I found that weird. It was only touching depth+stencil
01:22alyssaNote that there is dedicated depth/stencil hardware (the ZLS)
01:22alyssathere is not dedicated colour buffer hardware
01:22Dcow has joined #asahi-gpu
01:22alyssathe closest equivalent is the PBE which handles image writes in general
01:22alyssabut the ZLS knows what depth buffers and stencil buffers are,
01:22alyssathe PBE just writes images
01:24Etrien__ has joined #asahi-gpu
01:29Etrien has quit [Ping timeout: 480 seconds]
01:30Dcow has quit [Ping timeout: 480 seconds]
01:33phireI guess all the depth stuff is already fixed-function anyway, due to the deferred shading nature
01:34phireZLS = Z load store?
01:34alyssaPresumably
01:49chadmed has quit [Quit: Konversation terminated!]
02:09linaphire: It "works" but it also faults sometimes. I did get frames out of it without the patch, but the hypervisor showed GPU faults.
02:09phireoh, point. I should chuck this into the hypervisor later
02:10linaKeep in mind that the depth buffer, unless the app really needs it, is only written to on TVB overflows
02:10linaAnd those go away after a few frames
02:10alyssa02:10 < lina> Keep in mind that the depth buffer, unless the app really needs it, is only written to on TVB overflows
02:10alyssalina: sorry what?
02:11linaIf the app isn't actually reading out the depth buffer there is no need to flush it out to RAM
02:11linaWith my bunny renders, the depth buffer is unwritten if I make the TVB large enough that it can render in a single pass, I only get data there if it ends up splitting due to a small TVB
02:12alyssa02:11 < lina> If the app isn't actually reading out the depth buffer there is no need to flush it out to RAM
02:12alyssaThat's an optimization that gallium/asahi isn't doing yet, though.
02:12alyssaWith current Mesa, the intention is to always flush to RAM
02:13linaIt sure is with my bunny framedumps...
02:13alyssa(yes I know that's wasteful)
02:13alyssaSo I see two possibilities
02:13alyssa1. I screwed up Mesa and this isn't working on macOS, but in that case I'd expect to see more CTS fails
02:14alyssa2. Mesa is working ok, but your driver/Python isn't setting the right control register bits to make this work
02:14linaMind you, the mesa I'm using for python testing is very outdated right now, so if you fixed this recently, that might explain it. Or I got the depth flags wrong.
02:17linaOr... hold on.
02:17phireor there are two depth buffers?
02:17linaOhhh....
02:17phirefinal output, and in-progress?
02:17linaalyssa: The depth buffer *is* written unconditionally. However, it's written uncompressed!
02:18linaSo only the intermediate flushes use the acceleration buffer!
02:18linaSo you probably found the flag to make Z uncompressed on *final store*, and I am setting that right
02:19linaBut you're still faulting on intermediate flushes, before the TVB grows in Mesa, without the metadata buffer
02:19linaAnd that's why it looks like it works
02:19linaYou just fault for a few frames iff the geometry is complex enough
02:19alyssaOh, geez
02:19LunaFoxgirlVT has joined #asahi-gpu
02:19alyssaThat seems plausible
02:20linaBut I still haven't seen this on M1, only Ultra
02:20linaSo maybe intermediate Z flushes on Ultra using compression is a new G13X thing
02:20alyssaI could believe that
02:20alyssaAlthough it does seem odd to change any of this *within* a major arch,
02:20linaIt could be a config change
02:20alyssathough maybe it's specced out for G13 but it's a model-specific feature bit
02:20linaEither global or per batch
02:20linaLet me look at what changed...
02:21phirethere were a few unks that flipped from 0 to 1
02:21linaAnd at least a couple general bitmask like things with different values
02:21alyssaThere's precedent for G13P missing capabilities that G13G has, I think)
02:21alyssaLunaFoxgirlVT: Nya!~
02:22phirehey LunaFoxgirlVT
02:22phirethough I understand apple has a habbit of just not enabling features that weren't ready in time, and never enabling them
02:23alyssaLunaFoxgirlVT: we haven't talked in a while but i wanted to let you know that my sister really likes inochi2d o:)
02:24LunaFoxgirlVTalyssa: こんこん
02:25phirebut given the Pro, Max and Ultra all have the exact same gpu name (G13X), I suspect they share features
02:26LunaFoxgirlVTalyssa: I'm in call with her right now lol
02:26alyssaLunaFoxgirlVT: ^_^
02:27alyssaphire: G13X isn't the name
02:27alyssathe X is a wildcard
02:27alyssaG13D, G13S, and i forget the other one
02:27phirereally?
02:28LunaFoxgirlVTExcited for the display port stuff to get merged some day so that I can see stuff on my mac mini conveniently lol
02:29LunaFoxgirlVTAt some point I gotta start building and releasing arm linux releases of Inochi2D =w=
02:29LunaFoxgirlVTbut it already runs on a raspberry pi 4 so it's a good start
02:29linaAlso I just realized my bunny is very, very broken with TVB overflows...
02:30phirelina: did you push your changes to m1n1 somewhere?
02:30linaNot yet
02:30linaNeed to clean it up
02:30phireyeah, figured
02:32phireI can probally check from macos if my m1 max is allocating those accleration structures
02:33linaYeah, they show up in the command buffers
02:33linaI also need to check again on the M1 Mini, since I didn't actually look there
02:33linaI just don't see them in any HV logs I have lying around
02:34phireguess that's a task for tomorrows stream
02:35alyssaI am curious, is the value of zls_control different on g13x from g13g?
02:37linaI just got there w
02:37linaSetting zls_control differently fixes the bunny on TVB overflows
02:38linaLooks like it needs 0x44 ORed in
02:38dviola has quit [Ping timeout: 480 seconds]
02:38lina(Still storing to the accel buffer either way though)
02:38alyssaOk, I definitely don't see those bits on G13G
02:39alyssa0x44 in the RGX zls_control is "zloaden | forcezstore"
02:39linaOh, I have logs with those flags in the past... but I don't recall ever taking logs on an M1 Ultra before?
02:39alyssawhich is possible but maybe unlikely
02:39linaInteresting...
02:40alyssaI think 0x44 is just the general Z compression enable
02:41alyssa02:32 < phire> I can probally check from macos if my m1 max is allocating those accleration structures
02:41linaAnd yet I still get it using the compression buffer without that
02:41alyssaphire: very curious to the answer here if you can manage to get a linear depth buffer
02:41linaIt just breaks
02:41alyssalina: \shrug/
02:41linaAlso I found logs with 0x80044 that were definitely taken on an M1...
02:41alyssathe real solution here is to r/e compression on g13g and wire that up on g13g
02:42phirelina: is that cute flag demo somewhere?
02:42linaDon't think so w
02:42lina*And* those logs don't have the compression meta buffer on G13G
02:42linaNo wait they do
02:43phireum... wat. is this just something that was always broken?
02:43linaOK, so this is related to compression... but then why is G13D enabling compression even without them, partially, then breaking?
02:44linaI see a 1:1 correlation between 0x44 and the accel/meta buffer existing
02:44phirealso, who is forcing compression on? the kernel driver, or the agx firmware?
02:44linaIn old G13G traces (that I now found - there are few of them)
02:44linaphire: Partially, even!
02:44chadmed has joined #asahi-gpu
02:45alyssa02:44 < lina> I see a 1:1 correlation between 0x44 and the accel/meta buffer existing
02:45phireseperate control over TVB overflow and final depthbuffer is a useful feature
02:45alyssaOk, that jives with what i've seen on g
02:45linaYeah, but not having 0x44 seems to break the overflow, like it stores compressed but loads uncompressed.
02:46chadmed has quit []
02:46linaActually this fits the image I'm seeing... I get lots of mini-tiles with stuff in the top left.
02:46linaThat's... exactly what you would expect of compressed data loaded as uncompressed
02:46alyssaeyes emoji
02:47linaMaybe this is an outright bug? G13X always does partial depth stores compressed?
02:47LunaFoxgirlVTdata has been squimshed (´・ω・)
02:48phireagx firmware bug? I'd be supprised if it was a hardware bug
02:48linaFirmware bug would be kind of weird... especially since it's a shared codebase
02:49phirebut hardware bug would be weirder. how would the PBE know the diffrence between a final store and a TVB flush store?
02:49phireunless... what if there is a hardware bug loading non-compressed depth/stencil buffers, and this is a workaround?
02:50linaBut then why is *store* being forced on, but not *load*?
02:51phirehmmm.... weird
02:51phirealso, this is a waste of memory, having seperate buffers for the TVB overflows and the final depth
02:52linaThey aren't separate, the extra buffer is the *metadata* buffer
02:52linaWhich is needed for compression
02:52phireso that means the buffer has the same layout when compressed?
02:53linaThe main buffer is the same, it just has compressed tiles and the metadata buffer tells it how they were compressed.
02:53linaThe metadata buffer has one byte per 8x4 pixel block in the main buffer
02:53linaThis is pretty typical framebuffer compression stuff
02:53phireah, makes sense. so you can fallback to uncompressed if compression fails to produce a smaller result
02:54linaYes, exactly
02:54linaYou always need more space any time you use compression, by definition
02:54alyssaNow I want to know what macOS on m1 ultra does with the "do not compress depth" magic with metal
02:54linaFB compression isn't about size, it's about bandwidth, so the buffers are actually slightly larger (extra meta)
02:54alyssaI honestly can't remember how I got it do that
02:54phireand framebuffer compresion *only* cares about reducing memory bandwidth, not buffer size
02:54alyssasomething about rendering to a texture with usage Unknown and allowGPU = false
02:55linaWhat's a good macOS app to exercise the depth buffer? I just did boot->safari->youtube and there isn't a single render with depth...
02:55linaSome random webGL demo?
02:56* linaopens up WebGL Aquarium
02:59linadepth_flags = 0x5000000000c4154
02:59linaWhat the heck. Well, that's a new one.
03:00linaI see the stencil aux buffers too, so this was good to name those fields...
03:01linaalyssa: Remember how there is more than one depth buffer?
03:02linadepth_buffer_ptr1 = 0x1501c68000
03:02linadepth_buffer_ptr2 = 0x1501750000
03:02linadepth_buffer_ptr3 = 0x1501c68000
03:02linaNow I wonder if this for separate buffers for load/partial/store
03:02linaAnd then similarly the meta buffers are separate
03:03linaSince some could be compressed and not others
03:03phirethat's what I was already wondering. though why is it so keen to avoid writing to the store buffer until the end?
03:03phireoh... multisample resolve?
03:04linaIt makes sense to compress the intermediate buffers but not the final ones if the app needs it for some reason
03:04linaAnd I guess under some conditions maybe you can't guarantee that the final buffer is "safe"? Like, the GPU can't trust it to read back during an internal reload?
03:04linaSo you'd want to use a separate buffer from the user-provided buffer in that case
03:04phireyes, but if you are doing that, might as well use the same buffer for both partial and store. It's only if the final store buffer has a diffrent layout for some reason that you need seperate buffers
03:05phiresafe? that's very paranoid. but I guess
03:05linaYeah, so maybe if the app provides a custom layout Z buffer it can't use compression, and then you need a separate buffer for internal
03:05phirewait, these are all supplied from userspace, so app has control over the partial anyway
03:05linaMetal does
03:05linaApps, not so much
03:06phireif apple think Metal is a safety boundary....
03:07chadmed has joined #asahi-gpu
03:08linaI mean, none of this matters for safety
03:08linaIf it's wrong the GPU will just fault
03:08lina(Fault handling being terrible is a separate issue)
03:09phireI just really doubt paranoia is the justification. diffrent buffer layouts (store also resolving MSAA being the best example) is a much better reason
03:10alyssa03:02 < lina> Now I wonder if this for separate buffers for load/partial/store
03:10alyssalina: Yes, that's it
03:10alyssaI thought I noted that down somewhere
03:10linaCome to think of it... I think aquarium is doing AA?
03:11linaMaybe not? Hard to tell with my cursed capture card
03:11phirecould the ultra have forced MSAA on for some reason?
03:11linaWait, does MSAA also need multiple samples in the depth buffer, or only color?
03:11phireyes, multiple depth samples
03:12linaOK, then it makes sense that it would have separate buffers
03:12alyssai should sleep
03:12linaAnd then those extra mystery zls_control flags are probably related...
03:12phiredepth-test and triangle edeges are per sample. color is duplicated over all samples (masked by depth/stencil/rasteriation)
03:12linaalyssa: You should...
03:13phirecya alyssa
03:13alyssalina: ohhh that's an excellent point
03:13alyssaEXT_ms_rtt
03:13alyssathat means multiple samples in the tilebuffer but only one in memory
03:14alyssawhich means 4x larger temp buffers for tvb overflow
03:14alyssaI'm curious if Apple does page fault tricks to get away without wasting that memory in the happy path
03:14linaNo chance of that
03:14linaThey don't have any kind of reasonable fault handling
03:15linaThere is an IRQ line that goes high on faults, but the firmware has a 250us timeout or something like that, so there's no way that would be reliable
03:21linaI guess tomorrow I should poke around those flags a bit and see what I find...
03:22phireeven when not using the EXT_ms_rtt extention, that's still something a smart opengl implemenation can infer from the commands and optimise in.
03:23phireI have no idea how smart apple's opengl implementation is, and I assume it's all very explict in metal
03:23alyssaphire: no it's not?
03:23alyssabut yes metal builds in something like ms_rtt so safari should be using it fine
03:26phire"no it's not?" actually, you might be right. opengl makes it near impossible to tell the unresolved MSAA buffer won't be used again later
03:34chadmed has quit [Quit: Konversation terminated!]
03:59ella-0_ has joined #asahi-gpu
04:03ella-0 has quit [Read error: Connection reset by peer]
04:08Etrien__ has quit [Read error: Connection reset by peer]
04:08Etrien has joined #asahi-gpu
04:21Etrien has quit [Ping timeout: 480 seconds]
04:28ckileeeeeeeeeeeeeeeeeeeeeeetb^ has joined #asahi-gpu
04:31SSJ_GZ has joined #asahi-gpu
04:32chadmed has joined #asahi-gpu
04:53Etrien has joined #asahi-gpu
04:53chadmed has quit [Quit: Konversation terminated!]
04:56chadmed has joined #asahi-gpu
05:00phirem1 max seems to just set all those accleration pointers as soon as the depth buffer is enabled
05:43Etrien has quit [Read error: No route to host]
05:48Etrien has joined #asahi-gpu
06:00chadmed has quit [Quit: Konversation terminated!]
06:09LunaFoxgirlVT has quit [Read error: Connection reset by peer]
06:16Etrien has quit [Ping timeout: 480 seconds]
06:25Etrien has joined #asahi-gpu
06:36Etrien has quit [Read error: Connection reset by peer]
06:37Etrien has joined #asahi-gpu
06:39will[m] has quit [Write error: connection closed]
07:35ckileeeeeeeeeeeeeeeeeeeeeeetb^ has quit [Remote host closed the connection]
07:58Etrien__ has joined #asahi-gpu
08:05Etrien has quit [Ping timeout: 480 seconds]
08:06Etrien has joined #asahi-gpu
08:11Etrien__ has quit [Ping timeout: 480 seconds]
08:54le0n_ has joined #asahi-gpu
08:54cr1901 has quit [Read error: Connection reset by peer]
09:01le0n has quit [Ping timeout: 480 seconds]
09:06chadmed has joined #asahi-gpu
10:10chadmed has quit [Quit: Konversation terminated!]
10:46r0ni has joined #asahi-gpu
11:19Dcow has joined #asahi-gpu
11:21Dcow_ has joined #asahi-gpu
11:27Dcow has quit [Ping timeout: 480 seconds]
11:54r0ni has quit [Quit: Textual IRC Client: www.textualapp.com]
12:06sneak has joined #asahi-gpu
12:38cr1901 has joined #asahi-gpu
12:47Dcow has joined #asahi-gpu
12:53Dcow_ has quit [Ping timeout: 480 seconds]
13:05yamii has quit [Remote host closed the connection]
13:06yamii has joined #asahi-gpu
13:42sneak has quit [Quit: ZNC 1.7.5 - https://znc.in]
13:45alyssalina: "maybe figure out how to do FP math in the kernel"
13:45sneak has joined #asahi-gpu
13:45alyssasounds fun ;-)
13:45* alyssatrusts your Rust code to get it right more than any of the kernel C code doing FP math
14:07mrkajetanp has joined #asahi-gpu
14:11mrkajetanp has quit [Remote host closed the connection]
14:35Gaspare has joined #asahi-gpu
15:10mkurz has joined #asahi-gpu
15:23mkurz has quit [Quit: Leaving]
16:23Gaspare has quit [Quit: Gaspare]
16:59Dcow_ has joined #asahi-gpu
17:06Dcow has quit [Ping timeout: 480 seconds]
17:17alyssa has quit [Quit: leaving]
17:34Gaspare has joined #asahi-gpu
17:34balrog_ has quit []
17:35balrog has joined #asahi-gpu
18:35cy8aer has quit [Remote host closed the connection]
18:35cy8aer has joined #asahi-gpu
19:03r0ni has joined #asahi-gpu
19:47Dcow has joined #asahi-gpu
19:54Dcow_ has quit [Ping timeout: 480 seconds]
20:56uur has joined #asahi-gpu
21:06uur has quit []
21:09Etrien__ has joined #asahi-gpu
21:12ella-0_ is now known as ella-0
21:13Etrien has quit [Ping timeout: 480 seconds]
21:20DarkShadow44 has quit [Quit: ZNC - https://znc.in]
21:20DarkShadow44 has joined #asahi-gpu
21:24DarkShadow4444 has joined #asahi-gpu
21:25DarkShadow4444 has quit []
21:27DarkShadow4444 has joined #asahi-gpu
21:27Etrien__ has quit [Read error: Connection reset by peer]
21:27Etrien has joined #asahi-gpu
21:30DarkShadow44 has quit [Ping timeout: 480 seconds]
21:38uur has joined #asahi-gpu
21:44phireI said this on Twitter but I'll repeat it here:
21:44phireSurely there is a way to (safely) prevent reordering; compiler Instruction reordering barrier?
21:44phireasm volitile("" ::: "memory") // for c
21:44phirestd::sync:: atomic::compiler_fence() // for rust
21:45phireThough, I do really like the "let's just do soft float" solution. People are too scared of soft float
21:52uur has quit [Remote host closed the connection]
21:54Etrien has quit [Ping timeout: 480 seconds]
21:54phireThe preformance isn't even that bad (when you inline it and avoid unpacking/packing into the proper ieee754 format)
21:57SSJ_GZ has quit [Ping timeout: 480 seconds]
21:59phireLina: consider using a soft float working format of 64bit, sign in bit63, 8/16 bits of exponent at bit 32+, and 32bits of signficand in bits 0-31
22:02phireWould allow you pass it around (and even compare) as if it was a 64bit int, but then the compiler can quickly unpack it into it's components just by just treating it as two 32bit ints
22:16Gaspare has quit [Ping timeout: 480 seconds]
22:17Etrien has joined #asahi-gpu
22:54Etrien__ has joined #asahi-gpu
22:58Etrien has quit [Ping timeout: 480 seconds]
…