Commit 114e3df3 authored by José Casanova Crespo's avatar José Casanova Crespo

modesetting: Fix front_bo leak at drmmode_xf86crtc_resize on XRandR rotation

Since the introduction of "modesetting: Remove unnecessary fb addition from
drmmode_xf86crtc_resize" the fb_id isn't initialited at
drmmode_xf86crtc_resize.

Rotate operation of XRandR uses rotate_bo. So in this case the fb_id
associated to the front_bo is not initialized at drmmode_set_mode_major.
So fd_id remains 0.

As every call to drmmode_xf86crtc_resize allocates a new front_bo we should
destroy uncondicionally the old_front_bo if operation success. So we free
the allocated GBM handles.

This avoids crashing xserver with a OOM in the RPI4 1Gb at 4k resolution
after 3 series xrandr rotations from normal to left and viceversa reported at
https://github.com/raspberrypi/firmware/issues/1345Signed-off-by: José Casanova Crespo's avatarJose Maria Casanova Crespo <jmcasanova@igalia.com>
Closes: xorg/xserver#1024
Fixes: 87745321 "modesetting: Remove unnecessary fb addition from
       drmmode_xf86crtc_resize"
parent 3d6efc4a
Pipeline #147423 passed with stages
in 7 minutes and 14 seconds
......@@ -3223,10 +3223,10 @@ drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
crtc->rotation, crtc->x, crtc->y);
}
if (old_fb_id) {
if (old_fb_id)
drmModeRmFB(drmmode->fd, old_fb_id);
drmmode_bo_destroy(drmmode, &old_front);
}
drmmode_bo_destroy(drmmode, &old_front);
return TRUE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment