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

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

Issue 1134993003: ozone: Implement zero/one-copy texture for Ozone GBM. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: restore switch Created 5 years, 4 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/gbm.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/common/client_native_pixmap_factory_gbm.cc
diff --git a/ui/ozone/platform/drm/common/client_native_pixmap_factory_gbm.cc b/ui/ozone/platform/drm/common/client_native_pixmap_factory_gbm.cc
index 34a941da3ed824f35ffc0ebaa78fb85b1cbab567..8dd6116beb02a3df2f107f1807ce4c9286e2e316 100644
--- a/ui/ozone/platform/drm/common/client_native_pixmap_factory_gbm.cc
+++ b/ui/ozone/platform/drm/common/client_native_pixmap_factory_gbm.cc
@@ -8,6 +8,11 @@
#include "ui/gfx/native_pixmap_handle_ozone.h"
#include "ui/ozone/public/client_native_pixmap_factory.h"
+#if defined(USE_VGEM_MAP)
+#include <fcntl.h>
+#include "ui/ozone/platform/drm/gpu/client_native_pixmap_vgem.h"
+#endif
+
namespace ui {
namespace {
@@ -27,7 +32,15 @@ class ClientNativePixmapGbm : public ClientNativePixmap {
class ClientNativePixmapFactoryGbm : public ClientNativePixmapFactory {
public:
- ClientNativePixmapFactoryGbm() {}
+ ClientNativePixmapFactoryGbm() {
+#if defined(USE_VGEM_MAP)
+ // TODO(dshwang): remove ad-hoc file open. crrev.com/1248713002
+ static const char kVgemPath[] = "/dev/dri/renderD129";
+ int vgem_fd = open(kVgemPath, O_RDWR | O_CLOEXEC);
+ vgem_fd_.reset(vgem_fd);
+ DCHECK_GE(vgem_fd_.get(), 0) << "Failed to open: " << kVgemPath;
+#endif
+ }
~ClientNativePixmapFactoryGbm() override {}
// ClientNativePixmapFactory:
@@ -37,18 +50,37 @@ class ClientNativePixmapFactoryGbm : public ClientNativePixmapFactory {
{gfx::BufferFormat::RGBX_8888, gfx::BufferUsage::SCANOUT}};
std::vector<Configuration> configurations(
kConfigurations, kConfigurations + arraysize(kConfigurations));
+#if defined(USE_VGEM_MAP)
+ configurations.push_back(
+ {gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::MAP});
+#endif
return configurations;
}
scoped_ptr<ClientNativePixmap> ImportFromHandle(
const gfx::NativePixmapHandle& handle,
const gfx::Size& size,
- gfx::BufferFormat format,
gfx::BufferUsage usage) override {
base::ScopedFD scoped_fd(handle.fd.fd);
+
+#if defined(USE_VGEM_MAP)
+ switch (usage) {
reveman 2015/08/13 15:15:58 nit: NOTREACHED and return nullptr if |usage| is a
dshwang 2015/08/13 15:45:28 Done.
+ case gfx::BufferUsage::MAP:
+ return ClientNativePixmapVgem::ImportFromDmabuf(
+ vgem_fd_.get(), scoped_fd.get(), size, handle.stride);
+ case gfx::BufferUsage::PERSISTENT_MAP:
+ NOTREACHED();
+ case gfx::BufferUsage::SCANOUT:
+ break;
+ }
+#endif
return make_scoped_ptr<ClientNativePixmapGbm>(new ClientNativePixmapGbm);
}
private:
+#if defined(USE_VGEM_MAP)
+ base::ScopedFD vgem_fd_;
+#endif
+
DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryGbm);
};
« no previous file with comments | « ui/ozone/platform/drm/BUILD.gn ('k') | ui/ozone/platform/drm/gbm.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698