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

Unified Diff: ui/ozone/platform/drm/client_native_pixmap_factory_gbm.cc

Issue 2711933002: Rename ClientNativePixmapFactoryGbm to ClientNativePixmapFactoryDmabuf amd move to ui/gfx (Closed)
Patch Set: Addressed sadrul's remark Created 3 years, 9 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
« no previous file with comments | « ui/ozone/platform/drm/BUILD.gn ('k') | ui/ozone/platform/drm/common/client_native_pixmap_dmabuf.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/client_native_pixmap_factory_gbm.cc
diff --git a/ui/ozone/platform/drm/client_native_pixmap_factory_gbm.cc b/ui/ozone/platform/drm/client_native_pixmap_factory_gbm.cc
index 090b048c29c36ded3e8f0c04192ec9ace1a4ca5f..f8dd781ebf403672d9948aa108ee9d39a3e0228b 100644
--- a/ui/ozone/platform/drm/client_native_pixmap_factory_gbm.cc
+++ b/ui/ozone/platform/drm/client_native_pixmap_factory_gbm.cc
@@ -8,110 +8,13 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
-#include "ui/gfx/client_native_pixmap_factory.h"
+#include "ui/gfx/linux/client_native_pixmap_factory_dmabuf.h"
#include "ui/gfx/native_pixmap_handle.h"
-#include "ui/ozone/platform/drm/common/client_native_pixmap_dmabuf.h"
namespace ui {
-namespace {
-
-class ClientNativePixmapGbm : public gfx::ClientNativePixmap {
- public:
- ClientNativePixmapGbm() {}
- ~ClientNativePixmapGbm() override {}
-
- bool Map() override {
- NOTREACHED();
- return false;
- }
- void Unmap() override { NOTREACHED(); }
- void* GetMemoryAddress(size_t plane) const override {
- NOTREACHED();
- return nullptr;
- }
- int GetStride(size_t plane) const override {
- NOTREACHED();
- return 0;
- }
-};
-
-} // namespace
-
-class ClientNativePixmapFactoryGbm : public gfx::ClientNativePixmapFactory {
- public:
- ClientNativePixmapFactoryGbm() {}
- ~ClientNativePixmapFactoryGbm() override {}
-
- // ClientNativePixmapFactory:
- bool IsConfigurationSupported(gfx::BufferFormat format,
- gfx::BufferUsage usage) const override {
- switch (usage) {
- case gfx::BufferUsage::GPU_READ:
- return format == gfx::BufferFormat::BGR_565 ||
- format == gfx::BufferFormat::RGBA_8888 ||
- format == gfx::BufferFormat::RGBX_8888 ||
- format == gfx::BufferFormat::BGRA_8888 ||
- format == gfx::BufferFormat::BGRX_8888 ||
- format == gfx::BufferFormat::YVU_420;
- case gfx::BufferUsage::SCANOUT:
- return format == gfx::BufferFormat::BGRX_8888 ||
- format == gfx::BufferFormat::RGBX_8888;
- case gfx::BufferUsage::SCANOUT_CPU_READ_WRITE:
- return format == gfx::BufferFormat::BGRX_8888 ||
- format == gfx::BufferFormat::BGRA_8888 ||
- format == gfx::BufferFormat::RGBX_8888 ||
- format == gfx::BufferFormat::RGBA_8888;
- case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
- case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: {
-#if defined(OS_CHROMEOS)
- return
-#if defined(ARCH_CPU_X86_FAMILY)
- // Currently only Intel driver (i.e. minigbm and Mesa) supports R_8
- // and RG_88. crbug.com/356871
- format == gfx::BufferFormat::R_8 ||
- format == gfx::BufferFormat::RG_88 ||
-#endif
- format == gfx::BufferFormat::BGRA_8888;
-#else
- return false;
-#endif
- }
- }
- NOTREACHED();
- return false;
- }
- std::unique_ptr<gfx::ClientNativePixmap> ImportFromHandle(
- const gfx::NativePixmapHandle& handle,
- const gfx::Size& size,
- gfx::BufferUsage usage) override {
- DCHECK(!handle.fds.empty());
- switch (usage) {
- case gfx::BufferUsage::SCANOUT_CPU_READ_WRITE:
- case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
- case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT:
-#if defined(OS_CHROMEOS)
- return ClientNativePixmapDmaBuf::ImportFromDmabuf(handle, size);
-#else
- NOTREACHED();
- return nullptr;
-#endif
- case gfx::BufferUsage::GPU_READ:
- case gfx::BufferUsage::SCANOUT:
- // Close all the fds.
- for (const auto& fd : handle.fds)
- base::ScopedFD scoped_fd(fd.fd);
- return base::WrapUnique(new ClientNativePixmapGbm);
- }
- NOTREACHED();
- return nullptr;
- }
-
- DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryGbm);
-};
-
gfx::ClientNativePixmapFactory* CreateClientNativePixmapFactoryGbm() {
- return new ClientNativePixmapFactoryGbm();
+ return gfx::CreateClientNativePixmapFactoryDmabuf();
}
} // namespace ui
« no previous file with comments | « ui/ozone/platform/drm/BUILD.gn ('k') | ui/ozone/platform/drm/common/client_native_pixmap_dmabuf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698