mirror of https://github.com/encounter/SDL.git
[KMS/DRM] Restore hacky code to point to TTY buffer on surface destruction b/c I lack alternatives.
This commit is contained in:
parent
5dabc4d72f
commit
7539ac8087
|
@ -409,7 +409,6 @@ KMSDRM_InitMouse(_THIS)
|
||||||
SDL_VideoData *viddata = ((SDL_VideoData *)dev->driverdata);
|
SDL_VideoData *viddata = ((SDL_VideoData *)dev->driverdata);
|
||||||
SDL_DisplayData *dispdata = (SDL_DisplayData *)SDL_GetDisplayDriverData(0);
|
SDL_DisplayData *dispdata = (SDL_DisplayData *)SDL_GetDisplayDriverData(0);
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
uint64_t usable_cursor_w, usable_cursor_h;
|
|
||||||
|
|
||||||
mouse->CreateCursor = KMSDRM_CreateCursor;
|
mouse->CreateCursor = KMSDRM_CreateCursor;
|
||||||
mouse->ShowCursor = KMSDRM_ShowCursor;
|
mouse->ShowCursor = KMSDRM_ShowCursor;
|
||||||
|
@ -439,23 +438,20 @@ KMSDRM_InitMouse(_THIS)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KMSDRM_drmGetCap(viddata->drm_fd, DRM_CAP_CURSOR_WIDTH, &usable_cursor_w) ||
|
if (KMSDRM_drmGetCap(viddata->drm_fd, DRM_CAP_CURSOR_WIDTH, &dispdata->cursor_w) ||
|
||||||
KMSDRM_drmGetCap(viddata->drm_fd, DRM_CAP_CURSOR_HEIGHT, &usable_cursor_h))
|
KMSDRM_drmGetCap(viddata->drm_fd, DRM_CAP_CURSOR_HEIGHT, &dispdata->cursor_h))
|
||||||
{
|
{
|
||||||
SDL_SetError("Could not get the recommended GBM cursor size");
|
SDL_SetError("Could not get the recommended GBM cursor size");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usable_cursor_w == 0 || usable_cursor_h == 0) {
|
if (dispdata->cursor_w == 0 || dispdata->cursor_h == 0) {
|
||||||
SDL_SetError("Could not get an usable GBM cursor size");
|
SDL_SetError("Could not get an usable GBM cursor size");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
dispdata->cursor_w = usable_cursor_w;
|
|
||||||
dispdata->cursor_h = usable_cursor_h;
|
|
||||||
|
|
||||||
dispdata->cursor_bo = KMSDRM_gbm_bo_create(viddata->gbm_dev,
|
dispdata->cursor_bo = KMSDRM_gbm_bo_create(viddata->gbm_dev,
|
||||||
usable_cursor_w, usable_cursor_h,
|
dispdata->cursor_w, dispdata->cursor_h,
|
||||||
GBM_FORMAT_ARGB8888, GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE);
|
GBM_FORMAT_ARGB8888, GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE);
|
||||||
|
|
||||||
if (!dispdata->cursor_bo) {
|
if (!dispdata->cursor_bo) {
|
||||||
|
|
|
@ -1323,6 +1323,26 @@ void
|
||||||
KMSDRM_DestroySurfaces(_THIS, SDL_Window *window)
|
KMSDRM_DestroySurfaces(_THIS, SDL_Window *window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
|
||||||
|
SDL_DisplayData *dispdata = (SDL_DisplayData *)SDL_GetDisplayDriverData(0);
|
||||||
|
KMSDRM_PlaneInfo plane_info = {0};
|
||||||
|
|
||||||
|
/************************************************************/
|
||||||
|
/* Make the display plane point to the original TTY buffer. */
|
||||||
|
/************************************************************/
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
drm_atomic_set_plane_props(&plane_info);
|
||||||
|
|
||||||
|
if (drm_atomic_commit(_this, SDL_TRUE)) {
|
||||||
|
SDL_SetError("Failed to issue atomic commit on surfaces destruction.");
|
||||||
|
}
|
||||||
|
|
||||||
/***************************/
|
/***************************/
|
||||||
/* Destroy the EGL surface */
|
/* Destroy the EGL surface */
|
||||||
|
|
Loading…
Reference in New Issue