From patchwork Tue Aug 22 00:00:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurchetan Singh X-Patchwork-Id: 13359944 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 44D37EE49AA for ; Tue, 22 Aug 2023 00:01:18 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYEp6-0003HR-BZ; Mon, 21 Aug 2023 20:00:40 -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 1qYEp3-0003GU-0O for qemu-devel@nongnu.org; Mon, 21 Aug 2023 20:00:37 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYEp0-0001PM-GG for qemu-devel@nongnu.org; Mon, 21 Aug 2023 20:00:36 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1bf11b1c7d0so31093395ad.0 for ; Mon, 21 Aug 2023 17:00:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1692662433; x=1693267233; 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=hvionuIXv7LMOq0cI8KPe5wcQe2Sqak65Qf/t8GWDQo=; b=G3y66SY/ibTVQkIeccrcZ7qW+DX7Y9IeS1CFHNjVPbN3cCP/JEPJKc9DSoQoKFUwn5 YByJ5rdWUwJHapnMflYqsrNmsFLBW9TNrTgjhb9UDIbDnalQKRBFNcq2BLlPtgCP0pj4 tPsW117MA57Trf6eXV+hDUjsT85sXNlxm9Ak4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692662433; x=1693267233; 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=hvionuIXv7LMOq0cI8KPe5wcQe2Sqak65Qf/t8GWDQo=; b=KsDysN2b41PBEizgGdtWV3dFBKAcvaVWwt9EtS0Gqk/Y1M2wZnaOv22pLVgBcmz6fc U8JrUn5SQofKR+7zzDY+V09jF3KymYoeAgRF0r0SXGS4k/X2/F5J4PNopqFxQ5iyO9AZ JvfOEMt+JlONaiVONkB804w5y+JCj2ZaywRTbfSH7fMD7Tf7S0wlzsZa0p57ybUxMCYR mdfYpjOG/pAv9z/FKqebA1h5TizqK066InqVuAtJTEhywWyUUhRK2cWDJ5QsuxSxTHkV IHMPgNKBFylepxZSS9CyzEK3L8/0O5cxrAHLx2AoDjCkEH3v9YtT1c/eEKZYv7fBHWCu USqg== X-Gm-Message-State: AOJu0YxbZmNZieRJ722YKIF+KkjVR0CsHAisOva6ifBPr2I5ABIV1jC/ I45rOk2wmPItcY5q+2SL5C4jksoMdFLUJ7KzYLQ= X-Google-Smtp-Source: AGHT+IFBmD+usjDAS7sUn3fEvi+WA9xtatnPbV3HAjzA4/KYNu5o6vvEP2RMkq/saAYWb4v1GcKMkQ== X-Received: by 2002:a17:902:64cf:b0:1bc:17ab:8d68 with SMTP id y15-20020a17090264cf00b001bc17ab8d68mr9744465pli.16.1692662432936; Mon, 21 Aug 2023 17:00:32 -0700 (PDT) Received: from gurchetansingh0.mtv.corp.google.com ([2620:15c:a7:2:91e:34c5:6c84:1464]) by smtp.gmail.com with ESMTPSA id b10-20020a170902bd4a00b001bba669a7eesm7626277plx.52.2023.08.21.17.00.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Aug 2023 17:00:32 -0700 (PDT) From: Gurchetan Singh To: qemu-devel@nongnu.org Cc: marcandre.lureau@redhat.com, kraxel@redhat.com, akihiko.odaki@gmail.com, ray.huang@amd.com, alex.bennee@linaro.org, shentey@gmail.com, hi@alyssa.is, ernunes@redhat.com, manos.pitsidianakis@linaro.org Subject: [PATCH v10 5/9] gfxstream + rutabaga prep: added need defintions, fields, and options Date: Mon, 21 Aug 2023 17:00:21 -0700 Message-Id: <20230822000025.501-5-gurchetansingh@chromium.org> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20230822000025.501-1-gurchetansingh@chromium.org> References: <20230822000025.501-1-gurchetansingh@chromium.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=gurchetansingh@chromium.org; helo=mail-pl1-x633.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, DKIMWL_WL_HIGH=-0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This modifies the common virtio-gpu.h file have the fields and defintions needed by gfxstream/rutabaga, by VirtioGpuRutabaga. Signed-off-by: Gurchetan Singh Tested-by: Alyssa Ross Tested-by: Emmanouil Pitsidianakis Reviewed-by: Emmanouil Pitsidianakis --- v1: void *rutabaga --> struct rutabaga *rutabaga (Akihiko) have a separate rutabaga device instead of using GL device (Bernard) v2: VirtioGpuRutabaga --> VirtIOGPURutabaga (Akihiko) move MemoryRegionInfo into VirtIOGPURutabaga (Akihiko) remove 'ctx' field (Akihiko) remove 'rutabaga_active' v6: remove command from commit message, refer to docs instead (Manos) include/hw/virtio/virtio-gpu.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 55973e112f..e2a07e68d9 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -38,6 +38,9 @@ OBJECT_DECLARE_SIMPLE_TYPE(VirtIOGPUGL, VIRTIO_GPU_GL) #define TYPE_VHOST_USER_GPU "vhost-user-gpu" OBJECT_DECLARE_SIMPLE_TYPE(VhostUserGPU, VHOST_USER_GPU) +#define TYPE_VIRTIO_GPU_RUTABAGA "virtio-gpu-rutabaga-device" +OBJECT_DECLARE_SIMPLE_TYPE(VirtIOGPURutabaga, VIRTIO_GPU_RUTABAGA) + struct virtio_gpu_simple_resource { uint32_t resource_id; uint32_t width; @@ -94,6 +97,7 @@ enum virtio_gpu_base_conf_flags { VIRTIO_GPU_FLAG_DMABUF_ENABLED, VIRTIO_GPU_FLAG_BLOB_ENABLED, VIRTIO_GPU_FLAG_CONTEXT_INIT_ENABLED, + VIRTIO_GPU_FLAG_RUTABAGA_ENABLED, }; #define virtio_gpu_virgl_enabled(_cfg) \ @@ -108,6 +112,8 @@ enum virtio_gpu_base_conf_flags { (_cfg.flags & (1 << VIRTIO_GPU_FLAG_BLOB_ENABLED)) #define virtio_gpu_context_init_enabled(_cfg) \ (_cfg.flags & (1 << VIRTIO_GPU_FLAG_CONTEXT_INIT_ENABLED)) +#define virtio_gpu_rutabaga_enabled(_cfg) \ + (_cfg.flags & (1 << VIRTIO_GPU_FLAG_RUTABAGA_ENABLED)) #define virtio_gpu_hostmem_enabled(_cfg) \ (_cfg.hostmem > 0) @@ -232,6 +238,28 @@ struct VhostUserGPU { bool backend_blocked; }; +#define MAX_SLOTS 4096 + +struct MemoryRegionInfo { + int used; + MemoryRegion mr; + uint32_t resource_id; +}; + +struct rutabaga; + +struct VirtIOGPURutabaga { + struct VirtIOGPU parent_obj; + + struct MemoryRegionInfo memory_regions[MAX_SLOTS]; + char *capset_names; + char *wayland_socket_path; + char *wsi; + bool headless; + uint32_t num_capsets; + struct rutabaga *rutabaga; +}; + #define VIRTIO_GPU_FILL_CMD(out) do { \ size_t s; \ s = iov_to_buf(cmd->elem.out_sg, cmd->elem.out_num, 0, \