Open fifteenhex opened 1 year ago
Just to make sure I understand correctly, SDL2 applications:
I know you have size constraints to embed the DirectFB examples, but it might be interesting to be able to run df_andi and df_dok with directfb2-ge hardware acceleration and this ILI9341 TFT screen (this will also give an idea of performance).
SDL2 uses an IDirectFBWindow object: I don't know if the df_window example is able to start on a 320x240 screen but maybe the hardcoded sizes in the example can be updated for a simple test.
Just to make sure I understand correctly, SDL2 applications:
- are able to start when using the drmkms system module alone, regardless of the screen
With the fix for the pixel format, yes.
- fail when using drmkms system module + directfb2-ge GFX driver on ILI9341 TFT screen, but are able to start on another screen
I need to recheck this but they used to work on almost the same hardware on a bigger screen. The bigger screen is also 24 bit hence not noticing the pixel format issue before.
On the smaller SPI screen SDL2 applications will run with the hardware acceleration enabled but they constantly output the buffer allocation issue. The screen is being drawn though so it must be falling back to software.
I know you have size constraints to embed the DirectFB examples, but it might be interesting to be able to run df_andi and df_dok with directfb2-ge hardware acceleration and this ILI9341 TFT screen (this will also give an idea of performance).
Going to try that.. I need to change the examples meson file a bit so I can select what to install. I don't think the performance will change that much on the SPI screen. Performance with/without GE on the bigger screen is night and day though.
SDL2 uses an IDirectFBWindow object: I don't know if the df_window example is able to start on a 320x240 screen but maybe the hardcoded sizes in the example can be updated for a simple test.
I'll take a look.
Notes:
This works around the issue and I can see blits being done with the hardware now:
diff --git a/systems/drmkms/drmkms_surface_pool.c b/systems/drmkms/drmkms_surface_pool.c
index d4014027cd23..72f506d19142 100644
--- a/systems/drmkms/drmkms_surface_pool.c
+++ b/systems/drmkms/drmkms_surface_pool.c
@@ -414,7 +414,8 @@ drmkmsAllocateBuffer( CoreSurfacePool *pool,
allocation->size = alloc->size;
allocation->offset = alloc->prime_fd;
- if (surface->type & (CSTF_LAYER | CSTF_WINDOW) && Core_GetIdentity() == local->core->fusion_id) {
+ //| CSTF_WINDOW
+ if ((surface->type & (CSTF_LAYER)) && Core_GetIdentity() == local->core->fusion_id) {
u32 handles[4] = { 0, 0, 0, 0 };
u32 pitches[4] = { 0, 0, 0, 0 };
u32 offsets[4] = { 0, 0, 0, 0 };
I'm not sure what this logic is supposed to do. Certain buffers need to be directly added to the CRTC to start scan out? The window layer created by/for SDL2 is getting caught by this and then DRM/KMS says no.
The CPU usage is ~10% lower for the few things I've tried so certainly isn't a waste of time.
I don't see issues when running DirectFB applications with this change. So if this gets your hardware working, let's push it: can you create a pull request?
let's push it: can you create a pull request?
Sure. I want to quickly test I didn't break my other DFB2 using system and then I'll create a PR.
Notes as I debug this:
Output from scummvm (SDL2 + directfb2 + drm/kms + my hw driver):
Backtrace from the `drmModeAddFB2()' line:
DRM/KMS debug
Seems to be with hw enabled the geometry of the buffer is wrong and DRM/KMS is rejecting it.