From 51ac0d73a3399831670bee563f8f06341a3757f3 Mon Sep 17 00:00:00 2001 From: Stephan Unverwerth Date: Wed, 21 Dec 2022 15:16:19 +0100 Subject: [PATCH] LibVirtGPU: Move VirGLDemo protocol code into VirtGPU namespace --- Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp | 10 ++++++++-- Userland/Libraries/LibVirtGPU/CommandBufferBuilder.h | 6 +++++- Userland/Libraries/LibVirtGPU/VirGLProtocol.h | 5 +++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp b/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp index cad3892f97..5552d716d9 100644 --- a/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp +++ b/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2022, Sahan Fernando + * Copyright (c) 2022, Stephan Unverwerth * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause @@ -9,12 +10,15 @@ #include #include -#include "CommandBufferBuilder.h" -#include "VirGLProtocol.h" +#include +#include + +namespace VirtGPU { constexpr int DRAWTARGET_WIDTH = 500; constexpr int DRAWTARGET_HEIGHT = 500; + static u32 encode_command(u32 length, u32 mid, Protocol::VirGLCommand command) { u32 command_value = to_underlying(command); @@ -301,3 +305,5 @@ void CommandBufferBuilder::append_bind_dsa(ObjectHandle handle) CommandBuilder builder(m_buffer, Protocol::VirGLCommand::BIND_OBJECT, to_underlying(Protocol::ObjectType::DSA)); builder.appendu32(handle.value()); // VIRGL_OBJ_BIND_HANDLE } + +} diff --git a/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.h b/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.h index 34250d7f5b..7503cdf54a 100644 --- a/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.h +++ b/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2022, Sahan Fernando + * Copyright (c) 2022, Stephan Unverwerth * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause @@ -9,9 +10,10 @@ #include #include +#include #include -#include "VirGLProtocol.h" +namespace VirtGPU { class CommandBufferBuilder { public: @@ -41,3 +43,5 @@ public: private: Vector m_buffer; }; + +} diff --git a/Userland/Libraries/LibVirtGPU/VirGLProtocol.h b/Userland/Libraries/LibVirtGPU/VirGLProtocol.h index 15d4afa583..84f7af3a59 100644 --- a/Userland/Libraries/LibVirtGPU/VirGLProtocol.h +++ b/Userland/Libraries/LibVirtGPU/VirGLProtocol.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2022, Sahan Fernando + * Copyright (c) 2022, Stephan Unverwerth * * SPDX-License-Identifier: BSD-2-Clause */ @@ -8,6 +9,8 @@ #include +namespace VirtGPU { + AK_TYPEDEF_DISTINCT_ORDERED_ID(u32, ObjectHandle); AK_TYPEDEF_DISTINCT_ORDERED_ID(u32, ResourceID); @@ -208,3 +211,5 @@ enum class ShaderType : u32 { }; } + +}