Only add main fb if necessary

If we're doing reverse-prime; or doing rotation the main fb is not used,
and there is no reason to add it in this case.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(Ported from xserver commit 4313122dea0df9affc280ee698e929489061ccc6)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Hans de Goede
2016-06-01 15:14:32 +02:00
committed by Michel Dänzer
parent 9ca1c24235
commit a3ca150070

View File

@@ -656,24 +656,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
drmModeModeInfo kmode;
uint32_t bo_handle;
if (drmmode->fb_id == 0) {
if (!amdgpu_bo_get_handle(info->front_buffer, &bo_handle)) {
ErrorF("failed to get BO handle for FB\n");
return FALSE;
}
ret = drmModeAddFB(pAMDGPUEnt->fd,
pScrn->virtualX,
pScrn->virtualY,
pScrn->depth, pScrn->bitsPerPixel,
pScrn->displayWidth * info->pixel_bytes,
bo_handle, &drmmode->fb_id);
if (ret < 0) {
ErrorF("failed to add fb\n");
return FALSE;
}
}
saved_mode = crtc->mode;
saved_x = crtc->x;
saved_y = crtc->y;
@@ -783,6 +765,27 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
}
}
if (fb_id == 0) {
if (!amdgpu_bo_get_handle(info->front_buffer, &bo_handle)) {
ErrorF("failed to get BO handle for FB\n");
ret = FALSE;
goto done;
}
if (drmModeAddFB(pAMDGPUEnt->fd,
pScrn->virtualX,
pScrn->virtualY,
pScrn->depth, pScrn->bitsPerPixel,
pScrn->displayWidth * info->pixel_bytes,
bo_handle, &drmmode->fb_id) < 0) {
ErrorF("failed to add fb\n");
ret = FALSE;
goto done;
}
fb_id = drmmode->fb_id;
}
/* Wait for any pending flip to finish */
do {} while (drmmode_crtc->flip_pending &&
drmHandleEvent(pAMDGPUEnt->fd,