Skip to content

Commit

Permalink
staging/vboxvideo: Drop initial_mode_queried workaround
Browse files Browse the repository at this point in the history
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: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190304164724.10210-2-hdegoede@redhat.com
  • Loading branch information
Hans de Goede committed Mar 11, 2019
1 parent 893ded3 commit dcf7000
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 56 deletions.
3 changes: 0 additions & 3 deletions drivers/staging/vboxvideo/TODO
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
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>,
Expand Down
25 changes: 0 additions & 25 deletions drivers/staging/vboxvideo/vbox_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 0 additions & 6 deletions drivers/staging/vboxvideo/vbox_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions drivers/staging/vboxvideo/vbox_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
caps |= VBVACAPS_VIDEO_MODE_HINTS;

/* 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);
}

Expand Down
21 changes: 2 additions & 19 deletions drivers/staging/vboxvideo/vbox_mode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dcf7000

Please sign in to comment.