forked from pool/virtualbox
79 lines
2.6 KiB
Diff
79 lines
2.6 KiB
Diff
|
From: Egbert Eich <eich@suse.de>
|
||
|
Date: Mon Apr 25 16:47:41 2016 +0200
|
||
|
Subject: drm/vboxvideo: Add delayed update to support fbdev
|
||
|
Patch-mainline: Not yet
|
||
|
Git-commit: 0671f61d2a240e26c02d5a4d5cb993e1a446e601
|
||
|
References: boo#977200
|
||
|
|
||
|
Due to the virtrual nature of the emulated hardware, the
|
||
|
hardware needs help to know about updates to screen content.
|
||
|
The fb layer provides this with 'deferred IO'.
|
||
|
This patch adds support for this to the vboxvideo DRM driver.
|
||
|
|
||
|
Signed-off-by: Egbert Eich <eich@suse.de>
|
||
|
Signed-off-by: Egbert Eich <eich@suse.com>
|
||
|
---
|
||
|
src/VBox/Additions/linux/drm/vbox_fb.c | 36 ++++++++++++++++++++++++++++++++++
|
||
|
1 file changed, 36 insertions(+)
|
||
|
diff --git a/src/VBox/Additions/linux/drm/vbox_fb.c b/src/VBox/Additions/linux/drm/vbox_fb.c
|
||
|
index 8e0e40d..e8c5a60 100644
|
||
|
--- a/src/VBox/Additions/linux/drm/vbox_fb.c
|
||
|
+++ b/src/VBox/Additions/linux/drm/vbox_fb.c
|
||
|
@@ -68,6 +68,7 @@
|
||
|
#include <drm/drm_crtc_helper.h>
|
||
|
#include "vbox_drv.h"
|
||
|
|
||
|
+#define VBOX_DIRTY_DELAY (HZ / 30)
|
||
|
/**
|
||
|
* Tell the host about dirty rectangles to update.
|
||
|
*/
|
||
|
@@ -162,6 +163,38 @@ static void vbox_dirty_update(struct vbox_fbdev *fbdev,
|
||
|
vbox_bo_unreserve(bo);
|
||
|
}
|
||
|
|
||
|
+static void vbox_deferred_io(struct fb_info *info,
|
||
|
+ struct list_head *pagelist)
|
||
|
+{
|
||
|
+ struct vbox_fbdev *fbdev = info->par;
|
||
|
+ unsigned long start, end, min, max;
|
||
|
+ struct page *page;
|
||
|
+ int y1, y2;
|
||
|
+
|
||
|
+ min = ULONG_MAX;
|
||
|
+ max = 0;
|
||
|
+ list_for_each_entry(page, pagelist, lru) {
|
||
|
+ start = page->index << PAGE_SHIFT;
|
||
|
+ end = start + PAGE_SIZE - 1;
|
||
|
+ min = min(min, start);
|
||
|
+ max = max(max, end);
|
||
|
+ }
|
||
|
+
|
||
|
+ if (min < max) {
|
||
|
+ y1 = min / info->fix.line_length;
|
||
|
+ y2 = (max / info->fix.line_length) + 1;
|
||
|
+ printk(KERN_INFO "%s: Calling dirty update: 0, %d, %d, %d\n",
|
||
|
+ __func__, y1, info->var.xres, y2 - y1 - 1);
|
||
|
+ vbox_dirty_update(fbdev, 0, y1, info->var.xres, y2 - y1 - 1);
|
||
|
+ }
|
||
|
+}
|
||
|
+
|
||
|
+static struct fb_deferred_io vbox_defio =
|
||
|
+{
|
||
|
+ .delay = VBOX_DIRTY_DELAY,
|
||
|
+ .deferred_io = vbox_deferred_io,
|
||
|
+};
|
||
|
+
|
||
|
static void vbox_fillrect(struct fb_info *info,
|
||
|
const struct fb_fillrect *rect)
|
||
|
{
|
||
|
@@ -324,6 +357,9 @@ static int vboxfb_create(struct drm_fb_helper *helper,
|
||
|
info->screen_base = sysram;
|
||
|
info->screen_size = size;
|
||
|
|
||
|
+ info->fbdefio = &vbox_defio;
|
||
|
+ fb_deferred_io_init(info);
|
||
|
+
|
||
|
info->pixmap.flags = FB_PIXMAP_SYSTEM;
|
||
|
|
||
|
DRM_DEBUG_KMS("allocated %dx%d\n",
|