Index: /trunk/src/VBox/Additions/linux/drm/vbox_main.c
===================================================================
--- /trunk/src/VBox/Additions/linux/drm/vbox_main.c	(revision 74778)
+++ /trunk/src/VBox/Additions/linux/drm/vbox_main.c	(revision 74779)
@@ -40,4 +40,6 @@
 #include <VBoxVideoVBE.h>
 
+#include "hgsmi_channels.h"
+
 static void vbox_user_framebuffer_destroy(struct drm_framebuffer *fb)
 {
@@ -232,7 +234,43 @@
 #endif
 
+/**
+ * Tell the host about the views.  This design originally targeted the
+ * Windows XP driver architecture and assumed that each screen would
+ * have a dedicated frame buffer with the command buffer following it,
+ * the whole being a "view".  The host works out which screen a command
+ * buffer belongs to by checking whether it is in the first view, then
+ * whether it is in the second and so on.  The first match wins.  We
+ * cheat around this by making the first view be the managed memory
+ * plus the first command buffer, the second the same plus the second
+ * buffer and so on.
+ */
+static int vbox_set_views(struct vbox_private *vbox)
+{
+	VBVAINFOVIEW *p;
+	int i;
+
+	p = VBoxHGSMIBufferAlloc(vbox->guest_pool, sizeof(*p),
+			       HGSMI_CH_VBVA, VBVA_INFO_VIEW);
+	if (!p)
+		return -ENOMEM;
+
+	for (i = 0; i < vbox->num_crtcs; ++i) {
+		p->u32ViewIndex = i;
+		p->u32ViewOffset = 0;
+		p->u32ViewSize = vbox->available_vram_size +
+			i * VBVA_MIN_BUFFER_SIZE;
+		p->u32MaxScreenSize = vbox->available_vram_size;
+
+		VBoxHGSMIBufferSubmit(vbox->guest_pool, p);
+	}
+
+	VBoxHGSMIBufferFree(vbox->guest_pool, p);
+
+	return 0;
+}
+
 static int vbox_accel_init(struct vbox_private *vbox)
 {
-	unsigned int i;
+	unsigned int i, ret;
 
 	vbox->vbva_info = devm_kcalloc(vbox->dev->dev, vbox->num_crtcs,
@@ -258,6 +296,13 @@
 
 	vbox_enable_accel(vbox);
-
-	return 0;
+	ret = vbox_set_views(vbox);
+	if (ret)
+		goto err_pci_iounmap;
+
+	return 0;
+
+err_pci_iounmap:
+	pci_iounmap(vbox->dev->pdev, vbox->vbva_buffers);
+	return ret;
 }
 
Index: /trunk/src/VBox/Additions/linux/drm/vbox_mode.c
===================================================================
--- /trunk/src/VBox/Additions/linux/drm/vbox_mode.c	(revision 74778)
+++ /trunk/src/VBox/Additions/linux/drm/vbox_mode.c	(revision 74779)
@@ -45,5 +45,4 @@
 
 #include "VBoxVideo.h"
-#include "hgsmi_channels.h"
 
 static int vbox_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv,
@@ -108,42 +107,8 @@
 	flags |= vbox_crtc->disconnected ? VBVA_SCREEN_F_DISABLED : 0;
 	VBoxHGSMIProcessDisplayInfo(vbox->guest_pool, vbox_crtc->crtc_id,
-				   x_offset, y_offset,
+				   x_offset, y_offset, vbox_crtc->fb_offset +
 				   crtc->x * bpp / 8 + crtc->y * pitch,
 				   pitch, width, height,
 				   vbox_crtc->blanked ? 0 : bpp, flags);
-}
-
-static int vbox_set_view(struct drm_crtc *crtc)
-{
-	struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
-	struct vbox_private *vbox = crtc->dev->dev_private;
-	VBVAINFOVIEW *p;
-
-	/*
-	 * Tell the host about the view.  This design originally targeted the
-	 * Windows XP driver architecture and assumed that each screen would
-	 * have a dedicated frame buffer with the command buffer following it,
-	 * the whole being a "view".  The host works out which screen a command
-	 * buffer belongs to by checking whether it is in the first view, then
-	 * whether it is in the second and so on.  The first match wins.  We
-	 * cheat around this by making the first view be the managed memory
-	 * plus the first command buffer, the second the same plus the second
-	 * buffer and so on.
-	 */
-	p = VBoxHGSMIBufferAlloc(vbox->guest_pool, sizeof(*p),
-			       HGSMI_CH_VBVA, VBVA_INFO_VIEW);
-	if (!p)
-		return -ENOMEM;
-
-	p->u32ViewIndex = vbox_crtc->crtc_id;
-	p->u32ViewOffset = vbox_crtc->fb_offset;
-	p->u32ViewSize = vbox->available_vram_size - vbox_crtc->fb_offset +
-		       vbox_crtc->crtc_id * VBVA_MIN_BUFFER_SIZE;
-	p->u32MaxScreenSize = vbox->available_vram_size - vbox_crtc->fb_offset;
-
-	VBoxHGSMIBufferSubmit(vbox->guest_pool, p);
-	VBoxHGSMIBufferFree(vbox->guest_pool, p);
-
-	return 0;
 }
 
@@ -287,5 +252,4 @@
 		list_for_each_entry(crtci, &vbox->dev->mode_config.crtc_list,
 				    head) {
-			vbox_set_view(crtc);
 			vbox_do_modeset(crtci, &crtci->mode);
 		}
@@ -305,5 +269,4 @@
 		return ret;
 	mutex_lock(&vbox->hw_mutex);
-	ret = vbox_set_view(crtc);
 	if (!ret)
 		vbox_do_modeset(crtc, mode);
