From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5310EC433E1 for ; Tue, 25 Aug 2020 21:57:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2293D2071E for ; Tue, 25 Aug 2020 21:57:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fcTL7q1g" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726723AbgHYV5o (ORCPT ); Tue, 25 Aug 2020 17:57:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726303AbgHYV5n (ORCPT ); Tue, 25 Aug 2020 17:57:43 -0400 Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A7F4C061574 for ; Tue, 25 Aug 2020 14:57:43 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id k20so170846qtq.11 for ; Tue, 25 Aug 2020 14:57:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OWRVhAyQrMMbNCybKNpaTOkjxzgRbbU/WkM3Dt9pX54=; b=fcTL7q1gFc3oZ0ZWW6ITOvGLzyP26ghrzc9ma1/q3Derm5NBJOZwguT0X4p6uheACV uVVIQzNvB8KGcKFTpJo5tKZxLc9thz96kuXIo29pjk1ZNZkKNl8b8OfOHJLtaPiNbaUY 7CwCpaIoA0O0CwL1VzmdXnKZkYd4ZWLbRYzhHWtimbk6krXb9E7L67tPAZJ6qtyR+9S+ BfQFfmygj1UK6xTAM9En3S4vNuGyIq4S4Fcj1wFuh9bg7Vdv0yV7SVLXjWyeB4IjLzJ3 8mOwUBdLrzcuoMvfNvOV9W3M1KnLAw7XMREVAjiwctxj0JRLrt4P42VToIqM9nSEUquW Pvcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OWRVhAyQrMMbNCybKNpaTOkjxzgRbbU/WkM3Dt9pX54=; b=Pg6W8K/JURin4khhNPiKnCMU9YjipRvjgDurbNY/Xlqt+1/A2eGU6GENJRQq7R/0eG xkdYvZYREnsCkjYe/xkmbGP5iqOaXfcxFMVJ1CNSLvHM7v2vuY/2ETc0mUuWGnUUD1UE nwWsVcEX8+SDom0NQDJdxNQaNYj67PF5pIrrBgBWQfJZRaWutnLCJMKxw3i8wvH9OaC1 YJjVboykEHGFXw2JnsFHtGhHGWDt1YWvtEJOJWkpFmMOWsrsLdmXU60Sh4swW6alHsGC I1KJdqQNkqqmK/sw6TiGe+TyD0n1w1AowHmJ07+Im0IiIBqkEb/7OToagD3CX1kyS0m5 qAWA== X-Gm-Message-State: AOAM533hz8AFsm3o/7baPnZQ4g8AzUQHZC8a74EnTOvbhDLrzFHZAcmj Sz8RFq1fzztl6QXCajFpa20= X-Google-Smtp-Source: ABdhPJwkJ91ZZA7Cq3/WkBuZ3vsYC6CZvy1AW1h0c+XAfq+Qj5c/LtYCXS036Taqiw9hcTxMPh+/Ew== X-Received: by 2002:aed:3824:: with SMTP id j33mr3131055qte.374.1598392662216; Tue, 25 Aug 2020 14:57:42 -0700 (PDT) Received: from localhost.localdomain ([189.7.69.189]) by smtp.gmail.com with ESMTPSA id w28sm128308qkw.87.2020.08.25.14.57.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2020 14:57:41 -0700 (PDT) From: Diego Viola To: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org, Gerd Hoffmann , 1882851@bugs.launchpad.net, Jiri Slaby , Diego Viola Subject: [PATCH] drm/virtio: fix unblank Date: Tue, 25 Aug 2020 18:56:46 -0300 Message-Id: <20200825215646.66853-1-diego.viola@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200818072511.6745-1-kraxel@redhat.com> References: <20200818072511.6745-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gerd Hoffmann When going through a disable/enable cycle without changing the framebuffer the optimization added by commit 3954ff10e06e ("drm/virtio: skip set_scanout if framebuffer didn't change") causes the screen stay blank. Add a bool to force an update to fix that. v2: use drm_atomic_crtc_needs_modeset() (Daniel). Cc: 1882851@bugs.launchpad.net Fixes: 3954ff10e06e ("drm/virtio: skip set_scanout if framebuffer didn't change") Signed-off-by: Gerd Hoffmann Tested-by: Jiri Slaby Tested-by: Diego Viola --- drivers/gpu/drm/virtio/virtgpu_display.c | 11 +++++++++++ drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_plane.c | 4 +++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index af55b334be2f..35b5c80f5d85 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -123,6 +123,17 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc, static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { + struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc); + + /* + * virtio-gpu can't do modeset and plane update operations + * independant from each other. So the actual modeset happens + * in the plane update callback, and here we just check + * whenever we must force the modeset. + */ + if (drm_atomic_crtc_needs_modeset(crtc->state)) { + output->needs_modeset = true; + } } static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = { diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index 9ff9f4ac0522..4ab1b0ba2925 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -138,6 +138,7 @@ struct virtio_gpu_output { int cur_x; int cur_y; bool enabled; + bool needs_modeset; }; #define drm_crtc_to_virtio_gpu_output(x) \ container_of(x, struct virtio_gpu_output, crtc) diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index 52d24179bcec..65757409d9ed 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -163,7 +163,9 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane, plane->state->src_w != old_state->src_w || plane->state->src_h != old_state->src_h || plane->state->src_x != old_state->src_x || - plane->state->src_y != old_state->src_y) { + plane->state->src_y != old_state->src_y || + output->needs_modeset) { + output->needs_modeset = false; DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n", bo->hw_res_handle, plane->state->crtc_w, plane->state->crtc_h, -- 2.28.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2ACADC433DF for ; Tue, 25 Aug 2020 22:06:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EC16020706 for ; Tue, 25 Aug 2020 22:06:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EC16020706 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bugs.launchpad.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:44650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAh5S-0001nh-7i for qemu-devel@archiver.kernel.org; Tue, 25 Aug 2020 18:06:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAh4s-0001NG-N4 for qemu-devel@nongnu.org; Tue, 25 Aug 2020 18:06:02 -0400 Received: from indium.canonical.com ([91.189.90.7]:39576) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kAh4q-0001dV-6f for qemu-devel@nongnu.org; Tue, 25 Aug 2020 18:06:02 -0400 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.86_2 #2 (Debian)) id 1kAh4o-0005i6-E9 for ; Tue, 25 Aug 2020 22:05:58 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 66AED2E80EA for ; Tue, 25 Aug 2020 22:05:58 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Tue, 25 Aug 2020 21:56:46 -0000 From: Diego Viola <1882851@bugs.launchpad.net> To: qemu-devel@nongnu.org X-Launchpad-Notification-Type: bug X-Launchpad-Bug: product=qemu; status=New; importance=Undecided; assignee=None; X-Launchpad-Bug-Information-Type: Public X-Launchpad-Bug-Private: no X-Launchpad-Bug-Security-Vulnerability: no X-Launchpad-Bug-Commenters: diego-viola kraxel-redhat X-Launchpad-Bug-Reporter: Diego Viola (diego-viola) X-Launchpad-Bug-Modifier: Diego Viola (diego-viola) References: <159174217343.32241.17743917589333297614.malonedeb@gac.canonical.com> Message-Id: <20200825215646.66853-1-diego.viola@gmail.com> Subject: [Bug 1882851] [PATCH] drm/virtio: fix unblank X-Launchpad-Message-Rationale: Subscriber (QEMU) @qemu-devel-ml X-Launchpad-Message-For: qemu-devel-ml Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="99c2d833c8d727fd05148486920aca032e908071"; Instance="production" X-Launchpad-Hash: df90cc23592ec1f9b0510edfbec90834af0419e4 Received-SPF: none client-ip=91.189.90.7; envelope-from=bounces@canonical.com; helo=indium.canonical.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/25 18:05:58 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -65 X-Spam_score: -6.6 X-Spam_bar: ------ X-Spam_report: (-6.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Bug 1882851 <1882851@bugs.launchpad.net> Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann When going through a disable/enable cycle without changing the framebuffer the optimization added by commit 3954ff10e06e ("drm/virtio: skip set_scanout if framebuffer didn't change") causes the screen stay blank. Add a bool to force an update to fix that. v2: use drm_atomic_crtc_needs_modeset() (Daniel). Cc: 1882851@bugs.launchpad.net Fixes: 3954ff10e06e ("drm/virtio: skip set_scanout if framebuffer didn't ch= ange") Signed-off-by: Gerd Hoffmann Tested-by: Jiri Slaby Tested-by: Diego Viola --- drivers/gpu/drm/virtio/virtgpu_display.c | 11 +++++++++++ drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_plane.c | 4 +++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/vir= tio/virtgpu_display.c index af55b334be2f..35b5c80f5d85 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -123,6 +123,17 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crt= c *crtc, static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { + struct virtio_gpu_output *output =3D drm_crtc_to_virtio_gpu_output(crtc); + + /* + * virtio-gpu can't do modeset and plane update operations + * independant from each other. So the actual modeset happens + * in the plane update callback, and here we just check + * whenever we must force the modeset. + */ + if (drm_atomic_crtc_needs_modeset(crtc->state)) { + output->needs_modeset =3D true; + } } = static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs =3D= { diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/= virtgpu_drv.h index 9ff9f4ac0522..4ab1b0ba2925 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -138,6 +138,7 @@ struct virtio_gpu_output { int cur_x; int cur_y; bool enabled; + bool needs_modeset; }; #define drm_crtc_to_virtio_gpu_output(x) \ container_of(x, struct virtio_gpu_output, crtc) diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virti= o/virtgpu_plane.c index 52d24179bcec..65757409d9ed 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -163,7 +163,9 @@ static void virtio_gpu_primary_plane_update(struct drm_= plane *plane, plane->state->src_w !=3D old_state->src_w || plane->state->src_h !=3D old_state->src_h || plane->state->src_x !=3D old_state->src_x || - plane->state->src_y !=3D old_state->src_y) { + plane->state->src_y !=3D old_state->src_y || + output->needs_modeset) { + output->needs_modeset =3D false; DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n", bo->hw_res_handle, plane->state->crtc_w, plane->state->crtc_h, -- = 2.28.0 -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1882851 Title: QEMU video freezes with "Guest disabled display" (virtio driver) Status in QEMU: New Bug description: I am using Arch Linux as my Guest and Host OS, after starting qemu with the following command: $ qemu-system-x86_64 -enable-kvm -hda arch-zoom.qcow2 -m 4G -vga virtio and waiting for a screen blank, I get this message: Guest disabled display And nothing happens after that, I can move the mouse or hit any key, and the message is still there. I can still reboot the VM but that's not optimal. I can reproduce this with the latest QEMU release (5.0.0) or git master, = I also tried this with older releases (4.0.0, 3.0.0) and the issue is sti= ll there. I can't reproduce this with other video drivers (std, qxl). With std/qxl the screen will blank a bit and then continue as normal. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1882851/+subscriptions From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BC8DC433E4 for ; Wed, 26 Aug 2020 08:05:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5FEA420838 for ; Wed, 26 Aug 2020 08:05:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fcTL7q1g" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5FEA420838 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 18D016EA47; Wed, 26 Aug 2020 08:04:53 +0000 (UTC) Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by gabe.freedesktop.org (Postfix) with ESMTPS id 964FE6E9CB for ; Tue, 25 Aug 2020 21:57:43 +0000 (UTC) Received: by mail-qt1-x844.google.com with SMTP id k18so178363qtm.10 for ; Tue, 25 Aug 2020 14:57:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OWRVhAyQrMMbNCybKNpaTOkjxzgRbbU/WkM3Dt9pX54=; b=fcTL7q1gFc3oZ0ZWW6ITOvGLzyP26ghrzc9ma1/q3Derm5NBJOZwguT0X4p6uheACV uVVIQzNvB8KGcKFTpJo5tKZxLc9thz96kuXIo29pjk1ZNZkKNl8b8OfOHJLtaPiNbaUY 7CwCpaIoA0O0CwL1VzmdXnKZkYd4ZWLbRYzhHWtimbk6krXb9E7L67tPAZJ6qtyR+9S+ BfQFfmygj1UK6xTAM9En3S4vNuGyIq4S4Fcj1wFuh9bg7Vdv0yV7SVLXjWyeB4IjLzJ3 8mOwUBdLrzcuoMvfNvOV9W3M1KnLAw7XMREVAjiwctxj0JRLrt4P42VToIqM9nSEUquW Pvcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OWRVhAyQrMMbNCybKNpaTOkjxzgRbbU/WkM3Dt9pX54=; b=ccsdyppLg8lYeovsv2GfvcBA8MryZHhFlU+C9WApi4hotnMGMwCN84Kb3LFP3UnuoI 1dVIB66lpEXxLY1s6s7Z3Qla3JZw4s5s+Md+kGWW/Ctcgb+F0wFsZvqIC4faBBxrmCu2 luteZd7/kDSS/4RGExICa2snG37g+DDBWZMkm78qE2DotwcMnzBNJafKyE2MltZqS1ke gNBBe/NZA2K8EHcAMX1lPpT6pi4X9wX87X/M6UZJOow97o8Wnj2Fnpu/YXw+bIwLeeWR +aoUqjE43EK2ug3jWHIS+bMex3Pox7QzYWiH4KdBOX3C7tQojiVo0zEyf2BUhJtR55YW TSQg== X-Gm-Message-State: AOAM533DIfD2mPTciIlF0M28c7gNe6loaUv4dU08OMiqcrI2L4/RjulS t5uMHeLmkiiM2TGceYc/Dr6W51QgHyCCcg== X-Google-Smtp-Source: ABdhPJwkJ91ZZA7Cq3/WkBuZ3vsYC6CZvy1AW1h0c+XAfq+Qj5c/LtYCXS036Taqiw9hcTxMPh+/Ew== X-Received: by 2002:aed:3824:: with SMTP id j33mr3131055qte.374.1598392662216; Tue, 25 Aug 2020 14:57:42 -0700 (PDT) Received: from localhost.localdomain ([189.7.69.189]) by smtp.gmail.com with ESMTPSA id w28sm128308qkw.87.2020.08.25.14.57.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2020 14:57:41 -0700 (PDT) From: Diego Viola To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/virtio: fix unblank Date: Tue, 25 Aug 2020 18:56:46 -0300 Message-Id: <20200825215646.66853-1-diego.viola@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200818072511.6745-1-kraxel@redhat.com> References: <20200818072511.6745-1-kraxel@redhat.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 26 Aug 2020 08:04:49 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 1882851@bugs.launchpad.net, Diego Viola , Jiri Slaby , linux-kernel@vger.kernel.org, Gerd Hoffmann Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Gerd Hoffmann When going through a disable/enable cycle without changing the framebuffer the optimization added by commit 3954ff10e06e ("drm/virtio: skip set_scanout if framebuffer didn't change") causes the screen stay blank. Add a bool to force an update to fix that. v2: use drm_atomic_crtc_needs_modeset() (Daniel). Cc: 1882851@bugs.launchpad.net Fixes: 3954ff10e06e ("drm/virtio: skip set_scanout if framebuffer didn't change") Signed-off-by: Gerd Hoffmann Tested-by: Jiri Slaby Tested-by: Diego Viola --- drivers/gpu/drm/virtio/virtgpu_display.c | 11 +++++++++++ drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_plane.c | 4 +++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index af55b334be2f..35b5c80f5d85 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -123,6 +123,17 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc, static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { + struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc); + + /* + * virtio-gpu can't do modeset and plane update operations + * independant from each other. So the actual modeset happens + * in the plane update callback, and here we just check + * whenever we must force the modeset. + */ + if (drm_atomic_crtc_needs_modeset(crtc->state)) { + output->needs_modeset = true; + } } static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = { diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index 9ff9f4ac0522..4ab1b0ba2925 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -138,6 +138,7 @@ struct virtio_gpu_output { int cur_x; int cur_y; bool enabled; + bool needs_modeset; }; #define drm_crtc_to_virtio_gpu_output(x) \ container_of(x, struct virtio_gpu_output, crtc) diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index 52d24179bcec..65757409d9ed 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -163,7 +163,9 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane, plane->state->src_w != old_state->src_w || plane->state->src_h != old_state->src_h || plane->state->src_x != old_state->src_x || - plane->state->src_y != old_state->src_y) { + plane->state->src_y != old_state->src_y || + output->needs_modeset) { + output->needs_modeset = false; DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n", bo->hw_res_handle, plane->state->crtc_w, plane->state->crtc_h, -- 2.28.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel