diff options
| author | tomarigr <[email protected]> | 2021-10-04 00:59:59 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-10-04 01:59:59 +0200 |
| commit | 5d8c477d12d6eba4a3c79f18173ebdb2df6b8280 (patch) | |
| tree | f7ce1eec6c5a40f192cef1a29dc8a8ad991a98c1 | |
| parent | 79f36799e7e8f7f76dfa53076cc3c3b023d704da (diff) | |
| download | raylib-5d8c477d12d6eba4a3c79f18173ebdb2df6b8280.tar.gz raylib-5d8c477d12d6eba4a3c79f18173ebdb2df6b8280.zip | |
[rcore] fix rpi4 Failed to get DRM resources (#2031)
* [rcore] fix rpi4 Failed to get DRM resources
card1 is not always the the correct card to use on rpi4
rpi os finds the correct card and links it to /dev/dri/by-path/platform-gpu-card during boot.
this fix makes sure that we always point to the correct card on rpi4
* Update rcore.c
| -rw-r--r-- | src/rcore.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/rcore.c b/src/rcore.c index cb212af3..7b16e7f7 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -3912,8 +3912,13 @@ static bool InitGraphicsDevice(int width, int height) #if defined(DEFAULT_GRAPHIC_DEVICE_DRM) CORE.Window.fd = open(DEFAULT_GRAPHIC_DEVICE_DRM, O_RDWR); #else - TRACELOG(LOG_INFO, "DISPLAY: No graphic card set, trying card1"); - CORE.Window.fd = open("/dev/dri/card1", O_RDWR); // VideoCore VI (Raspberry Pi 4) + TRACELOG(LOG_INFO, "DISPLAY: No graphic card set, trying platform-gpu-card"); + CORE.Window.fd = open("/dev/dri/by-path/platform-gpu-card", O_RDWR); // VideoCore VI (Raspberry Pi 4) + if ((-1 == CORE.Window.fd) || (drmModeGetResources(CORE.Window.fd) == NULL)) + { + TRACELOG(LOG_INFO, "DISPLAY: Failed to open platform-gpu-card, trying card1"); + CORE.Window.fd = open("/dev/dri/card1", O_RDWR); // Other Embedded + } if ((-1 == CORE.Window.fd) || (drmModeGetResources(CORE.Window.fd) == NULL)) { TRACELOG(LOG_INFO, "DISPLAY: Failed to open graphic card1, trying card0"); |
