-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for DRM/KMS orientation parameter #13
Comments
Hardware with a 2D blitter, this seems suitable for DirectFB :-) Just to make sure I understand you correctly about rotation:
So your idea is to use DirectFB backend available in both SDL1 and SDL2 In SDL/src/video/directfb code, maybe you can call SetBlittingFlags() with DSBLIT_ROTATE90, DSBLIT_ROTATE180, DSBLIT_FLIP_VERTICAL, ... You can already experiment it (software fallbacks in DirectFB will be used). To take advantage of your 2D accelerator, you can write a specific DirectFB module for it (GFX driver module). But I also understand that you would like to do something simple directly in the drmkms system module: I don't know if it's easy to make it work but you can try. |
I think so too. It can do rotation, line drawing, fills etc. Very classic 2D hardware
Yes. I want to fix the issue in one place. DirectFB also has the bonus that it doubles up as a window manager multiple apps could be running at the same time. The machine that has the screen upside down is a gameboy shaped emulator machine.
Interesting. Thanks for the hint.
That's the idea. I have a kernel driver that exports a char device to control the blitter. I'm writing a little userspace library to operate it. Then DirectFB would call into the library to use the hardware.
This is mostly to fix up the rotation in one place. If the drmkms system module knows about the rotated screen and does what is needed to make apps appear correctly the whole system is a lot easier to put together. If the drmkms system level can also call the 2D blitter to do the rotation the CPU overhead is low and everything above DirectFB should just work. |
For reference here is the target SoC running DirectFB2 and SDL2 for ScummVM. |
I've made some progress on this. The drmkms system can now probe the display orientation from kernel side. |
Pretty close on this now. DFB supports rotation internally so it can already handle flipping around the inputs etc. |
Yes I forgot this rotate configuration option. So if you set rotate=180 in the directfbrc config file, you probably get the expected result. |
I thought that too but it currently doesn't work because the calculation for the blitting flags comes up with 0 degrees rotation.
This is certainly needed. With a 640x480 screen the overhead of rotation seems to be ok. But with a 1024x600 screen the CPU usage of my test app (chocolate doom) goes from 70% to 90%. |
When setting rotate=180, I can see that the image is flipped vertically and I have rotation = surface->rotation = 180, so after rotation -= surface->rotation => rotation = 0 in this case. |
Is that with the fbdev backend? maybe this is just a problem with drmkms? |
Yes you're right, I can see that the image is flipped vertically only with the fbdev system. We have different behaviors:
In drmkmsPrimaryUpdateRegion(), we have the surface->rotation information. |
I guess that surface->rotation should be the physical rotation of the surface (normally 0) but it's picking up the desired rotation. Edit: |
Found something interesting:
|
If you test for example with df_andi, you may also have different behaviors when using the force-windowed option: df_andi --dfb:force-windowed,scaled=x (width and height can be set to screen resolution) Yes, it would be nice to clarify (and possibly fix) all this, differences between 180 and 90/270, possible confusion between layer rotation (the rotate parameter) and surface rotation. And I would like to understand the different behaviors I get between fbdev and drmkms. |
Between fbdev and drmkms, dfb_surface_flip_buffers() may behave differently. In my case:
It actually depends on the result of fbdevPrimaryTestRegion() / drmkmsPrimaryTestRegion() when creating the surface. Hope we can clarify the correct behavior for layer rotation for all cases. |
Now that I've got hardware rotation running I've started looking at this again. |
Hi,
Sorry for the flood of issues.
I have a DRM/KMS driver, one of the machines that uses it has the screen mounted upside down. There is hardware to do rotation of a framebuffer but not on the framebuffer as it as being scanned out (i.e. it needs to be rotated into a second buffer). I was going to do this in the kernel driver itself. But was told "do it in userspace" (https://lore.kernel.org/all/CAFr9PXnig9YfnwSzMg5UPm3UtAsEAQT_xVheBbLppiU45mc_QQ@mail.gmail.com/).
I think I could hack up SDL1 to do the rotation before flip but SDL2 doesn't work with the DRM/KMS driver because there is no GPU to do the drawing (and mesa is massive etc).
So my plan is to fix the issue at the directfb2 level and then build SDL1/2 on top of directfb2.
Scanning through the current code I can't see the drmkms system consuming the orientation. Do you think it would be much work to have it parse it and the rotate the framebuffer before sending it to be displayed?
The text was updated successfully, but these errors were encountered: