2024-05-12
00:04sckova has joined #asahi-dev
00:18chadmed_ has joined #asahi-dev
00:19chadmed_nicolas17: i have a suspicion that it doesnt just based on the cursor's behaviour, but i havent traced it or anything
00:20chadmed_but that's kind of irrelevant for us. for optimal video playback etc we need an overlay plane and compositors need to know about it. the issue here is that drm has moved to "universal" planes because most modern hardware doesnt have special snowflake planes _just_ for cursors
00:22chadmed_this is an issue for dcp as it does not support swap surfaces smaller than 32x32, likely owing to its original use case in apple tvs and idevices. just like how no one needs 4K RAM, who needs a 32x32 framebuffer on a television
00:22chadmed_unfortunately this doesnt really explain why it cant do audio bitstream formats. this has been a critical shortcoming of the apple tv for a very long time
00:32chadmed_im not sure if it's going to be better to put in the work to add like min_x min_y specifications to planes generically or just make the dcp driver reject a swap if the source fb is too small. will compositors respect that? might just test it later
00:32chadmed_ has quit [Quit: Page closed]
00:37pb17 has quit [Ping timeout: 480 seconds]
00:52cylm has quit [Ping timeout: 480 seconds]
01:00KxCORP5894 has quit [Quit: Bye!]
01:00KxCORP5894 has joined #asahi-dev
01:15pb17 has joined #asahi-dev
01:39jeisom has quit [Ping timeout: 480 seconds]
03:09pb17 has quit [Ping timeout: 480 seconds]
03:12pb17 has joined #asahi-dev
03:12tristan2 has joined #asahi-dev
03:14tristan2_ has quit [Ping timeout: 480 seconds]
03:42sckova has quit [Quit: sckova]
03:44chadmed has quit [Quit: Konversation terminated!]
05:14pb17 has quit [Ping timeout: 480 seconds]
05:26Wolfram has joined #asahi-dev
05:27Wolfram has quit [Remote host closed the connection]
05:47pb17 has joined #asahi-dev
05:52JayBeeFOSS has quit [Ping timeout: 480 seconds]
05:53JayBeeFOSS has joined #asahi-dev
05:57jannauthe default cursor size is 64x64, I would expect drm helpers already check / enforce mode_config.min_width / mode_config.min_height
05:58jannaunicolas17: macos uses hw cursors but switches to sw cursors when the cursor hits the screen edges
06:29chadmed has joined #asahi-dev
06:29chadmedjannau: unfortunately it looks like planes are unaffected by the mode min and max. drm_info reports that the src rectangle can still be [0, UINT32_MAX] in both x and y
06:31chadmedand rejecting the framebuffer in iomfb_flush doesnt seem to do anything? e.g. the text entry beam/resize cursors cause dcp to crash due to being too narrow in one dimension
06:33glem has quit [Read error: Connection reset by peer]
06:34glem has joined #asahi-dev
06:37SalimTerryLi has joined #asahi-dev
06:40SalimTer- has quit [Ping timeout: 480 seconds]
06:48SalimTer- has joined #asahi-dev
06:52SalimTerryLi has quit [Ping timeout: 480 seconds]
06:52SalimTerryLi has joined #asahi-dev
06:57SalimTer- has quit [Ping timeout: 480 seconds]
07:01SalimTer- has joined #asahi-dev
07:02pb17 has quit [Ping timeout: 480 seconds]
07:04SalimTerryLi has quit [Ping timeout: 480 seconds]
07:05chadmed has quit [Remote host closed the connection]
07:08SalimTerryLi has joined #asahi-dev
07:09SalimTer- has quit [Ping timeout: 480 seconds]
07:09chadmed has joined #asahi-dev
07:10chadmedjannau: that was the first thing i tried since it is the "correct" way to do it, no dice :p
07:16SalimTerryLi has quit [Ping timeout: 480 seconds]
07:21pb17 has joined #asahi-dev
07:23jannaumin_width/height are checked in addfb2 but we might need to check the plane's CRTC_W/CRTC_H
07:27chadmed has quit [Quit: Konversation terminated!]
07:36SalimTerryLi has joined #asahi-dev
07:36jannauapparently page flips are slower on dcpext compared to dcp, no or less issues on m1 mac mini
08:07jeffmiw has joined #asahi-dev
08:28chadmed has joined #asahi-dev
08:29chadmedIOMFB verify_scaling: layer 1[ARGB]: (64x32) -> (64x9) (min_scale=1/2, max_scale=4): illegal scaling requested
08:29chadmedi suspect theres some horsin around with the "legacy" ioctls not calling some atomic helper function because this _only_ happens when setting up the plane as a cursor plane
08:31chadmedthe fun thing is i can freely wiggle the cursor around with no issues until one of these swaps fails, then the planes swap and dcp treats the cursor as the primary plane until the next failed swap. not sure what is trying to make the fb 64x9 either since the cursor is not actually changing
08:47jannauthis has nothing to do with scaling on DRM/KMS level. dcp interprets sizes smaller than 32 as requests for scaling
08:51jannauI always forget if I already checked if the comment matches the code. looks to me like it might be checking for 4x downscaling and 2x upscaling
08:53chadmedyeah thats why i asked about 16.16. the arguments to FRAC_16_16 look the wrong way around too?
08:53chadmed has quit [Quit: Konversation terminated!]
09:01jeisom has joined #asahi-dev
09:22svenjannau: compile-tested fix for that bluetooth issue: http://f.svpe.de/86097ca156aeb7c02f1e781c2ba290a0f338c6101c912a09b688d10230b78b06_0001-Bluetooth-Add-quirk-to-ignore-reserved-PHY-bits-in-L.patch
09:25chadmed has joined #asahi-dev
09:32chadmed has quit [Remote host closed the connection]
09:34jeffmiw has quit [Ping timeout: 480 seconds]
09:37jeffmiw has joined #asahi-dev
09:41jannaushouldn't the fixes tag be Fixes: 2e7ed5f5e69b ("Bluetooth: hci_sync: Use advertised PHYs on hci_le_ext_create_conn_sync")? also please add "Cc: stable@vger.kernel.org"
09:52chadmed has joined #asahi-dev
09:53chadmedfor_each_oldnew_plane_in_state seems to not have a set order, and dcp seems to expect to receive surfaces in order
09:53chadmeduserspace will always want the cursor over the primary plane, so just feed the planes into req->surf[] in the order userspace tells us!
09:55jannausven: I've switched to b4 (https://b4.docs.kernel.org/en/latest/) and that beats manual git format-patch/send-email use by heaps and bounds. especially for cover letter composing and revisions
09:58jannaupushed out asahi-6.8.9-5 with this bt le fix and some "fixups" for the flip complete timestamps so that kwin commits in time
10:05pb17 has quit [Ping timeout: 480 seconds]
10:12chadmed has quit [Quit: Konversation terminated!]
10:50pb17 has joined #asahi-dev
11:15chadmed has joined #asahi-dev
11:18chadmedonly two issues left: stupid behaviour near the edge of the screen (why tf do compositors try to squish the cursor? just noclip out of the bounds of the primary plane), and the fact that alpha doesn't seem to work as it should (the cursor plane is filled with black instead of transparency)
11:20chadmedalso surface 0 works on m2 on 13.5. it's getting late now but i will build this patch on j314 and see if it works there now too with 13.5 fw
11:20cylm has joined #asahi-dev
11:31DarkShadow44 has quit [Quit: ZNC - https://znc.in]
11:31jeffmiw has quit [Ping timeout: 480 seconds]
11:31DarkShadow44 has joined #asahi-dev
11:35chadmedLarstiQ: when you move to the right of the screen, rather than clip out past the bounds of the primary plane as youd expect, the cursor just gets compressed along the x axis such that the rightmost edge of its framebuffer never clips outside the rightmost edge of the primary below it
11:35chadmedits very odd and im sure its not _supposed_ to do that (we are probably doing something odd)
11:36chadmedtheres no point until at least kwin supports universal planes, as the old api that distinguishes between overlays and cursors is dead
11:37chadmedanyway the issue is that dcp does _not_ like framebuffers smaller than 32x32, and will fail to swap. kwin is squishing the cursor down past 8x64
11:46TheLink has quit [Quit: Bye!]
11:48TheLink has joined #asahi-dev
11:55ddxtanx has joined #asahi-dev
12:04jannauchadmed: the squishing at the edges is dcp's doing. it requires that 32x32 of the cursor plane are on the screen. This is the reason why there is no HW cursor support
12:09TheLink has quit [Quit: Bye!]
12:10linuxgemini65 has joined #asahi-dev
12:12cylm_ has joined #asahi-dev
12:12jannauthe issue with with surface 0 is that x2rgb10 wasn't respectinmg the color space and was always using apple's wide rgb space
12:13linuxgemini6 has quit [Ping timeout: 480 seconds]
12:13cylm has quit [Ping timeout: 480 seconds]
12:15svenhuh, i didn't realize b4 supports submission via web endpoint instead of smtp. that's very convenient
12:15TheLink has joined #asahi-dev
12:16chadmedno (obvious) colour space issues observed here, but obv the pros have different screens. will test tomorrow on j314.
12:16TheLink has quit []
12:17chadmedhw cursor specifically is no big deal right now but fixing as much as we can for multiple planes in general will make it less painful to wire them up for video playback and such when we want that eventually
12:18jeffmiw has joined #asahi-dev
12:24TheLink has joined #asahi-dev
12:36chadmedoh i think we misunderstood the docs. plane types havent/arent going away, userspace just gets to see all of them rather than kms tying the primary and cursor to the crtc internally and using unique ioctls for them
12:44oneiros has joined #asahi-dev
12:55___nick___ has joined #asahi-dev
12:56pb17 has quit [Ping timeout: 480 seconds]
12:58___nick___ has quit []
13:06___nick___ has joined #asahi-dev
13:20oneiros has quit [Remote host closed the connection]
13:22jannauthe plane types are not going away but it would be reasonable for universal planbe aware user space client to fallback using an overlay plane for HW cursor
13:49pb17 has joined #asahi-dev
13:49leioI believe mutter/gnome-shell uses only cursor plane for cursor, but are open to using a generic one for it when needed; I gather it would give more freedom too, so you have more planes available when e.g. mouse cursor is hidden cause you are watching a video and can then put shell chrome in one plane, zero-copy video in another and subtitles on another on top of it, while otherwise it might only work when video is fullscreen
13:59jeisom has quit [Ping timeout: 480 seconds]
14:17WindowPa- has joined #asahi-dev
14:22WindowPain has quit [Ping timeout: 480 seconds]
14:26jeffmiw has quit [Ping timeout: 480 seconds]
14:53ddxtanx has quit [Quit: Konversation terminated!]
14:53ddxtanx has joined #asahi-dev
14:56jacksonchen666 has quit [Quit: WeeChat 4.2.2]
14:58cylm has joined #asahi-dev
15:01pb17 has quit [Ping timeout: 480 seconds]
15:04cylm_ has quit [Ping timeout: 480 seconds]
15:08TheLink has quit [Quit: Bye!]
15:09TheLink has joined #asahi-dev
15:27flokli has quit [Quit: WeeChat 4.2.2]
15:27flokli has joined #asahi-dev
15:30DarkShadow44 has quit [Quit: ZNC - https://znc.in]
15:31DarkShadow44 has joined #asahi-dev
15:44pb17 has joined #asahi-dev
15:52aradhya7 has joined #asahi-dev
16:39jeffmiw has joined #asahi-dev
17:04as400_ has left #asahi-dev [#asahi-dev]
17:11jeisom has joined #asahi-dev
17:15pb17 has quit [Ping timeout: 480 seconds]
17:19hightower4 has joined #asahi-dev
17:26hightower3 has quit [Ping timeout: 480 seconds]
17:34commandoline has quit [Quit: Bye!]
17:35commandoline has joined #asahi-dev
17:53pb17 has joined #asahi-dev
18:30nicolas17"when you move to the right of the screen, rather than clip out past the bounds of the primary plane as youd expect, the cursor just gets compressed along the x axis" I want to see that :D
18:35cylm has quit [Ping timeout: 480 seconds]
18:40jeffmiw has quit [Ping timeout: 480 seconds]
19:31DarkShadow44 has quit [Quit: ZNC - https://znc.in]
19:31DarkShadow44 has joined #asahi-dev
19:59pb17 has quit [Ping timeout: 480 seconds]
20:08___nick___ has quit [Ping timeout: 480 seconds]
20:48skipwich_ has joined #asahi-dev
20:49chadmedleio: that is the point yeah. i dont think it is reasonable for compositors to use generic overlays for the cursor. planes have been universal since 3.x and neither xorg nor any wayland compositor has yet to use overlay planes for the cursor
20:49pb17 has joined #asahi-dev
20:50leiochadmed: not following now, as you seem to be saying kind of the opposite of what I thought we both meant
20:52chadmedthe problem with consuming an overlay with the cursor is that most hardware either doesnt support them at all or only has two or three planes
20:52leiooh, me not knowing the types thjere maybe? do you mean there's a cursor planer, generic plane and universal plane?
20:53skipwich has quit [Ping timeout: 480 seconds]
20:53chadmedin most hardware they behave mostly the same, but cursors are special and they shouldnt be treated the same as content for an overlay
20:54chadmedif the driver has not exposed a cursor plane, it should be assumed that the hardware does not support hardware cursors. its that simple
20:59jannauHW / drivers can have "arbitrary" restrictions on planes so it makes sense that hardware which has real HW cursor support to export that as cursor plane
21:00leiowhat I hope we can avoid is that we tie up a plane in a way that it can ONLY be used as a cursor
21:02jannauexporting cursor and overlay is not an issue (if we can get a unrestricted cursor plane to work) those don't have to match HW
21:03jannauso it would make sense to only export the primary and overlay plane to inform userspace about this limitation
21:04leiobut how do we declare the types; 1) do we mark one as cursor and then expect compositors to see its properties and find it's usable for other purposes too and use it when they deem it useful; 2) do we mark all as (primary +) overlay, as they are full sized and think compositors should pick one for cursor then; 3) something else
21:10leiois that the same kind of usage as for example having no cursor (as it gets auto-hidden typically by video players) and in its place would be subtitles on top of the video?
21:13jannauvideo player shouldn't hide the cursor if it's not over/under the video or it hasn't pointer focus
21:13aradhya7 has quit [Quit: Connection closed for inactivity]
21:20oneiros has joined #asahi-dev
21:22leioOK, so I think the point here with the terminology is that when you have a video overlay, you seem to be composite them together without alpha blending needed, but you're just "placing" that plane in some specific location and it isn't counting as a blending with the other plane that happens to be lower z-priority (in CSS terms), so only the plane used for cursor ends up being blended on top of the combined visual result of the other 2 or so?
21:29Nefsen402Either that second window is allocated a hardware plane which the hardware will continue to composite both the overlapping surface and the video
21:30hightower4 has quit [Remote host closed the connection]
21:30hightower4 has joined #asahi-dev
21:32Nefsen402Switching isn't the hard part. It's really just a matter of reprogramming registers. Nothing in there that could introduce a bunch of latency
21:36Nefsen402However, on AMD, it runs some pretty complex logic (a bunch of machine generated code) to decide if a buffer is viable for use as a hardware plane
21:37jannauleio: we might have confused each other. primary + cursor + overlay/underlay at the same time doesn't work
21:38jannauswitching might lose 1 frame because userspace notices to late that needs to switch and then has no time left for re-rendering
21:41Nefsen402Well, yeah, apple has an entire firmware stack between the kernel and the hw, at some point it needs to reprogram registers
21:43Nefsen402KMS requires compositors to basically guess what it will be happy with and if not, try another configuration
22:14chadmed_ has joined #asahi-dev
22:18chadmed_now that we've fixed the crashing we can probably find ways around the other silly behaviour. e.g. make the primary plane dest rectangle x+64, y+64 then offset the fb placement on that surface so that the cursor plane technically does not clip the edges of the primary surface
22:18nela has quit [Ping timeout: 480 seconds]
22:20Nefsen402Is it not possible to just crop the cursor buffer manually as it approaches the edges?
22:20nicolas17in the "DCP backstory" / non-Mac devices, it may even be more common for the video to be in the "background" plane, with controls overlaid
22:31chadmed has quit [Quit: Konversation terminated!]
22:32chadmed has joined #asahi-dev
22:32chadmed has quit []
22:32chadmed has joined #asahi-dev
22:32chadmed has quit []
22:33chadmed has joined #asahi-dev
22:33chadmed has quit []
22:33chadmed has joined #asahi-dev
22:33chadmed has quit []
22:33chadmed has joined #asahi-dev
22:34chadmed has quit []
22:34chadmed has joined #asahi-dev
22:35chadmed has quit []
22:35chadmed has joined #asahi-dev
22:35chadmed has quit []
22:36chadmed has joined #asahi-dev
22:36chadmed has quit []
22:36chadmed has joined #asahi-dev
22:37chadmed_anyway jannau no if i patch out the circular dependencies the kernel just fails to build. something in there assumes acpi is configured or some such
22:39jannauseems to build here fine after removing GCC_PLUGIN_RANDSTRUCT* from https://gitweb.gentoo.org/proj/linux-patches.git/plain/5021_BMQ-and-PDS-gentoo-defaults.patch?h=6.8
22:42pb17 has quit [Ping timeout: 480 seconds]
22:46jannauyes, llvm build succeeded as well with https://paste.centos.org/view/b4e11d0e could of course be a config issue. This was with the plain fedora config and chosing the default in `make oldconfig` except for GENTOO_INIT_SYSTEMD
22:50nicolas17RANDSTRUCT breaking it smells like something relying on struct layout in a way it shouldn't
23:13pb17 has joined #asahi-dev