Don't set up black scanout buffer if LeaveVT is called from CloseScreen
Avoids a crash described in
https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/merge_requests/43#note_223718
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Michel Dänzer authored 4 years ago
Michel Dänzer committed 4 years ago
2266 | 2266 | unsigned w = 0, h = 0; |
2267 | 2267 | int i; |
2268 | 2268 | |
2269 | /* If we're called from CloseScreen, trying to clear the black | |
2270 | * scanout BO will likely crash and burn | |
2271 | */ | |
2272 | if (!pScreen->GCperDepth[0]) | |
2273 | goto hide_cursors; | |
2274 | ||
2269 | 2275 | /* Compute maximum scanout dimensions of active CRTCs */ |
2270 | 2276 | for (i = 0; i < xf86_config->num_crtc; i++) { |
2271 | 2277 | crtc = xf86_config->crtc[i]; |
2338 | 2344 | info->pixel_bytes * pScrn->virtualY); |
2339 | 2345 | } |
2340 | 2346 | |
2341 | TimerSet(NULL, 0, 1000, cleanup_black_fb, pScreen); | |
2342 | ||
2347 | if (pScreen->GCperDepth[0]) | |
2348 | TimerSet(NULL, 0, 1000, cleanup_black_fb, pScreen); | |
2349 | ||
2350 | hide_cursors: | |
2343 | 2351 | xf86_hide_cursors(pScrn); |
2344 | 2352 | |
2345 | 2353 | amdgpu_drop_drm_master(pScrn); |