From: Michel Dänzer <[email protected]>

Without this, drmmode_set_mode_major may just re-set the FB for the
last flipped BO, in which case the display will probably freeze.

Reproduction recipe: Enable rotation while a fullscreen client is
flipping.

(Ported from radeon commit 40191d82370eb7e58bd34c44966cbf44c3703229)

Signed-off-by: Michel Dänzer <[email protected]>
---
 src/amdgpu_present.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index 5de1d19..c11a807 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -324,6 +324,7 @@ static void
 amdgpu_present_unflip(ScreenPtr screen, uint64_t event_id)
 {
        ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+       AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
        AMDGPUInfoPtr info = AMDGPUPTR(scrn);
        xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
        struct amdgpu_present_vblank_event *event;
@@ -348,6 +349,12 @@ amdgpu_present_unflip(ScreenPtr screen, uint64_t event_id)
                return;
 
 modeset:
+       /* info->drmmode.fb_id still points to the FB for the last flipped BO.
+        * Clear it, drmmode_set_mode_major will re-create it
+        */
+       drmModeRmFB(pAMDGPUEnt->fd, info->drmmode.fb_id);
+       info->drmmode.fb_id = 0;
+
        for (i = 0; i < config->num_crtc; i++) {
                xf86CrtcPtr crtc = config->crtc[i];
                drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
-- 
2.7.0

_______________________________________________
xorg-driver-ati mailing list
[email protected]
https://lists.x.org/mailman/listinfo/xorg-driver-ati

Reply via email to