Explorar el Código

[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
pull/2032/head
tomarigr hace 4 años
cometido por GitHub
padre
commit
5d8c477d12
No se encontró ninguna clave conocida en la base de datos para esta firma ID de clave GPG: 4AEE18F83AFDEB23
Se han modificado 1 ficheros con 7 adiciones y 2 borrados
  1. +7
    -2
      src/rcore.c

+ 7
- 2
src/rcore.c Ver fichero

@ -3912,8 +3912,13 @@ static bool InitGraphicsDevice(int width, int height)
#if defined(DEFAULT_GRAPHIC_DEVICE_DRM) #if defined(DEFAULT_GRAPHIC_DEVICE_DRM)
CORE.Window.fd = open(DEFAULT_GRAPHIC_DEVICE_DRM, O_RDWR); CORE.Window.fd = open(DEFAULT_GRAPHIC_DEVICE_DRM, O_RDWR);
#else #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)) if ((-1 == CORE.Window.fd) || (drmModeGetResources(CORE.Window.fd) == NULL))
{ {
TRACELOG(LOG_INFO, "DISPLAY: Failed to open graphic card1, trying card0"); TRACELOG(LOG_INFO, "DISPLAY: Failed to open graphic card1, trying card0");

Cargando…
Cancelar
Guardar