Commit b48269ab authored by Siarhei Siamashka's avatar Siarhei Siamashka
Browse files

mali: added a sanity check for the UMP framebuffer wrappers size



Even though we are primarily using the UMP buffer obtained by the
GET_UMP_SECURE_ID_SUNXI_FB ioctl, another UMP buffer obtained by
the GET_UMP_SECURE_ID_BUF1 ioctl should also span over the whole
framebuffer. Otherwise we may have troubles with the window resize
bug recovery and buffer flipping.
Signed-off-by: default avatarSiarhei Siamashka <siarhei.siamashka@gmail.com>
parent 4ae7f6cf
......@@ -920,6 +920,20 @@ static void DisableHWCursor(ScrnInfoPtr pScrn)
}
}
static unsigned long ump_get_size_from_secure_id(ump_secure_id secure_id)
{
unsigned long size;
ump_handle handle;
if (secure_id == UMP_INVALID_SECURE_ID)
return 0;
handle = ump_handle_create_from_secure_id(secure_id);
if (handle == UMP_INVALID_MEMORY_HANDLE)
return 0;
size = ump_size_get(handle);
ump_reference_release(handle);
return size;
}
SunxiMaliDRI2 *SunxiMaliDRI2_Init(ScreenPtr pScreen,
Bool bUseOverlay,
Bool bSwapbuffersWait)
......@@ -969,6 +983,14 @@ SunxiMaliDRI2 *SunxiMaliDRI2_Init(ScreenPtr pScreen,
"GET_UMP_SECURE_ID_SUNXI_FB ioctl failed, overlays can't be used\n");
mali->ump_fb_secure_id = UMP_INVALID_SECURE_ID;
}
if (mali->ump_alternative_fb_secure_id == UMP_INVALID_SECURE_ID ||
ump_get_size_from_secure_id(mali->ump_alternative_fb_secure_id) !=
disp->framebuffer_size) {
xf86DrvMsg(pScreen->myNum, X_INFO,
"UMP does not wrap the whole framebuffer, overlays can't be used\n");
mali->ump_fb_secure_id = UMP_INVALID_SECURE_ID;
mali->ump_alternative_fb_secure_id = UMP_INVALID_SECURE_ID;
}
}
else {
/* Try to allocate small dummy UMP buffers to secure id 1 and 2 */
......
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