PaulStoffregen / ST7735_t3

Teensy 3.x Optimized Version of Adafruit_ST7735 (1.8 inch TFT Display)
33 stars 16 forks source link

perf: transmit RASET/CASET only when changed #34

Open ardnew opened 5 months ago

ardnew commented 5 months ago

These display drivers always write color data to the screen region defined by their row address (RA) and column address (CA) registers.

The SPI command to update the addresses in these registers are RASET and CASET. It is not necessary to re-transmit RASET/CASET when refreshing the color data in the same address window repeatedly.

Apparently, it is extremely common for graphics drivers to refresh a fixed region of the display (full-screen refresh, dirty rectangles, bitmap fonts/sprites, etc.). So this optimization yields a substantial performance improvement in nearly all cases without penalty.

Also, the call to writecommand(ST7735_RAMWR) has been refactored into the setAddr routine. You can easily see from the patch that this command is always transmitted immediately following calls to setAddr. So this merely reduces a lot of duplicate lines.