[PATCH 2/4] fbdev: Introduce fb_dirty operation.

Rodrigo Vivi rodrigo.vivi at intel.com
Mon Jun 29 13:44:44 PDT 2015


There are cases we need to mark dirty/damaged areas, specially with
operations that touches frontbuffer directly. To cover these cases
this patch introduces the optional fb_dirty operation.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
---
 drivers/video/fbdev/core/cfbcopyarea.c | 3 +++
 drivers/video/fbdev/core/cfbfillrect.c | 3 +++
 drivers/video/fbdev/core/cfbimgblt.c   | 4 ++++
 drivers/video/fbdev/core/syscopyarea.c | 3 +++
 drivers/video/fbdev/core/sysfillrect.c | 3 +++
 drivers/video/fbdev/core/sysimgblt.c   | 4 ++++
 include/linux/fb.h                     | 3 +++
 7 files changed, 23 insertions(+)

diff --git a/drivers/video/fbdev/core/cfbcopyarea.c b/drivers/video/fbdev/core/cfbcopyarea.c
index 6d4bfee..2e5b69f 100644
--- a/drivers/video/fbdev/core/cfbcopyarea.c
+++ b/drivers/video/fbdev/core/cfbcopyarea.c
@@ -427,6 +427,9 @@ void cfb_copyarea(struct fb_info *p, const struct fb_copyarea *area)
 			src_idx += bits_per_line;
 		}
 	}
+
+	if (p->fbops->fb_dirty)
+		p->fbops->fb_dirty(p, dx, dy, width, height);
 }
 
 EXPORT_SYMBOL(cfb_copyarea);
diff --git a/drivers/video/fbdev/core/cfbfillrect.c b/drivers/video/fbdev/core/cfbfillrect.c
index ba9f58b..c8732d5 100644
--- a/drivers/video/fbdev/core/cfbfillrect.c
+++ b/drivers/video/fbdev/core/cfbfillrect.c
@@ -362,6 +362,9 @@ void cfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
 			dst_idx += p->fix.line_length*8;
 		}
 	}
+
+	if (p->fbops->fb_dirty)
+		p->fbops->fb_dirty(p, rect->dx, rect->dy, width, height);
 }
 
 EXPORT_SYMBOL(cfb_fillrect);
diff --git a/drivers/video/fbdev/core/cfbimgblt.c b/drivers/video/fbdev/core/cfbimgblt.c
index a2bb276..09c2dbe 100644
--- a/drivers/video/fbdev/core/cfbimgblt.c
+++ b/drivers/video/fbdev/core/cfbimgblt.c
@@ -267,6 +267,7 @@ void cfb_imageblit(struct fb_info *p, const struct fb_image *image)
 	u32 fgcolor, bgcolor, start_index, bitstart, pitch_index = 0;
 	u32 bpl = sizeof(u32), bpp = p->var.bits_per_pixel;
 	u32 width = image->width;
+	u32 height = image->height;
 	u32 dx = image->dx, dy = image->dy;
 	u8 __iomem *dst1;
 
@@ -303,6 +304,9 @@ void cfb_imageblit(struct fb_info *p, const struct fb_image *image)
 					start_index, pitch_index);
 	} else
 		color_imageblit(image, p, dst1, start_index, pitch_index);
+
+	if (p->fbops->fb_dirty)
+		p->fbops->fb_dirty(p, dx, dy, width, height);
 }
 
 EXPORT_SYMBOL(cfb_imageblit);
diff --git a/drivers/video/fbdev/core/syscopyarea.c b/drivers/video/fbdev/core/syscopyarea.c
index c1eda31..3f74683 100644
--- a/drivers/video/fbdev/core/syscopyarea.c
+++ b/drivers/video/fbdev/core/syscopyarea.c
@@ -360,6 +360,9 @@ void sys_copyarea(struct fb_info *p, const struct fb_copyarea *area)
 			src_idx += bits_per_line;
 		}
 	}
+
+	if (p->fbops->fb_dirty)
+		p->fbops->fb_dirty(p, dx, dy, width, height);
 }
 
 EXPORT_SYMBOL(sys_copyarea);
diff --git a/drivers/video/fbdev/core/sysfillrect.c b/drivers/video/fbdev/core/sysfillrect.c
index 33ee3d3..f2c3efa 100644
--- a/drivers/video/fbdev/core/sysfillrect.c
+++ b/drivers/video/fbdev/core/sysfillrect.c
@@ -326,6 +326,9 @@ void sys_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
 			dst_idx += p->fix.line_length*8;
 		}
 	}
+
+	if (p->fbops->fb_dirty)
+		p->fbops->fb_dirty(p, rect->dx, rect->dy, width, height);
 }
 
 EXPORT_SYMBOL(sys_fillrect);
diff --git a/drivers/video/fbdev/core/sysimgblt.c b/drivers/video/fbdev/core/sysimgblt.c
index a4d05b1..d690fb5 100644
--- a/drivers/video/fbdev/core/sysimgblt.c
+++ b/drivers/video/fbdev/core/sysimgblt.c
@@ -243,6 +243,7 @@ void sys_imageblit(struct fb_info *p, const struct fb_image *image)
 	u32 bpl = sizeof(u32), bpp = p->var.bits_per_pixel;
 	u32 width = image->width;
 	u32 dx = image->dx, dy = image->dy;
+	u32 height = image->height;
 	void *dst1;
 
 	if (p->state != FBINFO_STATE_RUNNING)
@@ -278,6 +279,9 @@ void sys_imageblit(struct fb_info *p, const struct fb_image *image)
 					start_index, pitch_index);
 	} else
 		color_imageblit(image, p, dst1, start_index, pitch_index);
+
+	if (p->fbops->fb_dirty)
+		p->fbops->fb_dirty(p, dx, dy, width, height);
 }
 
 EXPORT_SYMBOL(sys_imageblit);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 043f328..e17e4b7 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -284,6 +284,9 @@ struct fb_ops {
 	/* wait for blit idle, optional */
 	int (*fb_sync)(struct fb_info *info);
 
+	/* Mark rect as dirty (optional) */
+	void (*fb_dirty)(struct fb_info *info, u32 x1, u32 y1, u32 x2, u32 y2);
+
 	/* perform fb specific ioctl (optional) */
 	int (*fb_ioctl)(struct fb_info *info, unsigned int cmd,
 			unsigned long arg);
-- 
2.1.0



More information about the dri-devel mailing list