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

Side by Side Diff: ui/ozone/platform/drm/client_native_pixmap_factory_gbm.cc

Issue 1598573002: Propagate supported scanout formats from driver to SurfaceFactoryOzone. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/ozone/platform/drm/client_native_pixmap_factory_gbm.h" 5 #include "ui/ozone/platform/drm/client_native_pixmap_factory_gbm.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "ui/gfx/native_pixmap_handle_ozone.h" 10 #include "ui/gfx/native_pixmap_handle_ozone.h"
11 #include "ui/ozone/platform/drm/common/drm_util.h"
11 #include "ui/ozone/public/client_native_pixmap_factory.h" // nogncheck 12 #include "ui/ozone/public/client_native_pixmap_factory.h" // nogncheck
13 #include "ui/ozone/public/ozone_platform.h"
12 14
13 #if defined(USE_VGEM_MAP) 15 #if defined(USE_VGEM_MAP)
14 #include "ui/ozone/platform/drm/common/client_native_pixmap_vgem.h" 16 #include "ui/ozone/platform/drm/common/client_native_pixmap_vgem.h"
15 #endif 17 #endif
16 18
17 namespace ui { 19 namespace ui {
18 20
19 namespace { 21 namespace {
20 22
21 class ClientNativePixmapGbm : public ClientNativePixmap { 23 class ClientNativePixmapGbm : public ClientNativePixmap {
(...skipping 22 matching lines...) Expand all
44 // It's called in IO thread. We rely on clients for thread-safety. 46 // It's called in IO thread. We rely on clients for thread-safety.
45 // Switching to an IPC message filter ensures thread-safety. 47 // Switching to an IPC message filter ensures thread-safety.
46 DCHECK_LT(vgem_fd_.get(), 0); 48 DCHECK_LT(vgem_fd_.get(), 0);
47 vgem_fd_ = std::move(device_fd); 49 vgem_fd_ = std::move(device_fd);
48 #endif 50 #endif
49 } 51 }
50 bool IsConfigurationSupported(gfx::BufferFormat format, 52 bool IsConfigurationSupported(gfx::BufferFormat format,
51 gfx::BufferUsage usage) const override { 53 gfx::BufferUsage usage) const override {
52 switch (usage) { 54 switch (usage) {
53 case gfx::BufferUsage::GPU_READ: 55 case gfx::BufferUsage::GPU_READ:
54 case gfx::BufferUsage::SCANOUT: 56 case gfx::BufferUsage::SCANOUT: {
55 return format == gfx::BufferFormat::RGBA_8888 || 57 std::vector<uint32_t> support_formats;
56 format == gfx::BufferFormat::RGBX_8888 || 58 ui::OzonePlatform::GetInstance()->GetSupportedFormats(&support_formats);
spang 2016/01/18 18:14:31 The renderer process is allowed to have a ClientNa
william.xie 2016/01/19 04:40:16 Done.
57 format == gfx::BufferFormat::BGRA_8888 || 59 return find(support_formats.begin(), support_formats.end(),
58 format == gfx::BufferFormat::BGRX_8888; 60 GetFourCCFormatForFramebuffer(format)) !=
61 support_formats.end();
62 }
63
59 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: 64 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
60 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: { 65 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: {
61 #if defined(USE_VGEM_MAP) 66 #if defined(USE_VGEM_MAP)
62 return vgem_fd_.is_valid() && format == gfx::BufferFormat::BGRA_8888; 67 return vgem_fd_.is_valid() && format == gfx::BufferFormat::BGRA_8888;
63 #else 68 #else
64 return false; 69 return false;
65 #endif 70 #endif
66 } 71 }
67 } 72 }
68 NOTREACHED(); 73 NOTREACHED();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 #endif 106 #endif
102 107
103 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryGbm); 108 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryGbm);
104 }; 109 };
105 110
106 ClientNativePixmapFactory* CreateClientNativePixmapFactoryGbm() { 111 ClientNativePixmapFactory* CreateClientNativePixmapFactoryGbm() {
107 return new ClientNativePixmapFactoryGbm(); 112 return new ClientNativePixmapFactoryGbm();
108 } 113 }
109 114
110 } // namespace ui 115 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698