mirror of
https://github.com/X11Libre/xf86-video-amdgpu.git
synced 2026-03-24 01:24:31 +00:00
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:
committed by
Michel Dänzer
parent
9ca1c24235
commit
a3ca150070
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user