Skip to content

Commit 75c3e8a

Browse files
en4bzzackr
authored andcommitted
drm/vmwgfx: Trigger a modeset when the screen moves
When multi-monitor is cycled the X,Y position of the Screen Target will likely change but the resolution will not. We need to trigger a modeset when this occurs in order to recreate the Screen Target with the correct X,Y position. Fixes a bug where multiple displays are shown in a single scrollable host window rather than in 2+ windows on separate host displays. Fixes: 4268269 ("drm/vmwgfx: Filter modes which exceed graphics memory") Signed-off-by: Ian Forbes <[email protected]> Signed-off-by: Zack Rusin <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent cb372a5 commit 75c3e8a

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,32 @@ vmw_stdu_connector_mode_valid(struct drm_connector *connector,
873873
return MODE_OK;
874874
}
875875

876+
/*
877+
* Trigger a modeset if the X,Y position of the Screen Target changes.
878+
* This is needed when multi-mon is cycled. The original Screen Target will have
879+
* the same mode but its relative X,Y position in the topology will change.
880+
*/
881+
static int vmw_stdu_connector_atomic_check(struct drm_connector *conn,
882+
struct drm_atomic_state *state)
883+
{
884+
struct drm_connector_state *conn_state;
885+
struct vmw_screen_target_display_unit *du;
886+
struct drm_crtc_state *new_crtc_state;
887+
888+
conn_state = drm_atomic_get_connector_state(state, conn);
889+
du = vmw_connector_to_stdu(conn);
890+
891+
if (!conn_state->crtc)
892+
return 0;
893+
894+
new_crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
895+
if (du->base.gui_x != du->base.set_gui_x ||
896+
du->base.gui_y != du->base.set_gui_y)
897+
new_crtc_state->mode_changed = true;
898+
899+
return 0;
900+
}
901+
876902
static const struct drm_connector_funcs vmw_stdu_connector_funcs = {
877903
.dpms = vmw_du_connector_dpms,
878904
.detect = vmw_du_connector_detect,
@@ -887,7 +913,8 @@ static const struct drm_connector_funcs vmw_stdu_connector_funcs = {
887913
static const struct
888914
drm_connector_helper_funcs vmw_stdu_connector_helper_funcs = {
889915
.get_modes = vmw_connector_get_modes,
890-
.mode_valid = vmw_stdu_connector_mode_valid
916+
.mode_valid = vmw_stdu_connector_mode_valid,
917+
.atomic_check = vmw_stdu_connector_atomic_check,
891918
};
892919

893920

0 commit comments

Comments
 (0)