kmsdrm_legacy build fixes: - add missing '_LEGACY' to symbol names - perform missing 2.0.14 portage - fix 'for' loop initial declarations are only allowed in C99 mode errors
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
diff --git a/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_dyn.c b/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_dyn.c
index 26bdc2b..019c8e1 100644
--- a/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_dyn.c
+++ b/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_dyn.c
@@ -79,9 +79,9 @@ KMSDRM_LEGACY_GetSym(const char *fnname, int *pHasModule)
#endif /* SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC */
/* Define all the function pointers and wrappers... */
-#define SDL_KMSDRM_LEGACY_MODULE(modname) int SDL_KMSDRM_HAVE_##modname = 0;
-#define SDL_KMSDRM_LEGACY_SYM(rc,fn,params) SDL_DYNKMSDRMFN_##fn KMSDRM_##fn = NULL;
-#define SDL_KMSDRM_LEGACY_SYM_CONST(type,name) SDL_DYNKMSDRMCONST_##name KMSDRM_##name = NULL;
+#define SDL_KMSDRM_LEGACY_MODULE(modname) int SDL_KMSDRM_LEGACY_HAVE_##modname = 0;
+#define SDL_KMSDRM_LEGACY_SYM(rc,fn,params) SDL_DYNKMSDRM_LEGACYFN_##fn KMSDRM_LEGACY_##fn = NULL;
+#define SDL_KMSDRM_LEGACY_SYM_CONST(type,name) SDL_DYNKMSDRM_LEGACYCONST_##name KMSDRM_LEGACY_##name = NULL;
#include "SDL_kmsdrm_legacy_sym.h"
static int kmsdrm_load_refcount = 0;
@@ -97,9 +97,9 @@ SDL_KMSDRM_LEGACY_UnloadSymbols(void)
#endif
/* set all the function pointers to NULL. */
-#define SDL_KMSDRM_LEGACY_MODULE(modname) SDL_KMSDRM_HAVE_##modname = 0;
-#define SDL_KMSDRM_LEGACY_SYM(rc,fn,params) KMSDRM_##fn = NULL;
-#define SDL_KMSDRM_LEGACY_SYM_CONST(type,name) KMSDRM_##name = NULL;
+#define SDL_KMSDRM_LEGACY_MODULE(modname) SDL_KMSDRM_LEGACY_HAVE_##modname = 0;
+#define SDL_KMSDRM_LEGACY_SYM(rc,fn,params) KMSDRM_LEGACY_##fn = NULL;
+#define SDL_KMSDRM_LEGACY_SYM_CONST(type,name) KMSDRM_LEGACY_##name = NULL;
#include "SDL_kmsdrm_legacy_sym.h"
@@ -132,15 +132,15 @@ SDL_KMSDRM_LEGACY_LoadSymbols(void)
}
}
-#define SDL_KMSDRM_LEGACY_MODULE(modname) SDL_KMSDRM_HAVE_##modname = 1; /* default yes */
+#define SDL_KMSDRM_LEGACY_MODULE(modname) SDL_KMSDRM_LEGACY_HAVE_##modname = 1; /* default yes */
#include "SDL_kmsdrm_legacy_sym.h"
-#define SDL_KMSDRM_LEGACY_MODULE(modname) thismod = &SDL_KMSDRM_HAVE_##modname;
-#define SDL_KMSDRM_LEGACY_SYM(rc,fn,params) KMSDRM_##fn = (SDL_DYNKMSDRMFN_##fn) KMSDRM_GetSym(#fn,thismod);
-#define SDL_KMSDRM_LEGACY_SYM_CONST(type,name) KMSDRM_##name = *(SDL_DYNKMSDRMCONST_##name*) KMSDRM_GetSym(#name,thismod);
+#define SDL_KMSDRM_LEGACY_MODULE(modname) thismod = &SDL_KMSDRM_LEGACY_HAVE_##modname;
+#define SDL_KMSDRM_LEGACY_SYM(rc,fn,params) KMSDRM_LEGACY_##fn = (SDL_DYNKMSDRM_LEGACYFN_##fn) KMSDRM_LEGACY_GetSym(#fn,thismod);
+#define SDL_KMSDRM_LEGACY_SYM_CONST(type,name) KMSDRM_LEGACY_##name = *(SDL_DYNKMSDRM_LEGACYCONST_##name*) KMSDRM_LEGACY_GetSym(#name,thismod);
#include "SDL_kmsdrm_legacy_sym.h"
- if ((SDL_KMSDRM_LEGACY_HAVE_LIBDRM) && (SDL_KMSDRM_HAVE_GBM)) {
+ if ((SDL_KMSDRM_LEGACY_HAVE_LIBDRM) && (SDL_KMSDRM_LEGACY_HAVE_GBM)) {
/* all required symbols loaded. */
SDL_ClearError();
} else {
@@ -151,9 +151,9 @@ SDL_KMSDRM_LEGACY_LoadSymbols(void)
#else /* no dynamic KMSDRM_LEGACY */
-#define SDL_KMSDRM_LEGACY_MODULE(modname) SDL_KMSDRM_HAVE_##modname = 1; /* default yes */
-#define SDL_KMSDRM_LEGACY_SYM(rc,fn,params) KMSDRM_##fn = fn;
-#define SDL_KMSDRM_LEGACY_SYM_CONST(type,name) KMSDRM_##name = name;
+#define SDL_KMSDRM_LEGACY_MODULE(modname) SDL_KMSDRM_LEGACY_HAVE_##modname = 1; /* default yes */
+#define SDL_KMSDRM_LEGACY_SYM(rc,fn,params) KMSDRM_LEGACY_##fn = fn;
+#define SDL_KMSDRM_LEGACY_SYM_CONST(type,name) KMSDRM_LEGACY_##name = name;
#include "SDL_kmsdrm_legacy_sym.h"
#endif
diff --git a/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_dyn.h b/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_dyn.h
index 6ff8a31..3cb67b0 100644
--- a/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_dyn.h
+++ b/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_dyn.h
@@ -38,10 +38,10 @@ void SDL_KMSDRM_LEGACY_UnloadSymbols(void);
/* Declare all the function pointers and wrappers... */
#define SDL_KMSDRM_LEGACY_SYM(rc,fn,params) \
typedef rc (*SDL_DYNKMSDRM_LEGACYFN_##fn) params; \
- extern SDL_DYNKMSDRM_LEGACYFN_##fn KMSDRM_##fn;
+ extern SDL_DYNKMSDRM_LEGACYFN_##fn KMSDRM_LEGACY_##fn;
#define SDL_KMSDRM_LEGACY_SYM_CONST(type, name) \
typedef type SDL_DYNKMSDRM_LEGACYCONST_##name; \
- extern SDL_DYNKMSDRM_LEGACYCONST_##name KMSDRM_##name;
+ extern SDL_DYNKMSDRM_LEGACYCONST_##name KMSDRM_LEGACY_##name;
#include "SDL_kmsdrm_legacy_sym.h"
#ifdef __cplusplus
diff --git a/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_mouse.c b/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_mouse.c
index 0357b83..c980ebb 100644
--- a/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_mouse.c
+++ b/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_mouse.c
@@ -394,7 +394,7 @@ KMSDRM_LEGACY_FreeCursor(SDL_Cursor * cursor)
if (curdata) {
if (curdata->bo) {
if (curdata->crtc_id != 0) {
- drm_fd = KMSDRM_LEGACY_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo));
+ drm_fd = KMSDRM_LEGACY_gbm_device_get_fd(KMSDRM_LEGACY_gbm_bo_get_device(curdata->bo));
/* Hide the cursor if previously shown on a CRTC */
KMSDRM_LEGACY_drmModeSetCursor(drm_fd, curdata->crtc_id, 0, 0, 0);
curdata->crtc_id = 0;
@@ -433,7 +433,7 @@ KMSDRM_LEGACY_WarpMouseGlobal(int x, int y)
if (curdata->crtc_id != 0) {
int ret, drm_fd;
- drm_fd = KMSDRM_LEGACY_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo));
+ drm_fd = KMSDRM_LEGACY_gbm_device_get_fd(KMSDRM_LEGACY_gbm_bo_get_device(curdata->bo));
ret = KMSDRM_LEGACY_drmModeMoveCursor(drm_fd, curdata->crtc_id, x, y);
if (ret) {
@@ -488,7 +488,7 @@ KMSDRM_LEGACY_MoveCursor(SDL_Cursor * cursor)
That's why we move the cursor graphic ONLY. */
if (mouse && mouse->cur_cursor && mouse->cur_cursor->driverdata) {
curdata = (KMSDRM_LEGACY_CursorData *) mouse->cur_cursor->driverdata;
- drm_fd = KMSDRM_LEGACY_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo));
+ drm_fd = KMSDRM_LEGACY_gbm_device_get_fd(KMSDRM_LEGACY_gbm_bo_get_device(curdata->bo));
ret = KMSDRM_LEGACY_drmModeMoveCursor(drm_fd, curdata->crtc_id, mouse->x, mouse->y);
if (ret) {
diff --git a/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_video.c b/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_video.c
index 666415d..36b1899 100644
--- a/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_video.c
+++ b/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_video.c
@@ -160,6 +160,10 @@ KMSDRM_LEGACY_CreateDevice(int devindex)
SDL_VideoDevice *device;
SDL_VideoData *viddata;
+ if (!KMSDRM_LEGACY_Available()) {
+ return NULL;
+ }
+
if (!devindex || (devindex > 99)) {
devindex = get_driindex();
}
@@ -236,7 +240,6 @@ cleanup:
VideoBootStrap KMSDRM_LEGACY_bootstrap = {
"KMSDRM_LEGACY",
"KMS/DRM Video Driver",
- KMSDRM_LEGACY_Available,
KMSDRM_LEGACY_CreateDevice
};
@@ -244,7 +247,7 @@ VideoBootStrap KMSDRM_LEGACY_bootstrap = {
static void
KMSDRM_LEGACY_FBDestroyCallback(struct gbm_bo *bo, void *data)
{
- KMSDRM_LEGACY_FBInfo *fb_info = (KMSDRM_FBInfo *)data;
+ KMSDRM_LEGACY_FBInfo *fb_info = (KMSDRM_LEGACY_FBInfo *)data;
if (fb_info && fb_info->drm_fd >= 0 && fb_info->fb_id != 0) {
KMSDRM_LEGACY_drmModeRmFB(fb_info->drm_fd, fb_info->fb_id);
@@ -263,7 +266,7 @@ KMSDRM_LEGACY_FBFromBO(_THIS, struct gbm_bo *bo)
Uint32 stride, handle;
/* Check for an existing framebuffer */
- KMSDRM_LEGACY_FBInfo *fb_info = (KMSDRM_FBInfo *)KMSDRM_gbm_bo_get_user_data(bo);
+ KMSDRM_LEGACY_FBInfo *fb_info = (KMSDRM_LEGACY_FBInfo *)KMSDRM_LEGACY_gbm_bo_get_user_data(bo);
if (fb_info) {
return fb_info;
@@ -271,7 +274,7 @@ KMSDRM_LEGACY_FBFromBO(_THIS, struct gbm_bo *bo)
/* Create a structure that contains enough info to remove the framebuffer
when the backing buffer is destroyed */
- fb_info = (KMSDRM_LEGACY_FBInfo *)SDL_calloc(1, sizeof(KMSDRM_FBInfo));
+ fb_info = (KMSDRM_LEGACY_FBInfo *)SDL_calloc(1, sizeof(KMSDRM_LEGACY_FBInfo));
if (!fb_info) {
SDL_OutOfMemory();
@@ -296,7 +299,7 @@ KMSDRM_LEGACY_FBFromBO(_THIS, struct gbm_bo *bo)
fb_info->fb_id, w, h, stride, (void *)bo);
/* Associate our DRM framebuffer with this buffer object */
- KMSDRM_LEGACY_gbm_bo_set_user_data(bo, fb_info, KMSDRM_FBDestroyCallback);
+ KMSDRM_LEGACY_gbm_bo_set_user_data(bo, fb_info, KMSDRM_LEGACY_FBDestroyCallback);
return fb_info;
}
@@ -430,7 +433,7 @@ KMSDRM_LEGACY_CreateSurfaces(_THIS, SDL_Window * window)
int
KMSDRM_LEGACY_VideoInit(_THIS)
{
- int ret = 0;
+ int i, j, ret = 0;
SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
SDL_DisplayData *dispdata = NULL;
drmModeRes *resources = NULL;
@@ -472,7 +475,7 @@ KMSDRM_LEGACY_VideoInit(_THIS)
goto cleanup;
}
- for (int i = 0; i < resources->count_connectors; i++) {
+ for (i = 0; i < resources->count_connectors; i++) {
drmModeConnector *conn = KMSDRM_LEGACY_drmModeGetConnector(viddata->drm_fd, resources->connectors[i]);
if (!conn) {
@@ -495,7 +498,7 @@ KMSDRM_LEGACY_VideoInit(_THIS)
}
/* Try to find the connector's current encoder */
- for (int i = 0; i < resources->count_encoders; i++) {
+ for (i = 0; i < resources->count_encoders; i++) {
encoder = KMSDRM_LEGACY_drmModeGetEncoder(viddata->drm_fd, resources->encoders[i]);
if (!encoder) {
@@ -513,7 +516,7 @@ KMSDRM_LEGACY_VideoInit(_THIS)
if (!encoder) {
/* No encoder was connected, find the first supported one */
- for (int i = 0, j; i < resources->count_encoders; i++) {
+ for (i = 0; i < resources->count_encoders; i++) {
encoder = KMSDRM_LEGACY_drmModeGetEncoder(viddata->drm_fd, resources->encoders[i]);
if (!encoder) {
@@ -547,7 +550,7 @@ KMSDRM_LEGACY_VideoInit(_THIS)
if (!dispdata->saved_crtc) {
/* No CRTC was connected, find the first CRTC that can be connected */
- for (int i = 0; i < resources->count_crtcs; i++) {
+ for (i = 0; i < resources->count_crtcs; i++) {
if (encoder->possible_crtcs & (1 << i)) {
encoder->crtc_id = resources->crtcs[i];
dispdata->saved_crtc = KMSDRM_LEGACY_drmModeGetCrtc(viddata->drm_fd, encoder->crtc_id);
@@ -594,7 +597,7 @@ KMSDRM_LEGACY_VideoInit(_THIS)
#endif
display.current_mode = display.desktop_mode;
display.driverdata = dispdata;
- SDL_AddVideoDisplay(&display);
+ SDL_AddVideoDisplay(&display, SDL_FALSE);
#ifdef SDL_INPUT_LINUXEV
SDL_EVDEV_Init();
@@ -691,8 +694,9 @@ KMSDRM_LEGACY_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
SDL_DisplayData *dispdata = display->driverdata;
drmModeConnector *conn = dispdata->conn;
SDL_DisplayMode mode;
+ int i;
- for (int i = 0; i < conn->count_modes; i++) {
+ for (i = 0; i < conn->count_modes; i++) {
SDL_DisplayModeData *modedata = SDL_calloc(1, sizeof(SDL_DisplayModeData));
if (modedata) {
@@ -718,6 +722,7 @@ KMSDRM_LEGACY_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode
SDL_DisplayData *dispdata = (SDL_DisplayData *)display->driverdata;
SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)mode->driverdata;
drmModeConnector *conn = dispdata->conn;
+ int i;
if (!modedata) {
return SDL_SetError("Mode doesn't have an associated index");
@@ -725,7 +730,7 @@ KMSDRM_LEGACY_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode
dispdata->mode = conn->modes[modedata->mode_index];
- for (int i = 0; i < viddata->num_windows; i++) {
+ for (i = 0; i < viddata->num_windows; i++) {
SDL_Window *window = viddata->windows[i];
SDL_WindowData *windata = (SDL_WindowData *)window->driverdata;
@@ -826,6 +831,8 @@ KMSDRM_LEGACY_DestroyWindow(_THIS, SDL_Window * window)
{
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
SDL_VideoData *viddata;
+ int i, j;
+
if (!windata) {
return;
}
@@ -833,11 +840,11 @@ KMSDRM_LEGACY_DestroyWindow(_THIS, SDL_Window * window)
/* Remove from the internal window list */
viddata = windata->viddata;
- for (int i = 0; i < viddata->num_windows; i++) {
+ for (i = 0; i < viddata->num_windows; i++) {
if (viddata->windows[i] == window) {
viddata->num_windows--;
- for (int j = i; j < viddata->num_windows; j++) {
+ for (j = i; j < viddata->num_windows; j++) {
viddata->windows[j] = viddata->windows[j + 1];
}
diff --git a/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_video.h b/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_video.h
index bb19fe5..28e1bc4 100644
--- a/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_video.h
+++ b/src/video/kmsdrm_legacy/SDL_kmsdrm_legacy_video.h
@@ -85,7 +85,7 @@ typedef struct KMSDRM_LEGACY_FBInfo
/* Helper functions */
int KMSDRM_LEGACY_CreateSurfaces(_THIS, SDL_Window * window);
-KMSDRM_LEGACY_FBInfo *KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo);
+KMSDRM_LEGACY_FBInfo *KMSDRM_LEGACY_FBFromBO(_THIS, struct gbm_bo *bo);
SDL_bool KMSDRM_LEGACY_WaitPageFlip(_THIS, SDL_WindowData *windata, int timeout);
/****************************************************************************/