KMSDRM: valid file descriptors could positive or 0. -1 is invalid. (Bug 4530)

This commit is contained in:
Sylvain Becker 2019-03-13 14:54:51 +01:00
parent 3bc1a8b619
commit cbe80d4708
1 changed files with 2 additions and 2 deletions

View File

@ -250,7 +250,7 @@ KMSDRM_FBDestroyCallback(struct gbm_bo *bo, void *data)
{ {
KMSDRM_FBInfo *fb_info = (KMSDRM_FBInfo *)data; KMSDRM_FBInfo *fb_info = (KMSDRM_FBInfo *)data;
if (fb_info && fb_info->drm_fd > 0 && fb_info->fb_id != 0) { if (fb_info && fb_info->drm_fd >= 0 && fb_info->fb_id != 0) {
KMSDRM_drmModeRmFB(fb_info->drm_fd, fb_info->fb_id); KMSDRM_drmModeRmFB(fb_info->drm_fd, fb_info->fb_id);
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Delete DRM FB %u", fb_info->fb_id); SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Delete DRM FB %u", fb_info->fb_id);
} }
@ -552,7 +552,7 @@ KMSDRM_VideoQuit(_THIS)
} }
if(vdata->saved_crtc != NULL) { if(vdata->saved_crtc != NULL) {
if(vdata->drm_fd > 0 && vdata->saved_conn_id > 0) { if(vdata->drm_fd >= 0 && vdata->saved_conn_id > 0) {
/* Restore saved CRTC settings */ /* Restore saved CRTC settings */
drmModeCrtc *crtc = vdata->saved_crtc; drmModeCrtc *crtc = vdata->saved_crtc;
if(KMSDRM_drmModeSetCrtc(vdata->drm_fd, crtc->crtc_id, crtc->buffer_id, if(KMSDRM_drmModeSetCrtc(vdata->drm_fd, crtc->crtc_id, crtc->buffer_id,