summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2016-06-01 15:14:32 +0200
committerMichel Dänzer <michel@daenzer.net>2016-06-23 16:08:51 +0900
commita3ca1500703837cbb8d49c554199a25dea7d5e1e (patch)
tree92d4893ee3509d624ffc6c68ac067788c1765436
parent9ca1c24235ff5ab2e028333fc326e2eff008c574 (diff)
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>
-rw-r--r--src/drmmode_display.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 6a918e6..8d8eeb1 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -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,