/* we need to lock this section since fb_cursor may use fb_imageblit()  */
char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size)
/* we need to lock this section since fb_cursor may use fb_imageblit()  */
char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size)
{
	u32 align = buf->buf_align - 1, offset;
	char *addr = buf->addr;
	if (buf->flags & FB_PIXMAP_IO) {
		if (info->fbops->fb_sync && (buf->flags & FB_PIXMAP_SYNC))
			info->fbops->fb_sync(info);
		return addr;
	}
	offset = buf->offset + align;
	offset &= ~align;
	if (offset + size > buf->size) {
		if (info->fbops->fb_sync && (buf->flags & FB_PIXMAP_SYNC))
			info->fbops->fb_sync(info);
		offset = 0;
	}
	buf->offset = offset + size;
	addr += offset;
	return addr;
}