A new user interface for you! Read more...

File drm-vboxvideo-Initialize-data-needed-to-map-fbdev-memory.patch of Package virtualbox-5.0

From: Egbert Eich <eich@suse.de>
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 <eich@suse.de>
Signed-off-by: Egbert Eich <eich@suse.com>
---
 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);