Skip to contentSkip to conversation

fbtft: Improve damage_range to mark only changed rows

PATCH In review ChanSoo Shin 3 participants 3 messages Jan 28

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fbtft: Improve damage_range to mark only changed rows

Instead of marking the entire display as dirty, calculate start_row and end_row based on off/len and mark only those rows. This improves performance for partial framebuffer updates.

---
 drivers/staging/fbtft/fbtft-core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/staging/fbtft/fbtft-core.c +5 -2
index 8a5ccc8ae0a1..0fbdfdaaa94d 100644
@@ -415,8 +415,11 @@ static void fbtft_ops_damage_range(struct fb_info *info, off_t off, size_t len)
 {
 	struct fbtft_par *par = info->par;
 
-	/* TODO: only mark changed area update all for now */
-	par->fbtftops.mkdirty(info, -1, 0);
+	__u32 width = info->var.xres;
+	__u32 start_row = off / width;
+	__u32 end_row = (off + len - 1) / width;
+
+	par->fbtftops.mkdirty(info, start_row, end_row);
 }
 
 static void fbtft_ops_damage_area(struct fb_info *info, u32 x, u32 y, u32 width, u32 height)
Signature · 1 line
2.52.0
#1 lore raw
Quoted 6 lines · ChanSoo Shin

Instead of marking the entire display as dirty, calculate start_row and end_row based on off/len and mark only those rows. This improves performance for partial framebuffer updates.

---

This is v3 but it's not marked or described.

Have you tested this patch? What was the speed up?

regards,
dan carpenter

#2 lore raw
In reply to ChanSoo Shin
Quoted 14 lines · ChanSoo Shin

Instead of marking the entire display as dirty, calculate start_row and end_row based on off/len and mark only those rows. This improves performance for partial framebuffer updates.

---
 drivers/staging/fbtft/fbtft-core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/staging/fbtft/fbtft-core.c +0 -0
index 8a5ccc8ae0a1..0fbdfdaaa94d 100644

drivers/staging/fbtft/fbtft-core.c static void fbtft_ops_damage_range(struct fb_info *info, off_t off, size_t len) · line 422

Quoted 10 lines
drivers/staging/fbtft/fbtft-core.c +5 -2
@@ -415,8 +415,11 @@ static void fbtft_ops_damage_range(struct fb_info *info, off_t off, size_t len)
 {
 	struct fbtft_par *par = info->par;
 
-	/* TODO: only mark changed area update all for now */
-	par->fbtftops.mkdirty(info, -1, 0);
+	__u32 width = info->var.xres;
+	__u32 start_row = off / width;
+	__u32 end_row = (off + len - 1) / width;
+
+	par->fbtftops.mkdirty(info, start_row, end_row);

This doesn't look right: mkdirty() takes start row and number of rows, not start row and end row. Don't be fooled by how mkdirty() is declared, look at how it is implemented.

Nam