From dd5ee8846e551bc71b67c02e57bbcaf51c5d758d Mon Sep 17 00:00:00 2001 From: dmoreno Date: Mon, 22 Jun 2026 13:45:43 +0200 Subject: [PATCH] Changes that allows PLATFORM_DRM to work on NVIDIA Orin platform --- src/platforms/rcore_drm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/platforms/rcore_drm.c b/src/platforms/rcore_drm.c index 659c80011..45ab835d1 100644 --- a/src/platforms/rcore_drm.c +++ b/src/platforms/rcore_drm.c @@ -1373,8 +1373,14 @@ int InitPlatform(void) return -1; } +#if !defined(TEGRA_COMPATIBILITY) platform.gbmSurface = gbm_surface_create(platform.gbmDevice, platform.connector->modes[platform.modeIndex].hdisplay, platform.connector->modes[platform.modeIndex].vdisplay, GBM_FORMAT_ARGB8888, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); +#else + uint64_t mod = DRM_FORMAT_MOD_LINEAR; + platform.gbmSurface = gbm_surface_create(platform.gbmDevice, platform.connector->modes[platform.modeIndex].hdisplay, + platform.connector->modes[platform.modeIndex].vdisplay, GBM_FORMAT_ARGB8888, &mod, 1); +#endif if (!platform.gbmSurface) { TRACELOG(LOG_WARNING, "DISPLAY: Failed to create GBM surface"); @@ -1446,7 +1452,7 @@ int InitPlatform(void) return -1; } - if (!eglChooseConfig(platform.device, NULL, NULL, 0, &numConfigs)) + if (!eglGetConfigs(platform.device, NULL, 0, &numConfigs)) { TRACELOG(LOG_WARNING, "DISPLAY: Failed to get EGL config count: 0x%x", eglGetError()); return -1; @@ -1650,6 +1656,7 @@ void ClosePlatform(void) } #if !defined(GRAPHICS_API_OPENGL_SOFTWARE) +#if !defined(TEGRA_COMPATIBILITY) if (platform.prevBO) { gbm_surface_release_buffer(platform.gbmSurface, platform.prevBO); @@ -1667,6 +1674,7 @@ void ClosePlatform(void) gbm_device_destroy(platform.gbmDevice); platform.gbmDevice = NULL; } +#endif #endif if (platform.crtc) @@ -2732,4 +2740,4 @@ static void SetupFramebuffer(int width, int height) } } -// EOF \ No newline at end of file +// EOF