[KMS/DRM] Cleanup remainings from plane/scaling usage.
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
diff --git a/src/video/kmsdrm/SDL_kmsdrmopengles.c b/src/video/kmsdrm/SDL_kmsdrmopengles.c
index 859b786..4dab504 100644
--- a/src/video/kmsdrm/SDL_kmsdrmopengles.c
+++ b/src/video/kmsdrm/SDL_kmsdrmopengles.c
@@ -134,14 +134,25 @@ KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window) {
Has to be done before the upcoming pageflip issue, so the buffer with the
new size is big enough so the CRTC doesn't read out of bounds. */
if (dispdata->modeset_pending) {
+
+ /***************************************************************************/
+ /* This is fundamental. */
+ /* We can't display an fb smaller than the resolution currently configured */
+ /* on the CRTC, because the CRTC would be scanning out of bounds, and */
+ /* drmModeSetCrtc() would fail. */
+ /* A possible solution would be scaling on the primary plane with */
+ /* drmModeSetPlane(), but primary plane scaling is not supported in most */
+ /* LEGACY-only hardware, so never use drmModeSetPlane(). */
+ /***************************************************************************/
+
ret = KMSDRM_drmModeSetCrtc(viddata->drm_fd,
dispdata->crtc->crtc_id, fb_info->fb_id, 0, 0,
&dispdata->connector->connector_id, 1, &dispdata->mode);
if (ret) {
- SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not set videomode on CRTC");
- }
+ SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not set videomode on CRTC.");
+ }
return 0;
}
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index e13f105..bd1ec72 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -1001,7 +1001,6 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window)
SDL_bool is_vulkan = window->flags & SDL_WINDOW_VULKAN; /* Is this a VK window? */
SDL_bool vulkan_mode = viddata->vulkan_mode; /* Do we have any Vulkan windows? */
NativeDisplayType egl_display;
- float ratio;
int ret = 0;
if ( !(dispdata->gbm_init) && !is_vulkan && !vulkan_mode ) {
@@ -1068,26 +1067,6 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window)
goto cleanup;
}
- if (((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP)
- || ((window->flags & SDL_WINDOW_FULLSCREEN) == SDL_WINDOW_FULLSCREEN))
- {
- windata->src_w = dispdata->mode.hdisplay;
- windata->src_h = dispdata->mode.vdisplay;
- windata->output_w = dispdata->mode.hdisplay;
- windata->output_h = dispdata->mode.vdisplay;
- windata->output_x = 0;
- } else {
- /* Normal non-fullscreen windows are scaled to the in-use video mode
- using a PLANE connected to the CRTC, so get input size,
- output (CRTC) size, and position. */
- 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_h = dispdata->mode.vdisplay;
- windata->output_x = (dispdata->mode.hdisplay - windata->output_w) / 2;
- }
-
/* Don't force fullscreen on all windows: it confuses programs that try
to set a window fullscreen after creating it as non-fullscreen (sm64ex) */
// window->flags |= SDL_WINDOW_FULLSCREEN;
@@ -1102,17 +1081,9 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window)
goto cleanup;
}
- /***************************************************************************/
- /* This is fundamental. */
- /* We can't display an fb smaller than the resolution currently configured */
- /* on the CRTC, because the CRTC would be scanning out of bounds, and */
- /* drmModeSetCrtc() would fail. */
- /* A possible solution would be scaling on the primary plane with */
- /* drmModeSetPlane(), but primary plane scaling is not supported in most */
- /* LEGACY-only hardware, so never use drmModeSetPlane(). */
- /***************************************************************************/
-
-#if 1
+ /* Configure the current video mode on the CRTC, without changing the buffer
+ it's pointing to (well, that the primary plane connected to the CRTC is
+ pointing to). */
ret = KMSDRM_drmModeSetCrtc(viddata->drm_fd, dispdata->crtc->crtc_id,
/*fb_info->fb_id*/ -1, 0, 0, &dispdata->connector->connector_id, 1,
&dispdata->mode);
@@ -1121,7 +1092,6 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window)
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not set CRTC");
goto cleanup;
}
-#endif
}
/* Add window to the internal list of tracked windows. Note, while it may
@@ -1167,36 +1137,12 @@ cleanup:
}
/*****************************************************************************/
-/* Reconfigure the window scaling parameters and re-construct it's surfaces, */
-/* without destroying the window itself. */
+/* Re-create a window surfaces without destroying the window itself. */
/* To be used by SetWindowSize() and SetWindowFullscreen(). */
/*****************************************************************************/
static int
KMSDRM_ReconfigureWindow( _THIS, SDL_Window * window) {
- SDL_WindowData *windata = window->driverdata;
- SDL_DisplayData *dispdata = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
SDL_bool is_vulkan = window->flags & SDL_WINDOW_VULKAN; /* Is this a VK window? */
- float ratio;
-
- if (((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) ||
- ((window->flags & SDL_WINDOW_FULLSCREEN) == SDL_WINDOW_FULLSCREEN)) {
-
- windata->src_w = dispdata->mode.hdisplay;
- windata->src_h = dispdata->mode.vdisplay;
- windata->output_w = dispdata->mode.hdisplay;
- windata->output_h = dispdata->mode.vdisplay;
- windata->output_x = 0;
-
- } else {
- /* Normal non-fullscreen windows are scaled using the CRTC,
- so get output (CRTC) size and position, for AR correction. */
- 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_h = dispdata->mode.vdisplay;
- windata->output_x = (dispdata->mode.hdisplay - windata->output_w) / 2;
- }
if (!is_vulkan) {
if (KMSDRM_CreateSurfaces(_this, window)) {
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.h b/src/video/kmsdrm/SDL_kmsdrmvideo.h
index 1995bb0..d90f3ed 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.h
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.h
@@ -96,13 +96,6 @@ typedef struct SDL_WindowData
EGLSurface egl_surface;
- /* For scaling and AR correction. */
- int32_t src_w;
- int32_t src_h;
- int32_t output_w;
- int32_t output_h;
- int32_t output_x;
-
} SDL_WindowData;
typedef struct KMSDRM_FBInfo