Fixed bug 4296 - kmsdrm video driver leaks 1 bo in KMSDRM_GLES_SetupCrtc()
Icenowy Zheng One front buffer is locked in GLES_SetupCrtc() and overrides the next_bo just locked in KMSDRM_GLES_SwapWindow, then the next_bo gets lost and is not released even when quitting the video. It may leads to problems with GLES drivers that doesn't clean up GBM correctly if there's any bo left (e.g. the Mali Utgard r6p2 blob). In the case of Mali Utgard r6p2 blob, the DRM device file is still hold by the blob, and if you try to SDL_Quit to let another program to run (this is done by EmulationStation), the new program will fail to open DRM device.
parent
367f9b915c
commit
3ac9e2aa4e
|
@ -54,13 +54,13 @@ KMSDRM_GLES_SetupCrtc(_THIS, SDL_Window * window) {
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wdata->next_bo = KMSDRM_gbm_surface_lock_front_buffer(wdata->gs);
|
wdata->crtc_bo = KMSDRM_gbm_surface_lock_front_buffer(wdata->gs);
|
||||||
if (wdata->next_bo == NULL) {
|
if (wdata->crtc_bo == NULL) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not lock GBM surface front buffer on CRTC setup");
|
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not lock GBM surface front buffer on CRTC setup");
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fb_info = KMSDRM_FBFromBO(_this, wdata->next_bo);
|
fb_info = KMSDRM_FBFromBO(_this, wdata->crtc_bo);
|
||||||
if (fb_info == NULL) {
|
if (fb_info == NULL) {
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -566,6 +566,10 @@ KMSDRM_DestroyWindow(_THIS, SDL_Window * window)
|
||||||
if(data) {
|
if(data) {
|
||||||
/* Wait for any pending page flips and unlock buffer */
|
/* Wait for any pending page flips and unlock buffer */
|
||||||
KMSDRM_WaitPageFlip(_this, data, -1);
|
KMSDRM_WaitPageFlip(_this, data, -1);
|
||||||
|
if (data->crtc_bo != NULL) {
|
||||||
|
KMSDRM_gbm_surface_release_buffer(data->gs, data->crtc_bo);
|
||||||
|
data->crtc_bo = NULL;
|
||||||
|
}
|
||||||
if (data->next_bo != NULL) {
|
if (data->next_bo != NULL) {
|
||||||
KMSDRM_gbm_surface_release_buffer(data->gs, data->next_bo);
|
KMSDRM_gbm_surface_release_buffer(data->gs, data->next_bo);
|
||||||
data->next_bo = NULL;
|
data->next_bo = NULL;
|
||||||
|
|
|
@ -62,6 +62,7 @@ typedef struct SDL_WindowData
|
||||||
struct gbm_surface *gs;
|
struct gbm_surface *gs;
|
||||||
struct gbm_bo *current_bo;
|
struct gbm_bo *current_bo;
|
||||||
struct gbm_bo *next_bo;
|
struct gbm_bo *next_bo;
|
||||||
|
struct gbm_bo *crtc_bo;
|
||||||
SDL_bool waiting_for_flip;
|
SDL_bool waiting_for_flip;
|
||||||
SDL_bool crtc_ready;
|
SDL_bool crtc_ready;
|
||||||
SDL_bool double_buffer;
|
SDL_bool double_buffer;
|
||||||
|
|
Loading…
Reference in New Issue