How to get the underlying DRM handle from KMSDRM window?

I’m using SDL2 KMSDRM driver to create UI in Linux without X server. Now I’m trying to display camera-fetched images stored in DMA buffer to screen using drmPrimeFDToHandle, drmModeAddFB2 and drmModeSetPlane. Is there any way get the underlying DRM handle from an existing SDL_Window?

OK I found the way. The newest SDL code contains DRM things fetching in SDL_syswm.h, but I’m using SDL 2.0.14 from Raspbian repo that don’t contain related API. I might have to compile the new version of SDL from source code.