From patchwork Tue Oct 29 12:10:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 839323 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:4593:b0:37d:45d0:187 with SMTP id gb19csp328596wrb; Tue, 29 Oct 2024 05:11:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWHVPX9I5atvDgMdWaNGWNnVMsJI53FBKCp1tEhLwQc8OF5hmJcwNaqBHL/M3gTWbpA5SfRUw==@linaro.org X-Google-Smtp-Source: AGHT+IEVXf3O6olPZXCTKWfPlSSGTU3nTb3i4/Rh0Boxy/ypI9oiUrJGdIjRHCmrYmOWi51HeWNP X-Received: by 2002:a05:6102:2ac6:b0:4a3:ce63:dac1 with SMTP id ada2fe7eead31-4a8cfd59e11mr9284799137.28.1730203881140; Tue, 29 Oct 2024 05:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730203881; cv=none; d=google.com; s=arc-20240605; b=BKOCeW+05ZgzfST8RVc4lUaBZrSo16qhqpFTZuqujHVq5/Te1R9+D1QNWa2MTgjeQY d5UEwYz2jqKcIRHuSVLTQRpUaEwY1Wby4/aJACSJhKyoRMD3SR8YZ2oCpkMBEYYWr0rb Hn6C6TXPHQtkvGitj7kL9cgVnduVggLBktG98b/foDtl7lpxx6Kin1m9FW7QJ+VtdBNo RXwFZyeEwjQDtO0kMs87fkjEkrlBqHaTvoisYJhGNwRm369wEi/HwueEoAFvlyK1mrRz YgC7dZ2RC+b3ZVpj7AcH9m2h/v0LHhuSQaC65+P5+bA67awLrHN+mEH02NQy46FBXIN5 N+qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=XPzMIRyHHPYrwvugSrdgfTS150qXNc9bgO1rDL0GqR8=; fh=VyoImqtNGezAyRveop7jJLIY1GvuLKHjGRNqLnjiHgY=; b=WpDc1JjyQY7WvZVggwvo78TRyHrM7V0MD3nMS04KXRDZpXMS8Xg1Yrz0A9UbxDDVUJ qZWnxzlS7YbQD7+eFN7LSqwwykNM/IavaJhkvKX/GPlPzZimRo4otkHgAd+brkrPkZ4M +SGDAKtvEMl6yQXE9zw2VpePkflyXEsB4F81AuvUqmcNPNK7JlGvy6ma3GAC0JIRlP4S I+7j9gPKYW3b62JaVjKUKWO4H+YUm49oojsw9Ud4Mjor6cmSC7cuXpkZPmnYAr34WUb+ VeJ74FKdCabupnlrxRNk7CoZYRMyMQHkOon3bgWmBMUP16joX2tNG1tMZfmbqD260zME /QNA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R5Tk4LwS; 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 ada2fe7eead31-4a8c51bab4fsi2473381137.5.2024.10.29.05.11.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Oct 2024 05:11:21 -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=R5Tk4LwS; 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 1t5l3a-0004as-23; Tue, 29 Oct 2024 08:10:42 -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 1t5l3W-0004Zd-Iw for qemu-devel@nongnu.org; Tue, 29 Oct 2024 08:10:38 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t5l3V-0007SQ-28 for qemu-devel@nongnu.org; Tue, 29 Oct 2024 08:10:38 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4315abed18aso51218855e9.2 for ; Tue, 29 Oct 2024 05:10:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730203835; x=1730808635; 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=XPzMIRyHHPYrwvugSrdgfTS150qXNc9bgO1rDL0GqR8=; b=R5Tk4LwSLjn1ujGeBKBzeq4YEmiLnPfzPFYKOJPl7g9RmRTpKALF5e2dg5E3IRPBsE YlR9EP0f0dXjvcowZbgDyPWIBcEkV8jDbdYKzMZk7DBbjdOz5yv/PGmThqEmn7SjaiXF cOprKLYktWGOJ2FSxZ83E6clkP2dmLhqU7twpNXWwgcp69hYzofuQcW71Xi63d2AhEd/ GQSx5Wit+v68Tj1twWnTlZOrmE6izOMuvK3uKq6f/9msLxiz4ECynfiZJ6OYKf3yD2G+ N0AU7sMqUeOy5lvEfLlnUwHh7NPLoNIGDvYxuAXnq9BOh/75uZ7iYWmyaIfnZpFfQrS1 LP0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730203835; x=1730808635; 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=XPzMIRyHHPYrwvugSrdgfTS150qXNc9bgO1rDL0GqR8=; b=GmY4hs6rUBNmAcnAX85LferH70E4SvejyRkk9ivLQvuuUUXl6BQXyv+DzFeuV7eKV5 a0Q1/BAEaiEieJGu3/Qed3jXF+MVKkLow49OZFXrWq9wfiU4VKfptf+ad3PFEqr+XGRM OFDAhZl1Murw5gEfc3QYFVCFHSdlxE56uQRY0CEONgvv95BvBmQiahhjMUSNmPIM6PG1 Rt6Or1Nj0tRnryelcsvJ+P18J6tyNZxtw1BWRFn8hHHJPOM+VdBOYgCrjYxHjhozSwhv GH9YXLnhzz1NZq2afGWcyakkwR349HpcJz2YIdhr8EGUQv+GhtcpsdiIjiGFnetpGvoD i4RQ== X-Gm-Message-State: AOJu0Yx8Jk6+DRd5fPcdWkNwuxYgVNkzS6zC/YqZef7u8MNFQoAKjHLQ UrxWcveggbbpAJ12XRWarcTi0lctqAkZkA4rypj7eMOLbZ9aHDwTHPk9Wyf53gqNRI+ZhkgPfqt R X-Received: by 2002:adf:e0c2:0:b0:37d:940c:7391 with SMTP id ffacd0b85a97d-380611e75b9mr9050584f8f.41.1730203835415; Tue, 29 Oct 2024 05:10:35 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38058b47a86sm12344746f8f.53.2024.10.29.05.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 05:10:34 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id E6E8D5FABB; Tue, 29 Oct 2024 12:10:30 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= , "Michael S. Tsirkin" Subject: [PULL 05/13] virtio-gpu: Unrealize GL device Date: Tue, 29 Oct 2024 12:10:22 +0000 Message-Id: <20241029121030.4007014-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241029121030.4007014-1-alex.bennee@linaro.org> References: <20241029121030.4007014-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x332.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: Dmitry Osipenko Even though GL GPU doesn't support hotplugging today, free virgl resources when GL device is unrealized. For consistency. Signed-off-by: Dmitry Osipenko Message-Id: <20241024210311.118220-6-dmitry.osipenko@collabora.com> Signed-off-by: Alex Bennée diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c index ea3413aa56..753b35ed69 100644 --- a/hw/display/virtio-gpu-gl.c +++ b/hw/display/virtio-gpu-gl.c @@ -156,6 +156,22 @@ static Property virtio_gpu_gl_properties[] = { DEFINE_PROP_END_OF_LIST(), }; +static void virtio_gpu_gl_device_unrealize(DeviceState *qdev) +{ + VirtIOGPU *g = VIRTIO_GPU(qdev); + VirtIOGPUGL *gl = VIRTIO_GPU_GL(qdev); + + if (gl->renderer_state >= RS_INITED) { + if (virtio_gpu_stats_enabled(g->parent_obj.conf)) { + timer_free(gl->print_stats); + } + timer_free(gl->fence_poll); + virgl_renderer_cleanup(NULL); + } + + gl->renderer_state = RS_START; +} + static void virtio_gpu_gl_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -169,6 +185,7 @@ static void virtio_gpu_gl_class_init(ObjectClass *klass, void *data) vgc->update_cursor_data = virtio_gpu_gl_update_cursor_data; vdc->realize = virtio_gpu_gl_device_realize; + vdc->unrealize = virtio_gpu_gl_device_unrealize; vdc->reset = virtio_gpu_gl_reset; device_class_set_props(dc, virtio_gpu_gl_properties); }