From patchwork Tue Feb 20 11:04:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 875482 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zlyYn6Hxbz9s08 for ; Tue, 20 Feb 2018 22:09:33 +1100 (AEDT) Received: from localhost ([::1]:54638 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eo5nf-0000XF-VC for incoming@patchwork.ozlabs.org; Tue, 20 Feb 2018 06:09:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eo5j9-0005py-D5 for qemu-devel@nongnu.org; Tue, 20 Feb 2018 06:04:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eo5j8-00087x-LS for qemu-devel@nongnu.org; Tue, 20 Feb 2018 06:04:51 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55626 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eo5j8-000878-Hp for qemu-devel@nongnu.org; Tue, 20 Feb 2018 06:04:50 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6FABE4023EDE for ; Tue, 20 Feb 2018 11:04:39 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-147.ams2.redhat.com [10.36.116.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 276E921411B6; Tue, 20 Feb 2018 11:04:35 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 461B617515; Tue, 20 Feb 2018 12:04:33 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 20 Feb 2018 12:04:32 +0100 Message-Id: <20180220110433.20353-3-kraxel@redhat.com> In-Reply-To: <20180220110433.20353-1-kraxel@redhat.com> References: <20180220110433.20353-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 20 Feb 2018 11:04:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 20 Feb 2018 11:04:40 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 2/3] egl-headless: cursor_dmabuf: handle NULL cursor X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The cursor dmabuf can be NULL, in case no cursor defined by the guest. Happens for example when linux guests show the framebuffer console. Signed-off-by: Gerd Hoffmann --- ui/egl-headless.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ui/egl-headless.c b/ui/egl-headless.c index 825ee5cc12..60c9061114 100644 --- a/ui/egl-headless.c +++ b/ui/egl-headless.c @@ -89,13 +89,16 @@ static void egl_cursor_dmabuf(DisplayChangeListener *dcl, { egl_dpy *edpy = container_of(dcl, egl_dpy, dcl); - egl_dmabuf_import_texture(dmabuf); - if (!dmabuf->texture) { - return; + if (dmabuf) { + egl_dmabuf_import_texture(dmabuf); + if (!dmabuf->texture) { + return; + } + egl_fb_setup_for_tex(&edpy->cursor_fb, dmabuf->width, dmabuf->height, + dmabuf->texture, false); + } else { + egl_fb_destroy(&edpy->cursor_fb); } - - egl_fb_setup_for_tex(&edpy->cursor_fb, dmabuf->width, dmabuf->height, - dmabuf->texture, false); } static void egl_cursor_position(DisplayChangeListener *dcl,