HI,

On 12-10-17 14:44, Hans de Goede wrote:
Hi,

On 12-10-17 11:17, Michael Thayer wrote:
Hello Both,

11.10.2017 17:41, Hans de Goede wrote:
Hi,

On 11-10-17 07:26, Michael Thayer wrote:
Hello Gianfranco,

02.10.2017 12:11, Gianfranco Costamagna wrote:
Thanks for the heads-up.  I am gradually adjusting our in-tree code to
match vboxvideo in staging, so at some point, when things stop turning
up to stop me, I will probably hit the crucial difference.  Gianfranco,
if you have time could you please give the Additions from the next beta
release a try, when it is available, since I have already started the
process?  I would be very grateful if you could.  I will too of course
when I find a moment, moments are just in short supply.


RC1 is now broken too
I haven't taken a look at the in-kernel version, but in RC1 the reason
was that the arguments to out*() calls got swapped: the Linux kernel
reverses them compared to everyone else I know of, and I failed to do
that during clean-up to match kernel style.  Will be committing soon.

Ok, so I double checked and this is not the same problem as people using
the driver from the upstream kernel's driver/staging are seeing, the
outl/w/b operands there are all in the right order.

That does not surprise me greatly.  The question is who if anyone will
instrument the staging version with printk commands to see what is going
wrong.  Hans, if you can answer without wasting time researching, can
you think of a simple way to send printk output straight to the
VirtualBox debug I/O port?  That could be simpler than setting up a
virtual serial port.  (I wonder how much work it would be to send
virtual serial port output straight to the log file...)  I do not
immediately plan to do the instrumentation - it is lower priority for me
than getting our code in a state to be submitted to the kernel, and that
is already going slowly enough.

<snip>

But I've just managed to reproduce this using F27 / gnome-shell 3.26,
so I'm looking into a fix now.

Attached is a fix, which I've already submitted for inclusion into the
mainline kernel. I believe this fix should also be applied to the VirtualBox
5.2 Guest Additions version of the driver too, as the bug seems to originally
come from there and to be present there too.

>From 3b40f521aa2f42862203497a94ae77536f41ade2 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdego...@redhat.com>
Date: Thu, 12 Oct 2017 19:44:48 +0200
Subject: [PATCH] staging: vboxvideo: Fix reporting invalid
 suggested-offset-properties

The x and y hints receives from the host are unsigned 32 bit integers and
they get set to -1 (0xffffffff) when invalid. Before this commit the
vboxvideo driver was storing them in an u16 causing the -1 to be truncated
to 65535 which, once reported to userspace, was breaking gnome 3.26+
in Wayland mode.

This commit stores the host values in 32 bit variables, removing the
truncation and checks for -1, replacing it with 0 as -1 is not a valid
suggested-offset-property value. Likewise the properties are now
initialized to 0 instead of -1, since -1 is not a valid value.
This fixes gnome 3.26+ in Wayland mode not working with the vboxvideo
driver.

Reported-by: Gianfranco Costamagna <locutusofb...@debian.org>
Cc: sta...@vger.kernel.org
Cc: Michael Thayer <michael.tha...@oracle.com>
Signed-off-by: Hans de Goede <hdego...@redhat.com>
---
 drivers/staging/vboxvideo/vbox_drv.h  |  8 ++++----
 drivers/staging/vboxvideo/vbox_irq.c  |  4 ++--
 drivers/staging/vboxvideo/vbox_mode.c | 26 ++++++++++++++++++--------
 3 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/vboxvideo/vbox_drv.h b/drivers/staging/vboxvideo/vbox_drv.h
index 4b9302703b36..eeac4f0cb2c6 100644
--- a/drivers/staging/vboxvideo/vbox_drv.h
+++ b/drivers/staging/vboxvideo/vbox_drv.h
@@ -137,8 +137,8 @@ struct vbox_connector {
 	char name[32];
 	struct vbox_crtc *vbox_crtc;
 	struct {
-		u16 width;
-		u16 height;
+		u32 width;
+		u32 height;
 		bool disconnected;
 	} mode_hint;
 };
@@ -150,8 +150,8 @@ struct vbox_crtc {
 	unsigned int crtc_id;
 	u32 fb_offset;
 	bool cursor_enabled;
-	u16 x_hint;
-	u16 y_hint;
+	u32 x_hint;
+	u32 y_hint;
 };
 
 struct vbox_encoder {
diff --git a/drivers/staging/vboxvideo/vbox_irq.c b/drivers/staging/vboxvideo/vbox_irq.c
index 3ca8bec62ac4..74abdf02d9fd 100644
--- a/drivers/staging/vboxvideo/vbox_irq.c
+++ b/drivers/staging/vboxvideo/vbox_irq.c
@@ -150,8 +150,8 @@ static void vbox_update_mode_hints(struct vbox_private *vbox)
 
 		disconnected = !(hints->enabled);
 		crtc_id = vbox_conn->vbox_crtc->crtc_id;
-		vbox_conn->mode_hint.width = hints->cx & 0x8fff;
-		vbox_conn->mode_hint.height = hints->cy & 0x8fff;
+		vbox_conn->mode_hint.width = hints->cx;
+		vbox_conn->mode_hint.height = hints->cy;
 		vbox_conn->vbox_crtc->x_hint = hints->dx;
 		vbox_conn->vbox_crtc->y_hint = hints->dy;
 		vbox_conn->mode_hint.disconnected = disconnected;
diff --git a/drivers/staging/vboxvideo/vbox_mode.c b/drivers/staging/vboxvideo/vbox_mode.c
index 257a77830410..6f08dc966719 100644
--- a/drivers/staging/vboxvideo/vbox_mode.c
+++ b/drivers/staging/vboxvideo/vbox_mode.c
@@ -553,12 +553,22 @@ static int vbox_get_modes(struct drm_connector *connector)
 		++num_modes;
 	}
 	vbox_set_edid(connector, preferred_width, preferred_height);
-	drm_object_property_set_value(
-		&connector->base, vbox->dev->mode_config.suggested_x_property,
-		vbox_connector->vbox_crtc->x_hint);
-	drm_object_property_set_value(
-		&connector->base, vbox->dev->mode_config.suggested_y_property,
-		vbox_connector->vbox_crtc->y_hint);
+
+	if (vbox_connector->vbox_crtc->x_hint != -1)
+		drm_object_property_set_value(&connector->base,
+			vbox->dev->mode_config.suggested_x_property,
+			vbox_connector->vbox_crtc->x_hint);
+	else
+		drm_object_property_set_value(&connector->base,
+			vbox->dev->mode_config.suggested_x_property, 0);
+
+	if (vbox_connector->vbox_crtc->y_hint != -1)
+		drm_object_property_set_value(&connector->base,
+			vbox->dev->mode_config.suggested_y_property,
+			vbox_connector->vbox_crtc->y_hint);
+	else
+		drm_object_property_set_value(&connector->base,
+			vbox->dev->mode_config.suggested_y_property, 0);
 
 	return num_modes;
 }
@@ -640,9 +650,9 @@ static int vbox_connector_init(struct drm_device *dev,
 
 	drm_mode_create_suggested_offset_properties(dev);
 	drm_object_attach_property(&connector->base,
-				   dev->mode_config.suggested_x_property, -1);
+				   dev->mode_config.suggested_x_property, 0);
 	drm_object_attach_property(&connector->base,
-				   dev->mode_config.suggested_y_property, -1);
+				   dev->mode_config.suggested_y_property, 0);
 	drm_connector_register(connector);
 
 	drm_mode_connector_attach_encoder(connector, encoder);
-- 
2.14.2

_______________________________________________
vbox-dev mailing list
vbox-dev@virtualbox.org
https://www.virtualbox.org/mailman/listinfo/vbox-dev

Reply via email to