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 19b3e1042b4102e75c3cb8d10908f288712c6507..06aada4e3175f1dc3659cf53de62dcef0b3a7211 100644 |
--- a/ui/ozone/platform/drm/client_native_pixmap_factory_gbm.cc |
+++ b/ui/ozone/platform/drm/client_native_pixmap_factory_gbm.cc |
@@ -21,12 +21,19 @@ class ClientNativePixmapGbm : public ClientNativePixmap { |
ClientNativePixmapGbm() {} |
~ClientNativePixmapGbm() override {} |
- void* Map() override { |
+ bool Map() override { |
NOTREACHED(); |
- return nullptr; |
+ return false; |
} |
void Unmap() override { NOTREACHED(); } |
- void GetStride(int* stride) const override { NOTREACHED(); } |
+ void* GetMemoryAddress(size_t plane) const override { |
+ NOTREACHED(); |
+ return nullptr; |
+ } |
+ int GetStride(size_t plane) const override { |
+ NOTREACHED(); |
+ return 0; |
+ } |
}; |
} // namespace |
@@ -73,21 +80,20 @@ class ClientNativePixmapFactoryGbm : public ClientNativePixmapFactory { |
const gfx::Size& size, |
gfx::BufferUsage usage) override { |
DCHECK(!handle.fds.empty()); |
- base::ScopedFD scoped_fd(handle.fds[0].fd); |
switch (usage) { |
case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: |
case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: |
#if defined(OS_CHROMEOS) |
dnicoara
2016/09/14 21:47:40
On the non-CrOS case this would be leaking the FDs
Daniele Castagna
2016/09/19 18:26:39
True, but the non-CrOS case should never be reache
|
- // TODO(dcastagna): Add support for pixmaps with multiple FDs for non |
- // scanout buffers. |
- return ClientNativePixmapDmaBuf::ImportFromDmabuf( |
- scoped_fd.release(), size, handle.planes[0].stride); |
+ 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(); |