Rename Buffer to BufferGl and add Buffer and BufferVk

... to make Buffer API generic and coordinate between
the two backends.

Bug: b/233939967
Test: android build
Test: cmake build
Test: cvd start --gpu_mode=gfxstream
Test: gfxstream unit tests
Change-Id: I9576247b14b50140dac3de76aeb72bea561769b4
diff --git a/stream-servers/vulkan/BufferVk.cpp b/stream-servers/vulkan/BufferVk.cpp
new file mode 100644
index 0000000..6760447
--- /dev/null
+++ b/stream-servers/vulkan/BufferVk.cpp
@@ -0,0 +1,48 @@
+// Copyright 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expresso or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "BufferVk.h"
+
+#include "VkCommonOperations.h"
+
+namespace gfxstream {
+
+/*static*/
+std::unique_ptr<BufferVk> BufferVk::create(uint32_t handle, uint64_t size, bool vulkanOnly) {
+    if (!goldfish_vk::setupVkBuffer(handle, size, vulkanOnly,
+                                    VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)) {
+        ERR("Failed to create BufferVk:%d", handle);
+        return nullptr;
+    }
+
+    return std::unique_ptr<BufferVk>(new BufferVk(handle));
+}
+
+BufferVk::BufferVk(uint32_t handle) : mHandle(handle) {}
+
+BufferVk::~BufferVk() {
+    if (!goldfish_vk::teardownVkBuffer(mHandle)) {
+        ERR("Failed to destroy BufferVk:%d", mHandle);
+    }
+}
+
+void BufferVk::readToBytes(uint64_t offset, uint64_t size, void* outBytes) {
+    goldfish_vk::readBufferToBytes(mHandle, offset, size, outBytes);
+}
+
+bool BufferVk::updateFromBytes(uint64_t offset, uint64_t size, const void* bytes) {
+    return goldfish_vk::updateBufferFromBytes(mHandle, offset, size, bytes);
+}
+
+}  // namespace gfxstream
\ No newline at end of file