Migrating flush function from lvgl v6 to lvgl v9.2.2

I changed compiler option to:
Optimization Level: optimize for performance (-O2)

Mode: LV_DISPLAY_RENDER_MODE_DIRECT

Same problema that before:

piece of my driver code:
while( hw_lcd_transfer_done_status() );

But if a put this in same piece of my driver code:

while( hw_lcd_transfer_done_status() )
{
    ets_delay_us(1);
}

I noticed that the compiler must be optimizing in some way that is changing the order of my driver instructions, but at least now the partial lcd updates are going to the correct position.

The problem is that this partial updates are not understandable.

Some sugestion @kdschlosser or @kisvegabor ???

May be some LVGL config that i have missing ?

I am using with real time operating system ( FreeRtos ), can be that i didnt config LVGL in correct way to work with a rtos ?