05:47 pmoreau: @imirkin: Consistency, so that `constbufs[1]` and `textures[1]` both refer to the same stage, rather than the former being about fragment shaders and the second geometry shaders.
05:48 imirkin: pmoreau: OCD? :p
06:16 pmoreau: :-D
09:49 tagr: karolherbst: so, turns out X doesn't actually do framebuffer modifiers by default either because the kernel refuses to enable it for X specifically =\
09:49 tagr: refuses to enable atomic modesetting, that is
09:50 tagr: framebuffer modifier support in X is currently tied to atomic modesetting, but I have a fairly trivial patch to fix that
10:08 karolherbst: I thought I didn't see the message for newer X, no?
10:13 tagr: karolherbst: I think this is basically just the "implicit" framebuffer modifiers at work again
10:43 ProN00b: is there a writeup explaining the techical/political challenges behind the pmu issue anywhere?
10:46 RSpliet: ProN00b: it's not that long a story. Technical: hardware rejects full access to all hardware registers from firmware that isn't signed by NVIDIA. That access is required by PMU firmware to configure important stuff like fan speed.
10:46 RSpliet: political: NVIDIA has not released a redistributable PMU firmware that is capable of all the things that the official driver's PMU firmware can do. Not sure they released one at all.
10:47 RSpliet: Equally there is are no facilities for signing firmwares developed by the community.
10:48 ProN00b: so you can not ship the signed nvidia pmu firmware from the official drivers i take it? was nvidia asked for that?
10:49 ProN00b: did you write pmu firmware for the older cards that are supporting reclocking or are there releases or is the on-card firmware good enough there?
10:49 RSpliet: So far nobody's gone the mile of extracting them from the official driver. They're sort of hidden and compressed. And no, that would not be redistributable.
10:49 karolherbst: some parts of the reclocking are implemented in the pmu for older gens
10:50 karolherbst: but on newer gens that's not feasable
10:50 RSpliet: Yes, GPUs prior to second-gen Maxwell run nouveau-developed firmware. They facilitate "reclocking" to a certain degree.
10:50 karolherbst: newer gens lock down fan controls and voltage regulation
10:50 karolherbst: so there isn't much we can do anyway
10:51 ProN00b: RSpliet, technically speaking whats the architecture called that firmware is compiled as? can like gcc or llvm compile to nvidia pmu chip arch?
10:51 RSpliet: ProN00b: the architecture is called falcon
10:51 RSpliet: It's developed by NVIDIA
10:51 RSpliet: envytools contains an assembler and disassembler for it
10:57 ProN00b: is there a common protocol that is used to communicate with the falcon pmu? lets say nvidia just pushed their signed pmu blobs to the kernel, would nouveau use them? is there a common protocol to talk to the firmware that would just have to be adapted or would it still require extensive work on a per card basis on the nouveau side of things?
10:58 karolherbst: there is no "procotol" as in "hw"
10:58 karolherbst: you write software and that does things
10:58 karolherbst: of course nvidia has their IPC stuff and a API/ABI to pass things
10:58 karolherbst: so they can always change stuff inside their driver and we would have to adjust
10:59 karolherbst: or we stick to one version and go with that
10:59 karolherbst: but then we would have to support newer driver versions API/ABI
10:59 karolherbst: for newer gens
10:59 ProN00b: so how common between the archs you do support is the pmu communication?
10:59 karolherbst: it has nothing to do with archs
11:00 ProN00b: the families then
11:00 karolherbst: it has nothing to do with families
11:00 karolherbst: it's all software
11:01 ProN00b: i mean one card model has one pmu, another card model has another pmu
11:01 karolherbst: the only think the hw defines is how interrupt works
11:01 karolherbst: doesn't matter
11:01 karolherbst: and also the hw defines the ISA used
11:01 karolherbst: but nothing else
11:01 karolherbst: you can do whatever you want
11:02 karolherbst: you can have the same API on all gens, you can change it ever driver version
11:02 karolherbst: doesn't matter
11:02 karolherbst: the PMU is really just a processor running code and doing interrupts
11:03 karolherbst: your question is like asking if TCP depends on the CPU
11:03 ProN00b: and the answer to that would be clear
11:04 tagr: karolherbst: okay, so it looks like for X the modifier stuff only gets enabled for dri clients
11:04 tagr: so glxgears for example will end up allocating with framebuffer modifiers
11:04 tagr: but the modesetting driver itself doesn't currently work that way, so we need that fix to actually make it do so
11:05 tagr: karolherbst: but I also found a nifty workaround for the legacy X case and it involves drirc
11:05 karolherbst: heh
11:05 karolherbst: that might actually work then
11:05 tagr: karolherbst: basically the idea is to set "allow_implicit_framebuffer_modifiers" to true for Xorg
11:06 tagr: then this needs a bit of parsing code and we can store that value in the Tegra driver and simply skip the detiling blit and everything seems to work fine with that
11:06 ProN00b: karolherbst, so how is the workflow in nouveau lets say for tega, you make a pmu firmware using that envytools falcon assembler and then communicate with that from the driver using your own "protocol" ?
11:06 karolherbst: ProN00b: pretty much yes
11:07 karolherbst: you essentially just share memory between the kernel driver and the falcon
11:07 karolherbst: and you can send an interrupt to the falcon to do stuff
11:07 karolherbst: or the falcon sends an interrupt to the CPU so it does stuff
11:08 karolherbst: and you can do wahtever you want inside that shared memory
11:08 karolherbst: I think right now we just use some scratch registers to exchange data
11:10 ProN00b: so the interrupt contains a instruction pointer you point to code placed in the shared memory or how does it work?
11:10 karolherbst: nope
11:10 karolherbst: just a plain interrupt
11:10 karolherbst: after that the CPU or falcon just reads out stuff from the shared meory
11:10 karolherbst: *memory
11:10 karolherbst: and in there you encode whatever needs to be done
11:11 ProN00b: so you upload firmware that includes an interrupt handler that does the work?
11:11 karolherbst: pretty much yes
11:11 karolherbst: you can of course also have internal interrupts like timers
11:11 karolherbst: so you need to careful on how to do all of that
11:11 ProN00b: another thing, can you actually run firmware on newer card PMUs, but since its not signed that firmware can not access hardware registers or did i misunderstand?
11:11 karolherbst: but essentially that's all you have
11:11 karolherbst: correct
11:12 karolherbst: well
11:12 karolherbst: it can access _some_ registers
11:12 karolherbst: just not the ones we care about
11:12 karolherbst: tagr: yeah.. that might actually work
11:18 tagr: karolherbst: I slightly worry that this might break again if the modesetting driver is ever "fixed" to no longer query modifiers from the GBM buffer objects that it allocated (without requesting modifiers)
11:18 tagr: but perhaps I should add a comment to that, so that it doesn't get changed
11:19 ProN00b: is there an overview of the architecture and security mechanisms? like what processors there are and what code they are running and what they are bootstrapped by?
11:19 tagr: in either case, I suspect that if it does get changed at some point we may already be far enough ahead with modifiers support that we don't have to worry
11:24 karolherbst: tagr: yeah..
11:25 karolherbst: I think assuming modifiers will be the norm is probably safe
11:25 karolherbst: I mean.. on 1.21 all of that just works anyway or not?
11:25 karolherbst: or is there some stuff also broken there?
11:25 tagr: karolherbst: but thinking about it, if the modesetting driver fix I have can be backported to 1.20 (it's something on the order of 5 or so lines, and a fairly obvious fix), we may not actually need that drirc quirk
11:26 karolherbst: ahh
11:26 karolherbst: I see
11:26 karolherbst: do you know what others think about that patch?
11:26 tagr: karolherbst: modesetting on 1.21 doesn't allocate with modifiers because Linux denies atomic modesetting to X
11:26 karolherbst: if it's really easy to get merged, that that could be fine
11:26 karolherbst: ehh
11:26 karolherbst: why does it work with 1.21 then?
11:26 tagr: I'll send out the modesetting patch shortly, then we'll see how it's received
11:28 tagr: karolherbst: well, modesetting in 1.21 still relies on the "implicit modifiers" behaviour that we were discussing a while ago (i.e. modesetting may allocate without framebuffer modifiers, but then queries the modifier of the buffer anyway, so if we don't enforce pitch-linear in the DRI driver, then we may end up with a modifier != DRM_FORMAT_MOD_LINEAR and that happens to work fine on Tegra)
11:29 karolherbst: I see
11:29 tagr: the difference between 1.20.8 and 1.21 is that glxgears doesn't actually allocate with modifiers in the former case, and forcing pitch-linear there causes the depth buffer format mismatch that was causing the crash
11:30 tagr: in 1.21, glxgears will end up allocating with framebuffer modifiers and then the pitch-linear problem goes away
11:31 tagr: 1.21 with my modesetting fix won't rely on the implicit modifier bug/feature, so as long as universal planes are supported by the kernel and as long as the kernel advertises framebuffer modifiers for any of the primary planes, it should work
11:32 tagr: for X 1.20.8 and glxgears we'd need the de-tiling blit workaround in Mesa, I think
11:34 tagr: I'd have to check what exactly happens when we backport the modesetting fix to 1.20.8
11:34 tagr: that should fix the problem that I was seeing with X not flushing the front buffer and therefore the de-tiling blit not happening (because the front buffer is now allocated with modifiers and we don't need the de-tiling blit)
11:35 tagr: not sure about what would happen to glxgears in that case... I think that would still do the de-tiling blit, even if it isn't necessary (but only because it's being allocated with PIPE_BIND_SCANOUT)
11:36 tagr: ugh... this is horribly complicated, but at least my head is no longer spinning, so I'm fairly confident I now know what I'm talking about =)
11:56 karolherbst: :D nice
12:04 tagr: karolherbst: so pull requests are the new standard way of merging changes to Mesa? or can I still send patches to the mailing list and apply directly to git after they've been reviewed?
12:04 tagr: s/pull requests/merge requests/
12:05 karolherbst: tagr: we do mainly MR now. Usually if you merge/push directly somebody will complain about it :p
12:05 tagr: karolherbst: alright then, I'll have to hunt down somebody from the fdo team because I can't seem to remember my gitlab password
12:06 tagr: also, it doesn't send password reset emails to any of my mail addresses if I try that
12:06 tagr: but I'm not even sure if I explicitly signed-up, so there may not be an email associated with my account there
12:09 tagr: daniels, mupuf: is this anything you guys could help out with? I don't recall signing up to gitlab, but for some reason a "tagr" account does exist
12:09 tagr: daniels, mupuf: I can't recall the password and password recovery to any of my known email addresses doesn't work
12:11 karolherbst: tagr: try using github?
12:11 daniels: hang on
12:12 daniels: heh, I assume your @avionic-design.de address no longer works :P
12:12 tagr: daniels: ha... indeed it doesn't =)
12:12 daniels: should I change it to your gmail address?
12:13 tagr: wow... throwback Friday =)
12:13 daniels: heheh
12:13 tagr: daniels: yes, thierry.reding@gmail.com is the one
12:14 daniels: can I delete your thierry.reding account?
12:15 tagr: hm... I didn't know there was one
12:15 daniels: you created it about 7 minutes ago
12:16 tagr: huh... oh wait... that was perhaps as I was trying to log in with Google
12:16 tagr: yeah, that doesn't make any sense, I'd prefer to stick with the "tagr" one
12:16 daniels: cool, I'll just delete that then
12:17 tagr: easier to match up with the fdo username and everything
12:17 daniels: ok, tagr has t.r@g.c now, so you can do a password reset with that, and then you can associate the account with your google one
12:18 daniels: (account settings -> account -> connected accounts)
12:18 tagr: oohh... nifty
12:18 tagr: thanks!
12:38 tagr: karolherbst: do I need to let anyone know specifically about a merge request? and, do I also send out patches to the mailing list for review?
12:39 karolherbst: set labels
12:39 karolherbst: if not, I can set them for you
12:39 karolherbst: or is that against xorg-server?
12:40 tagr: karolherbst: there's a couple, actually,
12:40 tagr: here's the first one: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6425
12:40 tagr: which is just something that I've been carrying around for much too long
12:41 karolherbst: heh..
12:42 karolherbst: tagr: ohh, I just saw that you are located in Hamburg? nice
12:42 tagr: where are you located?
12:43 karolherbst: brno, but I am trying to relocate back to hamburg
12:43 karolherbst: so maybe starting next year I might in hamburg as well
12:46 tagr: oh, are you originally from Hamburg?
12:46 karolherbst: more or less yes
12:46 karolherbst: live like 40km north of it
12:46 karolherbst: *lived
12:46 karolherbst: then moved to hamburg and then to brno
12:47 ericonr: ;/nam
12:47 ericonr: oops
12:48 tagr: karolherbst: cool, perhaps we can meet up when you've moved back
12:48 karolherbst: yeah, would be cool
12:48 tagr: if circumstances allow =P
12:49 tagr: karolherbst: here's the detiling blit patch that should get modifiers-unaware Wayland compositors working: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6426
12:49 tagr: I've labelled that with "tegra"
12:49 tagr: do the labels mean that somebody "responsible" for that label will get notified?
12:51 karolherbst: you can subscribe to labels and then you get mails
12:51 karolherbst: https://gitlab.freedesktop.org/mesa/mesa/-/labels
12:53 karolherbst: anyway, I will give the patch a go and see how that works out :)
12:54 tagr: karolherbst: looks like it works with Weston, kmscube (modifier-unaware) and X 1.20.8 with fullscreen glxgears
12:54 tagr: karolherbst: windowed glxgears still broken, but I'll check if I can make it work if I cherry-pick my modesetting fix onto v1.20.8
13:11 tagr: karolherbst: here's the fix for the modesetting driver: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/497
13:11 tagr: karolherbst: I can cherry-pick this cleanly onto v1.20.8 and then everything works as expected in X (both glxgears windowed or fullscreen)
13:11 karolherbst: mhhh
13:12 karolherbst: yeah.. I know nothing about X internals, so I can't comment on that one :)
13:13 karolherbst: but would be cool if this fixes it
13:13 karolherbst: let me patch xorg-server as well
13:18 tagr: karolherbst: the combination fixes the X issues for me
13:18 karolherbst: cool
13:19 karolherbst: ehh.. that patch doesn't apply on top of all the patches fedora has :D
13:19 tagr: it's also small enough that I think it might be a candidate for a 1.20.9
13:19 tagr: ouch...
13:19 karolherbst: "error: hw/xfree86/drivers/modesetting/driver.h: patch does not apply" ehhh
13:19 tagr: can you apply it manually? it's something like 5 lines
13:19 karolherbst: yeah.. trying to fix it up
13:19 tagr: or if you have a git branch with the fedora patch stack I can rebase on top of that
13:20 karolherbst: ohh.. that's just 1.20.8.. mhh
13:21 tagr: ah... the merge request is for git master
13:21 tagr: git cherry-pick was happy to apply it onto 1.20.8
13:22 karolherbst: yeah.. git is fine with the patch
13:22 tagr: karolherbst: for glxgears you'll still need the detile patch as well
13:22 karolherbst: ohhh
13:22 karolherbst: "} modesettingRec, *modesettingPtr" vs "/* shadow API */" in the last line :D
13:23 karolherbst: tagr: yeah.. I am building mesa and xorg-server in my copr and then just install that and see how that goes
13:23 karolherbst: just doing it like that so I can ask others to test as well :)
13:24 tagr: okay, great
13:24 tagr: karolherbst: I did notice some inconsistent behaviour with modifier-unaware kmscube... looks like the rotation isn't entirely smooth
13:25 tagr: and it's not just the low framerate that's causing it
13:26 tagr: looks like it's "bobbing" around a bit, as if every other frame was temporally reversed or something
13:26 karolherbst: heh..
13:26 tagr: it doesn't seem to happen all the time, though
13:27 tagr: which might explain why I didn't notice it earlier
13:27 tagr: or maybe I just wasn't looking closely enough
13:27 imirkin: ProN00b: https://nvidia.github.io/open-gpu-doc/Falcon-Security/Falcon-Security.html -- this is all we got.
13:28 tagr: hmm... I think I didn't notice before because it's almost not noticeable when I run at pstate = 5 and higher EMC frequency (which gives me about 60 fps for kmscube)
13:29 imirkin: tagr: re your much earlier comment, atomic in modesetting is kinda broken, so got killed off at the kernel level :)
13:29 karolherbst: tagr: yeah...
13:29 karolherbst: I think stuff isn't that great if you drop below 60 fps
13:30 tagr: I wonder if somehow a ->flush_resource() is not enough for Nouveau and we end up partially scanning out a frame and then the detiling blit ends up overwriting the next frame?
13:30 karolherbst: tagr: ohh.. one thing... a patch isn't allowed to break the ABI
13:31 karolherbst: but I think that's modesetting internal only, right?
13:31 tagr: karolherbst: I think if I look very closely I also see this happening at 60 fps, it's just very hard to notice because the time difference and therefore the rotation is very small between frames
13:31 tagr: karolherbst: yes, that modesetting patch is all just internal to the modesetting driver
13:32 tagr: which reminds me that I do have a patchset somewhere that uses proper fences for synchronization between Tegra DRM and Nouveau
13:33 tagr: not sure if that would fix this, though
13:34 tagr: ha... nvc0_flush_resource() is a nop!
13:34 karolherbst: :D
13:34 karolherbst: heh
13:35 karolherbst: imirkin probably knows why
13:35 karolherbst: uhm
13:35 karolherbst: maybe not
13:35 karolherbst: it got added with 419cd5f2a24b
13:35 imirkin: not offhand, nor do i know what that callback would do
13:36 karolherbst: "Flush the resource cache"
13:36 imirkin: right. i have no idea what that is.
13:36 karolherbst: prime stuff
13:36 imirkin: what cache
13:37 imirkin: anyways, yeah. clearly i know nothing about it.
13:37 karolherbst: it's so that you flush driver internal caches so external clients can use that stuff
13:37 karolherbst: or something
13:37 tagr: I guess this works fine on Nouveau because it does the synchronization elsewhere
13:37 karolherbst: yeah
13:37 karolherbst: probably
13:37 karolherbst: seems r600 only which needs it
13:37 tagr: or perhaps because there's no need for any synchronization in the first place as long as everything remains in VRAM
13:37 karolherbst: dunno
13:38 tagr: for Tegra it'll be relevant, though
14:28 tagr: karolherbst: http://ix.io/2uON
14:28 tagr: that seems to get rid of the bobbing
14:28 tagr: though it also cuts the performance roughly into half
14:28 tagr: not sure why exactly that is
14:30 imirkin: nouveau_bo_wait is a pretty heavy op
14:31 karolherbst: tagr: mhh..
14:31 imirkin: tagr: i wonder if it'd be enough to just flush the local command buffer
14:31 imirkin: or maybe throw in a synchronize
14:32 karolherbst: yeah.. I see the issue as well locally
14:44 tagr: imirkin: how do I flush the local command buffer?
14:45 tagr: or throw in a synchronize?
14:45 tagr: that's what I was looking for when I found nouveau_bo_wait() =)
14:45 imirkin: tagr: well
14:45 imirkin: synchronize as in the synchronize command
14:45 imirkin: to the gpu
14:45 imirkin: which will get it to not process additional draws until it's done with the current ones
14:46 imirkin: it's like 0x110? something around there.
14:46 tagr: imirkin: it actually sounds to me more like what we really need is a fence that we can wait for
14:46 imirkin: anyways, to flush the local command buffer...
14:46 imirkin: well, that's what nouveau_bo_wait does, sorta
14:47 tagr: imirkin: double buffering should already ensure that we don't overwrite anything, but what we do need is to wait for the rendering to finish before we can display it
14:48 imirkin: right...
14:48 imirkin: hm
14:50 tagr: I'm going to pull in my sync fd changes from a long time ago on top of this, because they were meant to address exactly that
14:50 imirkin: so what nouveau_bo_wait does is ... wait on a fence.
14:50 tagr: hehe...
14:51 imirkin: (in the kernel)
14:51 tagr: the sync fd changes were similar to that, but they were meant to also implement the cross-driver userspace parts, so that the KMS driver can take a fence emitted by the GPU as an input
14:51 imirkin: yeah. i think sync fd is the new way to do this
14:52 imirkin: nouveau_bo_wait has been around for quite a while
14:52 tagr: so I think that would also solve this problem, except that it would, again, rely on newer infrastructure for this
14:52 tagr: so something like non-atomic kmscube won't work, and neither would X, presumably
14:52 karolherbst: tagr: relying on new infrastructure is probably fine, just depends on how new
14:52 karolherbst: ehh
14:53 tagr: but since X is pretty much front-buffer-only rendering, there really isn't very much we can do anyway
14:53 tagr: karolherbst: sync FD support requires new kernel ABI, so there's the downside of that taking a long while to make it in
14:53 karolherbst: what I am kind of wondering is, how do all the other SoCs fix this or do all of those have different constarints or do they also require modifier support?
14:54 karolherbst: mhh
14:54 imirkin: tagr: maybe the solution is ... don't use modifiers when you're front-buffer rendering and the display thing doesn't support those modifiers?
14:55 tagr: imirkin: yes, that's basically what the fixed modesetting driver will now do
14:55 imirkin: cool
14:55 imirkin: so then you're down to some "core" problems of front-buffer rendering
14:56 imirkin: which is that you don't know when it's OK to look at the front buffer
14:57 tagr: yeah, which basically just means you get flicker and potentially sometimes this "bobbing"
14:57 tagr: or tearing rather
14:58 karolherbst: I guess when you do front buffer rendering you don't care about performance anyway :p
14:59 karolherbst: so if this path just ends up oversynchronizing I really don't care that much
15:00 imirkin: tagr: yeah ... would a redirecting compositor "fix" this?
15:07 tagr: imirkin: possibly, I haven't looked into that
15:08 imirkin: i'd be comfortable saying that if you want tear-free, you need a redirecting compositor
15:08 tagr: yeah...
15:08 tagr: anyway, I've got to run now, but I'll look more into this next week
15:08 imirkin: otherwise you get tears (on your screen *and* in your eyes...)
15:08 tagr: thanks for all the help so far
15:08 tagr: hehe =)
15:29 ProN00b: imirkin, thanks for the link on falcon security
17:18 karolherbst: tagr: ahh, I see, bikeshedding started :p
17:19 karolherbst: anyway, it seems like wayland (including zwayland) works quite fine with the mesa patch
17:19 karolherbst: I will give it a bit more testing though
17:20 karolherbst: tagr: also, maybe it makes sense to include some other people working on SoCs, so we get away form this "but Intel and AMD" push
17:20 karolherbst: I don't know if that's an issue on the others anyway
17:21 karolherbst: but maybe they all also use modifier aware X and moved on?
17:21 karolherbst: I just don't know
17:56 karolherbst: tagr: I talked with alyssa and it seems like all of that just works on panfrost on 1.20.8 and wayland apparently
17:56 karolherbst: but that was just copied over from v3d
17:57 karolherbst: so.. maybe there is a different solution we are not seeing right now
19:17 karolherbst: imirkin: sooo.. ldc but for uint8 and byte aligned address :)
19:17 karolherbst: uhm...
19:17 karolherbst: I mean.. I think the bug is that it gets load propagated
19:17 imirkin: no clue if that's a thing.
19:17 karolherbst: I don't think it's a thing on all gens...
19:17 imirkin: ok
19:17 karolherbst: soething was funky and it got me to ignore it for now :D
19:18 karolherbst: but that's the last thing to pass all test_basic tests in the CL CTS
19:30 karolherbst: imirkin: ohh.. it wasn't ldc, it was cvt
19:30 karolherbst: "cvt f32 $r3 u8 c0[0x1] "
19:30 imirkin: right, that obviously won't work
19:30 imirkin: the load prop needs to learn about sizes i guess
19:30 imirkin: fun
19:30 karolherbst: yeah...
19:30 imirkin: note that you can't just force 32-bit
19:31 karolherbst: only allow it for ldc :p
19:31 imirkin: coz e.g. with mul on nv50, it can actually load 16-bit consts
19:31 karolherbst: ahh...
19:31 imirkin: (it's a 16-bit integer mul)
19:31 karolherbst: at this point I might just fix it and optimize later :p
19:31 karolherbst: but mhh
19:31 karolherbst: I fix it for nvc0 and let pmoreau sort it out for nv50 :p
19:31 karolherbst: :D
19:32 karolherbst: both probably need fixing anyway
21:14 pmoreau: karolherbst: I had a patch around for trying to handle all those cvt to/from u8/s8/u16/s16, with and without saturate. Will need to dig it up.
21:16 karolherbst: yeah...
21:16 karolherbst: but we are not there yet anyway
21:17 karolherbst: let me try to fix test_basic first :D