mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
[KMS/DRM][Vulkan] Correct non-existing property. Remove hacky surface destruction code (TTY buffer isn't there after a Vulkan window is created).
This commit is contained in:
parent
7186584b8d
commit
0feaf7d196
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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. */
|
||||
/********************************************************************/
|
||||
/***************************/
|
||||
/* Destroy the EGL surface */
|
||||
/***************************/
|
||||
|
||||
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;
|
||||
SDL_EGL_MakeCurrent(_this, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
|
||||
drm_atomic_set_plane_props(&plane_info);
|
||||
|
||||
/* 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);
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user