[KMS/DRM][Vulkan] Correct non-existing property. Remove hacky surface destruction code (TTY buffer isn't there after a Vulkan window is created).
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
diff --git a/src/video/kmsdrm/SDL_kmsdrmopengles.c b/src/video/kmsdrm/SDL_kmsdrmopengles.c
index 664621d..a828f3a 100644
--- a/src/video/kmsdrm/SDL_kmsdrmopengles.c
+++ b/src/video/kmsdrm/SDL_kmsdrmopengles.c
@@ -228,7 +228,7 @@ KMSDRM_GLES_SwapWindowFenced(_THIS, SDL_Window * window)
add_connector_property(dispdata->atomic_req, dispdata->connector, "CRTC_ID", dispdata->crtc->crtc->crtc_id);
KMSDRM_drmModeCreatePropertyBlob(viddata->drm_fd, &dispdata->mode, sizeof(dispdata->mode), &blob_id);
add_crtc_property(dispdata->atomic_req, dispdata->crtc, "MODE_ID", blob_id);
- add_crtc_property(dispdata->atomic_req, dispdata->crtc, "ACTIVE", 1);
+ add_crtc_property(dispdata->atomic_req, dispdata->crtc, "active", 1);
dispdata->modeset_pending = SDL_FALSE;
}
@@ -330,7 +330,7 @@ KMSDRM_GLES_SwapWindowDoubleBuffered(_THIS, SDL_Window * window)
add_connector_property(dispdata->atomic_req, dispdata->connector, "CRTC_ID", dispdata->crtc->crtc->crtc_id);
KMSDRM_drmModeCreatePropertyBlob(viddata->drm_fd, &dispdata->mode, sizeof(dispdata->mode), &blob_id);
add_crtc_property(dispdata->atomic_req, dispdata->crtc, "MODE_ID", blob_id);
- add_crtc_property(dispdata->atomic_req, dispdata->crtc, "ACTIVE", 1);
+ add_crtc_property(dispdata->atomic_req, dispdata->crtc, "active", 1);
dispdata->modeset_pending = SDL_FALSE;
}
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index b8ec424..57fced5 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -1319,45 +1319,26 @@ KMSDRM_GBMDeinit (_THIS, SDL_DisplayData *dispdata)
dispdata->gbm_init = SDL_FALSE;
}
-/* Destroy the window surfaces and buffers. Have the PRIMARY PLANE
- disconnected from these buffers before doing so, or have the PRIMARY PLANE
- reading the original FB where the TTY lives, before doing this, or CRTC will
- be disconnected by the kernel. */
void
KMSDRM_DestroySurfaces(_THIS, SDL_Window *window)
{
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
- SDL_DisplayData *dispdata = (SDL_DisplayData *)SDL_GetDisplayDriverData(0);
- KMSDRM_PlaneInfo plane_info = {0};
-
- /********************************************************************/
- /* BLOCK 1: protect the PRIMARY PLANE before destroying the buffers */
- /* it's using, by making it point to the original CRTC buffer, */
- /* where the TTY console should be. */
- /********************************************************************/
- plane_info.plane = dispdata->display_plane;
- plane_info.crtc_id = dispdata->crtc->crtc->crtc_id;
- plane_info.fb_id = dispdata->crtc->crtc->buffer_id;
- plane_info.src_w = dispdata->mode.hdisplay;
- plane_info.src_h = dispdata->mode.vdisplay;
- plane_info.crtc_w = dispdata->mode.hdisplay;
- plane_info.crtc_h = dispdata->mode.vdisplay;
+ /***************************/
+ /* Destroy the EGL surface */
+ /***************************/
- drm_atomic_set_plane_props(&plane_info);
+ SDL_EGL_MakeCurrent(_this, EGL_NO_SURFACE, EGL_NO_CONTEXT);
- /* Issue blocking atomic commit. */
- if (drm_atomic_commit(_this, SDL_TRUE)) {
- SDL_SetError("Failed to issue atomic commit on surfaces destruction.");
+ if (windata->egl_surface != EGL_NO_SURFACE) {
+ SDL_EGL_DestroySurface(_this, windata->egl_surface);
+ windata->egl_surface = EGL_NO_SURFACE;
}
- /****************************************************************************/
- /* BLOCK 2: We can finally destroy the window GBM and EGL surfaces, and */
- /* GBM buffers now that the buffers are not being used by the PRIMARY PLANE */
- /* anymore. */
- /****************************************************************************/
+ /***************************/
+ /* Destroy the GBM buffers */
+ /***************************/
- /* Destroy the GBM surface and buffers. */
if (windata->bo) {
KMSDRM_gbm_surface_release_buffer(windata->gs, windata->bo);
windata->bo = NULL;
@@ -1368,16 +1349,9 @@ KMSDRM_DestroySurfaces(_THIS, SDL_Window *window)
windata->next_bo = NULL;
}
- /***************************************************************************/
- /* Destroy the EGL surface. */
- /***************************************************************************/
-
- SDL_EGL_MakeCurrent(_this, EGL_NO_SURFACE, EGL_NO_CONTEXT);
-
- if (windata->egl_surface != EGL_NO_SURFACE) {
- SDL_EGL_DestroySurface(_this, windata->egl_surface);
- windata->egl_surface = EGL_NO_SURFACE;
- }
+ /***************************/
+ /* Destroy the GBM surface */
+ /***************************/
if (windata->gs) {
KMSDRM_gbm_surface_destroy(windata->gs);
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.h b/src/video/kmsdrm/SDL_kmsdrmvideo.h
index edb0e16..1023c1d 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.h
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.h
@@ -57,7 +57,7 @@ typedef struct SDL_VideoData
SDL_bool video_init; /* Has VideoInit succeeded? */
- SDL_bool vulkan_mode; /* Are we in Vulkan mode? One VK window is enough. */
+ SDL_bool vulkan_mode; /* Are we in Vulkan mode? One VK window is enough to be. */
} SDL_VideoData;