On Fri, Feb 13, 2026 at 09:59:46AM +0100, Nam Cao wrote: > When user write() only to part of the screen, the driver still updates the > entire screen. That wastes CPU cycles. > > Optimize by updating only the changed lines. Improvement is measured by a > pair of trace_printk() at the beginning of fb_write() and at the end of > fbtft_deferred_io().
Can you elaborate on the HW (the exact model of the panel and [sub]driver) in use? > Update type Before After > ==================================== > full screen 196ms 200ms > half screen 200ms 124ms > quarter screen 193ms 81ms > one pixle 199ms 43ms > > It is interesting to note that if the deferred IO's delay time (40ms) is > subtracted, then the time amount scales linearly with the write size. Reviewed-by: Andy Shevchenko <[email protected]> Some questions below, but they probably won't affect the decision on this change. ... > - /* special case, needed ? */ Do you know the history of this comment? What is "special case" and when does it appear? > - if (y == -1) { > - y = 0; > - height = info->var.yres; > - } ... > static void fbtft_ops_damage_range(struct fb_info *info, off_t off, size_t > len) > { > struct fbtft_par *par = info->par; > + u32 start, end; > + > + start = off / info->fix.line_length; > + end = (off + len - 1) / info->fix.line_length; > > - /* TODO: only mark changed area update all for now */ Ah, this change actually targets the TODO! > - par->fbtftops.mkdirty(info, -1, 0); > + par->fbtftops.mkdirty(info, start, end - start + 1); > } ... In light of the last TODO line I think that the change is desired by the original author. Nevertheless I am wondering about these side effects that might be (very unlikely?) considered if this code (partial refresh) runs for a significant period of time: - some bits of the screen (on non-updated part) might be flipped - the static picture may lead to wearing of (decolourisation) the panel - what is the thermal distribution (probably with backlight off)? Maybe it makes sense to refresh a full screen from time to time, but TBH my knowledge of TFT panels from last decade is quite limited. I only think from the point of the general physics and common sense. That's why this long footnote rather philosophical, but I would be glad to learn the state of affairs of the modern TFT panels in terms of the physical parameters lasting over the time under different application cases. -- With Best Regards, Andy Shevchenko
