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

Unified Diff: ui/gfx/linux/client_native_pixmap_factory_dmabuf.cc

Issue 2711933002: Rename ClientNativePixmapFactoryGbm to ClientNativePixmapFactoryDmabuf amd move to ui/gfx (Closed)
Patch Set: Rebase 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
Index: ui/gfx/linux/client_native_pixmap_factory_dmabuf.cc
diff --git a/ui/ozone/platform/drm/client_native_pixmap_factory_gbm.cc b/ui/gfx/linux/client_native_pixmap_factory_dmabuf.cc
similarity index 71%
copy from ui/ozone/platform/drm/client_native_pixmap_factory_gbm.cc
copy to ui/gfx/linux/client_native_pixmap_factory_dmabuf.cc
index e58ae39e6d854d58959cb2b42da5874d9e346e84..64afcc1073047fbb997acb2a89ff6544a564b8f4 100644
--- a/ui/ozone/platform/drm/client_native_pixmap_factory_gbm.cc
+++ b/ui/gfx/linux/client_native_pixmap_factory_dmabuf.cc
@@ -2,24 +2,31 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/ozone/platform/drm/client_native_pixmap_factory_gbm.h"
+#include "ui/gfx/linux/client_native_pixmap_factory_dmabuf.h"
#include <utility>
#include "base/macros.h"
#include "base/memory/ptr_util.h"
+#include "base/trace_event/trace_event.h"
#include "ui/gfx/client_native_pixmap_factory.h"
#include "ui/gfx/native_pixmap_handle.h"
-#include "ui/ozone/platform/drm/common/client_native_pixmap_dmabuf.h"
+
+#if defined(OS_CHROMEOS)
+// This can be enabled on all linux but it is not a requirement to support
+// glCreateImageChromium+Dmabuf since it uses gfx::BufferUsage::SCANOUT and
+// the pixmap does not need to be mappable on the client side.
+#include "ui/gfx/linux/client_native_pixmap_dmabuf.h"
+#endif
namespace ui {
namespace {
-class ClientNativePixmapGbm : public ClientNativePixmap {
+class ClientNativePixmapOpaque : public ClientNativePixmap {
public:
- ClientNativePixmapGbm() {}
- ~ClientNativePixmapGbm() override {}
+ ClientNativePixmapOpaque() {}
+ ~ClientNativePixmapOpaque() override {}
bool Map() override {
NOTREACHED();
@@ -38,10 +45,10 @@ class ClientNativePixmapGbm : public ClientNativePixmap {
} // namespace
-class ClientNativePixmapFactoryGbm : public ClientNativePixmapFactory {
+class ClientNativePixmapFactoryDmabuf : public ClientNativePixmapFactory {
public:
- ClientNativePixmapFactoryGbm() {}
- ~ClientNativePixmapFactoryGbm() override {}
+ ClientNativePixmapFactoryDmabuf() {}
+ ~ClientNativePixmapFactoryDmabuf() override {}
// ClientNativePixmapFactory:
bool IsConfigurationSupported(gfx::BufferFormat format,
@@ -101,17 +108,25 @@ class ClientNativePixmapFactoryGbm : public ClientNativePixmapFactory {
// Close all the fds.
for (const auto& fd : handle.fds)
base::ScopedFD scoped_fd(fd.fd);
- return base::WrapUnique(new ClientNativePixmapGbm);
+ return base::WrapUnique(new ClientNativePixmapOpaque);
}
NOTREACHED();
return nullptr;
}
- DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryGbm);
+ DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryDmabuf);
};
-ClientNativePixmapFactory* CreateClientNativePixmapFactoryGbm() {
- return new ClientNativePixmapFactoryGbm();
+// static
+ClientNativePixmapFactory* CreateClientNativePixmapFactoryDmabuf() {
+ return new ClientNativePixmapFactoryDmabuf();
+}
+
+// static
+std::unique_ptr<ClientNativePixmapFactory> ClientNativePixmapFactory::Create() {
+ TRACE_EVENT1("linux", "ClientNativePixmapFactory::Create", "plaform",
+ "dmabuf");
+ return base::WrapUnique(CreateClientNativePixmapFactoryDmabuf());
}
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698