Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(603)

Unified Diff: gpu/ipc/service/gpu_memory_buffer_factory_win.h

Issue 2930143004: Add DIRECT_COMPOSITION GpuMemoryBuffer type.
Patch Set: fix build Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/ipc/service/gpu_memory_buffer_factory_win.h
diff --git a/gpu/ipc/service/gpu_memory_buffer_factory_win.h b/gpu/ipc/service/gpu_memory_buffer_factory_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..aa6aa575d88ca3e59089a628c1dfdee1818d3f6a
--- /dev/null
+++ b/gpu/ipc/service/gpu_memory_buffer_factory_win.h
@@ -0,0 +1,63 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_WIN_H_
+#define GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_WIN_H_
+
+#include <unordered_map>
+
+#include "base/hash.h"
+#include "gpu/command_buffer/service/image_factory.h"
+#include "gpu/ipc/service/gpu_memory_buffer_factory.h"
+#include "ui/gl/gl_image.h"
+
+namespace gpu {
+
+class GPU_EXPORT GpuMemoryBufferFactoryWin : public GpuMemoryBufferFactory,
+ public ImageFactory {
+ public:
+ GpuMemoryBufferFactoryWin();
+ ~GpuMemoryBufferFactoryWin() override;
+
+ // Overridden from GpuMemoryBufferFactory:
+ gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer(
+ gfx::GpuMemoryBufferId id,
+ const gfx::Size& size,
+ gfx::BufferFormat format,
+ gfx::BufferUsage usage,
+ int client_id,
+ SurfaceHandle surface_handle) override;
+ void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
+ int client_id) override;
+ ImageFactory* AsImageFactory() override;
+
+ // Overridden from ImageFactory:
+ scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer(
+ const gfx::GpuMemoryBufferHandle& handle,
+ const gfx::Size& size,
+ gfx::BufferFormat format,
+ unsigned internalformat,
+ int client_id,
+ SurfaceHandle surface_handle) override;
+ scoped_refptr<gl::GLImage> CreateAnonymousImage(
+ const gfx::Size& size,
+ gfx::BufferFormat format,
+ unsigned internalformat) override;
+ unsigned RequiredTextureType() override;
+ bool SupportsFormatRGB() override;
+
+ private:
+ using UsageMapKey = std::pair<gfx::GpuMemoryBufferId, int>;
+
+ base::Lock lock_;
+ std::
+ unordered_map<UsageMapKey, gfx::BufferUsage, base_hash::hash<UsageMapKey>>
+ usage_map_;
reveman 2017/06/14 21:35:58 The factory needs to be stateless to handle GPU pr
jbauman 2017/06/14 22:18:16 I could put the buffer usage in the handle so it c
+
+ DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryWin);
+};
+
+} // namespace gpu
+
+#endif // GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_WIN_H_

Powered by Google App Engine
This is Rietveld 408576698