- else
- log_verbose("DRM/KMS: <%d> (add_mode) <debug> use existing frame buffer\n", m_id);
-
- drmModeFreeFB(pframebuffer);
-
- pframebuffer = drmModeGetFB(m_drm_fd, framebuffer_id);
- log_verbose("DRM/KMS: <%d> (add_mode) <debug> frame buffer id %d size %dx%d bpp %d\n", m_id, framebuffer_id, pframebuffer->width, pframebuffer->height, pframebuffer->bpp);
- drmModeFreeFB(pframebuffer);
-
- // set the mode on the crtc
- if (drmModeSetCrtc(m_drm_fd, mp_crtc_desktop->crtc_id, framebuffer_id, 0, 0, &m_desktop_output, 1, &dmode))
- log_error("DRM/KMS: <%d> (add_mode) [ERROR] cannot attach the mode to the crtc %d frame buffer %d\n", m_id, mp_crtc_desktop->crtc_id, framebuffer_id);
- else
- {
- if (old_dumb_handle)
- {
- log_verbose("DRM/KMS: <%d> (add_mode) <debug> remove old dumb %d\n", m_id, old_dumb_handle);
- int ret = ioctl(m_drm_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &old_dumb_handle);
- if (ret)
- log_verbose("DRM/KMS: <%d> (add_mode) [ERROR] ioctl DRM_IOCTL_MODE_DESTROY_DUMB %d\n", m_id, ret);
- old_dumb_handle = 0;