diff options
author | Hans de Goede <hdegoede@redhat.com> | 2016-09-21 16:31:51 +0900 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2016-09-21 18:20:19 +0900 |
commit | ace455d1db4db3f9b8b434a3747acfa7e1273db4 (patch) | |
tree | 2723397e36027fd436593be7a2d137d29f7f69f7 /src/drmmode_display.c | |
parent | eea370dc4f96e680cc29b416fe62d6e2ea09bc91 (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)
(Ported from amdgpu commit a3ca1500703837cbb8d49c554199a25dea7d5e1e)
Diffstat (limited to 'src/drmmode_display.c')
-rw-r--r-- | src/drmmode_display.c | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 4f25ae71..25c0e990 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -734,34 +734,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, int i; int fb_id; drmModeModeInfo kmode; - int pitch; - uint32_t tiling_flags = 0; - - if (info->allowColorTiling) { - if (info->ChipFamily >= CHIP_FAMILY_R600) - tiling_flags |= RADEON_TILING_MICRO; - else - tiling_flags |= RADEON_TILING_MACRO; - } - - pitch = RADEON_ALIGN(pScrn->displayWidth, drmmode_get_pitch_align(pScrn, info->pixel_bytes, tiling_flags)) * - info->pixel_bytes; - if (info->ChipFamily >= CHIP_FAMILY_R600) { - pitch = info->front_surface.level[0].pitch_bytes; - } - - if (drmmode->fb_id == 0) { - ret = drmModeAddFB(drmmode->fd, - pScrn->virtualX, pScrn->virtualY, - pScrn->depth, pScrn->bitsPerPixel, - pitch, - info->front_bo->handle, - &drmmode->fb_id); - if (ret < 0) { - ErrorF("failed to add fb\n"); - return FALSE; - } - } saved_mode = crtc->mode; saved_x = crtc->x; @@ -869,6 +841,22 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, } } + if (fb_id == 0) { + if (drmModeAddFB(drmmode->fd, + pScrn->virtualX, + pScrn->virtualY, + pScrn->depth, pScrn->bitsPerPixel, + pScrn->displayWidth * info->pixel_bytes, + info->front_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(drmmode->fd, |