Chromium Code Reviews| 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 af7042d44fdfe50159359bf1e690f757d73550b0..32dca7b4bc0baa6db647d2f66c05edb4f628e7ac 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 |
| @@ -44,21 +44,33 @@ class ClientNativePixmapFactoryGbm : public ClientNativePixmapFactory { |
| vgem_fd_ = device_fd.Pass(); |
| #endif |
| } |
| - std::vector<Configuration> GetSupportedConfigurations() const override { |
| - const Configuration kConfigurations[] = { |
| - {gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::SCANOUT}, |
| - {gfx::BufferFormat::BGRX_8888, gfx::BufferUsage::SCANOUT}}; |
| - std::vector<Configuration> configurations( |
| - kConfigurations, kConfigurations + arraysize(kConfigurations)); |
| + bool IsConfigurationSupported(gfx::BufferFormat format, |
| + gfx::BufferUsage usage) const override { |
| + switch (usage) { |
| + case gfx::BufferUsage::SCANOUT: { |
| + const gfx::BufferFormat kSupportedFormats[] = { |
| + gfx::BufferFormat::BGRA_8888, gfx::BufferFormat::BGRX_8888}; |
| + for (auto& supported_format : kSupportedFormats) { |
| + if (supported_format == format) |
| + return true; |
| + } |
| + return false; |
|
piman
2015/10/07 01:20:17
nit: return format == gfx::BufferFormat::BGRA_8888
reveman
2015/10/07 09:05:01
Done here and in places where I had a similar patt
|
| + } |
| + case gfx::BufferUsage::MAP: |
| + case gfx::BufferUsage::PERSISTENT_MAP: { |
| #if defined(USE_VGEM_MAP) |
| - if (vgem_fd_.is_valid()) { |
| - configurations.push_back( |
| - {gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::MAP}); |
| - configurations.push_back( |
| - {gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::PERSISTENT_MAP}); |
| - } |
| + if (vgem_fd_.is_valid()) { |
| + const gfx::BufferFormat kSupportedFormat = |
| + gfx::BufferFormat::BGRA_8888; |
| + if (format == kSupportedFormat) |
| + return true; |
| + } |
| #endif |
| - return configurations; |
| + return false; |
| + } |
| + } |
| + NOTREACHED(); |
| + return false; |
| } |
| scoped_ptr<ClientNativePixmap> ImportFromHandle( |
| const gfx::NativePixmapHandle& handle, |