How to avoid tear effect with TE signal

Hi !

  • here is things:
  1. user double full-sized buffer
  2. user soft rotate (90° or 270°)
  • code:
/* disp register */
disp_drv.rounder_cb = disp_rounder;
disp_drv.render_start_cb = disp_render_start;
disp_drv.monitor_cb = disp_monitor;
disp_drv.full_refresh = 0;
disp_drv.direct_mode = 0;

void disp_render_start(struct _lv_disp_drv_t * disp_drv)
        printf("start render %d.\n", get_cur_ms());

static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
        printf("start flush %d %d.\n", get_cur_ms(), x * y);

        /* use hard spi flush data */

void disp_monitor(struct _lv_disp_drv_t * disp_drv, uint32_t time, uint32_t px)
	printf("time = %u, px = %u.\n", time, px);
  • print info:
    start render 47632
    start flush 47643 9400
    start flush 47645 9400
    start flush 47648 9400
    start flush 47650 9400
    start flush 47653 9400
    start flush 47655 9400
    start flush 47658 9400
    start flush 47660 4700
    time = 29, px = 70500

  • question:

  1. it costed 11 ms betwin start render and first flush
  2. flush costed 3ms, but total 8 times
  3. the period of TE signal is 28ms

so how to avoid tear effect when scroll screen?

I’m also interested in this (to see if I can improve the performance on the ESP32-S3 RGB peripheral) and I came across this topic which suggest to wait for the tearing signal in the flush callback.
I haven’t tried this myself yet, as for my use case, I’m not yet sure where to get the “signal” from, but perhaps it will helps you.

If wait TE signal in flush_cb function, it’s slower. beacuse period of TE is about 22ms, and I use soft rotate, so one flush will cost “SPI transmit + TE signal”, and total 8 times :joy:

Current LV_DISP_ROT_MAX_BUF is (201024), it’s still spend 8 times in flushing if you expand LV_DISP_ROT_MAX_BUF to (1601024)

Is there any better way to prevent tearing if waiting for TE signal in flush_cb function is slow?

Hi @Scott.Zhu ,

I believe the preferred method is mentioned in the documentation here.

I haven’t tried this myself but hopefully it will get you on the right track.

Kind Regards,