From nobody Sun Feb 8 14:53:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1575933394; cv=none; d=zohomail.com; s=zohoarc; b=KTtQve3L5+Pj6PO8JgPzSgYM74W8D88PvOU9O4rbdX2Q1LLYE+sv+6XRsrth0LrDn8H/3KXF3C4i9JgHxooLfwylynSn3nLy4zvc2NmgfrvRlWO2uNDd3TsF8NKmVW6M3NqUJQFRqVnKr2ZdfnrfhAVJlNXLHeIJIR646kOGs4w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575933394; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0/ElVZ4ZSx5jzCtTdgYSGAReyUKJwIcO3mo+S/UjTlg=; b=O5pN+bezkStnXGc/tuRFelB1e3V7SiWmBKkzlAj91XGyvomq8VAeDfU0LuuhViXQZorKfQd8g1LqQSrvOw/7YIyGBBexX/TPu96bFNIH0/nE1JMIzTQs2ybfufIqKBIuTwS9MDgEtpPC6IAA7s1iVQESpVy5A2mrD9hiCZAYD2U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1575933394483897.5490265571785; Mon, 9 Dec 2019 15:16:34 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-78-sYr8h_jBO8SwTNSg8LrK0A-1; Mon, 09 Dec 2019 18:16:28 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AFCF8800C75; Mon, 9 Dec 2019 23:16:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 883A863742; Mon, 9 Dec 2019 23:16:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 49FCE18034EE; Mon, 9 Dec 2019 23:16:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB9NGJea008554 for ; Mon, 9 Dec 2019 18:16:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 11F751006EAC; Mon, 9 Dec 2019 23:16:19 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0CB711006EB7 for ; Mon, 9 Dec 2019 23:16:19 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E78008CCD26 for ; Mon, 9 Dec 2019 23:16:18 +0000 (UTC) Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-14-V8iVslSmPJ6lH6ie_HceOA-1; Mon, 09 Dec 2019 18:16:15 -0500 Received: by mail-qk1-f173.google.com with SMTP id d71so6808496qkc.0; Mon, 09 Dec 2019 15:16:15 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:fe5:8243:c780:f073:3beb]) by smtp.gmail.com with ESMTPSA id e130sm352436qkb.72.2019.12.09.15.16.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 15:16:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575933393; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=0/ElVZ4ZSx5jzCtTdgYSGAReyUKJwIcO3mo+S/UjTlg=; b=WHWaYRjIVEa9TlQ+R3ntKfrQmOBQng81YFVJiwAa9awfUVpuvG0qTJ9GRKEiYdQSYVHTZG SoYFj7CrJ/nwyQ+iJPjp0nps9/qoyeFGugYS9HmVB4m8eaWMyXRnFy0keAg+mSCrp9f1Zr FPcoRmfdLFBThCEABi3+7cRwI9AYNGE= 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=DfDodNtSCAScusCX9ThMZ6igsI7BUw4qsF7ZBahbX70=; b=MEBLN88+nkeVD5Du9nWAv2ltWMqPHK8dr5UAhid45Gm48gq0Tsw8yIxR4GnMhVUc8T YuPYsM1Swjvd3W9U5eL5uJD9GYzRSrIr8UY+eAXMrQc/Ez4zNH1eJUwvjowFLxfaT9qX ZzM8b2co2roiuWlchnKLXGYkmygLZoUwrYjUwdY8EjlmEzbetrho/CYgLR8zxzTubQD6 tbgH86OAmMrUkoGUBL+u/T4rKJShyb2UheaBSsQhVZfyrwmASfLJzUrtYAf/aPBftWHv df2sUZRrWWAqGfQWBz3TjRxC719Z+9EagUHOgy0MpJdMgcVOzQdSzdCqDfSDs6kx0zX8 pp4A== X-Gm-Message-State: APjAAAXFscki6/hHsmV28HLS6oO6Y7lv9BgVdhCYrCWPpQUylEgiv8Rz U+Lc1rY/ivrWMELx2GbdJ+twwbTzCMA= X-Google-Smtp-Source: APXvYqx7z4giiYcLu76OSHtEY/0253UpAFb4qvDQslsGqFNZuK8sNEnPJX62EPHD72J+jmCq6LH6fw== X-Received: by 2002:a37:63d2:: with SMTP id x201mr30787305qkb.30.1575933374689; Mon, 09 Dec 2019 15:16:14 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Mon, 9 Dec 2019 20:15:25 -0300 Message-Id: <20191209231531.2423222-21-danielhb413@gmail.com> In-Reply-To: <20191209231531.2423222-1-danielhb413@gmail.com> References: <20191209231531.2423222-1-danielhb413@gmail.com> MIME-Version: 1.0 X-MC-Unique: V8iVslSmPJ6lH6ie_HceOA-1 X-MC-Unique: sYr8h_jBO8SwTNSg8LrK0A-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xB9NGJea008554 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , crobinso@redhat.com Subject: [libvirt] [PATCH v1 20/26] qemu: move qemuBuildGraphicsSDLCommandLine validation to qemu_domain.c X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" There are validations for SDL, VNC, SPICE and EGL_HEADLESS around several BuildGraphics*CommandLine in qemu_command.c. This patch starts to move all of them to qemu_domain.c, inside the existent qemuDomainDeviceDefValidateGraphics() function. This function is called by qemuDomainDefValidate(), validating the graphics parameters in domain define time. In this patch we'll move the SDL validation code from qemuBuildGraphicsSDLCommandLine(). Tests were adapted to consider SDL validation in this earlier stage. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_command.c | 14 +------------- src/qemu/qemu_domain.c | 29 +++++++++++++++++++++++++++++ tests/qemuxml2xmltest.c | 3 ++- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 31b8784070..70b80fad63 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7380,19 +7380,10 @@ qemuBuildGraphicsSDLCommandLine(virQEMUDriverConfig= Ptr cfg G_GNUC_UNUSED, virCommandAddArg(cmd, "-display"); virBufferAddLit(&opt, "sdl"); =20 - if (graphics->data.sdl.gl !=3D VIR_TRISTATE_BOOL_ABSENT) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SDL_GL)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("OpenGL for SDL is not supported with this QE= MU " - "binary")); - return -1; - } - + if (graphics->data.sdl.gl !=3D VIR_TRISTATE_BOOL_ABSENT) virBufferAsprintf(&opt, ",gl=3D%s", virTristateSwitchTypeToString(graphics->data.sdl= .gl)); =20 - } - virCommandAddArgBuffer(cmd, &opt); =20 return 0; @@ -7848,9 +7839,6 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr c= fg, break; case VIR_DOMAIN_GRAPHICS_TYPE_RDP: case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported graphics type '%s'"), - virDomainGraphicsTypeToString(graphics->type)); return -1; case VIR_DOMAIN_GRAPHICS_TYPE_LAST: default: diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 7f6daaf276..b33e150690 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7614,6 +7614,35 @@ qemuDomainDeviceDefValidateGraphics(const virDomainG= raphicsDef *graphics, } } =20 + switch (graphics->type) { + case VIR_DOMAIN_GRAPHICS_TYPE_SDL: + if (graphics->data.sdl.gl !=3D VIR_TRISTATE_BOOL_ABSENT) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SDL_GL)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("OpenGL for SDL is not supported with thi= s QEMU " + "binary")); + return -1; + } + } + break; + + case VIR_DOMAIN_GRAPHICS_TYPE_VNC: + break; + case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: + break; + case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS: + break; + case VIR_DOMAIN_GRAPHICS_TYPE_RDP: + case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported graphics type '%s'"), + virDomainGraphicsTypeToString(graphics->type)); + return -1; + case VIR_DOMAIN_GRAPHICS_TYPE_LAST: + default: + return -1; + } + return 0; } =20 diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 0eb523fd43..052c7034e1 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1179,7 +1179,8 @@ mymain(void) QEMU_CAPS_VIRTIO_GPU_VIRGL); DO_TEST("video-virtio-gpu-sdl-gl", QEMU_CAPS_DEVICE_VIRTIO_GPU, - QEMU_CAPS_VIRTIO_GPU_VIRGL); + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_SDL_GL); =20 DO_TEST("virtio-input", QEMU_CAPS_VIRTIO_KEYBOARD, --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list