Make sure there is room before copying a scanout
If a CRTC is removed or shrunk, pOMAP->scanout may shrink such that it no
longer contains ANY of one or more of the pOMAP->scanouts. In this case,
make sure not to copy anything from the pOMAP->scanouts.
This patch fixes two bugs:
(a) the omap_bo_*() functions return uint32_t, so the subtraction was
resulting in a large positive number, instead of a negative. Thus,
the min() would choose to copy all of scanout.
(b) even if the subtraction was cast to int, the copy operation would
still do the wrong thing when given a negative range.
It also refactors how we copy between the overlapping regions of bo's.
And, while we are at it, we use the same function to copy from fb to scanout.
1. Attach external monitor using HDMI-HDMI cable
3. DISPLAY=:0.0 xrandr --output --off
4. Wait for both screens to come back on (~40 seconds)
5. DISPLAY=:0.0 xrandr --output --off
6. Ensure no "Segmentation fault" in /var/log/Xorg.0.log
(cherry picked from commit b6e43787be025cd4a5082b7bbbe75bd3cc8f0e84)
Signed-off-by: Daniel Kurtz <email@example.com>
Reviewed-by: Daniel Kurtz <firstname.lastname@example.org>
Tested-by: Daniel Kurtz <email@example.com>
1 file changed