Commit dcf7000b authored by Hans de Goede's avatar Hans de Goede
Browse files

staging/vboxvideo: Drop initial_mode_queried workaround



Drop the initial_mode_queried workaround for kms clients which do not
support hotplug, all kms clients should be able to deal with hotplug.

Suggested-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190304164724.10210-2-hdegoede@redhat.com
parent 893ded36
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
TODO:
-Get a full review from the drm-maintainers on dri-devel done on this driver
-Drop all the logic around initial_mode_queried, the master_set and
 master_drop callbacks and everything related to this. kms clients can handle
 hotplugs.
-Extend this TODO with the results of that review

Please send any patches to Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
+0 −25
Original line number Diff line number Diff line
@@ -200,36 +200,11 @@ static const struct file_operations vbox_fops = {
	.read = drm_read,
};

static int vbox_master_set(struct drm_device *dev,
			   struct drm_file *file_priv, bool from_open)
{
	struct vbox_private *vbox = dev->dev_private;

	/*
	 * We do not yet know whether the new owner can handle hotplug, so we
	 * do not advertise dynamic modes on the first query and send a
	 * tentative hotplug notification after that to see if they query again.
	 */
	vbox->initial_mode_queried = false;

	return 0;
}

static void vbox_master_drop(struct drm_device *dev, struct drm_file *file_priv)
{
	struct vbox_private *vbox = dev->dev_private;

	/* See vbox_master_set() */
	vbox->initial_mode_queried = false;
}

static struct drm_driver driver = {
	.driver_features =
	    DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME | DRIVER_ATOMIC,

	.lastclose = drm_fb_helper_lastclose,
	.master_set = vbox_master_set,
	.master_drop = vbox_master_drop,

	.fops = &vbox_fops,
	.irq_handler = vbox_irq_handler,
+0 −6
Original line number Diff line number Diff line
@@ -83,12 +83,6 @@ struct vbox_private {
	} ttm;

	struct mutex hw_mutex; /* protects modeset and accel/vbva accesses */
	/*
	 * We decide whether or not user-space supports display hot-plug
	 * depending on whether they react to a hot-plug event after the initial
	 * mode query.
	 */
	bool initial_mode_queried;
	struct work_struct hotplug_work;
	u32 input_mapping_width;
	u32 input_mapping_height;
+3 −3
Original line number Diff line number Diff line
@@ -32,9 +32,9 @@ void vbox_report_caps(struct vbox_private *vbox)
	u32 caps = VBVACAPS_DISABLE_CURSOR_INTEGRATION |
		   VBVACAPS_IRQ | VBVACAPS_USE_VBVA_ONLY;

	if (vbox->initial_mode_queried)
	/* The host only accepts VIDEO_MODE_HINTS if it is send separately. */
	hgsmi_send_caps_info(vbox->guest_pool, caps);
	caps |= VBVACAPS_VIDEO_MODE_HINTS;

	hgsmi_send_caps_info(vbox->guest_pool, caps);
}

+2 −19
Original line number Diff line number Diff line
@@ -736,29 +736,12 @@ static int vbox_get_modes(struct drm_connector *connector)

	vbox_connector = to_vbox_connector(connector);
	vbox = connector->dev->dev_private;
	/*
	 * Heuristic: we do not want to tell the host that we support dynamic
	 * resizing unless we feel confident that the user space client using
	 * the video driver can handle hot-plug events.  So the first time modes
	 * are queried after a "master" switch we tell the host that we do not,
	 * and immediately after we send the client a hot-plug notification as
	 * a test to see if they will respond and query again.
	 * That is also the reason why capabilities are reported to the host at
	 * this place in the code rather than elsewhere.
	 * We need to report the flags location before reporting the IRQ
	 * capability.
	 */

	hgsmi_report_flags_location(vbox->guest_pool, GUEST_HEAP_OFFSET(vbox) +
				    HOST_FLAGS_OFFSET);
	if (vbox_connector->vbox_crtc->crtc_id == 0)
		vbox_report_caps(vbox);
	if (!vbox->initial_mode_queried) {
		if (vbox_connector->vbox_crtc->crtc_id == 0) {
			vbox->initial_mode_queried = true;
			vbox_report_hotplug(vbox);
		}
		return drm_add_modes_noedid(connector, 800, 600);
	}

	num_modes = drm_add_modes_noedid(connector, 2560, 1600);
	preferred_width = vbox_connector->mode_hint.width ?
			  vbox_connector->mode_hint.width : 1024;