00:00zmike: I never disabled for zink
00:00zmike: crashes just make my users stronger
00:00zmike: user*
00:03kisak: zmike: that didn't work out too well last time https://www.youtube.com/watch?v=mYSSmZVYTkE (movie clip)
00:03Sachiel: safety critical zink when?
00:04HdkR: OpenGL through Vulkan SC
00:04zmike: I imagine it more like https://youtu.be/wuTcctu_DfM?t=32
00:06alyssa: Sachiel: anglesc? :p
00:06Sachiel: alyssa: rounded-angle
00:13alyssa: do we have any test coverage for clip distance enable masks?
00:13alyssa: the desktop gl kind
00:14zmike:handwaves at piglit
00:14alyssa: do we have piglits for it though
00:16alyssa: like that would fail if you didn't respect the mask
00:19zmike:handwaves
00:19alyssa: helpful
00:20alyssa: thanks
00:20zmike: there's a lot of clipdist testing
00:20zmike: glcts gtf has a bunch too
00:20alyssa: gtf oh
00:20alyssa: :p
00:20zmike: 😬
00:21alyssa: i love how extensivelt documented NIR_COMPACT_ARRAYS is ...
00:22gfxstrand: Oh, clipdist...
00:29alyssa: why did we put that in vulkan again
00:52alyssa: meh, this is easier than making lower_clip_fs work with lowered I/O
00:52alyssa: and with this + late lower_blend + late lower_tex_replace, I can finally preprocess at CSO create time
00:52alyssa: well
00:52alyssa: "finally" as if I haven't been shipping that downstream for months :p
00:52HdkR: \o/
00:57alyssa: i still can't tell how any of this is supposed to work
01:01alyssa: what does this CAP do?!
01:01alyssa: Seemingly spirv-to-nir always produces clip_dist0
01:02alyssa: with compact=true
01:04alyssa: and then the vk runtime calls nir_lower_clip_cull_distance_arrays which again gets us the compact thing
01:06alyssa: so... seemingly CLIP_DIST1 can't ever happen with vulkan, or with gl if NIR_COMPACT_ARRAYS is set
01:07alyssa: so... why do ir3/zink/etc handle it..
01:08zmike: can get some weird things happening when xfb is involved there
01:10jenatali: alyssa: With clip + cull, you can get a second var with location of clip1, or a fractional loc within clip0/1
01:11mareko: alyssa: yes
01:22alyssa: jenatali: hm. I don't really know anything about cull distances.
01:23jenatali: IIRC clip distance can partially clip primitives, where cull distances only apply if all vertices fail the distance test
01:23alyssa: tbh tempted to say this is "good enough" and revisit later if needed..
01:23alyssa: "fs-clip-distance-interpolated.shader_test" does seem unhappy though
01:23jenatali: There's a separate info bit to indicate how many of them are supposed to be clip
01:25alyssa: i see
01:25alyssa: well, I don't have cull distances in my hardware
01:25alyssa: and don't advertise ARB_cull_distance, so
01:26alyssa: GL4.5 grumble
01:27alyssa: why we did we make this core
01:29alyssa: Is this even possible to lower...
01:31alyssa: not good.
01:31mareko: because directx
01:32alyssa: evidently
01:32mareko: it's possible to lower on AMD or if you have GS
01:32alyssa: hm, yeah, I see how you would do it with a GS
01:36alyssa: ok, yeah, this can be lowered with excessive cost. meh
01:37alyssa: or... do we actually need to cull in the geometry processing stage?
01:37alyssa: could we instead just discard every fragment in the primitive?
01:37alyssa: obviously that's not efficient but it's better than what the GS-lite approach would need
01:38alyssa: i'm suspicious that NV_fragment_shader_barycentric might be possible on AGX, unsure
01:39HdkR: Everyone loves exposed barycentrics. Unless they aren't stable :)
01:43mareko: using discard disables early Z
01:44jenatali: Unless you force enable it
01:45alyssa: mareko: least of my worries right now
02:14alyssa: hmmm I wonder how my hardware interpolates NaN varyings
02:25alyssa: seemingly the whole triangle lights up if there's just one NaN varying and the rest 0
02:26alyssa:isn't sure what's happening
02:51alyssa: piglit: error: Failed to create waffle_context for OpenGL ES 4.0 Context
02:51alyssa: ummm
02:57alyssa: inexplicably AGX has decided that the interpolation of NaN, 0, and 0 is 0x7f7fffff
02:57alyssa: which is extremely large but finite
02:58alyssa: whatever, I can work with this
03:02alyssa: woahh infinity is different
03:03alyssa: I assume I'm hitting all kinds of hardware undefined behaviour lol
03:03alyssa: ahahaha no
03:03alyssa: 0x7f7fffff is the maximum representible *finite* single precision float
03:05alyssa: so it's carrying the NaN through and clamping to finite at the end, seemingly
03:05alyssa: I can work with this!!
03:05jenatali: O.o
03:06gfxstrand: tarceri_: I'll try to get back to copy-prop-vars on Monday. I've had a lot going on this week.
03:06alyssa: jenatali: No this is great
03:07alyssa: jenatali: So here's what I'm going to do :3
03:07gfxstrand: alyssa: What vile magic are you attempting?
03:07alyssa: gfxstrand: gl_CullDistance lowering
03:07alyssa: on hardware with no cull distances, no geometry shaders, and no NV_fragment_shader_barycentric
03:08gfxstrand: Oh
03:08gfxstrand: This is gonna be entertaining
03:08alyssa: gfxstrand: faith you're gonna love this
03:08gfxstrand: :D
03:08alyssa: so, the relevant spec text is
03:08alyssa: > Primitives whose vertices all have a negative clip distance for plane i will be discarded.
03:08alyssa: Culling happens after XFB (I think) so this can be validly implemented by discarding every pixel inside the primitive
03:09alyssa: So conceptually we just need to insert at the beginning of the fragment shader
03:09alyssa: if (cull_distance[0] < 0 && cull_distance[1] < 0 && cull_distance[2] < 0) discard;
03:10alyssa: The problem is that we don't have access to the cull distance varying at each vertex, we only have it at the provoking vertex (if flat) or we have the interpolation of them (if smooth)
03:11alyssa: Maybe interpolation is ok? Like, if the interpolated value is negative, that implies all 3 distances are negative so we discard, right?
03:11alyssa: True, but..
03:11alyssa: the converse fails
03:11alyssa: er
03:11alyssa: no that's the thing that fails
03:11alyssa: The converse is true, that's false
03:12alyssa: If the distances are (-1, -1, 1) then any pixel along the edge between -1 and -1 will have an interpolated value of -1 regardless of how positive the 1 is
03:12alyssa: So we're out of luck.... or are we?
03:12alyssa: Recall how varying interpolation works mathemtically, it's something of the form
03:12tarceri: gfxstrand: sure no problem. I'm just about to push the changes you suggested. Thanks!
03:13alyssa: (value_0 * coefficient_0) + (value_1 * coefficient_1) + (value_2 * coefficient_2)
03:13alyssa: now, if that interpolation happens with IEEE 754 arithmetic, a very interesting property emerges
03:13alyssa: if *any* vertex's value is NaN, then the interpolated value *everywhere on the primitive* is NaN
03:14alyssa: even if we have (0, 0, NaN), the values along the shared 0/0 edge will *still* be NaN because NaN * 0 = NaN and NaN + 0 = NaN and the NaN poisons the whole primitive
03:14alyssa: but that's exactly what we needed!
03:15alyssa: With that property, we now have a way to check for any pixel whether a boolean condition is true for any vertex
03:15alyssa: or by De Morgan's, whether a boolean condition is true for all vertices
03:15alyssa: So here's what we're gonna do
03:16alyssa: In the vertex shader, `gl_CullDistance = dist` is going to become instead `lowered_value = (dist >= 0.0) ? NaN : 0.0`
03:16alyssa: with `out highp float lowered_value`
03:16alyssa: then in the fragment shader, we're going to insert a prolog
03:16alyssa: `if (lowered_value == 0.0) discard;`
03:17alyssa: To check that this works: if all cull distances are negative, then all lowered values will be 0.0 so every pixel in the primitive will interpolate 0.0 so every pixel will in the primitive will be discarded
03:18alyssa: otherwise, some lowered value will be NaN so every pixel in the primitive will interpolate NaN so no pixel will be discard
03:18alyssa: One wrinkle... at least on the M1, varying interpolation *doesn't* happen with IEEE 754 arithmetic
03:18gfxstrand: I wonder if you could short-cut the discard bit and just do if (gl_cullDist < 0) gl_FragCoord.x = NaN
03:19gfxstrand: Or .w or something
03:19alyssa: in the VS or the FS?
03:19gfxstrand: in the VS
03:19alyssa: no, that won't work
03:19gfxstrand: And hope the clipper freaks and tosses the whole thing
03:19alyssa: because it's an AND not an OR
03:20gfxstrand: Oh
03:20gfxstrand: Well that's dumb
03:20gfxstrand: But ok
03:20alyssa: if you're drawing triangle strips or something, you can have a vertex whose negative value contributes to culling in one primitive but not the other
03:20gfxstrand: sure
03:20gfxstrand: Makes sense, I guess
03:20alyssa: so no pure VS lowering is possible unless you unroll everything
03:20gfxstrand: :(
03:20alyssa: 03:19 < gfxstrand> And hope the clipper freaks
03:20alyssa: it's too busy freaking from when I ran t-rex this morning
03:24gfxstrand: Yeah, TRex is mean to clippers
03:28alyssa: there are some annoying details about making that scheme work with separate shaders
03:28alyssa: (for GL it doesn't matter. for Vulkan monolithic it doesn't either. Might screw over GPL fast link.)
03:33gfxstrand: Eh, it can be made to work, I think.
03:33gfxstrand: Just need to push a mask into the shader or something
03:35alyssa: more thinking about how to link the internal extra varyings
03:35alyssa: definitely can be made to work, just unsure whether it would slow down everything separable to be conservative about it
04:26alyssa: meanwhile on gl_ClipDistance
04:26alyssa: I need nir_lower_clip_disable, but that is in itself an early pass that I need to do a late version of for this
04:27alyssa: ....and I have decent evidence that AGX can't interpolate gl_ClipDistance so the varyings need to be duplicated anyway
04:28alyssa: so maybe I want to punt on this and figure out if I can make lower_clip_fs happen late and revisit this come Vulkan
06:29RAOF: Hm. Would anyone object to me making it possible to add drirc.d directories from an environment variable?
06:29RAOF: It would be convenient, and it looks like it might allow removing some cludges added to support tests?
06:43mupuf: RAOF: no objections from me, provided we find a way to make it unsurprising. Were you thinking about purely adding, or overriding the default one?
06:47RAOF: 🤷♀️
06:47RAOF: Purely adding would be sufficient for my purpose, but if replacing was preferred I could certainly do that.
06:49mupuf: I would go for whichever would be least surprising... which may be the override one or may not
06:49mupuf: were you planning on a coma-separated list of directories?
06:49RAOF: Following the vulkan loader, something like a colon-delimited MESA_ADD_DRIRC_PATH would be my first thought.
06:50mupuf: well, at least, it wouldn't be surprising :)
06:52RAOF: I guess the most surprising behaviour would be how combining multiple settings would be handled.
06:54RAOF: Although that's not a novel problem, since drirc.d already aggregates multiple configs.
11:17X512: Is it possible to link libnir as shared library?
11:20tomeu: X512: it could be possible, but if you can extend on your use case, maybe somebody can give some opinions on whether that would be a good idea
11:20X512: It looks wasteful to duplicate libnir to each driver.
11:22tomeu: ah, drivers should be all together in a single .so
11:22tomeu: so no waste
11:27X512: Not for Gallium and Vulkan drivers.
11:29lynxeye: X512: not sure about vulkan, but gallium drivers are megadrivers, where all the drivers are linked into a single .so and the different names are just hardlinks
11:35danvet: mairacanal, for the rust bindings also chat with lina
11:36danvet: even right lina, yay
11:37X512: Rust bindings for internal Mesa API (Gallium etc.)?
11:37X512: Internal API seems often change.
11:46MrCooper: lynxeye: I think X512's point was that libnir is still duplicated between the Gallium mega-driver and Vulkan drivers at least
12:20melissawen: Is there any dependency between degamma and ctm atomic color properties on the DRM side? I mean, if the driver doesn't advertise degamma, it can still advertise CTM and gamma properties independently, right?
12:57mairacanal: danvet, I was checking lina 's DRM bindings which are looking pretty neat btw, but I currently I'm thinking mostly on the dma-buf bindings as they are a crucial part of vgem
13:19emersion: melissawen: AFAIK yes
13:19emersion: would be the same as DEGAMMA = null (zero object ID)
13:30melissawen: emersion, thanks for confirming. I've also double-checked with drm_info that the property keeps there, so I suspect there is a dependency between these properties in the userspace case.
13:31emersion: you mean some user-space expects these two to be supported together, or not at all?
13:31emersion: sounds like a user-space bug indeed
13:41melissawen: yeah, I suspect the userspace expects degamma support to advertise CTM, since I don't find any dependency on the kernel side.
16:50alyssa: off by one in user-clip-all-planes hmm
16:51alyssa: maybe buggy test, it's failing on a lot of drivers
16:52alyssa: including radeonsi, the reference driver :p
16:52alyssa: freedreno-a420-fails.txt says
16:52alyssa: # The clipped polygon is off-by-one pixel from the directly drawn one
16:52alyssa: spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
16:53alyssa: which is what I'm seeing too
16:54alyssa: wonder if it's a test bug with float math or something, idk
17:00jenatali: I think we pass it
17:10alyssa: yeah, it passes with hw clip distance interpolation, just not nir_lower_clip_fs
19:24danvet: mairacanal, I also wonder whether we should look into the drm_exec stuff that's floating around
19:24danvet: otoh vgem doesn't really need that
19:25danvet: for dma-buf bindings there's also the question of whether we need ww_mutex bindings first, or just wrap that all as a dma-buf implementation detail
19:32mairacanal: danvet, afaik we need the ww_mutex bindings first to make the safe abstraction for dma-buf, just like semaphores, rw_semaphore and other sync objects
19:41danvet: mairacanal, btw are you in the rust-for-linux zulip, or need an invite?
19:42danvet: I quickly discussed the ww_mutex binding stuff with the rust folks this week, if you want I think would be good if you also join
19:42danvet: there's also some sync meeting on gpu rust upstreaming in 2 weeks again
19:49mairacanal: danvet, yeah, I'm in zulip, I will try to take a look at the ww_mutex discussion. do you remember in which stream happened this discussion?
19:49DemiMarie: Any plans to deal with the "sleeping in atomic context causes UaF" unsoundness?
19:50DemiMarie: alyssa: mind if I DM you?
19:50alyssa: DemiMarie: about?
19:50alyssa: also, do I know you?
19:51alyssa: irc logs indicate yes
19:51DemiMarie: GuC stuff
19:52alyssa: I don't work on that hardware
19:52alyssa: try #intel-gfx
19:56danvet: DemiMarie, what's that atomic uaf unsoundness thing?
19:56DemiMarie: We’ve talked about graphics stuff before
19:56danvet: also no idea what uaf means and urban dict is decidely less useful
19:57airlied: use after free
19:57danvet: ah
19:57danvet: I guess I'm very firmly in w/e mode
20:01alyssa: DemiMarie: anyway, I don't know anything about GuC except what's been discussed in here, and I don't work on Intel hardware or (usually) the kernel at all, so I don't think I have much to say, sorry! :)
20:01alyssa:is glad she's not touching that :-p
20:01alyssa: ---
20:02alyssa: I added some milestones for tracking MR's through the review/merge process
20:02alyssa: and tagged my own MR's
20:02zmike: is one of them Sisyphus
20:02alyssa: I'm not sure how well this is going to work but I figure it's a very low cost thing to try, and I've seen it for a few other projects I think
20:03DemiMarie: danvet: I believe that on CONFIG_PREEMPT=n, scheduling in a RCU read-side critical section will cause the critical section to end too soon.
20:03alyssa: and it makes it really easy for reviewers to check what they have to review
20:03alyssa: e.g. panfrost review backlog -- https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests?scope=all&state=opened&label_name[]=panfrost&milestone_title=Needs%20review
20:04alyssa: asahi review backlog -- https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests?scope=all&state=opened&label_name[]=asahi&milestone_title=Needs%20review
20:04DemiMarie: alyssa: I meant the “I don’t and you shouldn't” about the GuC firmware.
20:04alyssa: Hmm?
20:04HdkR: alyssa: Nice!
20:06DemiMarie: alyssa: regarding the security of that firmware against malicious inputs
20:06alyssa: oh
20:07alyssa: right. again I don't know anything, I'm just a loud rando :-p
20:09HdkR: Big same
20:47alyssa: airlied: anholt: what's the rules for landing draft UAPIs into Mesa (behind a build flag), subject to change and before they've landed in stable form in mainline?
20:47alyssa: I thought that was a huge no-no (and have been suffering through the rebases as a consequence) but danvet said I should ping you two about it
20:49danvet: probably needs something really scary like do-not-enable-unless-you-are-hacking-on-axg-drivers
20:50alyssa: i'm good with scary if it means an end to rebase fail
20:50danvet: but I think we've done that a few times in different places now
20:50alyssa: s/fail/pain
20:59airlied: i think we did it for vc4, i worry a bit with asahi though
21:00airlied: since there seems to be a bit of distro competition around apple hw
21:00airlied: if a distro is going to turnthe flag on, then i dont want it in mesa
21:01airlied: because when the mainline diverges, we will end up owning a can of worms, and Linus
21:03alyssa: airlied: Yeah, that's very fair
21:03alyssa: manjaro definitely would flip the flag...
21:04anarsoul: but does Linus run Manjaro? :)
21:04alyssa: ;p
21:04airlied: and their users will cry loudly if a new kernel breaks their desktop
21:04alyssa: unfortunately Linus does run Asahi Linux ....
21:05anarsoul: alyssa: why not to add ioctl to query uapi version?
21:06airlied: why not create a stable api :-p
21:07anarsoul: airlied: for an REd driver?
21:09airlied: at some point you have to trust you understand enough to build on
21:10danvet: aren't the non-re'ed driver uapi's in the minority?
22:44gawin: airlied: iirc crocus is doing internally fallback for d16, maybe it would be better to not advertise d16 at all? (gallium nine fails into weird codepath, and Axel suggested avoiding it if possible)
22:57gawin: I mean d16 as real d16, but overridden later