Got the same problem while building a project from scratch using CubeMX.
Nearly 30 errors of identifier "HAL_LockTypeDef" is undefined and HAL_StatusTypeDef is undefined errors have been raised while compiling a gdisp_lld_STM32LTDC.c include chain. Removal of preprocessor symbols fixes this issue ( CubeMX defines two: USE_HAL_DRIVER and STM32F746xx ).
Second issue is Keil optimization - at level -O3 (which is default here) compiler brings corrupted image to display without any warnings/errors.
Comments on this two issues much appreciated - may be there is a way to keep optimization?