Update to SDL2.0.10

This commit is contained in:
Areloch 2019-08-19 23:30:35 -05:00
parent 600859bd63
commit c932bda8dd
915 changed files with 116675 additions and 21754 deletions

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -51,6 +51,8 @@ static void RPI_FreeCursor(SDL_Cursor * cursor);
static void RPI_WarpMouse(SDL_Window * window, int x, int y);
static int RPI_WarpMouseGlobal(int x, int y);
static SDL_Cursor *global_cursor;
static SDL_Cursor *
RPI_CreateDefaultCursor(void)
{
@ -126,13 +128,11 @@ RPI_ShowCursor(SDL_Cursor * cursor)
return -1;
}
if (cursor == NULL) {
/* FIXME: We hide the current mouse's cursor, what we actually need is *_HideCursor */
if (mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) {
curdata = (RPI_CursorData *) mouse->cur_cursor->driverdata;
if (curdata->element > DISPMANX_NO_HANDLE) {
update = vc_dispmanx_update_start(10);
if (cursor != global_cursor) {
if (global_cursor != NULL) {
curdata = (RPI_CursorData *) global_cursor->driverdata;
if (curdata && curdata->element > DISPMANX_NO_HANDLE) {
update = vc_dispmanx_update_start(0);
SDL_assert(update);
ret = vc_dispmanx_element_remove(update, curdata->element);
SDL_assert(ret == DISPMANX_SUCCESS);
@ -141,6 +141,10 @@ RPI_ShowCursor(SDL_Cursor * cursor)
curdata->element = DISPMANX_NO_HANDLE;
}
}
global_cursor = cursor;
}
if (cursor == NULL) {
return 0;
}
@ -152,7 +156,7 @@ RPI_ShowCursor(SDL_Cursor * cursor)
if (mouse->focus == NULL) {
return -1;
}
display = SDL_GetDisplayForWindow(mouse->focus);
if (display == NULL) {
return -1;
@ -165,9 +169,9 @@ RPI_ShowCursor(SDL_Cursor * cursor)
if (curdata->element == DISPMANX_NO_HANDLE) {
vc_dispmanx_rect_set(&src_rect, 0, 0, curdata->w << 16, curdata->h << 16);
vc_dispmanx_rect_set(&dst_rect, mouse->x, mouse->y, curdata->w, curdata->h);
vc_dispmanx_rect_set(&dst_rect, mouse->x - curdata->hot_x, mouse->y - curdata->hot_y, curdata->w, curdata->h);
update = vc_dispmanx_update_start(10);
update = vc_dispmanx_update_start(0);
SDL_assert(update);
env = SDL_GetHint(SDL_HINT_RPI_VIDEO_LAYER);
@ -184,7 +188,7 @@ RPI_ShowCursor(SDL_Cursor * cursor)
DISPMANX_PROTECTION_NONE,
&alpha,
DISPMANX_NO_HANDLE, // clamp
VC_IMAGE_ROT0);
DISPMANX_NO_ROTATE);
SDL_assert(curdata->element > DISPMANX_NO_HANDLE);
ret = vc_dispmanx_update_submit_sync(update);
SDL_assert(ret == DISPMANX_SUCCESS);
@ -206,7 +210,7 @@ RPI_FreeCursor(SDL_Cursor * cursor)
if (curdata != NULL) {
if (curdata->element != DISPMANX_NO_HANDLE) {
update = vc_dispmanx_update_start(10);
update = vc_dispmanx_update_start(0);
SDL_assert(update);
ret = vc_dispmanx_element_remove(update, curdata->element);
SDL_assert(ret == DISPMANX_SUCCESS);
@ -255,7 +259,7 @@ RPI_WarpMouseGlobal(int x, int y)
return 0;
}
update = vc_dispmanx_update_start(10);
update = vc_dispmanx_update_start(0);
if (!update) {
return 0;
}
@ -264,8 +268,8 @@ RPI_WarpMouseGlobal(int x, int y)
src_rect.y = 0;
src_rect.width = curdata->w << 16;
src_rect.height = curdata->h << 16;
dst_rect.x = x;
dst_rect.y = y;
dst_rect.x = x - curdata->hot_x;
dst_rect.y = y - curdata->hot_y;
dst_rect.width = curdata->w;
dst_rect.height = curdata->h;
@ -311,7 +315,7 @@ RPI_WarpMouseGlobalGraphicOnly(int x, int y)
return 0;
}
update = vc_dispmanx_update_start(10);
update = vc_dispmanx_update_start(0);
if (!update) {
return 0;
}
@ -320,8 +324,8 @@ RPI_WarpMouseGlobalGraphicOnly(int x, int y)
src_rect.y = 0;
src_rect.width = curdata->w << 16;
src_rect.height = curdata->h << 16;
dst_rect.x = x;
dst_rect.y = y;
dst_rect.x = x - curdata->hot_x;
dst_rect.y = y - curdata->hot_y;
dst_rect.width = curdata->w;
dst_rect.height = curdata->h;
@ -368,7 +372,6 @@ RPI_InitMouse(_THIS)
void
RPI_QuitMouse(_THIS)
{
}
/* This is called when a mouse motion event occurs */

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -154,28 +154,34 @@ VideoBootStrap RPI_bootstrap = {
RPI_Create
};
/*****************************************************************************/
/* SDL Video and Display initialization/handling functions */
/*****************************************************************************/
int
RPI_VideoInit(_THIS)
static void
AddDispManXDisplay(const int display_id)
{
DISPMANX_MODEINFO_T modeinfo;
DISPMANX_DISPLAY_HANDLE_T handle;
SDL_VideoDisplay display;
SDL_DisplayMode current_mode;
SDL_DisplayData *data;
uint32_t w,h;
/* Initialize BCM Host */
bcm_host_init();
SDL_zero(current_mode);
if (graphics_get_display_size( 0, &w, &h) < 0) {
return -1;
handle = vc_dispmanx_display_open(display_id);
if (!handle) {
return; /* this display isn't available */
}
current_mode.w = w;
current_mode.h = h;
if (vc_dispmanx_display_get_info(handle, &modeinfo) < 0) {
vc_dispmanx_display_close(handle);
return;
}
/* RPI_GetRefreshRate() doesn't distinguish between displays. I'm not sure the hardware distinguishes either */
SDL_zero(current_mode);
current_mode.w = modeinfo.width;
current_mode.h = modeinfo.height;
current_mode.refresh_rate = RPI_GetRefreshRate();
/* 32 bpp for default */
current_mode.format = SDL_PIXELFORMAT_ABGR8888;
@ -189,14 +195,25 @@ RPI_VideoInit(_THIS)
/* Allocate display internal data */
data = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData));
if (data == NULL) {
return SDL_OutOfMemory();
vc_dispmanx_display_close(handle);
return; /* oh well */
}
data->dispman_display = vc_dispmanx_display_open( 0 /* LCD */);
data->dispman_display = handle;
display.driverdata = data;
SDL_AddVideoDisplay(&display);
}
int
RPI_VideoInit(_THIS)
{
/* Initialize BCM Host */
bcm_host_init();
AddDispManXDisplay(DISPMANX_ID_MAIN_LCD); /* your default display */
AddDispManXDisplay(DISPMANX_ID_FORCE_OTHER); /* an "other" display...maybe DSI-connected screen while HDMI is your main */
#ifdef SDL_INPUT_LINUXEV
if (SDL_EVDEV_Init() < 0) {
@ -343,17 +360,17 @@ RPI_DestroyWindow(_THIS, SDL_Window * window)
SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
if(data) {
if (data->double_buffer) {
/* Wait for vsync, and then stop vsync callbacks and destroy related stuff, if needed */
SDL_LockMutex(data->vsync_cond_mutex);
SDL_CondWait(data->vsync_cond, data->vsync_cond_mutex);
SDL_UnlockMutex(data->vsync_cond_mutex);
if (data->double_buffer) {
/* Wait for vsync, and then stop vsync callbacks and destroy related stuff, if needed */
SDL_LockMutex(data->vsync_cond_mutex);
SDL_CondWait(data->vsync_cond, data->vsync_cond_mutex);
SDL_UnlockMutex(data->vsync_cond_mutex);
vc_dispmanx_vsync_callback(displaydata->dispman_display, NULL, NULL);
vc_dispmanx_vsync_callback(displaydata->dispman_display, NULL, NULL);
SDL_DestroyCond(data->vsync_cond);
SDL_DestroyMutex(data->vsync_cond_mutex);
}
SDL_DestroyCond(data->vsync_cond);
SDL_DestroyMutex(data->vsync_cond_mutex);
}
#if SDL_VIDEO_OPENGL_EGL
if (data->egl_surface != EGL_NO_SURFACE) {

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages