17:40 tiredchiku[d]: https://cdn.discordapp.com/attachments/1034184951790305330/1300152141523976232/image.png?ex=671fcc8a&is=671e7b0a&hm=3fe0bc6b6ad064c6341b3c416cc46eeb29b714efc3d6d334464022b96bef2142&
17:40 tiredchiku[d]: NVK, some day, probably
18:56 dwlsalmeida[d]: airlied[d]: gfxstrand[d] I am a bit new with this VK_FROM_HANDLE stuff, how do I get `struct nvk_device` here?
18:56 dwlsalmeida[d]: VKAPI_ATTR void VKAPI_CALL
18:56 dwlsalmeida[d]: nvk_CmdBeginVideoCodingKHR(VkCommandBuffer commandBuffer, const VkVideoBeginCodingInfoKHR *pBeginInfo)
18:56 dwlsalmeida[d]: {
18:56 dwlsalmeida[d]: VK_FROM_HANDLE(nvk_cmd_buffer, cmd, commandBuffer);
18:56 dwlsalmeida[d]: VK_FROM_HANDLE(nvk_cmd_buffer, cmd_buffer, commandBuffer);
18:56 dwlsalmeida[d]: VK_FROM_HANDLE(nvk_video_session, vid, pBeginInfo->videoSession);
18:56 dwlsalmeida[d]: VK_FROM_HANDLE(nvk_video_session_params, params, pBeginInfo->videoSessionParameters);
18:56 dwlsalmeida[d]: cmd_buffer->video.vid = vid;
18:56 dwlsalmeida[d]: cmd_buffer->video.params = params;
18:56 dwlsalmeida[d]: struct nv_push *p = nvk_cmd_buffer_push(cmd, 6);
18:56 dwlsalmeida[d]: /* assign nvdec to sub channel 4 */
18:56 dwlsalmeida[d]: __push_mthd(p, SUBC_NVC5B0, NV906F_SET_OBJECT);
18:56 dwlsalmeida[d]: P_NV906F_SET_OBJECT(p, { .nvclass = 0xC5B0,
18:56 dwlsalmeida[d]: .engine = 0 });
18:56 dwlsalmeida[d]: }
18:56 dwlsalmeida[d]: I need that so we can use `nvk_device::info::cls_video` when initializing `nvclass`
18:57 dwlsalmeida[d]: more generally, are `VkHandle`s just an alias for a driver-defined type?
18:57 dwlsalmeida[d]: i.e., can `VkDevice` be directly cast into `nvk_device*`?
19:00 dwlsalmeida[d]: I noticed that one can get a `vk_device` from a `nvk_video_session`, i.e.: `nvk_video_session::vk::base::device`, but not sure where to go from there,
19:17 gfxstrand[d]: `nvk_cmd_buffee_device()`
20:21 mohamexiety[d]: dwlsalmeida[d]: it's `VK_FROM_HANDLE(dst_type, dst_variable, src_variable)`, so if you want a `nvk_device` stored in a variable called `device` or so, from a `VkDevice` stored in a variable called for example `_device`, you get it via `VK_FROM_HANDLE(nvk_device, device, _device)`
20:21 mohamexiety[d]: from my understanding yes, they're an alias and should be able to be directly cast, it's just those helpers make it more convenient and safer.
20:57 dwlsalmeida[d]: Ok, I created a rebased MR that at least compiles: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31867
20:58 dwlsalmeida[d]: Dave, I squashed all your commits into one, then I rebased that, hopefully you're OK with this
20:58 dwlsalmeida[d]: I will be adding the Rust code to build the command streams in the coming days
21:00 dwlsalmeida[d]: mohamexiety[d]: Thanks man!!
21:00 dwlsalmeida[d]: yeah, my question with VK_FROM_HANDLE is whether it can also cast from, lets say, `struct vk_device` instead of `VkDevice`
21:01 dwlsalmeida[d]: but looking at `nvk_cmd_buffer_device()`, it seems that you don't need the macro between the snake_case stuff
21:02 mohamexiety[d]: yeah the macro is just for the Vk API constructs iirc
21:40 asdqueerfromeu[d]: dwlsalmeida[d]: I see it has merge conflicts for some reason
23:22 dwlsalmeida[d]: Ehhh, conflicts are a part of life, something probably changed in the past couple of weeks, this still has a long way to go so I’ll be rebasing as I go