From 2e5208f353f51a62cae5bf648e54af6e5205e012 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Thu, 5 Dec 2024 10:23:37 -0500
Subject: [PATCH] kmsdrm: Fix Vulkan type redefinition errors from commit
24ed947cc35ebb9f50ac0685f1b88ec164d46c6c
---
src/video/kmsdrm/SDL_kmsdrmopengles.h | 1 -
src/video/kmsdrm/SDL_kmsdrmvideo.c | 14 ++++++--------
src/video/kmsdrm/SDL_kmsdrmvulkan.h | 3 +--
3 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/src/video/kmsdrm/SDL_kmsdrmopengles.h b/src/video/kmsdrm/SDL_kmsdrmopengles.h
index 41eaf0bb1005f..e1c11e89fc781 100644
--- a/src/video/kmsdrm/SDL_kmsdrmopengles.h
+++ b/src/video/kmsdrm/SDL_kmsdrmopengles.h
@@ -23,7 +23,6 @@
#ifndef SDL_kmsdrmopengles_h_
#define SDL_kmsdrmopengles_h_
-#include "../SDL_sysvideo.h"
#include "../SDL_egl_c.h"
// OpenGLES functions
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index e5cdaed351ba8..6c2e7a691af2c 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -23,15 +23,11 @@
#ifdef SDL_VIDEO_DRIVER_KMSDRM
-/* Include this before SDL_kmsdrmvulkan.h, as the Vulkan header can pull in
- * Wayland headers, which pull in EGL headers with EGL types defined as Wayland
- * types, which causes warnings when building with strict-aliasing and LTO.
+/* Include this first, as some system headers may pull in EGL headers that
+ * define EGL types as native types for other enabled platforms, which can
+ * result in type-mismatch warnings when building with LTO.
*/
-#include "SDL_kmsdrmopengles.h"
-
-/* include this here before SDL_sysvideo.h to avoid vulkan type
- * redefinition errors. it already includes SDL_sysvideo.h. */
-#include "SDL_kmsdrmvulkan.h"
+#include "../SDL_egl_c.h"
// SDL internals
#include "../../events/SDL_events_c.h"
@@ -49,6 +45,8 @@
#include "SDL_kmsdrmevents.h"
#include "SDL_kmsdrmmouse.h"
#include "SDL_kmsdrmvideo.h"
+#include "SDL_kmsdrmopengles.h"
+#include "SDL_kmsdrmvulkan.h"
#include <dirent.h>
#include <errno.h>
#include <poll.h>
diff --git a/src/video/kmsdrm/SDL_kmsdrmvulkan.h b/src/video/kmsdrm/SDL_kmsdrmvulkan.h
index 41ca95a7f5c06..c2cb7ffeafe0f 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvulkan.h
+++ b/src/video/kmsdrm/SDL_kmsdrmvulkan.h
@@ -29,8 +29,7 @@
#ifndef SDL_kmsdrm_vulkan_h_
#define SDL_kmsdrm_vulkan_h_
-#include "../SDL_vulkan_internal.h"
-#include "../SDL_sysvideo.h"
+#include <SDL3/SDL_vulkan.h>
#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_KMSDRM)