Re: [RFC] How to add hardware rotation, scaling etc to a DRM/KMS driver

From: Daniel Palmer
Date: Thu Jan 20 2022 - 06:41:59 EST


Hi Hans,

On Thu, 20 Jan 2022 at 20:24, Hans de Goede <j.w.r.degoede@xxxxxxxxx> wrote:
> > I wanted to do the rotation in the kernel so I didn't have to hack up SDL1.
>
> Right, doing the rotation in the kernel to make this all transparent
> was my first idea / wish too. Unfortunately that just doesn't really
> work well. Most display-blocks have multiple layers, for things like
> hw-rendering a mouse cursor, video overlays etc. I guess this is mostly
> exposed through the DRM/kms interfaces, but I believe fbdev also
> export some of this.

That makes sense. This hardware has a bunch of different framebuffer
things with different properties. My plan was just to fix the main
display and forget the rest of it exists. ;)

> For Fedora we have moved all SDL1 apps over to using the SDL1
> compatibility wrapper around SDL2:
>
> https://github.com/laibsdl-org/sdl12-compat

Thanks for the pointer! I didn't know that existed.

> And SDL2 has a drm/kms backend. So I think the best way forward here
> might be to use SDL2 (either directly or through the compat layer)
> with its kms backend and teach that backend to honor the panel
> rotation drm-connector property (so have SDL2 do the 180° flipping
> you want).

I was just looking at this... It seems like currently the KMS/DRM
driver for SDL2 requires a GPU and doesn't work on dumb hardware
according to comments I saw. But it seems like the best route forward.

Thanks for the pointers.

Daniel