Skip to content

Commit 7ef91dc

Browse files
en4bzzackr
authored andcommitted
drm/vmwgfx: Don't destroy Screen Target when CRTC is enabled but inactive
drm_crtc_helper_funcs::atomic_disable can be called even when the CRTC is still enabled. This can occur when the mode changes or the CRTC is set as inactive. In the case where the CRTC is being set as inactive we only want to blank the screen. The Screen Target should remain intact as long as the mode has not changed and CRTC is enabled. This fixes a bug with GDM where locking the screen results in a permanent black screen because the Screen Target is no longer defined. Fixes: 7b00620 ("drm/vmwgfx: Implement virtual crc generation") Signed-off-by: Ian Forbes <[email protected]> Reviewed-by: Martin Krastev <[email protected]> Signed-off-by: Zack Rusin <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent a54a200 commit 7ef91dc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ static void vmw_stdu_crtc_atomic_disable(struct drm_crtc *crtc,
421421
{
422422
struct vmw_private *dev_priv;
423423
struct vmw_screen_target_display_unit *stdu;
424+
struct drm_crtc_state *new_crtc_state;
424425
int ret;
425426

426427
if (!crtc) {
@@ -430,6 +431,7 @@ static void vmw_stdu_crtc_atomic_disable(struct drm_crtc *crtc,
430431

431432
stdu = vmw_crtc_to_stdu(crtc);
432433
dev_priv = vmw_priv(crtc->dev);
434+
new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
433435

434436
if (dev_priv->vkms_enabled)
435437
drm_crtc_vblank_off(crtc);
@@ -441,6 +443,14 @@ static void vmw_stdu_crtc_atomic_disable(struct drm_crtc *crtc,
441443

442444
(void) vmw_stdu_update_st(dev_priv, stdu);
443445

446+
/* Don't destroy the Screen Target if we are only setting the
447+
* display as inactive
448+
*/
449+
if (new_crtc_state->enable &&
450+
!new_crtc_state->active &&
451+
!new_crtc_state->mode_changed)
452+
return;
453+
444454
ret = vmw_stdu_destroy_st(dev_priv, stdu);
445455
if (ret)
446456
DRM_ERROR("Failed to destroy Screen Target\n");

0 commit comments

Comments
 (0)