We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3792

Summary: [KMS/DRM] Wrong GBM format
Product: SDL Reporter: Romain Tisserand <romain.tisserand>
Component: videoAssignee: Brandon Schaefer <brandontschaefer>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: Linux   

Description Romain Tisserand 2017-09-01 09:58:10 UTC
Using KMS/DRM driver from WIP SDL2.0.6 on Linux/ARM SoC RockChip RK3328 (ARM Mali 450 MP2 GPU).

The current code is using GBM_BO_FORMAT_XRGB8888 as GBM buffer format specifier.

The Mali driver (it has been confirmed some other vendor implementations too) expects GBM_FORMAT_XRGB8888.

The Mesa implementation is actually handling both values as the same, but it's not implemented like this into every gbm.h vendor header.

https://github.com/ideak/mesa/blob/master/src/gbm/backends/dri/gbm_dri.c

So with stock SDL2 on my card (Mali vendor implementation), it does not work, eglCreateWindowSurface fails, and gbm_is_format_supported fails too (with the BO variant).
It runs fine with GBM_FORMAT_XRGB8888.

Here is a link of the gbm.h from Mali user-space driver :

https://github.com/rockchip-linux/libmali/blob/rockchip/include/gbm.h
Comment 1 Sam Lantinga 2017-09-01 17:26:56 UTC
Brandon, can you look at this and push a patch if appropriate?

Thanks!
Comment 2 Brandon Schaefer 2017-09-01 18:18:47 UTC
Yup! Was looking into it, but seems most usages of gbm_surface_create I see end up using GBM_BO_FORMAT_XRGB8888. Though Ive only ever tested things out on mesa :)

If the mesa driver seems to handle both I dont see an issue pushing that change. Ill test on the devices I have (raspi3/x86) to double check and Ill chase down if its possibly a driver bug in libmali not supporting that enum the same way mesa does.

Thanks again for testing this backend out!
Comment 3 Sam Lantinga 2017-09-01 19:54:11 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/11413fa29401
Comment 4 Brandon Schaefer 2017-09-01 21:00:08 UTC
Awesome, and tested on raspi3 and intel amd64 working.

Thanks again!