Skip to content

Commit

Permalink
LibVirtGPU: Move VirGLDemo protocol code into VirtGPU namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
sunverwerth authored and awesomekling committed Dec 26, 2022
1 parent a95eea5 commit 51ac0d7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
10 changes: 8 additions & 2 deletions Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2022, Sahan Fernando <[email protected]>
* Copyright (c) 2022, Stephan Unverwerth <[email protected]>
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
Expand All @@ -9,12 +10,15 @@
#include <Kernel/API/VirGL.h>
#include <sys/ioctl_numbers.h>

#include "CommandBufferBuilder.h"
#include "VirGLProtocol.h"
#include <LibVirtGPU/CommandBufferBuilder.h>
#include <LibVirtGPU/VirGLProtocol.h>

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);
Expand Down Expand Up @@ -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
}

}
6 changes: 5 additions & 1 deletion Userland/Libraries/LibVirtGPU/CommandBufferBuilder.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2022, Sahan Fernando <[email protected]>
* Copyright (c) 2022, Stephan Unverwerth <[email protected]>
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
Expand All @@ -9,9 +10,10 @@

#include <AK/StringView.h>
#include <AK/Vector.h>
#include <LibVirtGPU/VirGLProtocol.h>
#include <sys/ioctl_numbers.h>

#include "VirGLProtocol.h"
namespace VirtGPU {

class CommandBufferBuilder {
public:
Expand Down Expand Up @@ -41,3 +43,5 @@ class CommandBufferBuilder {
private:
Vector<u32> m_buffer;
};

}
5 changes: 5 additions & 0 deletions Userland/Libraries/LibVirtGPU/VirGLProtocol.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2022, Sahan Fernando <[email protected]>
* Copyright (c) 2022, Stephan Unverwerth <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
Expand All @@ -8,6 +9,8 @@

#include <AK/DistinctNumeric.h>

namespace VirtGPU {

AK_TYPEDEF_DISTINCT_ORDERED_ID(u32, ObjectHandle);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u32, ResourceID);

Expand Down Expand Up @@ -208,3 +211,5 @@ enum class ShaderType : u32 {
};

}

}

0 comments on commit 51ac0d7

Please sign in to comment.