From patchwork Tue Aug 6 12:51:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 817049 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1784446wrh; Tue, 6 Aug 2024 05:58:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU7i9rm3jNy8ej3MHMwiCfTONmLTNAwGR7LbyzaMnsmUDpdRIcQv+44niz1ITG1UKhvn3hB8JlfmLw/qh+qGb0t X-Google-Smtp-Source: AGHT+IEkVrwMXdWz+2mBFd5pVXko73N7WpFOSEZ9FfCrw9PfovG3c92OBEq0n0RdK8c+zR1dgaKB X-Received: by 2002:a05:6808:1489:b0:3d9:235b:185a with SMTP id 5614622812f47-3db55809957mr17540623b6e.18.1722949126502; Tue, 06 Aug 2024 05:58:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722949126; cv=none; d=google.com; s=arc-20160816; b=acspae22g4jnS0yzlpeIytSf6j5COnOBaf72JXPpPyDS3tioDngef6KNmnwvVOEaCY 29saXruXTsHVhhoCM3kGSmZxTJUsDYK5neKmru5aJ8z+LM2Bx0O58OpQD1/EPa28hfme wtvuuRnuU/6cDmCscKyBa8Q/9kv20QgxgdgCc0RqjBeIBd4RcmW29o09zL4BVcZT4Khq LrJPkH6XFEXuv39xyismOPn4Arb7JQc0KfPmVOCHFHAE6YcvGDhfivZLnxY9h079wZHl 8KbLG1Q9GE8f+NyjnsxL092Fwco0EohQq3TXswBIOVA4t1Xo9WKwNOnFm4mOrG+Ms8l/ iShQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nMm3A0DabsjolGXhyPhZ1sZzpOJXfaTPvfWzaUzLVvw=; fh=CxGANQnxl0w34GvKO0j3aLxcHGRl2QR9Bm7QFKqLsvg=; b=edsJSSh9HJXNSZ/oy9szhgcbUih781jTQhZa5e3US/Pl0GYk802kcCaw6ehxt1hZzu kMYsm5K13VDTaxfGWFuqmdzcLD07r9ZYpIkx/zyb41wXiJSwzAJM6+hgmiVy3YE32kFg jjOyPDB6QmyyAP77uO+HlczGERewYW0hoJutb8R+NLpQCFsT0I3MqRvV1+Bab+Pwj9DR qfflJ0CGY4amUL+K2PcZlGuqER1MxTk+BWwQ1MmncOvNzgkHvwv+fOrqF7VaKdRk/IS8 jl7wvJwSZHMINt0yB4pBISQIDYaAqpHsjFV99ILh9Hpx4S/i8BW06DBB8DR486AknGBq BQNw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SmbFAtbB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4518a762e94si113547001cf.358.2024.08.06.05.58.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Aug 2024 05:58:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SmbFAtbB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbJj3-00054t-98; Tue, 06 Aug 2024 08:55:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sbJhj-0000TS-Ew for qemu-devel@nongnu.org; Tue, 06 Aug 2024 08:54:24 -0400 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sbJhh-0000N2-H5 for qemu-devel@nongnu.org; Tue, 06 Aug 2024 08:54:19 -0400 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a7a9a369055so54930866b.3 for ; Tue, 06 Aug 2024 05:54:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722948855; x=1723553655; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nMm3A0DabsjolGXhyPhZ1sZzpOJXfaTPvfWzaUzLVvw=; b=SmbFAtbBPrGEkMuqRRb54s1Mewcnumej2DweE3kd3GdlqyW1uheRnTWocWgZHvBPbj 2YvBY5T+24pigPU4uJoRzPfbmWwpcWdTnO0OqaOeNQSjz74jRs2kMOGRRfOemwVuphYh 756EoKTqB/+jk2vgF6b05Gc7EHDly/PxF6p9G5qSmh2nQaqLJQ2O9pj+ITMTfL5yVKi6 EoZVpgbG6cmUEdDWff5jcHtM7p8SwxOr6D+S/c8lAMOQsFJ+0k9Sgi8myjfEKlWIw8VG /gP5syLzgR38PUNIVhLp7q+eeiBtGUKMGxv/n+kmn3nsNytHpiYXeUaRAS4x/QKexbFQ HG2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722948855; x=1723553655; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nMm3A0DabsjolGXhyPhZ1sZzpOJXfaTPvfWzaUzLVvw=; b=p4mQlJBJS+xEsoPDd4JorTAXV6vsN/HnOk8QRWplEnLT2SVoo7fEEvduK/ryPRNSo7 Fj89u8UVTC94jBvuAqdc8PIOtlC0r6WejwwpwOtmtY8scVYsoVTuvlEdimwu2V+STUdU uOnsXM85JgQZ5ISkl05s7L6rgBH2RpQRE2V9JcGjsqwxIizafr/U4j7LzuVpsZ1vWUgA eBhtSjFcsAgwukfvvGC98M3+gd9ozgikMeWnY3CYwQp6g7EK7Aps7P6tL4B1oxX3ZKWe sNcAp8VYvKpBhh8ph7h67SAY53Wrr+NwnZzjdg10RASvEkQLuIYFMMXX6Imb8eSrCMZi Q9Nw== X-Gm-Message-State: AOJu0YzSCl1bX2nMfdOHCX9prx3pq/QwoIxcU2oAIGqaz8dOLspB2zUk oFJ9NhrEECMsJ6a+s2wID7IYqiZUvZz0VqGPu67abQ0/tkW8g+QannIZYy8Vc4W0Xrld7A0xzzH D X-Received: by 2002:a17:907:724b:b0:a77:b516:3023 with SMTP id a640c23a62f3a-a7dc4db2a1emr1035988366b.4.1722948855304; Tue, 06 Aug 2024 05:54:15 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9bc3c7asm558455666b.14.2024.08.06.05.54.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 06 Aug 2024 05:54:14 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 22/28] hw/display/virtio-gpu: Improve "opengl is not available" error message Date: Tue, 6 Aug 2024 14:51:50 +0200 Message-ID: <20240806125157.91185-23-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240806125157.91185-1-philmd@linaro.org> References: <20240806125157.91185-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=philmd@linaro.org; helo=mail-ej1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Maydell If the user tries to use the virtio-gpu-gl device but the display backend doesn't have OpenGL support enabled, we currently print a rather uninformative error message: $ qemu-system-aarch64 -M virt -device virtio-gpu-gl qemu-system-aarch64: -device virtio-gpu-gl: opengl is not available Since OpenGL is not enabled on display frontends by default, users are quite likely to run into this. Improve the error message to be more specific and to suggest to the user a path forward. Note that the case of "user tried to enable OpenGL but the display backend doesn't handle it" is caught elsewhere first, so we can assume that isn't the problem: $ qemu-system-aarch64 -M virt -device virtio-gpu-gl -display curses,gl=on qemu-system-aarch64: OpenGL is not supported by the display (Use of error_append_hint() requires us to add an ERRP_GUARD() to the function, as noted in include/qapi/error.h.) With this commit we now produce the hopefully more helpful error: $ ./build/x86/qemu-system-aarch64 -M virt -device virtio-gpu-gl qemu-system-aarch64: -device virtio-gpu-gl: The display backend does not have OpenGL support enabled It can be enabled with '-display BACKEND,gl=on' where BACKEND is the name of the display backend to use. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2443 Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Acked-by: Marc-André Lureau Message-ID: <20240731154136.3494621-2-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- hw/display/virtio-gpu-gl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c index 952820a425..29d20b0132 100644 --- a/hw/display/virtio-gpu-gl.c +++ b/hw/display/virtio-gpu-gl.c @@ -106,6 +106,7 @@ static void virtio_gpu_gl_reset(VirtIODevice *vdev) static void virtio_gpu_gl_device_realize(DeviceState *qdev, Error **errp) { + ERRP_GUARD(); VirtIOGPU *g = VIRTIO_GPU(qdev); #if HOST_BIG_ENDIAN @@ -119,7 +120,12 @@ static void virtio_gpu_gl_device_realize(DeviceState *qdev, Error **errp) } if (!display_opengl) { - error_setg(errp, "opengl is not available"); + error_setg(errp, + "The display backend does not have OpenGL support enabled"); + error_append_hint(errp, + "It can be enabled with '-display BACKEND,gl=on' " + "where BACKEND is the name of the display backend " + "to use.\n"); return; }