mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2025-01-22 01:57:18 +01:00
kmsdrm: Do NOT modify window size manually from the backend: doing so caused renderer scaling params miscalculation.
This commit is contained in:
parent
c09d1cee95
commit
f4e02a5c1b
@ -143,8 +143,8 @@ KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window)
|
|||||||
info.crtc_id = dispdata->crtc->crtc->crtc_id;
|
info.crtc_id = dispdata->crtc->crtc->crtc_id;
|
||||||
info.fb_id = fb->fb_id;
|
info.fb_id = fb->fb_id;
|
||||||
|
|
||||||
info.src_w = window->w;
|
info.src_w = windata->src_w;
|
||||||
info.src_h = window->h;
|
info.src_h = windata->src_h;
|
||||||
info.crtc_w = windata->output_w;
|
info.crtc_w = windata->output_w;
|
||||||
info.crtc_h = windata->output_h;
|
info.crtc_h = windata->output_h;
|
||||||
info.crtc_x = windata->output_x;
|
info.crtc_x = windata->output_x;
|
||||||
@ -240,8 +240,8 @@ KMSDRM_GLES_SwapWindowDB(_THIS, SDL_Window * window)
|
|||||||
info.crtc_id = dispdata->crtc->crtc->crtc_id;
|
info.crtc_id = dispdata->crtc->crtc->crtc_id;
|
||||||
info.fb_id = fb->fb_id;
|
info.fb_id = fb->fb_id;
|
||||||
|
|
||||||
info.src_w = window->w;
|
info.src_w = windata->src_w;
|
||||||
info.src_h = window->h;
|
info.src_h = windata->src_h;
|
||||||
info.crtc_w = windata->output_w;
|
info.crtc_w = windata->output_w;
|
||||||
info.crtc_h = windata->output_h;
|
info.crtc_h = windata->output_h;
|
||||||
info.crtc_x = windata->output_x;
|
info.crtc_x = windata->output_x;
|
||||||
|
@ -815,15 +815,26 @@ KMSDRM_CreateSurfaces(_THIS, SDL_Window * window)
|
|||||||
{
|
{
|
||||||
SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
|
SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
|
||||||
SDL_WindowData *windata = (SDL_WindowData *)window->driverdata;
|
SDL_WindowData *windata = (SDL_WindowData *)window->driverdata;
|
||||||
Uint32 width = window->w;
|
SDL_DisplayData *dispdata = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
|
||||||
Uint32 height = window->h;
|
uint32_t surface_fmt = GBM_FORMAT_ARGB8888;
|
||||||
Uint32 surface_fmt = GBM_FORMAT_ARGB8888;
|
uint32_t surface_flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING;
|
||||||
Uint32 surface_flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING;
|
uint32_t width, height;
|
||||||
|
|
||||||
#if SDL_VIDEO_OPENGL_EGL
|
#if SDL_VIDEO_OPENGL_EGL
|
||||||
EGLContext egl_context;
|
EGLContext egl_context;
|
||||||
SDL_EGL_SetRequiredVisualId(_this, surface_fmt);
|
SDL_EGL_SetRequiredVisualId(_this, surface_fmt);
|
||||||
egl_context = (EGLContext)SDL_GL_GetCurrentContext();
|
egl_context = (EGLContext)SDL_GL_GetCurrentContext();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (window->flags & SDL_WINDOW_FULLSCREEN) {
|
||||||
|
width = dispdata->mode.hdisplay;
|
||||||
|
height = dispdata->mode.vdisplay;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
width = window->w;
|
||||||
|
height = window->h;
|
||||||
|
}
|
||||||
|
|
||||||
if (!KMSDRM_gbm_device_is_format_supported(viddata->gbm_dev, surface_fmt, surface_flags)) {
|
if (!KMSDRM_gbm_device_is_format_supported(viddata->gbm_dev, surface_fmt, surface_flags)) {
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "GBM surface format not supported. Trying anyway.");
|
SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "GBM surface format not supported. Trying anyway.");
|
||||||
}
|
}
|
||||||
@ -862,15 +873,16 @@ KMSDRM_ReconfigureWindow( _THIS, SDL_Window * window) {
|
|||||||
KMSDRM_SetPendingSurfacesDestruction(_this, window);
|
KMSDRM_SetPendingSurfacesDestruction(_this, window);
|
||||||
|
|
||||||
if (window->flags & SDL_WINDOW_FULLSCREEN) {
|
if (window->flags & SDL_WINDOW_FULLSCREEN) {
|
||||||
/* Windows only have one possible size in fullscreen mode. */
|
windata->src_w = dispdata->mode.hdisplay;
|
||||||
window->w = dispdata->mode.hdisplay;
|
windata->src_h = dispdata->mode.vdisplay;
|
||||||
window->h = dispdata->mode.vdisplay;
|
|
||||||
windata->output_w = dispdata->mode.hdisplay;
|
windata->output_w = dispdata->mode.hdisplay;
|
||||||
windata->output_h = dispdata->mode.vdisplay;
|
windata->output_h = dispdata->mode.vdisplay;
|
||||||
windata->output_x = 0;
|
windata->output_x = 0;
|
||||||
} else {
|
} else {
|
||||||
/* Get output (CRTC) size and position, for AR correction. */
|
/* Get output (CRTC) size and position, for AR correction. */
|
||||||
ratio = (float)window->w / (float)window->h;
|
ratio = (float)window->w / (float)window->h;
|
||||||
|
windata->src_w = window->w;
|
||||||
|
windata->src_h = window->h;
|
||||||
windata->output_w = dispdata->mode.vdisplay * ratio;
|
windata->output_w = dispdata->mode.vdisplay * ratio;
|
||||||
windata->output_h = dispdata->mode.vdisplay;
|
windata->output_h = dispdata->mode.vdisplay;
|
||||||
windata->output_x = (dispdata->mode.hdisplay - windata->output_w) / 2;
|
windata->output_x = (dispdata->mode.hdisplay - windata->output_w) / 2;
|
||||||
@ -1339,15 +1351,16 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window)
|
|||||||
dispdata = display->driverdata;
|
dispdata = display->driverdata;
|
||||||
|
|
||||||
if (window->flags & SDL_WINDOW_FULLSCREEN) {
|
if (window->flags & SDL_WINDOW_FULLSCREEN) {
|
||||||
/* Windows only have one possible size in fullscreen mode. */
|
windata->src_w = dispdata->mode.hdisplay;
|
||||||
window->w = dispdata->mode.hdisplay;
|
windata->src_h = dispdata->mode.vdisplay;
|
||||||
window->h = dispdata->mode.vdisplay;
|
|
||||||
windata->output_w = dispdata->mode.hdisplay;
|
windata->output_w = dispdata->mode.hdisplay;
|
||||||
windata->output_h = dispdata->mode.vdisplay;
|
windata->output_h = dispdata->mode.vdisplay;
|
||||||
windata->output_x = 0;
|
windata->output_x = 0;
|
||||||
} else {
|
} else {
|
||||||
/* Get output (CRTC) size and position, for AR correction. */
|
/* Get output (CRTC) size and position, for AR correction. */
|
||||||
ratio = (float)window->w / (float)window->h;
|
ratio = (float)window->w / (float)window->h;
|
||||||
|
windata->src_w = window->w;
|
||||||
|
windata->src_h = window->h;
|
||||||
windata->output_w = dispdata->mode.vdisplay * ratio;
|
windata->output_w = dispdata->mode.vdisplay * ratio;
|
||||||
windata->output_h = dispdata->mode.vdisplay;
|
windata->output_h = dispdata->mode.vdisplay;
|
||||||
windata->output_x = (dispdata->mode.hdisplay - windata->output_w) / 2;
|
windata->output_x = (dispdata->mode.hdisplay - windata->output_w) / 2;
|
||||||
@ -1455,6 +1468,7 @@ KMSDRM_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * displa
|
|||||||
{
|
{
|
||||||
KMSDRM_ReconfigureWindow(_this, window);
|
KMSDRM_ReconfigureWindow(_this, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
KMSDRM_ShowWindow(_THIS, SDL_Window * window)
|
KMSDRM_ShowWindow(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
|
@ -127,6 +127,8 @@ typedef struct SDL_WindowData
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* For scaling and AR correction. */
|
/* For scaling and AR correction. */
|
||||||
|
int32_t src_w;
|
||||||
|
int32_t src_h;
|
||||||
int32_t output_w;
|
int32_t output_w;
|
||||||
int32_t output_h;
|
int32_t output_h;
|
||||||
int32_t output_x;
|
int32_t output_x;
|
||||||
|
Loading…
Reference in New Issue
Block a user