From 0fb113d11a530472bad2bfad867deddf6e8531acc885413012862f39bebe0f06 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Tue, 26 Apr 2016 12:37:23 +0000 Subject: [PATCH] Accepting request 391691 from home:eeich:branches:Virtualization - drm-vboxvideo-Initialize-data-needed-to-map-fbdev-memory.patch: * Add missing initialization of scanout buffer base and size for proper fbdev support. - drm-vboxvideo-Add-delayed-update-to-support-fbdev.patch: * Add support for delayed_io in fbdev-layer. (boo#977200). OBS-URL: https://build.opensuse.org/request/show/391691 OBS-URL: https://build.opensuse.org/package/show/Virtualization/virtualbox?expand=0&rev=254 --- ...-Add-delayed-update-to-support-fbdev.patch | 78 +++++++++++++++++++ ...lize-data-needed-to-map-fbdev-memory.patch | 60 ++++++++++++++ virtualbox.changes | 10 +++ virtualbox.spec | 5 ++ 4 files changed, 153 insertions(+) create mode 100644 drm-vboxvideo-Add-delayed-update-to-support-fbdev.patch create mode 100644 drm-vboxvideo-Initialize-data-needed-to-map-fbdev-memory.patch diff --git a/drm-vboxvideo-Add-delayed-update-to-support-fbdev.patch b/drm-vboxvideo-Add-delayed-update-to-support-fbdev.patch new file mode 100644 index 0000000..2a7b6f1 --- /dev/null +++ b/drm-vboxvideo-Add-delayed-update-to-support-fbdev.patch @@ -0,0 +1,78 @@ +From: Egbert Eich +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 +Signed-off-by: Egbert Eich +--- + 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 + #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", diff --git a/drm-vboxvideo-Initialize-data-needed-to-map-fbdev-memory.patch b/drm-vboxvideo-Initialize-data-needed-to-map-fbdev-memory.patch new file mode 100644 index 0000000..aeb691d --- /dev/null +++ b/drm-vboxvideo-Initialize-data-needed-to-map-fbdev-memory.patch @@ -0,0 +1,60 @@ +From: Egbert Eich +Date: Mon Apr 25 09:32:04 2016 +0200 +Subject: drm/vboxvideo: Initialize data needed to map fbdev memory +Patch-mainline: Not yet +Git-commit: 4153ec3d267288659638e2397bcae5298e7f5930 +References: boo#977200 + +Due to a missing initialization there was no way to map fbdev memory. +Thus for example using the Xserver with the fbdev driver failed. +This fix adds initialization for fix.smem_start and fix.smem_len +in the fb_info structure, which fixes this problem. + +Signed-off-by: Egbert Eich +Signed-off-by: Egbert Eich +--- + src/VBox/Additions/linux/drm/vbox_drv.h | 1 + + src/VBox/Additions/linux/drm/vbox_fb.c | 8 ++++++++ + src/VBox/Additions/linux/drm/vbox_mode.c | 2 ++ + 3 files changed, 11 insertions(+) +diff --git a/src/VBox/Additions/linux/drm/vbox_drv.h b/src/VBox/Additions/linux/drm/vbox_drv.h +index fa3eb3c..a9bc156 100644 +--- a/src/VBox/Additions/linux/drm/vbox_drv.h ++++ b/src/VBox/Additions/linux/drm/vbox_drv.h +@@ -227,6 +227,7 @@ int vbox_framebuffer_init(struct drm_device *dev, + int vbox_fbdev_init(struct drm_device *dev); + void vbox_fbdev_fini(struct drm_device *dev); + void vbox_fbdev_set_suspend(struct drm_device *dev, int state); ++void vbox_fbdev_set_base(struct vbox_private *vbox, unsigned long gpu_addr); + + struct vbox_bo { + struct ttm_buffer_object bo; +diff --git a/src/VBox/Additions/linux/drm/vbox_fb.c b/src/VBox/Additions/linux/drm/vbox_fb.c +index a90f11d..8e0e40d 100644 +--- a/src/VBox/Additions/linux/drm/vbox_fb.c ++++ b/src/VBox/Additions/linux/drm/vbox_fb.c +@@ -452,3 +452,11 @@ void vbox_fbdev_set_suspend(struct drm_device *dev, int state) + + fb_set_suspend(vbox->fbdev->helper.fbdev, state); + } ++ ++void vbox_fbdev_set_base(struct vbox_private *vbox, unsigned long gpu_addr) ++{ ++ vbox->fbdev->helper.fbdev->fix.smem_start = ++ vbox->fbdev->helper.fbdev->apertures->ranges[0].base + ++ gpu_addr; ++ vbox->fbdev->helper.fbdev->fix.smem_len = vbox->vram_size - gpu_addr; ++} +diff --git a/src/VBox/Additions/linux/drm/vbox_mode.c b/src/VBox/Additions/linux/drm/vbox_mode.c +index d00ebff..40b6eb0 100644 +--- a/src/VBox/Additions/linux/drm/vbox_mode.c ++++ b/src/VBox/Additions/linux/drm/vbox_mode.c +@@ -224,6 +224,8 @@ static int vbox_crtc_do_set_base(struct drm_crtc *crtc, + ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &bo->kmap); + if (ret) + DRM_ERROR("failed to kmap fbcon\n"); ++ else ++ vbox_fbdev_set_base(vbox, gpu_addr); + } + vbox_bo_unreserve(bo); + diff --git a/virtualbox.changes b/virtualbox.changes index e7abdd8..f157671 100644 --- a/virtualbox.changes +++ b/virtualbox.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Tue Apr 26 11:23:41 UTC 2016 - eich@suse.com + +- drm-vboxvideo-Initialize-data-needed-to-map-fbdev-memory.patch: + * Add missing initialization of scanout buffer base and size for + proper fbdev support. +- drm-vboxvideo-Add-delayed-update-to-support-fbdev.patch: + * Add support for delayed_io in fbdev-layer. + (boo#977200). + ------------------------------------------------------------------- Fri Apr 22 19:38:06 UTC 2016 - Larry.Finger@lwfinger.net diff --git a/virtualbox.spec b/virtualbox.spec index 6c334b3..1daf2da 100644 --- a/virtualbox.spec +++ b/virtualbox.spec @@ -87,6 +87,9 @@ Patch109: vbox-usb-warning.diff Patch111: vbox_prevent_wrong_SONAME.patch # Apply Changeset 60565 - Fix bug in DevLsiLogicSCSI.cpp Patch112: changeset_60565.diff +# Patch to make xf86-video-fbdev work on vboxvideodrm +Patch114: drm-vboxvideo-Initialize-data-needed-to-map-fbdev-memory.patch +Patch113: drm-vboxvideo-Add-delayed-update-to-support-fbdev.patch # BuildRequires: LibVNCServer-devel BuildRequires: SDL-devel @@ -319,6 +322,8 @@ This package contains icons for guest desktop files that were created on the des %patch109 -p1 %patch111 -p1 %patch112 -p1 +%patch113 -p1 +%patch114 -p1 #copy user manual cp %{SOURCE1} UserManual.pdf #copy kbuild config