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

Unified Diff: gpu/ipc/client/gpu_memory_buffer_impl_native_pixmap.cc

Issue 2710223002: Rename GpuMemoryBufferImplOzoneNativePixmap to GpuMemoryBufferImplNativePixmap (Closed)
Patch Set: Rebase Created 3 years, 8 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/client/gpu_memory_buffer_impl_native_pixmap.cc
diff --git a/gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc b/gpu/ipc/client/gpu_memory_buffer_impl_native_pixmap.cc
similarity index 77%
rename from gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc
rename to gpu/ipc/client/gpu_memory_buffer_impl_native_pixmap.cc
index e749edeca6633159e9876455ca2ee53476b673ff..c4d900f431999696c30140ce0cbbab15250fb129 100644
--- a/gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc
+++ b/gpu/ipc/client/gpu_memory_buffer_impl_native_pixmap.cc
@@ -2,17 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.h"
+#include "gpu/ipc/client/gpu_memory_buffer_impl_native_pixmap.h"
#include <utility>
#include "base/memory/ptr_util.h"
#include "gpu/ipc/common/gpu_memory_buffer_support.h"
#include "ui/gfx/buffer_format_util.h"
+#include "ui/gfx/client_native_pixmap_factory.h"
#include "ui/gfx/native_pixmap.h"
-#include "ui/ozone/public/client_native_pixmap_factory_ozone.h"
+
+#if defined(USE_OZONE)
#include "ui/ozone/public/ozone_platform.h"
#include "ui/ozone/public/surface_factory_ozone.h"
+#endif
namespace gpu {
namespace {
@@ -25,7 +28,7 @@ void FreeNativePixmapForTesting(
} // namespace
-GpuMemoryBufferImplOzoneNativePixmap::GpuMemoryBufferImplOzoneNativePixmap(
+GpuMemoryBufferImplNativePixmap::GpuMemoryBufferImplNativePixmap(
gfx::GpuMemoryBufferId id,
const gfx::Size& size,
gfx::BufferFormat format,
@@ -38,11 +41,11 @@ GpuMemoryBufferImplOzoneNativePixmap::GpuMemoryBufferImplOzoneNativePixmap(
planes_(planes),
fd_(std::move(fd)) {}
-GpuMemoryBufferImplOzoneNativePixmap::~GpuMemoryBufferImplOzoneNativePixmap() {}
+GpuMemoryBufferImplNativePixmap::~GpuMemoryBufferImplNativePixmap() {}
// static
-std::unique_ptr<GpuMemoryBufferImplOzoneNativePixmap>
-GpuMemoryBufferImplOzoneNativePixmap::CreateFromHandle(
+std::unique_ptr<GpuMemoryBufferImplNativePixmap>
+GpuMemoryBufferImplNativePixmap::CreateFromHandle(
const gfx::GpuMemoryBufferHandle& handle,
const gfx::Size& size,
gfx::BufferFormat format,
@@ -72,59 +75,67 @@ GpuMemoryBufferImplOzoneNativePixmap::CreateFromHandle(
native_pixmap_handle, size, usage);
DCHECK(native_pixmap);
- return base::WrapUnique(new GpuMemoryBufferImplOzoneNativePixmap(
+ return base::WrapUnique(new GpuMemoryBufferImplNativePixmap(
handle.id, size, format, callback, std::move(native_pixmap),
handle.native_pixmap_handle.planes, std::move(scoped_fd)));
}
// static
-bool GpuMemoryBufferImplOzoneNativePixmap::IsConfigurationSupported(
+bool GpuMemoryBufferImplNativePixmap::IsConfigurationSupported(
gfx::BufferFormat format,
gfx::BufferUsage usage) {
+#if defined(OS_LINUX)
+ return false;
+#endif
return gpu::IsNativeGpuMemoryBufferConfigurationSupported(format, usage);
}
// static
-base::Closure GpuMemoryBufferImplOzoneNativePixmap::AllocateForTesting(
+base::Closure GpuMemoryBufferImplNativePixmap::AllocateForTesting(
const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage usage,
gfx::GpuMemoryBufferHandle* handle) {
DCHECK(IsConfigurationSupported(format, usage));
+#if defined(USE_OZONE)
scoped_refptr<gfx::NativePixmap> pixmap =
ui::OzonePlatform::GetInstance()
->GetSurfaceFactoryOzone()
->CreateNativePixmap(gfx::kNullAcceleratedWidget, size, format,
usage);
- handle->type = gfx::NATIVE_PIXMAP;
handle->native_pixmap_handle = pixmap->ExportHandle();
+#else
+ // TODO(j.isorce): use gbm_bo_create / gbm_bo_get_fd from system libgbm.
+ scoped_refptr<gfx::NativePixmap> pixmap;
+ NOTIMPLEMENTED();
+#endif
+ handle->type = gfx::NATIVE_PIXMAP;
return base::Bind(&FreeNativePixmapForTesting, pixmap);
}
-bool GpuMemoryBufferImplOzoneNativePixmap::Map() {
+bool GpuMemoryBufferImplNativePixmap::Map() {
DCHECK(!mapped_);
mapped_ = pixmap_->Map();
return mapped_;
}
-void* GpuMemoryBufferImplOzoneNativePixmap::memory(size_t plane) {
+void* GpuMemoryBufferImplNativePixmap::memory(size_t plane) {
DCHECK(mapped_);
return pixmap_->GetMemoryAddress(plane);
}
-void GpuMemoryBufferImplOzoneNativePixmap::Unmap() {
+void GpuMemoryBufferImplNativePixmap::Unmap() {
DCHECK(mapped_);
pixmap_->Unmap();
mapped_ = false;
}
-int GpuMemoryBufferImplOzoneNativePixmap::stride(size_t plane) const {
+int GpuMemoryBufferImplNativePixmap::stride(size_t plane) const {
DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_));
return pixmap_->GetStride(plane);
}
-gfx::GpuMemoryBufferHandle GpuMemoryBufferImplOzoneNativePixmap::GetHandle()
- const {
+gfx::GpuMemoryBufferHandle GpuMemoryBufferImplNativePixmap::GetHandle() const {
gfx::GpuMemoryBufferHandle handle;
handle.type = gfx::NATIVE_PIXMAP;
handle.id = id_;
« no previous file with comments | « gpu/ipc/client/gpu_memory_buffer_impl_native_pixmap.h ('k') | gpu/ipc/client/gpu_memory_buffer_impl_native_pixmap_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698